/* infer-chrome-contract: 2026-11-12 */

/* Tokens. Page <style> blocks keep their own light :root; these load after them. */
:root {
  --type-display: Archivo, ui-sans-serif, system-ui, sans-serif;
  --type-sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --type-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-display: var(--type-display);
  --font-sans: var(--type-sans);
  --font-mono: var(--type-mono);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1e2433;
  --bg-2: #1e2433;
  --surface: #252c3d;
  --surface-2: #252c3d;
  --surface-3: #3e4a66;
  --surface-raised: #2c3549;
  --ink: #f5f7fa;
  --ink-soft: #e2e8f0;
  --muted: #94a3b8;
  --faint: #94a3b8;
  --line: #2e374d;
  --line-strong: #3e4a66;
  --accent: #3060f1;
  --accent-hover: #668cff;
  --accent-ink: #668cff;
  --accent-mid: #99b2ff;
  --accent-mist: rgba(48, 96, 241, 0.16);
  --accent-tint: #3e4a66;
  --accent-soft: rgba(48, 96, 241, 0.22);
  --accent-contrast: #ffffff;
  --brand-navy: #ffffff;
  --brand-ink: #ffffff;
  --wordmark-fill: #ffffff;
  --lockup-product-color: #668cff;
  --success: #34d399;
  --warn: #fbbf24;
  --warn-mist: rgba(251, 191, 36, 0.14);
  --danger: #f87171;
  --code-bg: #141924;
  --code-fg: #f5f7fa;
  --shadow: 0 8px 10px rgb(37 44 61 / 28%);
}
:root, :root[data-theme="light"] {
  color-scheme: light;
  --wordmark-fill: var(--brand-navy, #000066);
  --lockup-product-color: var(--accent, #3060f1);
  --surface-raised: var(--bg-2, #edf0f5);
  --code-bg: #252c3d;
  --code-fg: #ffffff;
  --shadow: 0 8px 10px #4f709e1a;
}

/* Server-rendered pages (data-i18n-ssr) are already translated and must paint at once. */
html[data-i18n-pending]:not([data-i18n-ssr]) body { visibility: hidden; animation: infer-i18n-reveal 0s linear 2.5s forwards; }
@keyframes infer-i18n-reveal { to { visibility: visible; } }

/* Header (spec §4.6). Class names match the shared chrome-bar contract. */
header.chrome-bar {
  position: relative;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  height: 3.5rem;
  flex-shrink: 0;
}
header.chrome-bar .chrome-inner {
  max-width: 80rem;
  height: 100%;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(0.65rem, 1.4vw, 1.25rem);
  flex-wrap: nowrap;
  min-width: 0;
}
header.chrome-bar .brand-lockup { flex-shrink: 0; color: inherit; }
.brand-lockup { display: inline-flex; align-items: center; gap: 0.55rem; white-space: nowrap; text-decoration: none; }
.brand-mark { display: block; height: 1.35rem; width: auto; aspect-ratio: 4 / 3; flex-shrink: 0; }
.brand-words { font-family: var(--type-display, Archivo, sans-serif); font-weight: 600; font-size: 0.9375rem; letter-spacing: -0.025em; line-height: 1; white-space: nowrap; }
.brand-company { color: var(--wordmark-fill, var(--brand-navy, #000066)); }
.brand-sep { width: 1px; height: 1.1rem; margin: 0 0.55rem; background: var(--accent); color: transparent; overflow: hidden; display: inline-block; }
.brand-product, .lockup-product { color: var(--lockup-product-color, var(--accent)); }
.header-tools { margin-left: auto; display: inline-flex; align-items: center; gap: clamp(0.55rem, 1vw, 0.95rem); min-width: 0; flex-wrap: nowrap; }
.chrome-nav, .chrome-account { display: flex; align-items: center; gap: 0.85rem; font-size: 0.8125rem; white-space: nowrap; }
.chrome-nav a, .account-link { color: var(--ink-soft, var(--muted)); font-weight: 500; font-size: 0.8125rem; text-decoration: none; }
.chrome-nav a:hover, .account-link:hover { color: var(--accent-hover); text-decoration: none; }
.chrome-nav a[aria-current="page"], .account-link[aria-current="page"] {
  color: var(--ink); font-weight: 600; text-decoration: underline;
  text-decoration-color: var(--accent); text-underline-offset: 0.35rem; text-decoration-thickness: 2px;
}
.btn.btn-cta { background: transparent; border: 0; box-shadow: none; min-height: 0; padding: 0; color: var(--accent-ink); font-weight: 600; font-size: 0.8125rem; }
.chrome-controls { display: inline-flex; align-items: center; gap: 0.35rem; }
.chrome-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 1.5rem; min-width: 1.5rem; padding: 0.2rem 0.5rem; border-radius: 4px;
  border: 1px solid var(--line-strong, var(--line)); background: var(--surface-raised, var(--bg-2));
  color: var(--ink-soft, var(--muted)); font-family: var(--type-mono); font-size: 0.6875rem; font-weight: 500;
  line-height: 1.2; text-decoration: none; cursor: pointer;
}
.chrome-pill:hover { border-color: var(--accent); color: var(--ink); text-decoration: none; }
.chrome-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chrome-menu-toggle { display: none; gap: 0.3rem; }
.menu-toggle-icon, .lang-globe-icon { width: 0.875rem; height: 0.875rem; display: block; }
.lang-selector { position: relative; display: inline-block; }
.lang-selector > summary { list-style: none; }
.lang-selector > summary::-webkit-details-marker { display: none; }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 0.35rem); min-width: 9.5rem;
  background: var(--surface); border: 1px solid var(--line-strong, var(--line)); border-radius: 6px;
  padding: 0.35rem; box-shadow: var(--shadow, var(--elevation-soft)); z-index: 50;
  display: flex; flex-direction: column; gap: 0.125rem;
}
.lang-menu-label {
  font-family: var(--type-mono); font-size: 0.625rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); padding: 0.25rem 0.45rem;
}
.lang-option {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.35rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 500;
  color: var(--ink-soft, var(--muted)); text-decoration: none;
}
.lang-option:hover { background: var(--surface-raised, var(--bg-2)); color: var(--ink); text-decoration: none; }
.lang-option[aria-current="true"] { color: var(--accent-ink); font-weight: 600; }
.account-menu { position: relative; display: inline-block; }
.account-menu > summary { list-style: none; }
.account-menu > summary::-webkit-details-marker { display: none; }
/* The Host portal's account pill. Icon and chevron are CSS masks, so the summary text stays its whole accessible name. */
header.chrome-bar .account-menu-button {
  gap: 0.4rem; min-height: 2.25rem; padding: 0.35rem 0.6rem 0.35rem 0.5rem;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink);
  font-family: var(--type-sans); font-size: 0.875rem; font-weight: 500; white-space: nowrap;
}
header.chrome-bar .account-menu-button::before,
header.chrome-bar .account-menu-button::after { content: ""; flex-shrink: 0; background-color: currentColor; }
header.chrome-bar .account-menu-button::before {
  width: 18px; height: 18px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21a8 8 0 0 1 16 0'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21a8 8 0 0 1 16 0'/%3E%3C/svg%3E") center / contain no-repeat;
}
header.chrome-bar .account-menu-button::after {
  width: 14px; height: 14px; transition: transform 120ms ease;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}
header.chrome-bar .account-menu-button:hover,
header.chrome-bar .account-menu[open] > .account-menu-button { background: var(--surface-raised, var(--bg-2)); border-color: var(--line-strong, var(--line)); color: var(--ink); }
header.chrome-bar .account-menu[open] > .account-menu-button::after { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
  header.chrome-bar .account-menu-button::after { transition: none; }
}
@media (forced-colors: active) {
  header.chrome-bar .account-menu-button::before,
  header.chrome-bar .account-menu-button::after { forced-color-adjust: none; background-color: CanvasText; }
}
.account-menu-panel {
  position: absolute; right: 0; top: calc(100% + 0.4rem); z-index: 50; display: flex; flex-direction: column; gap: 0.1rem;
  width: 16rem; max-width: calc(100vw - 1.5rem); padding: 0.4rem; border: 1px solid var(--line-strong, var(--line)); border-radius: 10px;
  background: var(--surface); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16); white-space: normal;
}
.account-menu-who { margin: 0 0 0.3rem; padding: 0.5rem 0.65rem 0.6rem; border-bottom: 1px solid var(--line); font-size: 0.75rem; color: var(--muted); overflow-wrap: anywhere; }
.account-menu-label { margin: 0.25rem 0 0; padding: 0.25rem 0.65rem; font-family: var(--type-mono); font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.account-menu-group { display: flex; flex-direction: column; gap: 0.1rem; }
.account-menu-form { margin: 0; display: flex; }
.account-menu-item {
  display: flex; width: 100%; padding: 0.5rem 0.65rem; border: 0; border-radius: 6px; background: transparent;
  font: inherit; font-size: 0.8125rem; font-weight: 500; text-align: left; color: var(--ink); text-decoration: none; cursor: pointer;
}
.account-menu-item:hover, .account-menu-item:focus { background: var(--surface-raised, var(--bg-2)); text-decoration: none; }
.account-menu-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.account-menu-lang[aria-checked="true"] { color: var(--accent); font-weight: 600; }
.account-menu-lang[aria-checked="true"]::after { content: "\2713"; margin-left: auto; }
.mobile-nav {
  display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 40;
  flex-direction: column; gap: 0.125rem; padding: 0.5rem 1.25rem 0.75rem;
  background: var(--surface); border-bottom: 1px solid var(--line-strong, var(--line));
  box-shadow: var(--shadow, var(--elevation-soft));
}
.mobile-nav[data-open="true"], .mobile-nav.is-open { display: flex; }
.mobile-nav a { padding: 0.45rem 0.5rem; border-radius: 4px; color: var(--ink-soft, var(--muted)); font-weight: 500; font-size: 0.8125rem; text-decoration: none; }
.mobile-nav a:hover { background: var(--surface-raised, var(--bg-2)); }
.mobile-nav a[aria-current="page"] { color: var(--accent-ink); font-weight: 600; }
.email-badge { display: none; }
.logout-form { margin: 0; display: inline-flex; }
header.chrome-bar .logout-form .btn.btn-quiet {
  display: inline-flex; min-height: 2rem; align-items: center; justify-content: center; gap: 0.375rem;
  margin: 0; padding: 0.375rem 0.75rem; border-radius: 0.5rem;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-family: var(--type-display); font-size: 0.75rem; font-weight: 600; line-height: 1rem;
  cursor: pointer; white-space: nowrap; box-shadow: none;
}
header.chrome-bar .logout-form .btn.btn-quiet:hover { background: var(--surface-raised, var(--bg-2)); box-shadow: none; }
header.chrome-bar .logout-form .btn.btn-quiet:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 1099px) {
  .chrome-menu-toggle { display: inline-flex; }
  .chrome-nav { display: none; }
  .chrome-account .account-link { display: none; }
}
@media (min-width: 640px) {
  .email-badge {
    display: inline-block; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    border: 1px solid var(--line); border-radius: 9999px; background: var(--surface);
    padding: 0.125rem 0.625rem; font-family: var(--type-mono); font-size: 0.75rem; color: var(--ink);
  }
}
@media (max-width: 768px) {
  .brand-company, .brand-sep { display: none; }
  header.chrome-bar .chrome-inner { padding: 0.45rem 0.75rem; }
  .brand-product, .lockup-product { font-size: 0.875rem; }
}
@media (max-width: 480px) {
  header.chrome-bar .chrome-inner { padding-left: 0.65rem; padding-right: 0.65rem; }
  .brand-product, .lockup-product { font-size: 0.8125rem; }
}

/* Header hardening: page .btn / body rules must not leak into the bar. */
header.chrome-bar { font-family: var(--type-sans); line-height: 1.2; }
header.chrome-bar .brand-words { display: inline-flex; align-items: center; }
header.chrome-bar .btn.btn-cta { display: inline; font-family: var(--type-sans); line-height: 1.2; white-space: nowrap; transition: none; }
header.chrome-bar .btn.btn-cta:hover { color: var(--accent-hover); background: transparent; box-shadow: none; text-decoration: none; }
header.chrome-bar .btn.btn-cta[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 0.35rem; text-decoration-thickness: 2px; }
header.chrome-bar button.chrome-pill { font-family: var(--type-mono); margin: 0; }
@media (max-width: 420px) {
  .chrome-menu-toggle > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
}

.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 60;
  padding: 0.5rem 0.75rem; border-radius: 0.5rem;
  background: var(--accent); color: #ffffff; font-family: var(--type-sans); font-size: 0.875rem; font-weight: 600;
  text-decoration: none; transform: none;
}
.skip-link:focus { top: 0.5rem; }

/* Footer (same structure as website/infer renderSiteFooter) */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-2); color: var(--ink); font-family: var(--type-sans); }
.site-footer-inner { max-width: 80rem; margin: 0 auto; padding: 1.75rem 1.25rem; }
.footer-grid { display: grid; gap: 1.5rem; }
.footer-brand > a { display: inline-flex; text-decoration: none; color: inherit; }
.footer-brand .brand-lockup { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
.footer-brand .brand-mark { height: 1.75rem; }
.site-footer .brand-company { display: inline; }
.site-footer .brand-sep { display: inline-block; }
.footer-tagline { margin: 0.75rem 0 0; max-width: 24rem; font-size: 0.75rem; line-height: 1.25rem; color: var(--muted); }
.footer-heading { margin: 0; font-size: 0.75rem; line-height: 1rem; font-weight: 600; color: var(--faint); }
.footer-links { margin-top: 1rem; display: grid; gap: 0.625rem; font-size: 0.875rem; line-height: 1.25rem; color: var(--muted); }
.footer-links a { justify-self: start; color: inherit; text-decoration: none; }
.footer-links a:hover { color: var(--accent-ink); }
.footer-links a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.footer-bottom {
  margin-top: 2rem; display: flex; flex-direction: column; gap: 0.5rem;
  padding-top: 1rem; border-top: 1px solid var(--line);
  font-size: 0.75rem; line-height: 1rem; color: var(--faint);
}
.footer-bottom p { margin: 0; }
@media (min-width: 640px) {
  .site-footer-inner { padding: 2rem; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-tagline { font-size: 0.875rem; line-height: 1.5rem; }
  .footer-bottom { flex-direction: row; justify-content: space-between; }
}
@media (min-width: 1024px) {
  .footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Model rate table (Home, Docs, Pricing, signed-in pricing). Below 640px each row becomes a card:
   model name, ID and modality on top, then a 2x2 grid of Context / Input / Cached / Output.
   Rows carry td[data-col] and a .rate-cell-label in each number cell; Docs adds max_output as a last full-width row. */
.rate-cell-label { display: none; }
@media (max-width: 639.98px) {
  .rate-table, .rate-table tbody { display: block; width: 100%; }
  .rate-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .rate-table tbody tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.625rem 1rem;
    grid-template-areas: "model model" "modalities modalities" "context prompt" "cached_prompt completion";
    padding: 0.875rem 0.875rem 1rem; border-bottom: 1px solid var(--line);
  }
  .rate-table tbody tr:last-child { border-bottom: 0; }
  .rate-table td { display: block; min-width: 0; padding: 0; border: 0; text-align: left; }
  .rate-table td.num { text-align: left; white-space: normal; }
  .rate-table td[data-col="model"] { grid-area: model; min-width: 0; }
  .rate-table td[data-col="modalities"] { grid-area: modalities; margin-top: -0.25rem; }
  .rate-table td[data-col="context"] { grid-area: context; }
  .rate-table td[data-col="prompt"] { grid-area: prompt; }
  .rate-table td[data-col="cached_prompt"] { grid-area: cached_prompt; }
  .rate-table td[data-col="completion"] { grid-area: completion; }
  .rate-table td[data-col="max_output"] { grid-column: 1 / -1; }
  .rate-table td[data-col="model"] code { white-space: normal; overflow-wrap: anywhere; }
  .rate-table .rate-cell-label {
    display: block; margin-bottom: 0.125rem; font-family: var(--type-mono); font-size: 11px; font-weight: 500;
    letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint);
  }
}

/* Dark: shared components */
:root[data-theme="dark"] {
  --success-soft: rgba(52, 211, 153, 0.28);
  --success-mist: rgba(52, 211, 153, 0.12);
  --warn-soft: rgba(251, 191, 36, 0.3);
  --danger-soft: rgba(248, 113, 113, 0.3);
  --danger-mist: rgba(248, 113, 113, 0.12);
  --elevation-soft: 0 8px 10px rgb(0 0 0 / 22%);
  --elevation-chip: 0 2px 5px rgb(0 0 0 / 30%);
  --elevation-cta: 0 4px 10px rgba(48, 96, 241, 0.45);
  --elevation-cta-quiet: 0 4px 10px rgba(48, 96, 241, 0.25);
}
.code, pre.code, .codeblock pre {
  background: var(--code-bg);
  color: var(--code-fg);
}
:root[data-theme="dark"] .alert-error { border-color: rgba(248, 113, 113, 0.45); background: rgba(185, 28, 28, 0.22); color: var(--danger); }
:root[data-theme="dark"] .eyebrow,
:root[data-theme="dark"] .text-link,
:root[data-theme="dark"] .link-arrow { color: var(--accent-ink); }
:root[data-theme="dark"] .text-link:hover,
:root[data-theme="dark"] .link-arrow:hover { color: var(--accent-mid); }
:root[data-theme="dark"] ::selection { background: var(--accent); color: #ffffff; }
