/* ============================================================
   GIRL+GRID — the chapters

   Second half of GLOSS & GRID. styles/girl-gloss.css carries the
   foundation — the tone system, the rainbow button, the glass
   definition, the cover and the dock — and this file carries the six
   chapters built on it, plus the re-dressing of styles/girl.css.

   Load order is girl.css -> girl-gloss.css -> this. The overrides at
   the foot of this file depend on both.
   ============================================================ */

/* 03 · THE CHAMPIONSHIP lives in styles/girl-stand.css. */

/* ============================================================
   06 · SAME CAR, EIGHTEEN LIVERIES
   ============================================================ */
.liv { padding-block: var(--space-section) 0; overflow: hidden; }

.liv__head { display: grid; gap: 1.4rem; margin-bottom: clamp(1.8rem, 4vw, 3rem); }
@media (min-width: 960px) {
  .liv__head { grid-template-columns: 1fr 1fr; align-items: end; }
}
.liv__title { font-size: var(--text-section); }
.liv__lede { color: var(--muted); max-width: 52ch; }

/* One car, eighteen coats of paint. The car holds still and only the
   livery changes, which is the whole argument of the section. Nothing
   pins: the old sideways rail measured the page too early and floated
   over the sections around it. */
.liv__show {
  position: relative;
  display: grid;
  justify-items: center;
  gap: clamp(1rem, 2.4vw, 2rem);
  padding-block: clamp(1rem, 3vw, 2.5rem) clamp(1.5rem, 4vw, 3rem);
}

/* The race number sits behind the car, the way it sits on the nose. */
.liv__no {
  position: absolute;
  top: 0;
  left: var(--gutter);
  z-index: 0;
  font-family: var(--display-face);
  font-size: clamp(7rem, 24vw, 21rem);
  line-height: .8;
  color: var(--accent);
  user-select: none;
}

.liv__car {
  position: relative;
  z-index: 1;
  width: min(100%, 70rem);
  aspect-ratio: 1400 / 388;
  margin-top: clamp(3.2rem, 11vw, 9.5rem);
}
/* A little light on the floor, so the car stands on something. */
.liv__car::after {
  content: "";
  position: absolute;
  inset: auto 6% -9% 6%;
  height: 22%;
  z-index: -1;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 34%, transparent), transparent);
  filter: blur(14px);
}
.liv__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 100%;
  opacity: 0;
  transition: opacity var(--d3) var(--ease-out);
}
.liv__img.is-on { opacity: 1; }

.liv__who {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  margin: 0;
  text-align: center;
}
.liv__name {
  font-family: var(--display-face);
  font-size: clamp(1.7rem, 1.1rem + 2.2vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.liv__team { color: var(--muted); }
.liv__backer { color: var(--blue-text); }

/* The picker: all eighteen at once, so "same car" is visible before
   anybody touches anything. */
.liv__picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 clamp(0.5rem, 1.2vw, 1rem);
  padding-top: clamp(1rem, 3vw, 2rem);
}
@media (min-width: 720px)  { .liv__picker { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 1100px) { .liv__picker { grid-template-columns: repeat(9, 1fr); } }

.liv__pick {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding: 0.9rem 0.3rem 0.8rem;
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  opacity: .5;
  transition: opacity var(--d2) var(--ease-out), border-color var(--d2) var(--ease-out), color var(--d2) var(--ease-out);
}
.liv__pick img { width: 100%; height: auto; display: block; }
.liv__pick:hover,
.liv__pick:focus-visible,
.liv__pick[aria-pressed="true"] { opacity: 1; border-top-color: var(--accent); color: var(--accent); }
.liv__pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.liv__pick.is-wild img { filter: drop-shadow(0 0 1px var(--accent)); }

@media (prefers-reduced-motion: reduce) {
  .liv__img, .liv__pick { transition: none; }
}

.liv__spec {
  display: grid;
  gap: 1px;
  margin: 0;
  padding-block: clamp(2rem, 5vw, 4rem) var(--space-section);
}
@media (min-width: 720px) { .liv__spec { grid-template-columns: repeat(2, 1fr); column-gap: clamp(2rem, 5vw, 5rem); } }
@media (min-width: 1100px) { .liv__spec { grid-template-columns: repeat(4, 1fr); } }

.liv__spec > div {
  display: grid;
  gap: 0.3rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.liv__spec dt { color: var(--muted); }
.liv__spec dd { margin: 0; font-size: 1.05rem; }
.liv__spec dd b { color: var(--blue-text); font-weight: 700; }

/* ============================================================
   07 · HOW A WEEKEND WORKS — the sky toggle
   ============================================================ */
.fmt {
  position: relative;
  padding-block: var(--space-section);
  overflow: hidden;
  isolation: isolate;
}

/* Two stacked skies, cross-faded. Nothing re-renders on toggle. */
.fmt__sky {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  transition: opacity var(--d4) var(--ease-io);
}
.fmt__sky--sat {
  background:
    radial-gradient(90% 70% at 50% 100%, rgba(255,138,184,.42), transparent 70%),
    linear-gradient(180deg, #170f1c 0%, #35132c 52%, #5a1f3d 100%);
}
.fmt__sky--sun {
  background:
    radial-gradient(90% 70% at 50% 100%, rgba(56,255,245,.24), transparent 70%),
    linear-gradient(180deg, #080b1c 0%, #101a4a 54%, #1b2c8f 100%);
}
.fmt[data-day="sat"] .fmt__sky--sat { opacity: 1; }
.fmt[data-day="sun"] .fmt__sky--sun { opacity: 1; }

.fmt__head { display: grid; gap: 1.6rem; margin-bottom: clamp(2rem, 4vw, 3.2rem); }
@media (min-width: 860px) {
  .fmt__head { grid-template-columns: 1fr auto; align-items: end; }
}

/* Eyebrow, kicker and title each get their own row. The eyebrow was an
   inline span sitting on the title's line box, so "/ HOW A WEEKEND
   WORKS" printed on top of "SATURDAY". */
.fmt__head > div { display: grid; gap: 1.1rem; justify-items: start; }
.fmt__title { font-size: var(--text-section); display: grid; gap: 0.6rem; line-height: 0.92; }
.fmt__kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  color: var(--accent-text);
}
.fmt[data-day="sun"] .fmt__kicker { color: var(--accent-2); }
.fmt__line { font-family: var(--font-whisper); font-style: italic; font-size: 1.4rem; color: var(--muted); }

/* ---- the toggle ---- */
.fmt__toggle {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}
.fmt__toggletrack {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  width: 13rem;
  height: 3.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.fmt__orb {
  position: absolute;
  top: 0.32rem;
  left: 0.32rem;
  width: calc(50% - 0.32rem);
  height: calc(100% - 0.64rem);
  border-radius: 999px;
  background: linear-gradient(140deg, #ffd9e6, var(--accent));
  box-shadow: 0 0 26px -4px var(--accent);
  transition: transform var(--d3) var(--ease-io), background var(--d3) var(--ease-out),
              box-shadow var(--d3) var(--ease-out);
}
.fmt[data-day="sun"] .fmt__orb {
  transform: translateX(100%);
  background: linear-gradient(140deg, #d8ecff, var(--accent-2));
  box-shadow: 0 0 26px -4px var(--accent-2);
}
.fmt__toggleword {
  position: relative;
  z-index: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--track-mono);
  transition: color var(--d2) var(--ease-out);
}
.fmt[data-day="sat"] .fmt__toggleword--sat,
.fmt[data-day="sun"] .fmt__toggleword--sun { color: #0b0b12; }
.fmt[data-day="sat"] .fmt__toggleword--sun,
.fmt[data-day="sun"] .fmt__toggleword--sat { color: var(--ink); }
.fmt__toggle:focus-visible .fmt__toggletrack { outline: 2px solid var(--ink); outline-offset: 4px; }

.fmt__panel { display: grid; gap: clamp(2rem, 4vw, 3.4rem); }
@media (min-width: 960px) { .fmt__panel { grid-template-columns: 1.1fr 0.9fr; } }

.fmt__list { list-style: none; margin: 0; padding: 0; display: grid; }
.fmt__step {
  display: grid;
  grid-template-columns: 2.6rem 1fr;
  gap: 0.2rem 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.fmt__stepno { color: var(--muted); grid-row: span 2; }
.fmt__stepname { font-family: var(--display-face); font-size: 1.3rem; text-transform: uppercase; }
.fmt__stepdetail { color: var(--muted); }
.fmt__note { margin-top: 1.2rem; color: var(--muted); max-width: 56ch; }

.fmt__points { display: grid; gap: 1.6rem; align-content: start; }
.fmt__ladder { display: grid; gap: 0.6rem; }
.fmt__ladderhead { color: var(--accent-2); }
.fmt__pts {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px;
}
@media (min-width: 520px) { .fmt__pts { grid-template-columns: repeat(10, 1fr); } }
.fmt__pts li {
  display: grid; gap: 0.2rem; justify-items: center;
  padding: 0.6rem 0.2rem;
  background: rgba(255, 255, 255, .05);
}
.fmt__ptspos { color: var(--muted); font-size: 0.55rem; }
.fmt__ptsval { font-family: var(--display-face); font-size: 1.15rem; }

.fmt__bonus { display: grid; gap: 1px; margin: 0; }
.fmt__bonus > div { display: grid; gap: 0.2rem; padding: 0.8rem 0; border-bottom: 1px solid rgba(255,255,255,.12); }
.fmt__bonus dt { font-family: var(--display-face); text-transform: uppercase; font-size: 1.05rem; }
.fmt__bonus dd { margin: 0; display: flex; gap: 0.6rem; align-items: baseline; }
.fmt__bonusval { font-family: var(--display-face); font-size: 1.3rem; color: var(--accent-2); }

/* ============================================================
   09 · THE SEASON — the glass calendar
   ============================================================ */
.cal {
  position: relative;
  padding-block: var(--space-section);
  overflow: hidden;
  isolation: isolate;
}
.cal__bg {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: -2;
}
.cal__scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(11,11,18,.82), rgba(11,11,18,.94));
}

.cal__card {
  position: relative;
  padding: clamp(1.4rem, 3vw, 2.6rem);
  border-radius: clamp(1.2rem, 2.4vw, 2rem);
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .17);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  overflow: hidden;
  will-change: transform;
}
.cal__lip {
  position: absolute;
  inset: 0 0 auto 0;
  height: 40%;
  background: var(--glass-lip);
  opacity: .45;
  pointer-events: none;
}

.cal__head {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.6rem;
}
.cal__title {
  font-family: var(--display-face);
  font-size: clamp(1.8rem, 1.2rem + 2.4vw, 3.2rem);
  text-transform: uppercase;
  margin: 0.4rem 0 0;
  line-height: 1;
}
.cal__title em { font-family: var(--font-whisper); font-style: italic; text-transform: none; color: var(--accent); }
.cal__legend { display: inline-flex; align-items: center; gap: 0.4rem; }
.cal__dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.cal__dot--open { background: var(--accent); }

.cal__rounds { position: relative; list-style: none; margin: 0; padding: 0; display: grid; }

.cal__round {
  display: grid;
  grid-template-columns: 2.2rem 1.6rem 1fr auto;
  align-items: center;
  gap: 0.35rem 0.8rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
@media (min-width: 900px) {
  .cal__round {
    grid-template-columns: 2.4rem 1.8rem minmax(6rem, 1fr) minmax(8rem, 1.2fr) 8rem 5.5rem 9rem;
  }
}
.cal__r { color: var(--muted); }
.cal__flag { font-size: 1.15rem; }
.cal__city { font-family: var(--display-face); font-size: 1.2rem; text-transform: uppercase; }
.cal__circuit, .cal__races { color: var(--muted); }
@media (max-width: 899px) { .cal__circuit, .cal__races { display: none; } }
.cal__when { color: var(--ink); }
.cal__state { text-align: right; }

.cal__round.is-raced { opacity: .5; }
.cal__round.is-next { background: rgba(255, 21, 104, .1); }
.cal__round.is-next .cal__city { color: var(--accent-text); }
.cal__round.is-cancelled { opacity: .36; }
.cal__openlbl { color: var(--accent-text); }

.cal__book {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  white-space: nowrap;
}
.cal__book:hover { filter: brightness(1.12); }

.cal__foot { position: relative; margin-top: 1.2rem; max-width: 62ch; }

/* ============================================================
   10 · THE ROOM — arches and the print table
   ============================================================ */
.room { padding-block: var(--space-section); }

.room__head { display: grid; gap: 1.4rem; margin-bottom: clamp(2rem, 4vw, 3.2rem); }
@media (min-width: 960px) { .room__head { grid-template-columns: 1fr 1fr; align-items: end; } }
.room__title { font-size: var(--text-section); }
.room__lede { color: var(--muted); max-width: 48ch; }

.room__arches {
  display: grid;
  gap: clamp(1rem, 2.5vw, 2rem);
  margin-bottom: clamp(2.5rem, 6vw, 5rem);
}
@media (min-width: 760px) { .room__arches { grid-template-columns: 1fr 1fr; align-items: end; } }

.arch { margin: 0; display: grid; gap: 0.7rem; }
.arch img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  /* The mirror crop again, tying the room back to the cover. */
  border-radius: 50% 50% 12px 12px / 30% 30% 12px 12px;
}
.arch--tall img { aspect-ratio: 3 / 4; }
.arch figcaption { color: var(--muted); }

/* ---- the table ---- */
.room__table {
  position: relative;
  /* The prints are absolutely placed, so this box cannot size itself
     from them — the ratio and the scatter in roomtable.js are tuned
     against each other. See the note above LAYOUT there before
     changing either. */
  aspect-ratio: 4 / 3;
  min-height: 24rem;
}

.print {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  z-index: var(--lift, 1);
  margin: 0;
  /* A Polaroid: thin white on three sides, a deep blank foot, a square
     picture. --w is a percentage of the table, so the border scales
     with the print. */
  padding: calc(var(--w) * 0.062) calc(var(--w) * 0.055) calc(var(--w) * 0.25);
  background: linear-gradient(168deg, #fdfcf8, #f1eee6);
  border-radius: 3px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .2), 0 14px 30px -14px rgba(0, 0, 0, .55);
  transform: translate(var(--dx, 0px), var(--dy, 0px)) rotate(var(--rot, 0deg));
  transition: box-shadow var(--d2) var(--ease-out);
  /* Coarse pointers keep vertical scrolling; see roomtable.js. */
  touch-action: pan-y;
  cursor: grab;
}
.print.is-held { cursor: grabbing; box-shadow: 0 30px 60px -18px rgba(0, 0, 0, .7); }
.print__img {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
  /* Instant film is a little flat and a little warm. */
  filter: contrast(.94) saturate(.86) sepia(.12) brightness(1.03);
  outline: 1px solid rgba(0, 0, 0, .1); outline-offset: -1px;
  pointer-events: none;
}

.room__table[data-drag="off"] .print { cursor: default; }
.room__hint { margin-top: 1.4rem; text-align: center; color: var(--muted); }

/* On a phone a scatter is the wrong idea twice over: nine prints at a
   quarter of 343px are thumbnails, and dragging fights the scroll
   that the same finger is doing. Below this it becomes a tilted
   two-column grid — still prints on a table, just laid out instead of
   piled. */
@media (max-width: 760px) {
  .room__table {
    position: static;
    aspect-ratio: auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(0.8rem, 3vw, 1.4rem);
  }
  .print {
    position: static;
    width: auto;
    padding: 5.5% 5% 22%;
    transform: rotate(var(--rot, 0deg));
    cursor: default;
  }
  .room__hint { display: none; }
}

/* ============================================================
   11 · THE CLUB
   ============================================================ */
.club {
  position: relative;
  padding-block: var(--space-section);
  overflow: hidden;
  isolation: isolate;
}
.club__inner { position: relative; display: grid; gap: 1.2rem; justify-items: center; text-align: center; }
.club__title { font-size: var(--text-section); }
.club__lede { color: var(--muted); max-width: 46ch; }
.club__cta { margin-top: 0.6rem; }
.club__small { margin-top: -0.3rem; }

/* ---- the card ---- */
.club__card {
  display: grid;
  gap: clamp(1.4rem, 3vw, 2.4rem);
  align-items: center;
  width: 100%;
  max-width: 62rem;
  margin-block: clamp(1.5rem, 4vw, 3rem);
}
@media (min-width: 860px) { .club__card { grid-template-columns: 1.3fr 0.7fr; text-align: left; } }

.card__stage {
  transform-style: preserve-3d;
  will-change: transform;
  border-radius: clamp(0.8rem, 2vw, 1.5rem);
  /* The drop shadow is on the stage, not the canvas, so it tilts with
     the card instead of staying flat behind it. */
  filter: drop-shadow(0 28px 50px rgba(0, 0, 0, .6));
}
.card__canvas { width: 100%; height: auto; display: block; border-radius: inherit; }

.card__form { display: grid; gap: 0.9rem; justify-items: start; }
@media (max-width: 859px) { .card__form { justify-items: center; text-align: center; } }

.card__label { display: grid; gap: 0.5rem; width: 100%; }
.card__input {
  width: 100%;
  padding: 0.85rem 1.1rem;
  border-radius: 0.8rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.05rem;
}
.card__input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card__save {
  appearance: none;
  padding: 0.8rem 1.6rem;
  border-radius: 999px;
  border: 1px solid var(--line-light);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--d2) var(--ease-out), color var(--d2) var(--ease-out);
}
.card__save:hover { background: var(--ink); color: var(--ground); }
.card__small { max-width: 38ch; }

/* ============================================================
   RE-DRESSING styles/girl.css
   ============================================================ */

/* Driver cards gain a number, her car and her backer. */
.acard { position: relative; }
/* Her number, huge, behind her. Outline pink at rest, filled on hover. */
.acard__no {
  position: absolute;
  top: 0.35rem; left: 0.7rem;
  z-index: 0;
  font-family: var(--display-face);
  font-size: clamp(3rem, 6vw, 5.4rem);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--accent);
  opacity: .9;
  transition: color var(--d2) var(--ease-out);
  pointer-events: none;
}
.acard:hover .acard__no,
.acard:focus-visible .acard__no { color: var(--accent); }

.acard__car {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 0.55rem;
  opacity: .72;
  transition: opacity var(--d2) var(--ease-out), transform var(--d3) var(--ease-out);
}
.acard:hover .acard__car,
.acard:focus-visible .acard__car { opacity: 1; transform: translateX(3%); }

.acard__backer { display: block; color: var(--blue-text); margin-top: 0.15rem; }

.acard--wild .acard__no { color: var(--accent-text); }
.acard__wild { display: block; color: var(--accent-text); margin-top: 0.2rem; }

@media (prefers-reduced-motion: reduce) {
  .acard__car { transition: none; }
}


/* girl.css still styles .cta--girl; the cover and the club use
   .rainbow instead, and the old hero block is no longer in the page. */
