/* Page CSS: only what sits inside a visual. */

/* hero: the lit sky ground with one soft light */
.hero__art { background:
    radial-gradient(70% 60% at 18% 12%, color-mix(in oklab, var(--ground-surface) 80%, white), transparent 70%),
    radial-gradient(60% 50% at 90% 100%, color-mix(in oklab, var(--ground-bg) 80%, var(--ground-accent)), transparent 70%),
    var(--ground-bg); }
.hero__art > .ly-piece--note { left: var(--s-6); bottom: var(--s-6); width: 300px; z-index: 2; }
.hero__proof { font-size: var(--t-small); color: var(--ink); }
.ly-piece--main .d-row { grid-template-columns: minmax(0, 1fr) 72px 84px; padding-block: 11px; }
/* the window sits whole inside its frame; no sidebar, so each row stays on one line */
.hero__art .d-win__body { grid-template-columns: minmax(0, 1fr); min-height: 0; }
.hero__art .d-side { display: none; }
.hero__art > .ly-piece--main { width: calc(100% - 2 * var(--s-8)); }
@media (max-width: 1279px) { .hero__art > .ly-piece--main { width: calc(100% - 2 * var(--s-6)); } }
@media (max-width: 639px) { .hero__art > .ly-piece--main { width: calc(100% - 2 * var(--s-4)); } }
.d-note__line { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 13px; color: #3d4247; border-top: 1px solid rgb(0 0 0 / .06); }
.d-note__line:first-of-type { border-top: 0; }
.d-note__line i { width: 18px; height: 18px; border-radius: 50%; flex: none; display: grid; place-items: center; background: #e6e8fb; color: #1f2de6; font-style: normal; font-size: 13px; font-weight: 500; }
.d-note__line b { font-weight: 500; color: #16181a; }
@media (max-width: 1023px) { .hero__art > .ly-piece--note { left: var(--s-4); bottom: var(--s-4); width: 270px; } }
@media (max-width: 639px) { .ly-piece--main .d-row { grid-template-columns: minmax(0, 1fr) auto 84px; } .ly-piece--main .d-row .num { display: block; } }

/* app-frame (sections-library.md recipe) */
.app.ui { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); margin-top: var(--s-7); background: var(--u-bg); border: 1px solid var(--u-border); border-radius: var(--u-r); box-shadow: var(--u-shadow); }
.app > .app__pane { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.app > .app__pane + .app__pane { border-left: 1px solid var(--u-line); }
.app > .app__pane > .ui-panel { width: 100%; border: 0; border-radius: 0; box-shadow: none; }
@media (min-width: 1024px) and (max-width: 1279px) { .app.ui { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); } }
@media (max-width: 1023px) {
  .app.ui { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .app > .app__pane--list { max-height: 252px; }
  .app .ui-win__side { display: none; }
  .app .ui-win__body { grid-template-columns: minmax(0, 1fr); }
  .app > .app__pane + .app__pane { border-left: 0; border-top: 1px solid var(--u-line); }
}
@media (max-width: 639px) {
  .app.ui { grid-template-rows: minmax(0, 1fr); }
  .app > .app__pane--list { display: none; }
  .app > .app__pane + .app__pane { border-top: 0; }
}
.app .ui-avatar { object-fit: contain; padding: 4px; background: #fff; }

/* the open pane: one model's routes */
.cpt-open { padding: 20px 24px; font: 400 14px/1.4 var(--font-text); color: var(--u-ink, #16181a); }
.cpt-open__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 14px; }
.cpt-open__head b { font: 500 18px/1.2 var(--font-text); }
.cpt-open__head span, .cpt-note, .cpt-row small { color: var(--u-muted, #5d6470); font-size: 13px; }
.cpt-row { display: grid; grid-template-columns: minmax(0, 2.4fr) repeat(4, minmax(0, .8fr)) minmax(0, 1fr); align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--u-line, rgb(0 0 0 / .07)); font-variant-numeric: tabular-nums; }
.cpt-row > span:not(.cpt-who) { text-align: right; }
.cpt-row--head > span:first-child { text-align: left; }
.cpt-row--head { font-size: 13px; color: var(--u-muted, #5d6470); padding-block: 8px; }
.cpt-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cpt-who > span { display: grid; min-width: 0; }
.cpt-who b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cpt-bill { font-weight: 500; }
.cpt-note { margin: 14px 0 0; }
@media (max-width: 1279px) { .cpt-open:not(.cpt-sources) .cpt-row { grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, .8fr)) minmax(0, 1fr); } .cpt-open:not(.cpt-sources) .cpt-row > :nth-child(5) { display: none; } }

/* the provider hub across the wrap */
/* the hub fills the rest of the screen under the heading */
.cpt-hub { margin-top: var(--s-7); height: max(440px, calc(100svh - 360px)); }
@media (max-width: 639px) { .cpt-hub { height: 380px; } }

/* alerts: the split frame keeps its 5:4 (frame--lit would set 2:1) */
#alerts-frame { --ratio: 70%; }
/* the notification stack, whole and centred in its frame */
.cpt-center > .at-rise { top: 50%; transform: translateY(-50%); }
@media (min-width: 640px) and (max-width: 1023px) { #alerts-frame { --ratio: 40%; } }
@media (max-width: 639px) { #alerts-frame { --ratio: 100%; } .cpt-center > .at-rise { top: 50%; } }

/* sources: the three rows with their source under the statement */
.cpt-sources { margin-top: var(--s-6); border: 1px solid var(--u-border); border-radius: var(--u-r); background: var(--u-bg); }
.cpt-sources .cpt-row { grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, .8fr)) minmax(0, 1.6fr) minmax(0, 1.2fr); }
.cpt-sources .cpt-row:first-child { border-top: 0; }
.cpt-src { color: var(--u-accent, #1f2de6); text-decoration: underline; text-underline-offset: 3px; }

/* questions: the cost function's panel */
.cpt-code { --p-h: 340px; margin-top: var(--s-6); }
.cpt-code .ui-code__hint { line-height: 1.45; }
@media (max-width: 639px) { .cpt-code { --p-h: 360px; } }

/* hero window: keep only whole rows inside the frame at each width */
@media (max-width: 1279px) { .ly-piece--main .d-btn { display: none; } }
@media (min-width: 1024px) and (max-width: 1279px) { .ly-piece--main .d-row:nth-child(n+3) { display: none; } }
@media (min-width: 640px) and (max-width: 1023px) { .ly-piece--main .d-row:nth-child(n+5) { display: none; } }
@media (max-width: 639px) { .ly-piece--main .d-row:nth-child(n+3) { display: none; } }

/* the tablet stacks these splits past one screen: two there */
@media (min-width: 640px) and (max-width: 1023px) { #questions { --h: 2; } .closing__links .footer__col { grid-column: span 4; } }

/* every section is as tall as its content (the hero stays one screen), so no empty bands */
html body main > section.section:not(.hero), html body footer.closing { height: auto; min-height: 0; }
html body main > section.section:not(.hero) { padding-bottom: var(--padb); }
@media (max-width: 639px) {
  .cpt-open__head { flex-direction: column; gap: 4px; }
}

/* hero window: the sort it shows, as a quiet label rather than tabs that look clickable */
.cpt-sorted { font-size: 13px; color: #5d6268; }
/* the active count badge at 4.5:1 or more */
.app .ui-win__nav.is-on em { color: var(--p-ink); }
.app .ui-win__label { color: var(--p-muted); }

/* sources: a real list; each price keeps its source link and date at every width */
.cpt-src:hover { text-decoration-thickness: 2px; }
@media (max-width: 1023px) {
  .cpt-sources .cpt-row { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 6px; }
  .cpt-sources .cpt-row > .cpt-who { grid-column: 1 / -1; }
  .cpt-sources .cpt-row > span:not(.cpt-who), .cpt-sources .cpt-row > a { text-align: left; }
}

/* phones: each route a small card, name on top, then input, output and month; nothing hidden but the cache columns */
@media (max-width: 639px) {
  .cpt-open { padding: 16px; }
  .cpt-open:not(.cpt-sources) .cpt-row { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 6px; }
  .cpt-open .cpt-row > .cpt-who { grid-column: 1 / -1; }
  .cpt-open:not(.cpt-sources) .cpt-row > :nth-child(4), .cpt-open:not(.cpt-sources) .cpt-row > :nth-child(5) { display: none; }
  .cpt-open .cpt-row--head > :first-child { display: none; }
  .cpt-open .cpt-row > span:not(.cpt-who) { text-align: left; }
  .cpt-who b { white-space: normal; }
  .cpt-sources .cpt-row > span:not(.cpt-who) { text-align: left; }
}

/* the provider names, written out where the hub drops its labels */
.cpt-hub-names { display: none; margin: var(--s-4) 0 0; font-size: 16px; line-height: 1.6; }
@media (max-width: 639px) { .cpt-hub-names { display: block; } }

/* browser surfaces in the palette */
::selection { background: #1f2de6; color: #fff; }
input { caret-color: #1f2de6; }

/* phones: the source link and its date each get a line; the hero window keeps names, bills and chips */
@media (max-width: 639px) {
  .cpt-sources .cpt-row > a, .cpt-sources .cpt-row > span:last-child { grid-column: 1 / -1; }
  .cpt-src { overflow-wrap: anywhere; }
  .hero__art .cpt-sorted, .hero__art .d-row small { display: none; }
}

/* the spam trap: in the form, out of sight and out of reach */
.cpt-trap { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; overflow: hidden; clip-path: inset(50%); opacity: 0; }

/* ---------- calculator (/calculator) ---------- */
.calc-page { padding-top: calc(var(--nav) + var(--s-8)); }
.calc-page h1 { font-size: var(--t-h2); }
.calc { margin-top: var(--s-6); row-gap: var(--s-7); }
.calc__form { display: grid; gap: var(--s-5); align-content: start; padding: var(--s-6); background: var(--p-surface); border-radius: var(--r-lg); }
.calc__form .field { display: grid; gap: var(--s-2); }
.calc__form label { font-size: 14px; font-weight: 500; }
.calc__form input[type="text"] { height: 48px; padding: 0 14px; font: 400 16px/1 var(--font-text); color: var(--ink); background: var(--g-main); border: 1px solid var(--line-strong); border-radius: var(--r-sm); font-variant-numeric: tabular-nums; }
.calc__form input[type="text"]:focus-visible { outline: 2px solid var(--action); outline-offset: 1px; }
.calc__pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); align-items: end; }
.calc__check { display: flex; gap: var(--s-3); align-items: center; min-height: 44px; font-size: 16px !important; font-weight: 400 !important; }
.calc__check input { width: 20px; height: 20px; accent-color: var(--action); }
.calc__hint { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.calc__summary { margin: 0 0 var(--s-5); font-size: var(--t-lead); line-height: 1.45; }
.calc__summary b { font-weight: 500; }
.calc__table { border-top: 1px solid var(--line-strong); margin-bottom: var(--s-4); }
.calc__row { display: grid; grid-template-columns: minmax(0, 2.6fr) repeat(3, minmax(0, 1fr)) minmax(0, 1.2fr); gap: var(--s-4); align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.calc__row > span:not(.calc__who) { text-align: right; }
.calc__row--head { font-size: 13px; color: var(--muted); padding-block: 10px; }
.calc__row--head > span:first-child { text-align: left; }
.calc__who { display: grid; min-width: 0; }
.calc__who b { font-weight: 500; overflow-wrap: anywhere; }
.calc__who small { font-size: 13px; color: var(--muted); }
.calc__who a { color: var(--action); text-underline-offset: 3px; }
.calc__bill { font-weight: 500; }
.calc__h2 { font-size: var(--t-h3); margin: var(--s-8) 0 var(--s-2); }
.calc__models { list-style: none; margin: var(--s-4) 0 0; padding: 0; border-top: 1px solid var(--line-strong); counter-reset: m; }
.calc__models li { display: grid; grid-template-columns: 2em minmax(0, 1fr) minmax(0, 1fr) auto; gap: var(--s-4); align-items: center; min-height: 48px; border-bottom: 1px solid var(--line); counter-increment: m; font-variant-numeric: tabular-nums; }
.calc__models li::before { content: counter(m); color: var(--muted); font-size: 14px; }
.calc__models button { all: unset; cursor: pointer; font-weight: 500; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; min-height: 44px; display: flex; align-items: center; }
.calc__models button:hover { text-decoration-color: currentColor; }
.calc__models button:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
.calc__models span { color: var(--muted); font-size: 14px; }
.calc__models b { font-weight: 500; }
@media (max-width: 1023px) { .calc__form, .calc__results { grid-column: 1 / -1; } }
@media (max-width: 639px) {
  .calc__form { padding: var(--s-5); }
  .calc__pair { grid-template-columns: 1fr; }
  .calc__row { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 4px; }
  .calc__row > .calc__who { grid-column: 1 / -1; }
  .calc__row--head { display: none; }
  .calc__row > span:not(.calc__who) { text-align: left; }
  .calc__row > span[data-label]::before { content: attr(data-label); display: block; font-size: 13px; color: var(--muted); }
  .calc__row > span[data-label="Cache read"] { display: none; }
  .calc__models li { grid-template-columns: 1.5em minmax(0, 1fr) auto; }
  .calc__models span { display: none; }
}

/* the inputs stay in view beside a long ranking; "Show all" sits under the table */
@media (min-width: 1024px) { .calc__form { position: sticky; top: calc(var(--nav) + var(--s-5)); } }
.calc__more { margin: 0 0 var(--s-4); }

/* ---------- model pages (/models/[key]) ---------- */
.mp { padding-top: calc(var(--nav) + var(--s-8)); }
.mp h1 { font-size: var(--t-h2); }
.mp .section-head b { font-weight: 500; }
.mp__facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-5); margin: 0; padding: var(--s-5) 0; border-block: 1px solid var(--line-strong); }
.mp__facts dt { font-size: 13px; font-weight: 500; color: var(--muted); }
.mp__facts dd { margin: var(--s-1) 0 0; font: 500 var(--t-card)/1.3 var(--font-text); font-variant-numeric: tabular-nums; }
.mp__actions { margin-top: var(--s-6); }
.mp__h2 { font-size: var(--t-h3); margin: var(--s-8) 0 var(--s-2); }
.mp__table { margin-top: var(--s-4); border-top: 1px solid var(--line-strong); }
.mp__row { display: grid; grid-template-columns: minmax(0, 2.4fr) repeat(4, minmax(0, .8fr)) minmax(0, 1.2fr) minmax(0, .7fr) minmax(0, 1fr); gap: var(--s-4); align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.mp__row > span:not(.calc__who) { text-align: right; }
.mp__row--head { font-size: 13px; color: var(--muted); padding-block: 10px; }
.mp__row--head > span:first-child { text-align: left; }
.mp__related { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--s-6); border-top: 1px solid var(--line-strong); }
.mp__related li { display: flex; justify-content: space-between; align-items: center; gap: var(--s-4); min-height: 52px; border-bottom: 1px solid var(--line); }
.mp__related a { font-weight: 500; color: var(--ink); text-underline-offset: 4px; text-decoration-color: var(--line-strong); }
.mp__related a:hover { text-decoration-color: currentColor; }
.mp__related span { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 1023px) {
  .mp__facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mp__row { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 4px; }
  .mp__row > .calc__who { grid-column: 1 / -1; }
  .mp__row--head { display: none; }
  .mp__row > span:not(.calc__who) { text-align: left; }
  .mp__row > span[data-label]::before { content: attr(data-label); display: block; font-size: 13px; color: var(--muted); }
}
@media (max-width: 639px) {
  .mp__row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mp__row > span[data-label="Cache write"], .mp__row > span[data-label="Context"] { display: none; }
  .mp__related { grid-template-columns: 1fr; }
  .mp__related li { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding-block: 8px; }
}

/* ---------- models list (/models) ---------- */
.ml__tools { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: var(--s-5); align-items: end; margin-top: var(--s-6); }
.ml__tools .field { display: grid; gap: var(--s-2); }
.ml__tools label { font-size: 14px; font-weight: 500; }
.ml__tools input, .ml__tools select { height: 48px; padding: 0 14px; font: 400 16px/1 var(--font-text); color: var(--ink); background: var(--p-surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); }
.ml__tools input::placeholder { color: var(--muted); }
.ml__tools input:focus-visible, .ml__tools select:focus-visible { outline: 2px solid var(--action); outline-offset: 1px; }
.ml__tools .calc__hint { padding-bottom: 14px; white-space: nowrap; }
.ml__row { display: grid; grid-template-columns: minmax(0, 2.6fr) minmax(0, 1.6fr) repeat(3, minmax(0, .8fr)) minmax(0, 1fr); gap: var(--s-4); align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.ml__row > span:not(.calc__who) { text-align: right; }
.ml__row > span[data-label="Cheapest"] { text-align: left; }
.ml__row.mp__row--head > span:first-child, .ml__row.mp__row--head > span:nth-child(2) { text-align: left; }
.ml__row .calc__who a { color: var(--ink); text-decoration: none; }
.ml__row .calc__who a:hover b { text-decoration: underline; text-underline-offset: 4px; }
.ml__row[hidden] { display: none; }
@media (max-width: 1023px) {
  .ml__tools { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ml__tools .calc__hint { grid-column: 1 / -1; padding: 0; }
  .ml__row { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 4px; }
  .ml__row > .calc__who { grid-column: 1 / -1; }
  .ml__row.mp__row--head { display: none; }
  .ml__row > span:not(.calc__who) { text-align: left; }
  .ml__row > span[data-label]::before { content: attr(data-label); display: block; font-size: 13px; color: var(--muted); }
}
@media (max-width: 639px) {
  .ml__tools { grid-template-columns: 1fr; }
  .ml__row > span[data-label="Context"], .ml__row > span[data-label="Output"] { display: none; }
}

/* ---------- type: Switzer for words (set in layout :root), Tabular for prices ---------- */
/* every digit the same width, so price columns line up without relying on a font feature */
:is(.calc__row:not(.calc__row--head) > span:not(.calc__who), .mp__row:not(.mp__row--head) > span:not(.calc__who), .ml__row:not(.mp__row--head) > span[data-label]:not([data-label="Cheapest"]),
    .cpt-row:not(.cpt-row--head) > span:not(.cpt-who), .ly-piece--main .d-row .num, .app .ui-win__age, .calc__models b, .calc__form input[type="text"]:not(#c-model)) {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: -0.01em;
}
/* figures inside running text and facts stay in Switzer, with its tabular digits */
:is(.mp__facts dd, .calc__summary, .mp .section-head p, .mp__related span) { font-variant-numeric: tabular-nums; }
/* the labels a phone card adds stay in the text face */
:is(.calc__row, .mp__row, .ml__row) > span[data-label]::before { font-family: var(--font-text); }
/* the check date in the sources rows is a date, not a price */
.cpt-sources .cpt-row > span:last-child { font-family: var(--font-text); letter-spacing: 0; }
/* the code window stands on the section ground, not in a second panel (no card in a card) */
.panel.cpt-code { background: none; box-shadow: none; border: 0; border-radius: 0; --p-h: 300px; }
@media (max-width: 639px) { .panel.cpt-code { --p-h: 320px; } }
.panel.cpt-code, .panel.cpt-code .stage { background: none !important; }
.panel.cpt-code::before, .panel.cpt-code::after, .panel.cpt-code .stage::before, .panel.cpt-code .stage::after { content: none !important; }

/* ---------- reading pages (/privacy, /terms) ---------- */
.prose { padding-top: calc(var(--nav) + var(--s-8)); }
.prose__body { max-width: 68ch; }
.prose__body h1 { font-size: var(--t-h2); margin: 0; }
.prose__updated { margin: var(--s-3) 0 var(--s-7); font-size: 14px; color: var(--muted); }
.prose__body h2 { font-size: var(--t-h3); margin: var(--s-8) 0 var(--s-3); }
.prose__body h3 { font: 500 var(--t-card)/1.3 var(--font-text); margin: var(--s-6) 0 var(--s-2); }
.prose__body p, .prose__body li { font-size: 17px; line-height: 1.65; }
.prose__body p { margin: 0 0 var(--s-4); }
.prose__body ul { margin: 0 0 var(--s-4); padding-left: 1.2em; }
.prose__body a { color: var(--action); text-underline-offset: 3px; }
.footer__legal a { color: inherit; }
.prose__body ul { list-style: disc; }
.prose__body li::marker { color: var(--muted); }
.prose__body :is(p, li) { text-wrap: pretty; }

/* ---------- maker logos: one quiet tile size, so colour marks, wordmarks and the neutral chip all sit alike ---------- */
.ml__row > span.ml__model { display: flex; align-items: center; gap: var(--s-3); min-width: 0; text-align: left; }
.ml__icon { flex: none; width: 32px; height: 32px; padding: 6px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); }
.ml__icon[src$="ui-cpu.svg"] { opacity: .45; }
.mp__title { display: flex; align-items: center; gap: var(--s-4); }
.mp__icon { flex: none; width: 56px; height: 56px; padding: 10px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); }
.mp__icon[src$="ui-cpu.svg"] { opacity: .45; }
.mp__maker { margin: 0; font-size: 15px !important; color: var(--muted); }
.mp__related a { display: inline-flex; align-items: center; gap: var(--s-3); }
.mp__related .ml__icon { width: 28px; height: 28px; padding: 5px; }
@media (max-width: 1023px) { .ml__row > .ml__model { grid-column: 1 / -1; } }
@media (max-width: 639px) { .mp__icon { width: 44px; height: 44px; padding: 8px; } }
