/* ============================================================
   GIRL+GRID — GLOSS & GRID

   The FOUNDATION: the chapter/tone system, the tone-safe text
   colours, the rainbow button, the glass definition, the cover and
   the dock.

   The six chapters built on top of it live in girl-chapters.css,
   which also re-dresses styles/girl.css. Load order is
   girl.css -> this -> girl-chapters.css.

   THE COLOUR RULE, which every selector in here obeys:
     · pink feels  — names, headlines, the join CTA
     · blue thinks — numbers, tables, rules, the points ladder
     · cyan is live — on sale, racing now. Nothing else.
   ============================================================ */

/* ------------------------------------------------------------
   CHAPTERS

   Each section paints its own ground, so a section is correctly
   coloured before any JavaScript runs. scripts/tone.js only sets
   the PAGE tone, which is what the fixed chrome and the rubber-band
   gap at the ends of the document read.
   ------------------------------------------------------------ */
[data-world="girl"] [data-tone] {
  background: var(--ground);
  color: var(--ink);
  transition: background-color var(--d4) var(--ease-out),
              color var(--d4) var(--ease-out);
}

[data-world="girl"][data-page-tone="light"] body,
[data-world="girl"][data-page-tone="light"] { background: #f4f1ec; --nav-scrim: #f4f1ec; }
[data-world="girl"][data-page-tone="dark"] body,
[data-world="girl"][data-page-tone="dark"] { background: #0b0b12; --nav-scrim: #0b0b12; }

/* The fixed chrome sits outside every section and has to follow the
   page tone or it goes invisible over the light chapters. */
[data-world="girl"][data-page-tone="light"] .nav__mark,
[data-world="girl"][data-page-tone="light"] .megafoot__mark { filter: invert(1); }
[data-world="girl"][data-page-tone="light"] .nav__world { color: #17131c; }
[data-world="girl"][data-page-tone="light"] .cursor { border-color: #17131c; }
[data-world="girl"][data-page-tone="light"] .cursor__dot { background: #17131c; }
[data-world="girl"][data-page-tone="light"] .sidenav { color: #17131c; }

@media (prefers-reduced-motion: reduce) {
  [data-world="girl"] [data-tone] { transition: none; }
}

/* ------------------------------------------------------------
   TEXT COLOUR, PER TONE

   Pink reads 5.19 on the dark ground and 3.36 on the light one; blue
   is the reverse. Every small pink or blue label on this page goes
   through --accent-text / --blue-text so it picks up the variant that
   passes on the ground it is actually sitting on. Fills keep the
   brand colours: a pink bar or button is still #ff1568.
   ------------------------------------------------------------ */
[data-world="girl"] .mono--accent,
[data-world="girl"] .hot,
[data-world="girl"] .manifesto__type .p { color: var(--accent-text); }

/* The whisper voice. Used on one line per chapter at most — it is a
   change of register, and a change of register used twice in a
   paragraph is just a second font. */
[data-world="girl"] .cover__lede em,
[data-world="girl"] .grid26__lede em,
[data-world="girl"] .liv__lede em,
[data-world="girl"] .room__lede em {
  font-family: var(--font-whisper);
  font-style: italic;
  font-size: 1.18em;
  line-height: 1.32;
  color: var(--ink);
}

/* ------------------------------------------------------------
   THE RAINBOW BUTTON

   The only polychrome element on the page, reserved for joining.
   The border is a conic gradient rotating behind a solid pill; the
   pill masks all but a 2px rim. One element, no pseudo-stacking.
   ------------------------------------------------------------ */
@property --rb {
  syntax: "<angle>"; initial-value: 0deg; inherits: false;
}

.rainbow {
  --rb: 0deg;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2.1rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  color: var(--ink);
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    conic-gradient(from var(--rb),
      #ff1568, #ff7ab8, #e7a3ff, #ffd1e6, #ff3d8b, #ff1568) border-box;
  border: 2px solid transparent;
  isolation: isolate;
  transition: transform var(--d2) var(--ease-out),
              box-shadow var(--d2) var(--ease-out);
  animation: rb-spin 5s linear infinite;
}

[data-tone="light"] .rainbow { background:
  linear-gradient(#fffdfa, #fffdfa) padding-box,
  conic-gradient(from var(--rb),
    #ff1568, #ff7ab8, #e7a3ff, #ffd1e6, #ff3d8b, #ff1568) border-box; }

.rainbow:hover,
.rainbow:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 10px 34px -12px rgba(255, 21, 104, .65);
}

.rainbow--lg { padding: 1.25rem 2.8rem; font-size: calc(var(--text-mono) * 1.15); }

@keyframes rb-spin { to { --rb: 360deg; } }

@media (prefers-reduced-motion: reduce) {
  .rainbow { animation: none; }
}

/* ------------------------------------------------------------
   GLASS

   One definition. Two live backdrop-filter layers per viewport is
   the budget — beyond that a mid-range laptop drops frames on
   scroll, and the effect is not worth it.
   ------------------------------------------------------------ */
.glass {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-line);
  border-radius: clamp(1rem, 2vw, 1.75rem);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  overflow: hidden;
}

/* The lip-gloss line: a specular highlight along the top edge. It is
   what separates "translucent box" from "a pane of something". */
.glass::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 42%;
  background: var(--glass-lip);
  opacity: .5;
  pointer-events: none;
}

/* ============================================================
   01 · THE COVER
   ============================================================ */
.cover {
  position: relative;
  min-height: 100svh;
  display: grid;
  /* Two rows, not one centred block: the headline takes the space and
     centres inside it, and the scroll cue is pinned to the floor. With
     align-content:center the foot was centred too, which left a third
     of the screen empty beneath it on a phone. */
  grid-template-rows: 1fr auto;
  padding-block: clamp(6rem, 14vh, 10rem) clamp(2rem, 5vh, 4rem);
  overflow: hidden;
  isolation: isolate;
}

.cover__aurora {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  /* The gradient underneath shows through if WebGL2 is unavailable,
     so the cover is never a flat rectangle. */
  background:
    radial-gradient(70% 55% at 22% 32%, rgba(255,21,104,.42), transparent 62%),
    radial-gradient(60% 50% at 78% 62%, rgba(255,111,181,.40), transparent 64%),
    radial-gradient(50% 45% at 52% 18%, rgba(231,163,255,.30), transparent 66%),
    #0b0b12;
}

.cover__halo {
  position: absolute;
  inset: 12% 8% 22%;
  z-index: -1;
  background: var(--halo);
  filter: blur(44px);
  pointer-events: none;
}

.cover__inner {
  position: relative;
  display: grid;
  align-content: center;
  gap: clamp(1.2rem, 2.4vw, 2rem);
}

.cover__rail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem clamp(0.9rem, 2vw, 1.8rem);
  color: var(--muted);
}
.cover__rail .mono--accent { color: var(--accent); }

/* ---- the interlock ----
   Three layers: the back half of the headline, the portrait, then
   the front half. She stands INSIDE the words. The portrait is
   absolutely placed so the two halves stay on the normal text
   baseline and the line box does not depend on the image loading. */
.cover__h1 {
  position: relative;
  margin: 0;
  font-family: var(--display-face);
  font-weight: 400;
  font-size: clamp(3.4rem, 1rem + 13vw, 12.5rem);
  line-height: 0.84;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  display: grid;
  justify-items: start;
}

.cover__word { position: relative; display: block; }
.cover__word--back { z-index: 1; color: var(--ink); }
.cover__word--front { z-index: 3; color: var(--ink); margin-top: -0.04em; }

/* She has to SPAN both lines for the interlock to happen at all. Sized
   from the headline's own height rather than in rem, so she scales with
   the type at every viewport and the crossing point stays put: the top
   of her head clears "GIRLS" and "ON THE GRID" cuts across her chest.

   A cut-out on transparency is the only thing that can do this. A
   photograph with a background would be a rectangle sitting in front
   of both layers. */
.cover__girl {
  position: absolute;
  z-index: 2;
  /* In em, so she moves with the type: her chest lands on "GRID" at
     every width above 860px, which is the whole point of the layering.
     (She used to be pinned to the right edge, beside the words.) */
  left: 2.3em;
  top: -22%;
  height: 152%;
  /* The cut-out stops at her waist. Fade the last fifth so she melts
     into the light instead of ending on a hard horizontal line. */
  -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent 98%);
  mask-image: linear-gradient(180deg, #000 72%, transparent 98%);
  width: auto;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(-14px 26px 44px rgba(0, 0, 0, .62)) contrast(1.03) saturate(1.04);
  pointer-events: none;
}

@media (max-width: 860px) {
  /* Below this the headline wraps tight enough that she would cover
     the words rather than stand in them. She drops behind the whole
     h1 at low opacity instead — still there, no longer in the way. */
  .cover__girl {
    z-index: 0;
    left: auto;
    right: -12%;
    top: -14%;
    height: 128%;
    opacity: .5;
  }
  .cover__word--back, .cover__word--front { z-index: 3; }
}

.cover__lede {
  max-width: 42ch;
  color: var(--muted);
  font-size: clamp(1rem, 0.95rem + 0.4vw, 1.2rem);
  line-height: 1.55;
}

.cover__cta { margin: 0.4rem 0 0; }

/* Kiss-cut stickers. Only on the cover and the print table — never
   on a data section. */
.cover__sticker {
  position: absolute;
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  color: #0b0b12;
  box-shadow: 0 6px 20px -8px rgba(0, 0, 0, .7);
  pointer-events: none;
}
/* Bottom right, clear of her: at top-right it landed on her head. */
.cover__sticker--gg {
  right: 6%; top: 24%;
  background: var(--accent);
  font-family: var(--display-face);
  font-size: 1.4rem;
  letter-spacing: 0;
  rotate: -12deg;
  padding: 0.55rem 1rem;
}
.cover__sticker--city {
  right: 9%; bottom: 14%;
  background: #ffc4e1;
  rotate: 7deg;
}
@media (max-width: 720px) { .cover__sticker { display: none; } }

.cover__foot {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-self: end;
  margin-top: clamp(1.5rem, 4vh, 3rem);
}

/* ============================================================
   THE DOCK
   ============================================================ */
.dock {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  translate: -50% 0;
  z-index: 60;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity var(--d3) var(--ease-out), transform var(--d3) var(--ease-out);
}
.dock[data-shown="true"] { opacity: 1; transform: none; pointer-events: auto; }
/* A pinned section holds the viewport for three screens; the dock
   hovering over it the whole time reads as stuck. */
[data-pinned="true"] .dock { opacity: 0; transform: translateY(20px); pointer-events: none; }

.dock__pill {
  background: rgba(20, 18, 26, .62);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  padding: 0.5rem 0.7rem;
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 18px 50px -20px rgba(0, 0, 0, .9);
}
[data-page-tone="light"] .dock__pill {
  background: rgba(255, 255, 255, .72);
  border-color: rgba(23, 19, 28, .12);
}

.dock__list {
  display: flex;
  align-items: flex-end;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.dock__item { position: relative; display: flex; }

.dock__link {
  display: grid;
  place-items: center;
  width: clamp(2.5rem, 9vw, 3rem);
  height: clamp(2.5rem, 9vw, 3rem);
  border-radius: 50%;
  color: var(--ink);
  text-decoration: none;
}
[data-page-tone="light"] .dock__link { color: #17131c; }

.dock__icon {
  display: block;
  width: 1.35rem;
  height: 1.35rem;
  transform-origin: 50% 100%;
  will-change: transform;
}
.dock__icon svg { width: 100%; height: 100%; display: block; }

.dock__link.is-active { color: var(--accent); }
.dock__link.is-active::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 0.1rem;
  translate: -50% 0;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.dock__link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* The label rides on the swell, so it only appears for the icon
   actually under the pointer rather than on every hover. */
.dock__label {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  translate: -50% 0;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: var(--accent);
  color: #0b0b12;
  opacity: clamp(0, calc((var(--swell, 0) - 0.34) * 6), 1);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .dock__label { opacity: 0; }
  .dock__link:hover .dock__label,
  .dock__link:focus-visible .dock__label { opacity: 1; }
}
