/* site.css: shared on every page. Nav, footer, buttons, link tiles, the receipt, section scaffolding and the day's grounds.
   Colours and faces come from tokens.css only. Motion: opacity and transform only. */

/* ---------- The day: phase grounds ----------
   Every section that belongs to the day carries data-phase="evening|preopen|session|close|tomorrow".
   Base (scripting off, reduced motion): each phase paints its own band, and the bands chain seamlessly,
   so scrolling the page still walks from navy to royal blue and back.
   Enhanced (html.has-sky, motion allowed): the bands go clear and a fixed sky behind the page crossfades
   to the phase crossing the middle of the screen (src/scripts/day.js).
   Atmosphere, both forms: the brand's own ground (profile_trade_desk.png), faint angular shapes and soft
   vertical bars, lit per phase: low and quiet in the evening, rising before the open, tallest and brightest
   in the session, settling at the close, quiet again for tomorrow. Tokens only; no glow, no blur. */
.phase { position: relative; isolation: isolate; }
.phase[data-phase="evening"] { background: linear-gradient(180deg, var(--ground-evening) 0%, var(--ground-evening-2) 100%); }
.phase[data-phase="preopen"] { background: linear-gradient(180deg, var(--ground-evening-2) 0%, var(--ground-preopen) 100%); }
.phase[data-phase="session"] { background: linear-gradient(180deg, var(--ground-preopen) 0%, var(--ground-session) 100%); }
.phase[data-phase="close"] { background: linear-gradient(180deg, var(--ground-session) 0%, var(--ground-close) 100%); }
.phase[data-phase="tomorrow"] { background: linear-gradient(180deg, var(--ground-close) 0%, var(--ground-evening) 100%); }

/* A second band of the same phase holds that phase's end colour, so the chain never jumps back. */
/* :where() keeps these at the base rules' weight, so the enhanced form's ".has-sky .phase" still clears them */
.phase[data-phase="evening"]:where([data-phase="evening"] + *) { background: var(--ground-evening-2); }
.phase[data-phase="close"]:where([data-phase="close"] + *) { background: var(--ground-close); }
.phase[data-phase="tomorrow"]:where([data-phase="tomorrow"] + *) { background: var(--ground-evening); }

/* Base form: still bars (::before) and one angular shape (::after) painted by each band itself. */
.phase::before, .phase::after { content: ""; position: absolute; z-index: -1; pointer-events: none; }
.phase::before {
  inset: 0; opacity: 0.06;
  background:
    linear-gradient(0deg, transparent, var(--color-ink-2) 50%, transparent) 3% 50% / 3.5% 70% no-repeat,
    linear-gradient(0deg, transparent, var(--color-ink-2) 50%, transparent) 9% 40% / 3.5% 46% no-repeat,
    linear-gradient(0deg, transparent, var(--color-ink-2) 50%, transparent) 91% 60% / 3.5% 56% no-repeat,
    linear-gradient(0deg, transparent, var(--color-ink-2) 50%, transparent) 97% 45% / 3.5% 76% no-repeat;
}
.phase::after { top: 0; left: 0; width: max(30%, 16rem); aspect-ratio: 8 / 7; background: var(--ground-session); opacity: 0.18; clip-path: polygon(50% 0, 100% 100%, 0 100%); transform: translate(-30%, 10%); }
.phase[data-phase="preopen"]::before, .phase[data-phase="close"]::before { opacity: 0.09; }
.phase[data-phase="session"]::before { opacity: 0.12; }
.phase[data-phase="session"]::after { background: var(--color-ink-2); opacity: 0.05; }
.phase[data-phase="preopen"]::after, .phase[data-phase="close"]::after { left: auto; right: 0; transform: translate(30%, 6%) scaleX(-1); }
/* one shape per phase: only the first band of a run of the same phase draws it */
.phase[data-phase="evening"] + .phase[data-phase="evening"]::after,
.phase[data-phase="close"] + .phase[data-phase="close"]::after,
.phase[data-phase="tomorrow"] + .phase[data-phase="tomorrow"]::after { display: none; }

/* Enhanced form: a fixed sky of five cumulative layers; only opacity and transform move. */
.sky { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .has-sky .sky { display: block; position: fixed; inset: 0; z-index: -1; overflow: clip; pointer-events: none; }
  .has-sky .phase { background: none; }
  .has-sky .phase::before, .has-sky .phase::after { display: none; }
  .sky__layer { position: absolute; inset: 0; opacity: 0; transition: opacity var(--dur-sky) var(--ease-in-out); }
  .sky__layer.is-on { opacity: 1; }
  .sky__layer--evening { opacity: 1; background: linear-gradient(180deg, var(--ground-evening) 0%, var(--ground-evening-2) 100%); }
  .sky__layer--preopen { background: linear-gradient(180deg, var(--ground-evening-2) 0%, var(--ground-preopen) 100%); }
  .sky__layer--session { background: linear-gradient(180deg, var(--ground-preopen) 0%, var(--ground-session) 100%); }
  .sky__layer--close { background: linear-gradient(180deg, var(--ground-session) 0%, var(--ground-close) 100%); }
  .sky__layer--tomorrow { background: linear-gradient(180deg, var(--ground-close) 0%, var(--ground-evening) 100%); }

  /* the art box is taller than the screen so its slow drift never shows an edge */
  .sky__art { position: absolute; inset: -12% 0; }
  .sky__tri { position: absolute; display: block; background: var(--ground-session); opacity: 0.2; }
  .sky__tri--a { left: -8%; top: 14%; width: max(34%, 15rem); aspect-ratio: 8 / 7; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
  .sky__tri--b { right: -6%; top: 6%; width: max(44%, 18rem); aspect-ratio: 5 / 4; clip-path: polygon(96% 0, 100% 82%, 0 50%); }
  .sky__layer--preopen .sky__tri { opacity: 0.3; }
  .sky__layer--session .sky__tri { background: var(--color-ink-2); opacity: 0.06; }
  .sky__layer--close .sky__tri { opacity: 0.34; }
  .sky__layer--tomorrow .sky__tri { opacity: 0.16; }
  .sky__bar {
    position: absolute; bottom: 0; left: var(--x); width: 4.2%; height: var(--h); display: block;
    border-radius: var(--radius-inner) var(--radius-inner) 0 0;
    background: linear-gradient(0deg, var(--color-ink-2), transparent);
    opacity: 0.06; transform-origin: 50% 100%; transform: skewX(-8deg) scaleY(0.82);
    transition: transform var(--dur-sky) var(--ease-out);
  }
  .sky__layer.is-on .sky__bar { transform: skewX(-8deg) scaleY(1); }
  .sky__layer--preopen .sky__bar, .sky__layer--close .sky__bar { opacity: 0.09; }
  .sky__layer--session .sky__bar { opacity: 0.13; }
}
/* the one scroll-linked pattern of the page: the sky's art drifts up slowly as the day goes by */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .has-sky .sky__art { animation: sky-drift linear both; animation-timeline: scroll(root); }
    @keyframes sky-drift { to { transform: translateY(-8%); } }
  }
}

/* ---------- Section scaffolding ---------- */
.section { padding-block: var(--section-gap); }
.section:empty { display: none; }
.section__head { display: grid; gap: var(--space-md); margin-bottom: var(--space-2xl); }
.section__title { font-size: var(--text-section); max-width: 22ch; }
.section__intro { font-size: var(--text-lead); color: var(--color-ink-2); max-width: 46ch; }

/* ---------- Wordmark (the logo) ---------- */
.wordmark { display: inline-flex; align-items: center; gap: var(--space-sm); color: var(--color-ink); text-decoration: none; flex-shrink: 0; }
.wordmark__crown { width: 34px; height: auto; flex-shrink: 0; }
.wordmark__text { display: flex; flex-direction: column; gap: var(--space-2xs); }
.wordmark__name { font-family: var(--font-outlier); font-weight: 900; font-size: var(--text-wordmark); line-height: 0.98; letter-spacing: -0.025em; color: var(--color-ink); white-space: nowrap; }
.wordmark__sub { font-family: var(--font-outlier); font-weight: 900; font-size: 0.75rem; line-height: 1.1; letter-spacing: 0.22em; text-transform: uppercase; color: var(--color-gold); white-space: nowrap; }
.wordmark--stack { gap: var(--space-md); }
.wordmark--stack .wordmark__crown { width: 48px; }
.wordmark--stack .wordmark__name { font-size: 1.625rem; }
a.wordmark:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 4px; border-radius: var(--radius-inner); }

/* ---------- Buttons: one primary recipe, one secondary ---------- */
.btn {
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--control-height); padding: 0 var(--space-lg);
  border: 1px solid transparent; border-radius: var(--radius-control); background: none;
  font-family: var(--font-body); font-size: var(--text-md); font-weight: 600; line-height: 1.2;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform var(--dur-micro) var(--ease-out);
}
.btn::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; opacity: 0; transition: opacity var(--dur-short) var(--ease-out); }
/* the primary is a key: a gold-dark edge under its face; pressed, the face sinks onto the edge */
.btn--primary { background: var(--color-accent); color: var(--color-accent-ink); box-shadow: inset 0 -2px 0 var(--color-gold-dark); }
.btn--primary::before { background: var(--color-gold-pale); }
.btn--primary:active { box-shadow: inset 0 -1px 0 var(--color-gold-dark); }
.btn--secondary { color: var(--color-gold); border-color: var(--color-gold-deep); }
.btn--secondary::before { background: var(--color-hover-wash); }
.btn:hover::before { opacity: 1; }
.btn:active { transform: translateY(1px) scale(0.985); transition-duration: 60ms; }
.btn:active::before { opacity: 1; }
.btn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; background: var(--color-paper-3); color: var(--color-ink-2); border-color: var(--color-rule); }
.btn[disabled]::before, .btn[aria-disabled="true"]::before { display: none; }
.btn__label { white-space: nowrap; }
.btn--s { min-height: var(--control-height-s); padding: 0 var(--space-md); font-size: var(--text-sm); }

/* ---------- Link tiles (the phone hub, the free doors) ---------- */
.tile {
  position: relative; isolation: isolate;
  display: flex; align-items: center; gap: var(--space-md);
  min-height: var(--tile-height); padding: var(--space-sm) var(--space-lg) var(--space-sm) var(--space-md);
  border: 1px solid var(--color-rule); border-radius: var(--radius-control);
  background: var(--color-paper-2); color: var(--color-ink); text-decoration: none;
  transition: transform var(--dur-micro) var(--ease-out);
}
.tile::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--color-hover-wash); opacity: 0; transition: opacity var(--dur-short) var(--ease-out); }
.tile:hover::before { opacity: 1; }
.tile:active { transform: translateY(1px) scale(0.99); transition-duration: 60ms; }
.tile:active::before { opacity: 1; }
.tile:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }
.tile__glyph { width: 24px; height: 24px; flex-shrink: 0; color: var(--color-gold); transition: transform var(--dur-short) var(--ease-out); }
.tile:hover .tile__glyph { transform: scale(1.1); }
.tile:active .tile__glyph { transform: scale(0.96); }
.tile__glyph.glyph--crown { width: 26px; height: auto; }
.tile__text { display: grid; gap: var(--space-3xs); min-width: 0; }
.tile__label { font-size: var(--text-lg); font-weight: 600; line-height: 1.2; }
.tile__detail { font-size: var(--text-sm); line-height: 1.35; color: var(--color-ink-2); }

/* ---------- Nav ---------- */
.nav { position: relative; z-index: var(--z-dropdown); }
.nav__bar { display: flex; align-items: center; gap: var(--space-xl); min-height: var(--nav-height); }
.nav__links { display: flex; align-items: center; gap: var(--space-lg); margin-left: auto; list-style: none; }
.nav__link { display: inline-flex; align-items: center; min-height: var(--control-height-s); font-size: var(--text-sm); color: var(--color-ink-2); text-decoration: none; white-space: nowrap; }
.nav__link:hover { color: var(--color-ink); }
.nav__link[aria-current="page"] { color: var(--color-gold); }
.nav__link:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: var(--radius-inner); }
.nav__menu { display: none; position: relative; margin-left: auto; }
.nav__menu-button { display: inline-flex; align-items: center; min-height: var(--control-height-s); padding: 0 var(--space-md); border: 1px solid var(--color-rule-strong); border-radius: var(--radius-control); font-size: var(--text-sm); font-weight: 600; color: var(--color-ink); cursor: pointer; list-style: none; }
.nav__menu-button::-webkit-details-marker { display: none; }
.nav__menu-button:hover { border-color: var(--color-gold-deep); }
.nav__menu-button:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.nav__menu-list { position: absolute; right: 0; top: calc(100% + var(--space-xs)); z-index: var(--z-dropdown); display: grid; gap: var(--space-2xs); min-width: 15rem; padding: var(--space-sm); list-style: none; border: 1px solid var(--color-rule); border-radius: var(--radius-control); background: var(--color-paper-2); box-shadow: var(--shadow-card); }
.nav__menu-list .nav__link { width: 100%; padding-inline: var(--space-sm); font-size: var(--text-md); color: var(--color-ink); }
@media (max-width: 60rem) {
  .nav__links { display: none; }
  .nav__menu { display: block; }
  .nav__trial { margin-left: auto; }
  .nav__menu { margin-left: 0; }
}
@media (max-width: 40rem) {
  .nav__trial { display: none; }
  .nav__menu { margin-left: auto; }
  .nav--hub { display: none; }
}

/* ---------- Footer: a mast ---------- */
.footer { padding-block: var(--space-3xl) var(--space-2xl); background: var(--ground-evening); color: var(--color-ink); }
.footer__rule { display: flex; align-items: center; gap: var(--space-lg); }
.footer__line { flex: 1; height: 2px; border-radius: 2px; }
.footer__line--l { background: linear-gradient(90deg, var(--ground-evening), var(--color-gold)); }
.footer__line--r { background: linear-gradient(90deg, var(--color-gold), var(--ground-evening)); }
.footer__crown { width: 52px; height: auto; flex-shrink: 0; }
.footer__body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap-columns); margin-top: var(--space-2xl); }
.footer__brand { display: grid; gap: var(--space-md); align-content: start; }
.footer__slogan { font-family: var(--font-display); font-size: var(--text-xl); color: var(--color-ink); }
.footer__head { font-family: var(--font-body); font-size: var(--text-sm); font-weight: 600; letter-spacing: 0; color: var(--color-ink-2); margin-bottom: var(--space-sm); }
.footer__nav ul { display: grid; gap: var(--space-2xs); list-style: none; }
.footer__nav a { display: inline-flex; align-items: center; min-height: var(--control-height-s); color: var(--color-ink); text-decoration: none; }
.footer__nav a:hover { text-decoration: underline; text-decoration-color: var(--color-gold); }
.footer__nav a:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: var(--radius-inner); }
.footer__disclaimer { margin-top: var(--space-2xl); padding-top: var(--space-lg); border-top: 1px solid var(--color-rule); font-size: var(--text-sm); color: var(--color-ink-2); }
/* 60 to 75rem: give the Membership list room so "Every recap posted since 5 Nov 2026" stays on one line. */
@media (min-width: 60.0625rem) and (max-width: 75rem) { .footer__body { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr) minmax(0, 1fr); } }
@media (max-width: 60rem) { .footer__body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .footer__brand { grid-column: 1 / -1; } }
@media (max-width: 40rem) { .footer__body { grid-template-columns: minmax(0, 1fr); } }

/* ---------- The receipt: a pale slip printed in navy ink ---------- */
.receipt {
  display: grid; gap: var(--space-md); align-content: start;
  padding: var(--space-lg); border-radius: var(--radius-card);
  background: var(--color-slip); color: var(--color-slip-ink); box-shadow: var(--shadow-card);
  scroll-margin-top: var(--space-xl);
}
.receipt :focus-visible { outline-color: var(--color-slip-focus); }
.receipt__head { display: grid; gap: var(--space-2xs); }
.receipt__title { display: grid; gap: var(--space-2xs); max-width: none; }
.receipt__ticker { font-family: var(--font-display); font-size: var(--text-2xl); line-height: 1; letter-spacing: 0; }
.receipt__date { font-family: var(--font-body); font-size: var(--text-sm); color: var(--color-slip-ink-2); letter-spacing: 0; }
.receipt__call { font-size: var(--text-sm); color: var(--color-slip-ink-2); }
.receipt__outcome { margin-top: var(--space-xs); font-family: var(--font-display); font-size: var(--text-title); line-height: 1.15; color: var(--color-slip-ink); }
.receipt__scenario { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: var(--space-sm) var(--space-md); padding-top: var(--space-md); border-top: 1px solid var(--color-slip-rule); }
.receipt__scenario dt { font-size: var(--text-xs); color: var(--color-slip-ink-2); }
.receipt__scenario dd { font-size: var(--text-md); font-weight: 600; }
.receipt__caption { display: grid; gap: var(--space-sm); font-size: var(--text-sm); line-height: 1.55; color: var(--color-slip-ink); }
.receipt__caption p { max-width: var(--measure); }
.receipt__chart img { width: 100%; height: auto; border-radius: var(--radius-inner); background: var(--color-slip-2); }
.receipt__link { display: flex; flex-wrap: wrap; gap: 0 var(--space-lg); }
.receipt__link a { display: inline-flex; align-items: center; min-height: var(--control-height-s); font-weight: 600; color: var(--color-slip-ink); text-decoration-color: var(--color-slip-ink-2); }
.receipt__link a:hover { text-decoration-color: var(--color-slip-ink); }
.receipt__link a:focus-visible { outline: 2px solid var(--color-slip-focus); outline-offset: 2px; border-radius: var(--radius-inner); }

/* strip: a narrow slip for a sideways row on the home page; the chart leads */
.receipt--strip { grid-template-areas: "head" "chart" "scenario" "caption" "link"; }
.receipt--strip .receipt__head { grid-area: head; }
.receipt--strip .receipt__chart { grid-area: chart; }
.receipt--strip .receipt__scenario { grid-area: scenario; }
.receipt--strip .receipt__caption { grid-area: caption; }
.receipt--strip .receipt__link { grid-area: link; }
.receipt--strip .receipt__chart img { aspect-ratio: 16 / 9; object-fit: cover; object-position: right center; }

/* wall: the full slip on /results; the chart sits beside the words from 64rem */
.receipt--wall { padding: var(--space-xl); }
@media (min-width: 64rem) {
  .receipt--wall { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-areas: "head chart" "scenario chart" "caption chart" "link chart"; column-gap: var(--space-xl); }
  .receipt--wall .receipt__head { grid-area: head; }
  .receipt--wall .receipt__scenario { grid-area: scenario; }
  .receipt--wall .receipt__caption { grid-area: caption; }
  .receipt--wall .receipt__link { grid-area: link; }
  .receipt--wall .receipt__chart { grid-area: chart; align-self: start; }
  .receipt--wall:not(:has(.receipt__chart)) { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "scenario" "caption" "link"; }
}
@media (max-width: 40rem) { .receipt, .receipt--wall { padding: var(--space-md); } }
