/*
  Helix Drift Template
  https://templatemo.com/tm-630-helix-drift
*/

:root {
    --canvas: #F4F7FA;
    --sunk: #DDE7F2;
    --pastel: #B9CDE5;
    --pastel-deep: #96B1D0;
    --ink: #111827;
    --ink-2: #3A4355;
    --ink-3: #5C687A;
    --accent: #4A6E96;

    --bar: 70px;
    --plate-w: min(46vw, 620px);

    --rx: 600;
    --ry: 54;
    --coil: 0.9;
    --fall: 0.52;

    --ease: cubic-bezier(.22, 1, .36, 1);
    --dur: .6s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--bar) + 18px);
    scrollbar-gutter: stable;
}

body {
    min-height: 100vh;
    background: var(--canvas);
    color: var(--ink);
    font-family: 'Albert Sans', system-ui, sans-serif;
    font-weight: 300;
    overflow-x: hidden;
    position: relative;
}

/* ambient washes */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(120vw 90vh at 8% -10%, rgba(185, 205, 229, .55), transparent 62%),
        radial-gradient(110vw 80vh at 98% 108%, rgba(221, 231, 242, .85), transparent 60%);
}

/* grid + grain */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='320'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.34' numOctaves='2' stitchTiles='stitch'/></filter><rect width='320' height='320' filter='url(%23n)' opacity='0.10'/></svg>"),
        linear-gradient(to right, rgba(150, 177, 208, .30) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(150, 177, 208, .30) 1px, transparent 1px);
    background-size: 320px 320px, 72px 72px, 72px 72px;
    mix-blend-mode: overlay;
    opacity: .5;
    -webkit-mask-image: radial-gradient(80vw 80vh at 50% 42%, #000 20%, transparent 82%);
    mask-image: radial-gradient(80vw 80vh at 50% 42%, #000 20%, transparent 82%);
}

.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, .72);
    backdrop-filter: blur(14px) saturate(120%);
    -webkit-backdrop-filter: blur(14px) saturate(120%);
    border-bottom: 1px solid rgba(150, 177, 208, .28);
}

.brand {
    font-family: 'Newsreader', serif;
    font-weight: 300;
    font-size: 1.06rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: .62rem;
    text-decoration: none;
}

.brand i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    display: block;
    flex: 0 0 auto;
}

.nav {
    display: flex;
    gap: 2rem;
    align-items: center
}

.nav a {
    position: relative;
    color: var(--ink-2);
    text-decoration: none;
    font-size: .78rem;
    letter-spacing: .15em;
    text-transform: uppercase;
    font-weight: 300;
    padding: 14px 0 6px;
}

/* hover drops a chevron in from above the label */
.nav a,
.drawer a {
    transition: color .34s var(--ease)
}

.nav a:hover,
.nav a:focus-visible,
.drawer a:hover,
.drawer a:focus-visible {
    color: var(--accent)
}

.wv {
    position: absolute;
    left: 50%;
    top: 2px;
    width: 10px;
    height: 6px;
    overflow: visible;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -7px);
    transition: opacity .3s var(--ease), transform .42s var(--ease);
}

.wv path {
    fill: none;
    stroke: var(--accent);
    stroke-width: 1;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav a:hover .wv,
.nav a:focus-visible .wv {
    opacity: 1;
    transform: translate(-50%, 0)
}

.drawer a {
    position: relative;
    padding: .95rem 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, .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 .3s var(--ease), opacity .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: .9rem;
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .32s var(--ease), transform .32s var(--ease), visibility .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: .01em;
    border-bottom: 1px solid rgba(150, 177, 208, .3);
}

/* ---------- stage ---------- */
.stage-shell {
    padding-top: var(--bar)
}

.stage {
    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, .42), 0 2px 6px rgba(27, 34, 51, .08);
}

.plate-media::after {
    content: "";
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .42);
    border-radius: 3px;
}

.plate-no {
    position: absolute;
    left: 0;
    bottom: -30px;
    font-family: 'Newsreader', serif;
    font-style: italic;
    font-weight: 300;
    font-size: .9rem;
    color: var(--ink-3);
    letter-spacing: .04em;
    opacity: 0;
    transition: opacity .3s;
}

.plate.is-centre .plate-no {
    opacity: 1
}

.plate.press .plate-media {
    transform: scale(.988);
    transition: transform .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 .22s var(--ease), transform .22s var(--ease);
}

.caption.swap {
    opacity: 0;
    transform: translateY(6px)
}

.cap-head {
    display: flex;
    align-items: baseline;
    gap: .9rem;
    margin-bottom: .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: -.02em;
    line-height: 1.2
}

.cap-desc {
    font-size: .94rem;
    line-height: 1.62;
    color: var(--ink-2);
    font-weight: 300;
    max-width: 56ch
}

.cap-meta {
    margin-top: .7rem;
    font-size: .7rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--ink-3);
    display: flex;
    flex-wrap: wrap;
    gap: .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, .22), inset 0 -1px 0 rgba(255, 255, 255, .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 .3s var(--ease), background .3s, margin-top .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, .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: .7rem;
    text-align: center;
    font-size: .7rem;
    letter-spacing: .18em;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}

/* ---------- footer ---------- */
.foot {
    margin-top: clamp(48px, 8vh, 96px);
    background: var(--sunk);
    border-top: 1px solid rgba(150, 177, 208, .4);
    padding: 2.4rem clamp(18px, 5vw, 54px);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    font-size: .78rem;
    color: var(--ink-2);
}

.foot a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(74, 110, 150, .35)
}

.foot a:hover {
    border-bottom-color: var(--accent)
}

/* ---------- coil control ---------- */
.fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 70;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .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, .3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity .3s var(--ease), transform .3s var(--ease);
}

.fab.gone {
    opacity: 0;
    transform: scale(.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 .95rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(16px) saturate(124%);
    -webkit-backdrop-filter: blur(16px) saturate(124%);
    border: 1px solid rgba(255, 255, 255, .9);
    box-shadow: -6px -6px 16px rgba(255, 255, 255, .9), 6px 6px 20px rgba(150, 177, 208, .34);
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(.97);
    pointer-events: none;
    transition: opacity .3s var(--ease), transform .3s var(--ease), visibility .3s;
}

.panel.open {
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto
}

.panel h2 {
    font-family: 'Newsreader', serif;
    font-weight: 300;
    font-size: .94rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--ink);
    margin-bottom: 1rem;
}

.slot {
    margin-bottom: .85rem
}

.slot label {
    display: flex;
    justify-content: space-between;
    font-size: .68rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: .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, .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, .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, .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: .7rem;
    margin-top: .9rem;
    padding-top: .75rem;
    border-top: 1px solid rgba(150, 177, 208, .35);
}

.state {
    font-size: .76rem;
    color: var(--ink-2);
    letter-spacing: .02em
}

.close {
    margin-left: auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--pastel);
    background: rgba(255, 255, 255, .9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: -3px -3px 8px rgba(255, 255, 255, .9), 3px 3px 8px rgba(150, 177, 208, .3);
    color: var(--ink-2);
    font-size: 1rem;
    line-height: 1;
}

.close:active {
    box-shadow: inset 2px 2px 5px rgba(150, 177, 208, .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: .68rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: .9rem;
}

.sheet h2 {
    font-family: 'Newsreader', serif;
    font-weight: 300;
    font-size: clamp(1.5rem, 3.4vw, 2rem);
    letter-spacing: -.02em;
    line-height: 1.18;
    margin-bottom: 1rem;
}

.sheet p {
    font-size: .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, .35);
    border: 1px solid rgba(150, 177, 208, .35);
    border-radius: 3px;
    overflow: hidden;
}

.facts>div {
    background: var(--canvas);
    padding: .95rem 1rem
}

.facts dt {
    font-size: .66rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: .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, .35)
}

.lines li {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem 1.4rem;
    align-items: baseline;
    padding: .85rem 0;
    border-bottom: 1px solid rgba(150, 177, 208, .35);
}

.lines span {
    flex: 0 0 84px;
    font-size: .66rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.lines a {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid rgba(74, 110, 150, .3);
    font-size: .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: .65rem;
    padding: .45rem .7rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, .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, .3);
    transition: opacity .28s var(--ease), transform .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, .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, .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: .82rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tp-step[disabled] {
    opacity: .35;
    cursor: default
}

.tp-val {
    flex: 1 1 auto;
    text-align: center;
    font-size: .68rem;
    letter-spacing: .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 .7s var(--ease), transform .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: .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: .55rem;
        padding: .4rem .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: .001ms !important;
        transition-duration: .001ms !important
    }

    .rv {
        opacity: 1;
        transform: none
    }
}
