/* ==========================================================================
   nyteshift: the plant hero
   Layered after every earlier stylesheet. The hero at rest (the mark
   centred over the headline, the line about Addel and the buttons), the
   states plant.js moves it through, the mark's journey into the nav's
   corner, and the reduced-motion crossfade.

   With no script everything here is simply the composed hero. With
   reduced motion it is the composed hero, and the nav's lockup fades in
   once the mark has gone by. The plant's timings and intensities are not
   here: they are the FEEL object at the top of plant.js.
   ========================================================================== */

:root {
  /* the mark's 120-unit box at rest (the N itself is 96 by 64 units of it) */
  --mark-w: clamp(13rem, min(30vw, 47vh), 36rem);
  /* the headline: two lines on wide screens */
  --hl: clamp(2.6rem, min(6.1vw, 10.4vh), 7.35rem);   /* (the cap keeps the longer line inside the widest shell) */
}
@media (max-width: 899px) { :root { --hl: min(8.2vw, 8.4vh); --mark-w: clamp(12rem, min(42vw, 30vh), 26rem); } }
@media (max-width: 599px) { :root { --hl: min(10.6vw, 5.6vh); --mark-w: min(64vw, 30vh); } }

/* ==========================================================================
   THE HERO AT REST: one statement, centred under the mark
   ========================================================================== */
.hero__stage { padding-block: calc(var(--nav-h) + 1vh) max(5vh, 2.5rem); }
.hero__shell { display: flex; flex-direction: column; align-items: center; text-align: center; }
/* the slot is the N's own box, so the composition is measured from what you see, not from the artwork's
   clear space; the artwork itself hangs out of it, whole and unaltered */
.hero__mark { --mu: calc(var(--mark-w) / 120); position: relative; flex: none; width: calc(var(--mu) * 96); height: calc(var(--mu) * 64); }
.hero__mark img {
  position: absolute; left: calc(var(--mu) * -12); top: calc(var(--mu) * -28);
  width: var(--mark-w); height: var(--mark-w); max-width: none;
  -webkit-user-select: none; user-select: none; -webkit-user-drag: none; pointer-events: none;
}
.hero__line {
  margin: clamp(1.25rem, 4.4vh, 3.1rem) 0 0; font-size: var(--hl); line-height: .93; letter-spacing: -.046em;
  text-wrap: initial; max-width: none;
}
/* the breaks are authored, one set per layout: wide screens two lines, tablets three, phones four */
.hero__line .brk { display: none; }
@media (min-width: 900px) { .hero__line .brk--l { display: inline; } }
@media (min-width: 600px) and (max-width: 899px) { .hero__line .brk--m { display: inline; } }
@media (max-width: 599px) { .hero__line .brk--s { display: inline; } .hero__line { line-height: .97; } }
.hero__foot { margin: clamp(1.1rem, 3.3vh, 2.2rem) 0 0; justify-items: center; gap: clamp(1.1rem, 2.9vh, 1.9rem); }
@media (min-width: 900px) { .hero__foot { margin-left: 0; } }
.hero__body { max-width: 41ch; font-size: clamp(1.0625rem, min(1.32vw, 2.45vh), 1.36rem); line-height: 1.45; }
.hero__acts { justify-content: center; }
@media (max-width: 599px) {
  .hero__body { max-width: 30ch; }
  .hero__acts { width: 100%; max-width: 22rem; }
  .hero__acts .btn { width: 100%; justify-content: center; }
}

/* the cue (only while the mark waits to be planted): a short length of wire with a drop of light falling down it */
.hero__scroll { display: none; }
html.plant .hero__scroll {
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
  left: 50%; bottom: max(1.9rem, calc(env(safe-area-inset-bottom) + 1.2rem)); transform: translate3d(-50%, 0, 0);
  color: var(--p-ink-3); opacity: 0; transition: opacity .9s var(--e-io);
}
html.plant.p-cue .hero__scroll { opacity: 1; }
html.plant.p-go .hero__scroll { opacity: 0; transition: opacity .12s linear; }
html.plant .hero__scroll::after { content: ""; display: block; width: 1px; height: 46px; background: var(--wire-day); transform: none; animation: none; }
html.plant .hero__scroll::before {
  content: ""; position: absolute; left: 50%; bottom: 43px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%;
  background: var(--sodium); box-shadow: 0 0 0 2px rgba(255, 179, 92, .18), 0 0 8px rgba(255, 179, 92, .7); opacity: 0;
}
html.plant.p-cue .hero__scroll::before { animation: cue-drop 2.6s cubic-bezier(.55, 0, .85, .35) .5s infinite; }
@keyframes cue-drop {
  0% { transform: translate3d(0, 0, 0); opacity: 0; }
  8% { opacity: 1; }
  38% { transform: translate3d(0, 41px, 0) scale(1); opacity: 1; animation-timing-function: ease-out; }
  46% { transform: translate3d(0, 41px, 0) scale(2.2); opacity: 0; }
  100% { transform: translate3d(0, 41px, 0) scale(2.2); opacity: 0; }
}

/* ==========================================================================
   THE PLANT (motion, from the top of the page)
   Before the script has run the mark is already out on the paper, large
   and centred, but not yet shown (plant.js brings it up, then owns its
   position from the first frame). Nothing else of the hero shows, nor the
   nav, until the arcs build them.
   ========================================================================== */
html.plant .hero__mark img {
  position: fixed; left: 50%; top: 50%; z-index: 3; margin: calc(var(--mark-w) * -.5) 0 0 calc(var(--mark-w) * -.5);
  transform: scale(1.3); opacity: 0;
}
html.plant:not(.p-lit) .hero__line, html.plant:not(.p-lit) .hero__foot { opacity: 0; }
html.plant:not(.mark-fly) .nav__mark { opacity: 0; }
/* the Menu capsule waits drawn but all but invisible, so its soft shadow is not drawn for the first time as it
   is struck (the launch pass measured that at about 40 ms) */
html.plant:not(.p-menu) .menu { opacity: .001; pointer-events: none; }
html.plant:not(.p-menu) .nav:focus-within .menu { opacity: 1; pointer-events: auto; }

/* a word waiting for its arc: drawn, but all but invisible (0.4%: one level of 255 off the paper), so its type is already drawn
   when it is struck (drawing the headline's glyphs for the first time cost a frame of about 28 ms) */
.pw { opacity: .004; }
/* (struck: plant.js lights and cools it, then puts the markup back as it was) */
.pw.is-on { opacity: 1; }

/* the buttons wait the same way the launch pass found best: drawn, all but invisible, then powered on by an arc */
html.plant .hero__acts.life .btn--lamp:not(.is-on) .btn__body,
html.plant .hero__acts.life .btn--lamp:not(.is-on) .btn__label,
html.plant .hero__acts.life .btn--lamp:not(.is-on) .btn__arrow,
html.plant .hero__acts.life .btn--lamp:not(.is-on) .btn__lamp { opacity: .001; }
html.plant .hero__acts.life .btn--lamp:not(.is-on) .btn__trace { visibility: visible; opacity: .001; }
html.plant .hero__acts.life .btn__trace::before { will-change: transform; }
/* powered by current, not faded up: the body and label strike on with the lamp */
html.plant .hero__acts.life .btn--lamp.is-on .btn__body { animation: btn-strike .3s steps(1, end) var(--d, 0ms) backwards; transition: none; opacity: 1; }
html.plant .hero__acts.life .btn--lamp.is-on .btn__label { animation: btn-strike .34s steps(1, end) calc(var(--d, 0ms) + 60ms) backwards; transition: none; opacity: 1; transform: none; }
html.plant .hero__acts.life .btn--lamp.is-on .btn__arrow { animation: btn-strike .3s steps(1, end) calc(var(--d, 0ms) + 140ms) backwards; transition: none; opacity: 1; }
@keyframes btn-strike { 0% { opacity: 0; } 12% { opacity: 1; } 26% { opacity: .12; } 40% { opacity: 1; } 55% { opacity: .5; } 70%, 100% { opacity: 1; } }

/* the canvases: the paper's (shadow, heat, scorch, shockwave) under the hero, the current's over everything */
.plant-gl { position: fixed; left: 0; top: 0; z-index: 1; pointer-events: none; }
.plant-arcs { position: fixed; left: 0; top: 0; z-index: 31; pointer-events: none; }

/* ==========================================================================
   THE MARK INTO THE CORNER (motion): plant.js moves the mark, scrubbed by
   the scroll, onto the N of the nav's lockup, and the wordmark grows out
   of it (--grow, 0 to 1). Once it is there the lockup is whole again.
   ========================================================================== */
/* (the mark has its own layer over the page, under the nav: plant.js lifts it out of the hero's) */
.plant-mark {
  position: fixed; left: 0; top: 0; z-index: 29; margin: 0; width: var(--mark-w); height: var(--mark-w); max-width: none;
  transform-origin: 50% 50%; pointer-events: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none;
}
html.mark-fly .nav__lock {
  clip-path: inset(0 calc((1 - var(--grow, 1)) * 75%) 0 25%);
  transform: translate3d(calc((var(--grow, 1) - 1) * var(--slide, 14px)), 0, 0);
}
html.mark-fly.mark-docked .nav__lock { clip-path: none; transform: none; }
/* while it plants, the hero's type has its own layer from the start: the wire's lit pieces pass under it, and when they
   first became layers the browser promoted it on the spot and drew all of it in one frame (about 40 ms on a phone's
   GPU). At rest it is let go, so the type is drawn exactly as it is with no animation. */
html.plant .hero__shell { will-change: transform; }
/* while it plants, the mark keeps one raster rather than being drawn again at every size it passes through (an SVG with
   a mask, up to about 960 px across: the GPU's busiest work in the plant); at rest it is drawn afresh, crisp */
html.plant .plant-mark { will-change: transform; }
/* (the lockup follows the scroll exactly: no fade of its own until it is whole again) */
html.mark-fly:not(.mark-docked) .nav__lock { transition: none; }
/* while the mark is at rest the lockup and its ground are drawn, but all but invisible, so that drawing them for the
   first time costs nothing at the corner (measured: a single frame of up to 76 ms on the GPU at 1920 x 1080) */
html.mark-fly .nav__mark.is-wait { background: rgba(242, 238, 228, .004) !important; box-shadow: 0 10px 28px -18px rgba(23, 25, 24, .004) !important; }
html.mark-fly .nav__mark.is-wait .nav__lock { opacity: .004 !important; clip-path: none !important; transform: none !important; }
html.mark-fly .nav__mark.is-wait:focus-visible .nav__lock--day { opacity: 1 !important; }
/* (a keyboard on the logo always sees it whole) */
.nav__mark:focus-visible { opacity: 1 !important; }
.nav__mark:focus-visible .nav__lock { clip-path: none !important; transform: none !important; }

/* reduced motion: the mark stays in the page; once it has gone by, the nav's lockup fades in */
html.rm .nav__mark { opacity: 0; transition: opacity .4s var(--e-io), background-color .45s var(--e-io), box-shadow .45s var(--e-io); }
html.rm.mark-past .nav__mark { opacity: 1; }
html.rm .hero__mark img { transition: opacity .4s var(--e-io); }
html.rm.mark-past .hero__mark img { opacity: 0; }

/* ==========================================================================
   ?tune: a small panel for Del's notes (only with ?tune in the address)
   ========================================================================== */
.tune {
  position: fixed; right: 12px; bottom: 12px; z-index: 70; width: 290px; max-height: calc(100vh - 24px); overflow: auto;
  padding: 12px 14px 14px; border-radius: 14px; background: rgba(23, 25, 24, .92); color: var(--paper);
  font: 500 12px/1.3 var(--f); box-shadow: 0 18px 40px -20px rgba(0, 0, 0, .7);
}
.tune h2 { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--sodium); margin: 0 0 8px; }
.tune label { display: grid; grid-template-columns: 1fr 52px; gap: 2px 8px; align-items: center; margin: 6px 0; }
.tune input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--sodium); }
.tune output { text-align: right; font-variant-numeric: tabular-nums; color: #B5B2AB; }
.tune .tune__row { display: flex; gap: 6px; margin-top: 10px; }
.tune button { flex: 1; padding: 7px 8px; border-radius: 999px; background: var(--paper); color: var(--carbon); font-weight: 500; cursor: pointer; }
.tune button + button { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 1px rgba(242, 238, 228, .3); }
