/* /pos/ridge/ — Tuppence Ridge, the counter stand. Two WebGL stages (assets/js/ridge.js):
   .ridge-film (pinned, scroll-driven story on a counter) and .ridge-viewer ("Explore the hardware
   in 3D": drag, zoom, heights). html.ridge-gl once WebGL runs;
   html.ridge-no-gl falls back to the posters and plain text. */

.ridge {
  --ridge-night: #070a16;
  --ridge-ink: #0b1020;
}

/* ---------------------------------------------------------------- the film */
.ridge-film {
  position: relative;
  height: 720vh;
  background: var(--ridge-night);
  color: var(--text-inverse);
}
.ridge-film__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  isolation: isolate;
  /* the studio: a soft lift of midnight blue behind the stand, falling away to near black */
  background:
    radial-gradient(60% 55% at 64% 46%, #1b2550 0%, #0e1430 46%, #070a16 100%), var(--ridge-night);
}
.ridge-film__canvas,
.ridge-film__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.ridge-film__poster,
.ridge-viewer__poster {
  object-fit: cover;
  transition: opacity 0.9s ease;
}
.ridge-film__canvas,
.ridge-viewer__canvas {
  opacity: 0;
  transition: opacity 1.1s ease;
}
.is-ready > .ridge-film__sticky > .ridge-film__canvas,
.ridge-viewer.is-ready > .ridge-viewer__canvas {
  opacity: 1;
}
.is-ready > .ridge-film__sticky > .ridge-film__poster,
.ridge-viewer.is-ready > .ridge-viewer__poster {
  opacity: 0;
  pointer-events: none;
}
.ridge-film__scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(
      90deg,
      rgba(7, 10, 22, 0.82) 0%,
      rgba(7, 10, 22, 0.45) 34%,
      rgba(7, 10, 22, 0) 58%
    ), linear-gradient(0deg, rgba(7, 10, 22, 0.6) 0%, rgba(7, 10, 22, 0) 24%);
}
.ridge-film__caps {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.ridge-cap {
  position: absolute;
  top: 50%;
  left: max(24px, calc((100vw - var(--container, 1200px)) / 2 + 24px));
  max-width: 30rem;
  transform: translateY(calc(-50% + 18px));
  opacity: 0;
  transition:
    opacity 0.6s ease,
    transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
  pointer-events: none;
}
.ridge-cap.is-on,
html:not(.ridge-gl) .ridge-cap--intro {
  opacity: 1;
  transform: translateY(-50%);
  pointer-events: auto;
}
.ridge-cap .h2 {
  color: #fff;
  margin: 8px 0 12px;
}
.ridge-cap p {
  color: rgba(255, 255, 255, 0.78);
  font-size: 1.0625rem;
  line-height: 1.6;
  margin: 0;
}
.ridge-cap .lead {
  color: rgba(255, 255, 255, 0.82);
  margin: 16px 0 28px;
}
.ridge-cap__num {
  display: inline-block;
  font: 600 0.8125rem / 1 var(--font-sans);
  letter-spacing: 0.14em;
  color: var(--mint-300);
}
.ridge-title {
  color: #fff;
  margin-top: 14px;
  letter-spacing: -0.035em;
}
.ridge-eyebrow {
  color: var(--mint-300);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ridge-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(77, 226, 195, 0.45);
  color: var(--mint-100);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}
.ridge-film__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
}
.ridge-film__progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue-400), var(--mint-400));
  transform: scaleX(0);
  transform-origin: 0 50%;
}
.ridge-film__hint {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.62);
  font: 500 0.8125rem / 1 var(--font-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: opacity 0.4s;
}
.ridge-film.is-scrolled .ridge-film__hint {
  opacity: 0;
}

/* ---------------------------------------------------------------- who it's for, peripherals */
.ridge-pillars .card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ridge-art-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.ridge-art-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  border: 1px solid var(--ink-100);
  background: var(--surface-card);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
}
a.ridge-art-card:hover {
  border-color: var(--ink-200);
}
.ridge-art-card__art {
  aspect-ratio: 8 / 5;
  background: var(--tp-cloud);
  border-bottom: 1px solid var(--ink-100);
}
.ridge-art-card__art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ridge-art-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
  padding: 20px 22px;
}
.ridge-art-card__body p {
  margin: 0;
  color: var(--text-secondary);
  text-wrap: pretty;
}
.ridge-art-card__body .link-arrow {
  margin-top: auto;
}
.ridge-art-card__tag {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--ink-900);
}
@media (max-width: 1023px) and (min-width: 760px) {
  .ridge-art-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------------------------------------------------------------- the viewer */
.ridge-viewer {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 28px;
  overflow: hidden;
  background: #eef1f7;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 30px 60px -30px rgba(11, 16, 32, 0.35);
}
.ridge-viewer__canvas,
.ridge-viewer__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.ridge-viewer__canvas {
  touch-action: pan-y;
  cursor: grab;
}
.ridge-viewer__canvas:active {
  cursor: grabbing;
}
.ridge-viewer__controls {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.ridge-viewer__controls > * {
  pointer-events: auto;
}
.ridge-seg {
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 6px 20px -10px rgba(11, 16, 32, 0.35);
  gap: 2px;
}
.ridge-seg button {
  border-color: transparent;
  background: transparent;
}
.ridge-viewer__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ridge-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--ink-200);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink-800);
  cursor: pointer;
}
.ridge-icon-btn:hover {
  background: #fff;
}
.ridge-viewer__readout {
  position: absolute;
  top: 18px;
  left: 22px;
  margin: 0;
  font: 600 0.8125rem / 1.3 var(--font-sans);
  color: var(--ink-600);
  letter-spacing: 0.01em;
  pointer-events: none;
}

/* ---------------------------------------------------------------- specs */
.ridge-table th {
  width: 190px;
  text-align: left;
  white-space: nowrap;
  color: var(--ink-900);
}

/* ---------------------------------------------------------------- no WebGL, or before it starts */
html.ridge-no-gl .ridge-film {
  height: auto;
}
html.ridge-no-gl .ridge-film__sticky {
  position: relative;
  min-height: 640px;
}
html.ridge-no-gl .ridge-cap:not(.ridge-cap--intro),
html.ridge-no-gl .ridge-film__hint,
html.ridge-no-gl .ridge-film__progress,
html.ridge-no-gl .ridge-viewer__controls {
  display: none;
}
html.ridge-no-gl .ridge-cap--intro {
  opacity: 1;
  transform: translateY(-50%);
}
@supports (height: 100svh) {
  .ridge-film__sticky {
    height: 100svh;
  }
}

/* ---------------------------------------------------------------- phones */
@media (max-width: 759px) {
  .ridge-film {
    height: 620vh;
  }
  .ridge-film__scrim {
    background: linear-gradient(
      0deg,
      rgba(7, 10, 22, 0.92) 0%,
      rgba(7, 10, 22, 0.7) 34%,
      rgba(7, 10, 22, 0) 62%
    );
  }
  .ridge-cap {
    top: auto;
    bottom: 56px;
    left: 20px;
    right: 20px;
    max-width: none;
    transform: translateY(18px);
  }
  .ridge-cap.is-on,
  html:not(.ridge-gl) .ridge-cap--intro,
  html.ridge-no-gl .ridge-cap--intro {
    transform: none;
  }
  .ridge-cap .h2 {
    font-size: 1.75rem;
  }
  .ridge-cap p {
    font-size: 1rem;
  }
  .ridge-cap .lead {
    margin: 12px 0 20px;
  }
  .ridge-title {
    font-size: 3rem;
  }
  .ridge-film__hint {
    display: none;
  }
  .ridge-viewer {
    aspect-ratio: 3 / 4;
    border-radius: 22px;
  }
  .ridge-viewer__controls {
    left: 10px;
    right: 10px;
    bottom: 10px;
    gap: 8px;
  }
  .ridge-seg button {
    padding: 6px 11px;
  }
  .ridge-viewer__readout {
    top: 14px;
    left: 16px;
  }
  .ridge-table,
  .ridge-table tbody,
  .ridge-table tr,
  .ridge-table th,
  .ridge-table td {
    display: block;
    width: auto;
    white-space: normal;
  }
  .ridge-table {
    min-width: 0; /* site.css gives tables 640px to scroll; this one stacks instead */
  }
  .ridge-table th {
    padding-bottom: 0;
    border-bottom: 0;
  }
  .ridge-art-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ridge-cap,
  .ridge-film__canvas,
  .ridge-viewer__canvas {
    transition-duration: 0.01s;
  }
}

/* ---------------------------------------------------------------- captures (?ridge-snap&shot=…, posters) */
html[data-ridge-shot="film"] .ridge-film__sticky,
html[data-ridge-shot="viewer"] .ridge-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  border-radius: 0;
  aspect-ratio: auto;
}
html[data-ridge-bare] .ridge-film__caps,
html[data-ridge-bare] .ridge-film__hint,
html[data-ridge-bare] .ridge-film__progress,
html[data-ridge-bare] .ridge-viewer__controls,
html[data-ridge-bare] .ridge-viewer__readout,
html[data-ridge-bare] .ridge-film__scrim,
html[data-ridge-nohead] .site-header,
html[data-ridge-nohead] .ridge-cap--intro .row,
html[data-ridge-nohead] .ridge-film__hint {
  display: none;
}

/* ---------------------------------------------------------------- the header over the dark stages
   site.css turns a dark-page header white once you scroll; over the film it stays
   dark and translucent instead (ridge.js sets html.ridge-dark-head while it's over them) */
html.ridge-dark-head body[data-header="dark"] .site-header.is-scrolled:not(.is-open) {
  background: rgba(7, 10, 22, 0.66);
  color: var(--text-inverse);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}
html.ridge-dark-head body[data-header="dark"] .site-header.is-scrolled:not(.is-open) .logo-dark {
  display: none !important;
}
html.ridge-dark-head body[data-header="dark"] .site-header.is-scrolled:not(.is-open) .logo-light {
  display: block !important;
}
html.ridge-dark-head
  body[data-header="dark"]
  .site-header.is-scrolled:not(.is-open)
  .main-nav__trigger,
html.ridge-dark-head
  body[data-header="dark"]
  .site-header.is-scrolled:not(.is-open)
  .site-header__login {
  color: rgba(255, 255, 255, 0.9);
}
html.ridge-dark-head body[data-header="dark"] .site-header.is-scrolled:not(.is-open) .btn--primary {
  background: var(--surface-card);
  color: var(--ink-900);
}
