/*
  Helix Drift Template
  https://templatemo.com/tm-630-helix-drift
*/

:root {
  --canvas: #f4f7fa;
  --sunk: #dde7f2;
  --pastel: #b9cde5;
  --pastel-deep: #96b1d0;
  --ink: #1b2233;
  --ink-2: #5b6879;
  --ink-3: #93a0b2;
  --accent: #4a6e96;

  --bar: 70px;
  --plate-w: min(46vw, 620px);

  --rx: 600;
  --ry: 54;
  --coil: 0.9;
  --fall: 0.52;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.6s;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.wrap {
  position: relative;
  z-index: 1;
}

/* ---------- bar ---------- */
.bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--bar);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(18px, 4vw, 54px);
  background: rgba(244, 247, 250, 0.72);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border-bottom: 1px solid rgba(150, 177, 208, 0.28);
}

.brand {
  font-family: "Newsreader", serif;
  font-weight: 300;
  font-size: 1.06rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.62rem;
  text-decoration: none;
}

.brand i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: block;
  flex: 0 0 auto;
}

.wv {
  position: absolute;
  left: 50%;
  top: 2px;
  width: 10px;
  height: 6px;
  overflow: visible;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -7px);
  transition:
    opacity 0.3s var(--ease),
    transform 0.42s var(--ease);
}

.wv path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drawer a {
  position: relative;
  padding: 0.95rem 0 0.85rem;
}

.drawer a .wv {
  left: 0;
  top: 2px;
  bottom: auto;
  transform: translate(0, -7px);
}

.drawer a:hover .wv,
.drawer a:focus-visible .wv {
  opacity: 1;
  transform: translate(0, 0);
}

.burger {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(150, 177, 208, 0.5);
  background: transparent;
  border-radius: 2px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}

.burger span {
  display: block;
  width: 16px;
  height: 1px;
  background: var(--ink);
  transition:
    transform 0.3s var(--ease),
    opacity 0.3s;
}

.burger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(3px) rotate(45deg);
}

.burger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.burger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-3px) rotate(-45deg);
}

/* drawer is a SIBLING of .bar, never a child */
.drawer {
  position: fixed;
  top: var(--bar);
  left: 0;
  right: 0;
  z-index: 55;
  height: calc(100dvh - var(--bar));
  padding: 1.9rem clamp(18px, 5vw, 40px) 80px;
  background: var(--canvas);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  transform: translateY(-12px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.32s var(--ease),
    transform 0.32s var(--ease),
    visibility 0.32s;
}

.drawer.open {
  transform: none;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* page behind the open drawer stops scrolling, so only one scrollbar is ever live */
body.lock {
  overflow: hidden;
}

/* the spool controls slide off to their own side once the stage is scrolled past */
body.away .transport {
  transform: translateX(calc(-100% - 30px));
  opacity: 0;
  pointer-events: none;
}

body.away .fab,
body.away .panel {
  transform: translateX(calc(100% + 30px));
  opacity: 0;
  pointer-events: none;
}

body.lock .transport,
body.lock .fab {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.drawer a {
  color: var(--ink);
  text-decoration: none;
  font-family: "Newsreader", serif;
  font-size: 1.15rem;
  font-weight: 300;
  letter-spacing: 0.01em;
  border-bottom: 1px solid rgba(150, 177, 208, 0.3);
}

/* ---------- stage ---------- */
.stage-shell {
  padding-top: var(--bar);
}

.stage {
  top: var(--bar);
  position: relative;
  height: min(62vh, 560px);
  min-height: 340px;
  perspective: 1400px;
  touch-action: pan-y;
  cursor: grab;
  overflow: hidden;
  min-width: 0;
}

.stage.grabbing {
  cursor: grabbing;
}

.plate {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  width: var(--plate-w);
  aspect-ratio: 16/10;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 3px;
  cursor: pointer;
  -webkit-user-drag: none;
  user-select: none;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  /* promoted once at parse time, never toggled, toggling is what flashes on mobile */
  will-change: transform, opacity;
}

.plate > * {
  pointer-events: none;
}

.plate-media {
  position: absolute;
  inset: 0;
  border-radius: 3px;
  overflow: hidden;
  background-color: var(--sunk);
  background-size: cover;
  background-position: center;
  box-shadow:
    0 22px 46px -20px rgba(27, 34, 51, 0.42),
    0 2px 6px rgba(27, 34, 51, 0.08);
}

.plate-media::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
  border-radius: 3px;
}

.plate-no {
  position: absolute;
  left: 0;
  bottom: -30px;
  font-family: "Newsreader", serif;
  font-style: italic;
  font-weight: 300;
  font-size: 0.9rem;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  opacity: 0;
  transition: opacity 0.3s;
}

.plate.is-centre .plate-no {
  opacity: 1;
}

.plate.press .plate-media {
  transform: scale(0.988);
  transition: transform 0.14s var(--ease);
}

.plate:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
}

/* the real copy lives here in the markup, the caption block reads it out */
.plate-info {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- caption ---------- */
.caption {
  max-width: 620px;
  min-height: 96px;
  margin: 1.9rem auto 0;
  padding: 0 clamp(18px, 5vw, 24px);
  transition:
    opacity 0.22s var(--ease),
    transform 0.22s var(--ease);
}

.caption.swap {
  opacity: 0;
  transform: translateY(6px);
}

.cap-head {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  margin-bottom: 0.5rem;
}

.cap-no {
  font-family: "Newsreader", serif;
  font-style: italic;
  font-weight: 300;
  font-size: 1.15rem;
  color: var(--accent);
}

.cap-rule {
  flex: 0 0 34px;
  height: 1px;
  background: var(--pastel);
  transform: translateY(-4px);
}

.cap-title {
  font-family: "Newsreader", serif;
  font-weight: 300;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.cap-desc {
  font-size: 0.94rem;
  line-height: 1.62;
  color: var(--ink-2);
  font-weight: 300;
  max-width: 56ch;
}

.cap-meta {
  margin-top: 0.7rem;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
}

/* ---------- scrub ---------- */
.scrub-shell {
  margin: 1.9rem auto 0;
  width: 340px;
  max-width: calc(100vw - 44px);
  min-width: 0;
}

.scrub {
  position: relative;
  height: 26px;
  display: flex;
  align-items: center;
  touch-action: none;
  cursor: pointer;
}

.scrub:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
  border-radius: 4px;
}

.scrub-track {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 2px;
  background: var(--sunk);
  box-shadow:
    inset 0 1px 2px rgba(90, 110, 145, 0.22),
    inset 0 -1px 0 rgba(255, 255, 255, 0.9);
}

.scrub-fill {
  position: absolute;
  left: 0;
  height: 4px;
  border-radius: 2px;
  background: var(--pastel-deep);
  width: 0;
}

.scrub-ticks {
  position: absolute;
  left: 0;
  right: 0;
  height: 26px;
  pointer-events: none;
}

.tick {
  position: absolute;
  top: 50%;
  width: 1px;
  height: 9px;
  margin-top: -4.5px;
  background: var(--pastel);
  transition:
    height 0.3s var(--ease),
    background 0.3s,
    margin-top 0.3s var(--ease);
}

.tick.on {
  height: 13px;
  margin-top: -6.5px;
  background: var(--accent);
}

.thumb {
  position: absolute;
  top: 50%;
  width: 34px;
  height: 14px;
  margin-top: -7px;
  margin-left: -17px;
  border-radius: 7px;
  background: #fff;
  border: 1px solid var(--pastel);
  box-shadow: 0 3px 8px rgba(90, 110, 145, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  pointer-events: none;
}

.thumb i {
  width: 1px;
  height: 6px;
  background: var(--pastel-deep);
  display: block;
}

.scrub-label {
  margin-top: 0.7rem;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ---------- coil control ---------- */
.fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 70;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--pastel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px -6px rgba(27, 34, 51, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    opacity 0.3s var(--ease),
    transform 0.3s var(--ease);
}

.fab.gone {
  opacity: 0;
  transform: scale(0.68);
  pointer-events: none;
}

.fab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 71;
  width: min(308px, calc(100vw - 28px));
  padding: 1.15rem 1.15rem 0.95rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px) saturate(124%);
  -webkit-backdrop-filter: blur(16px) saturate(124%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    -6px -6px 16px rgba(255, 255, 255, 0.9),
    6px 6px 20px rgba(150, 177, 208, 0.34);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.97);
  pointer-events: none;
  transition:
    opacity 0.3s var(--ease),
    transform 0.3s var(--ease),
    visibility 0.3s;
}

.panel.open {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

.panel h2 {
  font-family: "Newsreader", serif;
  font-weight: 300;
  font-size: 0.94rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 1rem;
}

.slot {
  margin-bottom: 0.85rem;
}

.slot label {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.45rem;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 16px;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--pastel-deep) 0 var(--fill, 50%),
    var(--sunk) var(--fill, 50%) 100%
  );
  box-shadow: inset 0 1px 2px rgba(90, 110, 145, 0.2);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--pastel-deep) 0 var(--fill, 50%),
    var(--sunk) var(--fill, 50%) 100%
  );
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--pastel-deep);
  margin-top: -5.5px;
  box-shadow: 0 2px 5px rgba(90, 110, 145, 0.3);
}

input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid var(--pastel-deep);
  background: #fff;
  box-shadow: 0 2px 5px rgba(90, 110, 145, 0.3);
}

input[type="range"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.panel-out {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(150, 177, 208, 0.35);
}

.state {
  font-size: 0.76rem;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}

.close {
  margin-left: auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--pastel);
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    -3px -3px 8px rgba(255, 255, 255, 0.9),
    3px 3px 8px rgba(150, 177, 208, 0.3);
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1;
}

.close:active {
  box-shadow: inset 2px 2px 5px rgba(150, 177, 208, 0.35);
}

.close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- sheets ---------- */
.sheet {
  max-width: 620px;
  margin: clamp(52px, 9vh, 104px) auto 0;
  padding: 0 clamp(18px, 5vw, 24px);
}

.sheet-tag {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.9rem;
}

.sheet h2 {
  font-family: "Newsreader", serif;
  font-weight: 300;
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  letter-spacing: -0.02em;
  line-height: 1.18;
  margin-bottom: 1rem;
}

.sheet p {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--ink-2);
  margin-bottom: 1rem;
  max-width: 58ch;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  margin-top: 1.6rem;
  background: rgba(150, 177, 208, 0.35);
  border: 1px solid rgba(150, 177, 208, 0.35);
  border-radius: 3px;
  overflow: hidden;
}

.facts > div {
  background: var(--canvas);
  padding: 0.95rem 1rem;
}

.facts dt {
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.35rem;
}

.facts dd {
  font-family: "Newsreader", serif;
  font-weight: 300;
  font-size: 1.15rem;
  color: var(--ink);
}

.lines {
  list-style: none;
  margin-top: 1.4rem;
  border-top: 1px solid rgba(150, 177, 208, 0.35);
}

.lines li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  align-items: baseline;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(150, 177, 208, 0.35);
}

.lines span {
  flex: 0 0 84px;
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.lines a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid rgba(74, 110, 150, 0.3);
  font-size: 0.95rem;
}

.lines a:hover {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

/* ---------- transport ---------- */
.transport {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--pastel);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  box-shadow: 0 6px 18px -6px rgba(27, 34, 51, 0.3);
  transition:
    opacity 0.28s var(--ease),
    transform 0.28s var(--ease);
}

.tp-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: 0 0 auto;
  border: 1px solid var(--pastel);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(90, 110, 145, 0.22);
}

.tp-btn .ico-pause {
  display: none;
}

.tp-btn.playing .ico-play {
  display: none;
}

.tp-btn.playing .ico-pause {
  display: block;
}

.tp-stack {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100px;
}

.tp-line {
  position: relative;
  display: block;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--sunk);
  box-shadow: inset 0 1px 2px rgba(90, 110, 145, 0.2);
}

.tp-line i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--accent);
}

.tp-dur {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.tp-step {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  flex: 0 0 auto;
  border: 1px solid var(--pastel);
  background: #fff;
  color: var(--ink-2);
  font-size: 0.82rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tp-step[disabled] {
  opacity: 0.35;
  cursor: default;
}

.tp-val {
  flex: 1 1 auto;
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.tp-btn:focus-visible,
.tp-step:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- reveal ---------- */
.rv {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
}

.rv.in {
  opacity: 1;
  transform: none;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  /* fixed + mix-blend-mode repaints the whole layer on every scroll frame on mobile */
  body::before,
  body::after {
    position: absolute;
    mix-blend-mode: normal;
  }

  body::after {
    opacity: 0.28;
  }

  :root {
    --bar: 64px;
    --plate-w: min(74vw, 420px);
    --rx: 280;
  }

  .nav {
    display: none;
  }

  .burger {
    display: flex;
  }

  .bar {
    background: var(--canvas);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .stage {
    height: 48vh;
    min-height: 280px;
  }

  .caption {
    margin-top: 1.4rem;
  }
}

@media (max-width: 560px) {
  :root {
    --plate-w: min(80vw, 360px);
    --rx: 200;
  }

  .cap-title {
    font-size: 1.28rem;
  }

  .facts {
    grid-template-columns: 1fr;
  }

  .transport {
    left: 14px;
    bottom: 14px;
    gap: 0.55rem;
    padding: 0.4rem 0.55rem;
  }

  .tp-stack {
    width: 78px;
  }

  .fab {
    right: 16px;
    bottom: 16px;
    width: 42px;
    height: 42px;
  }

  .panel {
    right: 14px;
    bottom: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }

  .rv {
    opacity: 1;
    transform: none;
  }
}
