/* ───────────────────────────────────────────────────────────────────────────
 * plans.css — the comparison page, and only the comparison page.
 *
 * Loaded by the per-route loader in `partials/head.php` purely because this
 * file is named after the route key `plans` in `config/routes.php`. Nothing
 * else includes it, and nothing here may be depended on by another page.
 *
 * Everything is a real class. Not one rule in this file relies on a Tailwind
 * utility existing, because `tools/build-css.php` emits only the utilities it
 * already finds in the tree: an unused utility compiles to nothing at all, with
 * no error and no warning, and the markup goes on reading correctly while it
 * renders wrong. So layout, sizing and the type scale live here.
 *
 * No new colours. Every value below is a token from `ros.css`.
 * ─────────────────────────────────────────────────────────────────────────── */

/* ── 1 · Stage ──────────────────────────────────────────────────────────────
 *
 * One champagne wash behind the hero and nothing else. A pricing page is read,
 * not admired, and a second light source would start competing with the prices
 * for the eye — which on this page is the one thing that must win.
 */
.pl-stage {
  position: relative;
  isolation: isolate;
}

.pl-stage::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 46rem;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(60% 46% at 50% 0%, rgba(234, 214, 168, .07), transparent 68%),
    radial-gradient(90% 60% at 50% 0%, var(--ink-850), transparent 72%);
}

/*
 * `width: 100%` is load-bearing. `layouts/blank.php` wraps the page in
 * `.stage`, which carries `flex flex-col`, so a wrapper at the top level of
 * the page is a FLEX ITEM in a column container -- and auto margins on the
 * cross axis cancel the default stretch, leaving the item sized by its own
 * content. Measured on the About page before this line existed: a 1180px
 * wrapper rendered at 870px and 722px. No error, nothing in the console, just
 * two blocks narrower than the rest of the page.
 */
.pl-wrap {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/*
 * `width: 100%` is load-bearing. `layouts/blank.php` wraps the page in
 * `.stage`, which carries `flex flex-col`, so a wrapper at the top level of
 * the page is a FLEX ITEM in a column container -- and auto margins on the
 * cross axis cancel the default stretch, leaving the item sized by its own
 * content. Measured on the About page before this line existed: a 1180px
 * wrapper rendered at 870px and 722px. No error, nothing in the console, just
 * two blocks narrower than the rest of the page.
 */
.pl-wrap-narrow {
  width: 100%;
  max-width: 62rem;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* ── 2 · Hero ───────────────────────────────────────────────────────────── */

.pl-hero {
  padding-top: 9.5rem;
  padding-bottom: clamp(3rem, 6vw, 5rem);
}

.pl-h1 {
  font-size: clamp(2.7rem, 6.4vw, 4.6rem);
  margin: 1.4rem 0 1.6rem;
  max-width: 24ch;
}

/* The house emphasis: one word, italic, champagne. The serif carries a real
   italic, so this is a cut and not a slant. */
.pl-h1 em {
  font-style: italic;
  color: var(--gold-300);
}

.pl-hero-lede {
  color: var(--warm-500);
  max-width: 46ch;
}

/* ── 3 · The tiers ──────────────────────────────────────────────────────────
 *
 * Short cards, deliberately. The matrix below is what this page is for; these
 * exist so a visitor who already knows their size can read a price and leave,
 * and so the matrix's columns have names and figures attached to them before
 * the ticks start.
 *
 * `auto-fit` with a floor rather than a fixed column count: the price list has
 * three rows today and `PlanService::published()` decides how many it has
 * tomorrow, so a hardcoded `repeat(3, …)` would break on the day somebody adds
 * a tier in the console — which is exactly the day nobody is looking at CSS.
 */
.pl-tiers {
  margin-top: clamp(2.5rem, 5vw, 3.6rem);
  display: grid;
  gap: 1.15rem;
  grid-template-columns: repeat(auto-fit, minmax(16.5rem, 1fr));
  align-items: stretch;
}

.pl-tier {
  display: flex;
  flex-direction: column;
  padding: 1.9rem 1.7rem 1.7rem;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, var(--ink-800), var(--ink-850) 72%);
  transition:
    border-color var(--t-base) var(--ease-out),
    box-shadow   var(--t-base) var(--ease-out),
    transform    var(--t-base) var(--ease-out);
}

.pl-tier:hover,
.pl-tier:focus-within {
  border-color: var(--line-gold);
  box-shadow: var(--sh-2);
  transform: translateY(-3px);
}

/* A hairline of champagne along the top edge, drawn in the border token and
   fading at both ends so it reads as light on the card rather than a rule. */
.pl-tier-edge {
  height: 1px;
  margin: -1.9rem -1.7rem 1.7rem;
  background: linear-gradient(90deg, transparent, var(--line-gold) 22%, var(--line-gold) 78%, transparent);
}

.pl-tier-name {
  font-size: 1.95rem;
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--warm-100);
  margin-bottom: .55rem;
}

.pl-tier-desc {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--warm-500);
  min-height: 3.2em;      /* keeps the prices on one line across the row */
  margin-bottom: 1.5rem;
}

/* ── the figure ──
 *
 * Large because it is the question. `clamp()` rather than a fixed size: the
 * annual figure is five digits plus a symbol today and `money()` will happily
 * hand this six, and the card is 264px at its narrowest.
 */
.pl-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .3rem;
  margin-bottom: .35rem;
}

.pl-price-fig {
  font-size: clamp(2.1rem, 4.4vw, 2.75rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--gold-300);
}

.pl-price-per {
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--warm-700);
}

.pl-price-alt {
  font-size: 11.5px;
  color: var(--warm-700);
  margin-bottom: 1.6rem;
}

/* ── the ticks ──
 *
 * A mark and a dash, and nothing in between. The page's own `$cell` rule: a
 * tick that might mean "included" or might mean "available at extra cost" is
 * the thing this page exists to stop.
 */
.pl-facts {
  display: flex;
  flex-direction: column;
  gap: .62rem;
  margin: 0 0 1.75rem;
  padding: 0;
  list-style: none;
  flex: 1 1 auto;
}

.pl-fact {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--warm-300);
}

.pl-fact-off {
  color: var(--warm-700);
}

/* An svg with no sizing fills its box, so the mark is sized here and not left
   to the icon helper's default. */
.pl-tick {
  flex: none;
  margin-top: .14rem;
  color: var(--gold-300);
}

.pl-tick svg {
  width: 13px;
  height: 13px;
  display: block;
}

/* The dash sits in the tick's footprint so the labels line up down the card. */
.pl-dash {
  flex: none;
  width: 13px;
  margin-top: -.02rem;
  text-align: center;
  color: var(--warm-700);
}

.pl-tier-cta {
  width: 100%;
  margin-top: auto;
}

.pl-tiers-foot {
  margin-top: 1.6rem;
  font-size: 11.5px;
  color: var(--warm-700);
}

.pl-tiers-foot a {
  color: var(--gold-300);
  text-decoration: none;
  border-bottom: 1px solid var(--line-gold);
  transition: color var(--t-fast) var(--ease-out);
}

.pl-tiers-foot a:hover {
  color: var(--warm-100);
}

/* ── 4 · The matrix ─────────────────────────────────────────────────────── */

/* The in-page link from the tiers lands here, and the nav is fixed — without
   this the heading arrives under it. */
#matrix {
  scroll-margin-top: 6.5rem;
}

.pl-matrix-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.pl-h2 {
  font-size: clamp(1.9rem, 3.4vw, 2.7rem);
  line-height: 1.05;
}

.pl-h2 em {
  font-style: italic;
  color: var(--gold-300);
}

.pl-matrix {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--ink-850);
  /* Below the breakpoint where the columns fit, the table scrolls inside this
     box rather than taking the document sideways with it — a comparison table
     that scrolls the page loses the row labels, which are the only thing that
     makes the ticks mean anything. */
  overflow-x: auto;
  overflow-y: hidden;
}

.pl-table {
  width: 100%;
  min-width: 820px;
  border-collapse: separate;    /* `collapse` drops borders off a sticky th */
  border-spacing: 0;
  font-size: 13px;
}

/* ── head ── */

.pl-table thead th {
  text-align: left;
  padding: 1.5rem 1.25rem 1.3rem;
  vertical-align: bottom;
  background: var(--ink-850);
  box-shadow: inset 0 -1px 0 var(--line-strong);
}

.pl-th-label {
  width: 36%;
}

.pl-th-name {
  font-size: 1.22rem;
  line-height: 1;
  color: var(--warm-100);
  margin-bottom: .45rem;
}

.pl-th-price {
  font-size: 1.05rem;
  line-height: 1;
  color: var(--gold-300);
}

.pl-th-per {
  font-size: 10.5px;
  color: var(--warm-700);
  margin-left: .15rem;
}

.pl-th-alt {
  font-size: 10.5px;
  color: var(--warm-700);
  margin-top: .35rem;
}

/* ── section bands ──
 *
 * These were `bg-[var(--ink-900)]`, and `--ink-900` is `#06060700` — fully
 * transparent, the colour that exists to sit behind a blur. So the four band
 * rows that organise sixty cells had no background at all and the matrix read
 * as one undifferentiated list. `--ink-950` is the token that is actually dark.
 */
.pl-band td {
  padding: .9rem 1.25rem .75rem;
  background: var(--ink-950);
  box-shadow:
    inset 0  1px 0 var(--line),
    inset 0 -1px 0 var(--line);
}

.pl-band .eyebrow {
  color: var(--gold-300);
}

/* ── rows ── */

.pl-row td {
  padding: .95rem 1.25rem;
  box-shadow: inset 0 1px 0 var(--line);
  transition: background var(--t-fast) var(--ease-out);
}

.pl-row:hover td {
  background: rgba(247, 243, 234, .022);
}

.pl-row-label {
  color: var(--warm-300);
  line-height: 1.45;
}

/* ── cells ── */

.pl-yes {
  display: inline-flex;
  align-items: center;
  color: var(--gold-300);
}

.pl-yes svg {
  width: 15px;
  height: 15px;
  display: block;
}

.pl-no {
  color: var(--warm-700);
}

.pl-n {
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: var(--warm-300);
  line-height: 1.4;
}

/* ── desktop: pin the head ──
 *
 * Only once the columns fit without scrolling. `overflow-x: auto` on the
 * wrapper makes it the scroll container, and a `position: sticky` head inside
 * a scroll container sticks to that box rather than to the window — so the
 * wrapper gives up its overflow at the same breakpoint the head takes up
 * sticking, and never both at once.
 *
 * `top` clears the fixed nav shell: a 64px bar with a 12px top margin.
 */
@media (min-width: 900px) {
  .pl-matrix {
    overflow: visible;
  }

  .pl-table thead th {
    position: sticky;
    top: 4.6rem;
    z-index: 2;
  }

  /* The rounded corners of the wrapper are cut by the head's own background
     once the head is a separate painted layer, so it carries them itself. */
  .pl-table thead th:first-child {
    border-top-left-radius: var(--r-lg);
  }

  .pl-table thead th:last-child {
    border-top-right-radius: var(--r-lg);
  }
}

/* ── mobile: the stacked card ──
 *
 * `.table-stack` in `ros.css` already turns every row into a block and copies
 * each column's heading onto its cells (`stackTables()` in `ros.js`), so the
 * mechanism is inherited rather than rebuilt — including the no-script case,
 * where the table simply stays wide and scrollable.
 *
 * What is tuned here is only how it reads: the stacked head is hidden, which
 * takes the prices with it, and the tier cards above carry them instead.
 */
@media (max-width: 767px) {
  .pl-matrix {
    border-radius: var(--r-md);
  }

  /* `.table-stack tbody tr` is a card; this gives it air and a visible seam. */
  .pl-table tbody tr {
    padding: .95rem 1.15rem;
  }

  /* The row's own name, promoted: on a phone it is the heading of the little
     card the row became, not one field of it beside the others. */
  .pl-table tbody td.pl-row-label {
    display: block;
    font-size: 13px;
    color: var(--warm-100);
    padding: 0 0 .55rem;
    box-shadow: none;
  }

  .pl-table tbody td.pl-row-label::before {
    content: none;
  }

  /* Each plan's answer on its own line, labelled with the plan name that
     `stackTables()` copied off the column head. */
  .pl-table tbody td {
    padding: .26rem 0;
    box-shadow: none;
  }

  .pl-table tbody td::before {
    color: var(--warm-500);
    letter-spacing: .13em;
  }

  /* A band is a heading, so it keeps the left edge the labels have rather than
     centring the way a stacked `colspan` cell otherwise does. */
  .pl-table tbody tr.pl-band {
    padding: 1.15rem 1.15rem .5rem;
  }

  .pl-table tbody tr.pl-band td {
    padding: 0;
    text-align: left;
    background: transparent;
    box-shadow: none;
  }

  .pl-n {
    text-align: right;
  }
}

/* ── 4b · The header, on a phone ─────────────────────────────────────────────
 *
 * The header row is `gap-6 px-4` inside a `px-5` shell and does not wrap: at
 * 390px that is 439px of content in 338px of room, so the wordmark, the theme
 * toggle and three buttons overlapped each other and spilled past the shell.
 * Measured, not guessed — `scrollWidth` 439 against `clientWidth` 338.
 *
 * Tightened rather than thinned out. The comment on that markup is explicit
 * that every link stays at every width — this page's only other navigation is
 * the wordmark, so dropping one leaves a phone visitor on the pricing page with
 * no labelled way back — and that "the buttons are the thing to shorten if
 * something has to give". This is that shortening.
 *
 * Scoped to this stylesheet, so it reaches only the `plans` route. The same
 * header is drawn from `_identity.php` on the legal pages and from `home.php`
 * on the home page, and neither is mine to move.
 */
@media (max-width: 479px) {
  [data-nav-shell] {
    padding-inline: .25rem;
  }

  [data-nav-shell] > div {
    gap: .35rem;
    padding-inline: .15rem;
  }

  /* The three buttons and the theme toggle, closed up. They are one group and
     read as one, so the air between them is the cheapest 20px on the row. */
  [data-nav-shell] .ml-auto {
    gap: .15rem;
  }

  [data-nav-shell] .btn-sm {
    padding-inline: .6rem;
    font-size: .72rem;
  }
}

/* ── 5 · The add-on note ────────────────────────────────────────────────── */

.pl-note {
  margin-top: 1.4rem;
  padding: 1.7rem;
  border: 1px solid var(--line);
  border-left: 1px solid var(--line-gold);
  border-radius: var(--r-md);
  background: var(--ink-850);
}

.pl-note-body {
  font-size: 13px;
  line-height: 1.75;
  color: var(--warm-500);
  max-width: 68ch;
  margin-top: .7rem;
}

/* ── 6 · The close ──────────────────────────────────────────────────────── */

.pl-close {
  margin-top: clamp(3.5rem, 7vw, 5.5rem);
  padding: clamp(2rem, 4vw, 3rem);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, var(--ink-800), var(--ink-850) 72%);
  box-shadow: var(--sh-2);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.75rem;
}

.pl-close-body {
  flex: 1 1 28rem;
}

.pl-close-lead {
  font-size: 14px;
  line-height: 1.7;
  color: var(--warm-300);
  max-width: 54ch;
}

.pl-fine {
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--warm-700);
  max-width: 62ch;
  margin-top: .9rem;
}

.pl-close-cta {
  flex: 0 0 auto;
}

@media (max-width: 599px) {
  .pl-close-cta,
  .pl-close-cta .btn {
    width: 100%;
  }
}

/* The page's last section sits above the shared footer, so it needs the
   bottom air the footer does not give it. */
.pl-tail {
  padding-bottom: clamp(4.5rem, 8vw, 7rem);
}
