/* Four-layer menu-page splash system (always dark iron ground, text is LCP, title mask only while rising).
   Five compositions share one DOM: eyebrow, title, lede, actions and piece are grid items of .tw-splash__inner and
   each composition is a set of grid areas. Nothing here animates layout; every size is declared, none is measured. */

.tw-splash {
  position: relative;
  min-height: calc(100svh - var(--tw-header-h));
  display: grid;
  grid-template-rows: 1fr auto;
  overflow-x: clip;
  background: var(--tw-iron-950);
  color: var(--tw-iron-50);
  --tw-bg: var(--tw-iron-950);
  --tw-bg-raised: var(--tw-iron-900);
  --tw-bg-sunken: #070809;
  --tw-ink: var(--tw-iron-50);
  --tw-ink-2: var(--tw-iron-200);
  --tw-ink-3: var(--tw-iron-300);
  --tw-rule: var(--tw-iron-700);
  --tw-rule-strong: var(--tw-iron-50);
  --tw-accent: var(--tw-accent-light);
  --tw-accent-ink: var(--tw-accent-pale);
  --tw-on-accent: var(--tw-iron-950);
  --tw-second: var(--tw-temper-straw);
  color-scheme: dark;
}

.tw-splash__ground {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.tw-splash__grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.tw-splash__frame {
  position: relative;
  z-index: 2;
  display: grid;
  min-width: 0;
}

/* The grid of five items. It is a size container so fitted titles can use cqw (no script, no measuring). */
.tw-splash__inner {
  position: relative;
  display: grid;
  container-type: inline-size;
  container-name: splash;
  min-width: 0;
  column-gap: clamp(1.5rem, 3.5vw, 3.5rem);
  row-gap: var(--tw-space-4);
  padding-block: clamp(1.75rem, 4svh, 3.5rem);
  /* split (default): copy left, instrument right */
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.1fr);
  grid-template-rows: 1fr auto auto auto auto 1fr;
  grid-template-areas:
    '.       piece'
    'eyebrow piece'
    'title   piece'
    'lede    piece'
    'actions piece'
    '.       piece';
}

.tw-splash__inner > * {
  min-width: 0;
}

/* Font gate (set by the inline script in Splash.astro, lifted when the faces land or after 1.2 s) */
.tw-splash[data-font-wait] .tw-splash__inner > *,
.tw-splash[data-font-wait] .tw-splash__strip-inner > * {
  visibility: hidden;
}

.tw-splash__eyebrow {
  grid-area: eyebrow;
  display: inline-flex;
  align-items: center;
  gap: var(--tw-space-3);
  color: var(--tw-temper-straw);
}

.tw-splash__title {
  grid-area: title;
  font-family: var(--tw-font-display);
  font-weight: var(--tw-weight-heavy);
  font-size: clamp(2rem, 4.4vw, 3.75rem);
  line-height: 1.02;
  letter-spacing: var(--tw-tracking-display);
  color: var(--tw-iron-50);
  max-width: 18ch;
}

/* Title mask exists ONLY while rising (animation-fill-mode: backwards) so descenders never clip after landing */
.tw-splash__line {
  display: inline-block;
}
:root[data-m-go] .tw-splash__line {
  animation-name: tw-splash-mask;
  animation-duration: var(--splash-title, 620ms);
  animation-timing-function: var(--tw-ease-strike);
  animation-fill-mode: backwards;
  animation-iteration-count: 1;
  animation-direction: normal;
}
@keyframes tw-splash-mask {
  from { clip-path: inset(-0.2em -0.2em 100% -0.2em); translate: 0 0.55em; }
  to { clip-path: inset(-0.2em -0.2em -0.2em -0.2em); translate: 0 0; }
}

.tw-splash__lede {
  grid-area: lede;
  font-size: clamp(1rem, 1.35vw, 1.1875rem);
  line-height: 1.5;
  color: var(--tw-iron-200);
  max-width: 54ch;
}

.tw-splash__actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  gap: var(--tw-space-3);
  padding-top: var(--tw-space-2);
}

.tw-splash__aside {
  grid-area: aside;
  min-width: 0;
  display: grid;
  gap: var(--tw-space-2);
  align-content: start;
}

.tw-tower-rail {
  display: grid;
  gap: 8px;
}

.tw-tower-rail__item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  font-size: var(--tw-size-small);
  line-height: 1.38;
}

.tw-tower-rail__k {
  font-size: var(--tw-size-micro);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tw-temper-straw);
}

.tw-tower-rail__v {
  color: var(--tw-iron-200);
}

@media (max-width: 420px) {
  .tw-tower-rail__item {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
}

.tw-splash__piece {
  grid-area: piece;
  align-self: center;
  position: relative;
  min-width: 0;
  width: 100%;
  border: 1px solid var(--tw-iron-700);
  background: color-mix(in oklch, var(--tw-iron-900) 88%, var(--tw-iron-950));
  padding: clamp(14px, 2vw, 24px);
}

.tw-splash__strip {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--tw-iron-700);
  background: var(--tw-iron-900);
}

.tw-splash__strip-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--tw-space-3) var(--tw-space-5);
  padding-block: var(--tw-space-3);
}

.tw-splash__cue {
  display: inline-flex;
  align-items: center;
  gap: var(--tw-space-2);
  min-height: 44px;
  font-family: var(--tw-font-mono);
  font-size: var(--tw-size-label);
  letter-spacing: var(--tw-tracking-label);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--tw-iron-50);
}

.tw-splash__cue:hover {
  color: var(--tw-temper-straw);
}

.tw-splash__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tw-space-4);
  font-family: var(--tw-font-mono);
  font-size: var(--tw-size-micro);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tw-iron-300);
}

.tw-splash__temper {
  height: var(--tw-line-temper, 3px);
  background: var(--tw-temper-line);
}

/* ---------------------------------------------------------------------------------------------------------------
   Compositions (wide screens only; phones share one stacked order, further down)
   --------------------------------------------------------------------------------------------------------------- */
@media (min-width: 961px) {
  /* split-reverse: instrument left, copy right */
  .tw-splash--split-reverse .tw-splash__inner {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    grid-template-areas:
      'piece .'
      'piece eyebrow'
      'piece title'
      'piece lede'
      'piece actions'
      'piece .';
  }

  /* Wide instruments (stage, banner): a piece root marked [data-splash-parts] lays its parts side by side.
     [data-splash-part='head'] runs across the top, [data-splash-part='visual'] takes the wide column and every
     other child stacks in the narrow one. Unmarked pieces keep their own single-column layout. */
  :is(.tw-splash--stage, .tw-splash--banner) .tw-splash__piece [data-splash-parts] {
    display: grid;
    grid-template-columns: minmax(0, var(--splash-visual-share, 1.75fr)) minmax(0, 1fr);
    column-gap: clamp(1rem, 2.4vw, 2.25rem);
    row-gap: 0;
    align-items: start;
    align-content: center;
  }
  :is(.tw-splash--stage, .tw-splash--banner) .tw-splash__piece [data-splash-parts] > * {
    grid-column: 2;
    margin-bottom: var(--tw-space-3);
  }
  :is(.tw-splash--stage, .tw-splash--banner) .tw-splash__piece [data-splash-parts] > :last-child {
    margin-bottom: 0;
  }
  :is(.tw-splash--stage, .tw-splash--banner) .tw-splash__piece [data-splash-parts] > [data-splash-part='head'] {
    grid-column: 1 / -1;
    grid-row: 1;
  }
  :is(.tw-splash--stage, .tw-splash--banner) .tw-splash__piece [data-splash-parts] > [data-splash-part='visual'] {
    grid-column: 1;
    grid-row: 2 / span 12;
    align-self: center;
    margin-bottom: 0;
  }

  /* stage: the instrument unboxed across the full width of the screen, copy laid along the foot */
  .tw-splash--stage .tw-splash__inner {
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto auto auto;
    row-gap: var(--tw-space-3);
    padding-block: 0 clamp(1.25rem, 3svh, 2.5rem);
    grid-template-areas:
      'piece   piece'
      'eyebrow eyebrow'
      'title   lede'
      'title   actions';
  }
  .tw-splash--stage .tw-splash__piece {
    border: 0;
    background: none;
    padding: clamp(1.25rem, 3.4svh, 2.75rem) 0 clamp(1rem, 2.6svh, 2rem);
    margin-bottom: var(--tw-space-2);
    align-self: stretch;
    display: grid;
    align-content: center;
  }
  /* the stage floor: one band edge to edge behind the instrument, closed by a hairline (the horizon) */
  .tw-splash--stage .tw-splash__piece::before {
    content: '';
    position: absolute;
    inset: 0 -100vw;
    z-index: -1;
    background: color-mix(in oklch, var(--tw-iron-900) 72%, transparent);
    border-bottom: 1px solid var(--tw-iron-600);
    pointer-events: none;
  }
  .tw-splash--stage .tw-splash__title {
    font-size: clamp(2.1rem, 3.7vw, 3.5rem);
    max-width: 16ch;
    align-self: start;
  }
  .tw-splash--stage .tw-splash__lede {
    max-width: 58ch;
    align-self: start;
  }
  .tw-splash--stage .tw-splash__actions {
    padding-top: 0;
    align-self: end;
  }

  /* banner: instrument across the whole width, then a headline fitted to ONE line (cqw / characters) */
  .tw-splash--banner .tw-splash__inner {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    align-content: center;
    row-gap: var(--tw-space-3);
    padding-block: clamp(1.25rem, 3svh, 2.5rem);
    grid-template-areas:
      'piece   piece'
      'eyebrow eyebrow'
      'title   title'
      'lede    actions';
  }
  .tw-splash--banner .tw-splash__piece {
    margin-bottom: clamp(0.75rem, 3svh, 2.25rem);
    padding: clamp(12px, 1.6vw, 20px);
  }
  .tw-splash--banner .tw-splash__title {
    max-width: none;
    line-height: 1;
    font-size: clamp(1.9rem, 3.1vw, 3rem);
    font-size: clamp(1.9rem, calc(100cqw / (var(--splash-chars, 40) * 0.56)), 4.6rem);
  }
  .tw-splash--banner .tw-splash__lede {
    max-width: 78ch;
    font-size: clamp(0.95rem, 1.2vw, 1.0625rem);
  }
  .tw-splash--banner .tw-splash__actions {
    padding-top: 0;
    justify-content: flex-end;
    align-self: end;
  }

  /* tower: a shaft the full height of the screen; the headline crosses it at display scale */
  .tw-splash--tower .tw-splash__inner {
    grid-template-columns: minmax(0, 0.96fr) minmax(0, 1.18fr);
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
    row-gap: var(--tw-space-3);
    padding-block: clamp(1rem, 2.5svh, 2rem);
    grid-template-areas:
      'eyebrow eyebrow'
      'title   title'
      'lede    piece'
      'actions piece'
      'aside   piece';
  }
  /* the shaft: drawn behind the headline and the instrument, bleeding into the top and the strip */
  .tw-splash--tower .tw-splash__inner::before {
    content: '';
    grid-column: 2;
    grid-row: 1 / -1;
    margin-block: calc(-1 * clamp(1rem, 2.5svh, 2rem));
    border-inline: 1px solid var(--tw-iron-700);
    background:
      linear-gradient(var(--tw-iron-700), var(--tw-iron-700)) 0 0 / 100% 1px no-repeat,
      color-mix(in oklch, var(--tw-iron-900) 86%, var(--tw-iron-950));
    pointer-events: none;
  }
  .tw-splash--tower :is(.tw-splash__eyebrow, .tw-splash__title, .tw-splash__lede, .tw-splash__actions, .tw-splash__aside, .tw-splash__piece) {
    position: relative;
  }
  .tw-splash--tower .tw-splash__title {
    max-width: none;
    line-height: 0.96;
    font-size: clamp(2.4rem, 4.6vw, 4.4rem);
    font-size: clamp(2.4rem, calc(100cqw / ((var(--splash-chars, 40) / 2 + 4) * 0.58)), 5.25rem);
    padding-bottom: var(--tw-space-2);
  }
  .tw-splash--tower .tw-splash__lede {
    align-self: start;
    max-width: 46ch;
    padding-top: var(--tw-space-3);
    border-top: 1px solid var(--tw-iron-600);
  }
  .tw-splash--tower .tw-splash__actions {
    padding-top: 0;
    align-self: start;
  }
  .tw-splash--tower .tw-splash__aside {
    align-self: end;
    padding-top: var(--tw-space-3);
    border-top: 1px solid var(--tw-iron-700);
    max-width: 46ch;
  }
  .tw-splash--tower .tw-splash__piece {
    border: 0;
    background: none;
    align-self: start;
    padding: 0 clamp(14px, 1.6vw, 22px);
  }
}

/* Short wide screens (1366 x 650 and the like): every composition steps its type and spacing down once */
@media (max-height: 700px) and (min-width: 961px) {
  .tw-splash__inner {
    padding-block: var(--tw-space-4);
    column-gap: var(--tw-space-5);
  }
  .tw-splash--split .tw-splash__title,
  .tw-splash--split-reverse .tw-splash__title {
    font-size: clamp(1.85rem, 3.6vw, 2.85rem);
  }
  .tw-splash--stage .tw-splash__inner {
    padding-block: 0 var(--tw-space-4);
    row-gap: var(--tw-space-2);
  }
  .tw-splash--stage .tw-splash__piece {
    padding-block: var(--tw-space-4) var(--tw-space-3);
  }
  .tw-splash--stage .tw-splash__title {
    font-size: clamp(1.9rem, 3.1vw, 2.7rem);
  }
  .tw-splash--stage .tw-splash__lede,
  .tw-splash--banner .tw-splash__lede {
    font-size: 0.9375rem;
    line-height: 1.42;
  }
  .tw-splash--banner .tw-splash__inner,
  .tw-splash--tower .tw-splash__inner {
    padding-block: var(--tw-space-4);
    row-gap: var(--tw-space-2);
  }
  .tw-splash--banner .tw-splash__piece {
    margin-bottom: var(--tw-space-2);
    padding: 12px 14px;
  }
  .tw-splash--banner .tw-splash__title {
    font-size: clamp(1.8rem, 2.9vw, 2.6rem);
    font-size: clamp(1.8rem, calc(100cqw / (var(--splash-chars, 40) * 0.56)), 3.4rem);
  }
  .tw-splash--tower .tw-splash__inner::before {
    margin-block: calc(-1 * var(--tw-space-4));
  }
  .tw-splash--tower .tw-splash__title {
    font-size: clamp(2.2rem, 4vw, 3.4rem);
    font-size: clamp(2.2rem, calc(100cqw / ((var(--splash-chars, 40) / 2 + 3) * 0.6)), 3.9rem);
  }
}

/* Phones and narrow tablets: ONE stacked order for every composition. The instrument follows the title directly, so
   it is above the fold at 390 x 664; the lede and the actions follow it. */
@media (max-width: 960px) {
  .tw-splash {
    min-height: auto;
  }
  .tw-splash__inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    row-gap: var(--tw-space-3);
    padding-block: var(--tw-space-4) var(--tw-space-5);
    grid-template-areas:
      'eyebrow'
      'title'
      'piece'
      'lede'
      'actions'
      'aside';
  }
  .tw-splash__title {
    font-size: clamp(1.75rem, 7vw, 2.5rem);
  }
  .tw-splash__piece {
    padding: 10px;
    margin-block: var(--tw-space-1);
  }
  .tw-splash__lede {
    font-size: 1rem;
  }
}
