/* Carthagent shared styles: tokens, fonts, buttons, rows, commands, plans,
   usage table, FAQ and footer. The visual system is documented in DESIGN.md. */

@font-face {
  font-family: "Figtree";
  src: url("/assets/fonts/figtree-latin.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/assets/fonts/figtree-italic-latin.woff2") format("woff2");
  font-weight: 300 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Martian Mono";
  src: url("/assets/fonts/martian-mono-latin.woff2") format("woff2");
  font-weight: 400 500;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --purple: #160e20;
  --surface: #21162b;
  --gold: #e6c480;
  --gold-high: #f5dca9;
  --gold-low: #d5af66;
  --text: #f6f0e7;
  --muted: #c0b3ca;
  --faint: #9a8ca6;
  --line: #49364f;
  --water: #a385c7;
  --sans: "Figtree", "Helvetica Neue", Arial, sans-serif;
  --mono: "Martian Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --gutter: clamp(20px, 3.4vw, 48px);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  background: var(--purple);
  color: var(--text);
  accent-color: var(--gold);
  caret-color: var(--gold);
  scrollbar-color: #3a2a45 var(--purple);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100svh; overflow-x: clip; font-variant-numeric: tabular-nums; }
::selection { background: var(--gold); color: var(--purple); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #3a2a45; border: 3px solid var(--purple); border-radius: 8px; }
::-webkit-scrollbar-track { background: var(--purple); }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 6px; border-radius: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
code { font-family: var(--mono); font-weight: 400; }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex; justify-content: center; align-items: center; gap: 14px;
  min-height: 54px; padding: 12px 26px;
  border: 1px solid var(--gold); border-radius: 100px;
  background: var(--gold); color: var(--purple);
  font-size: 15px; font-weight: 600; white-space: nowrap;
  transition: background-color .18s, border-color .18s, color .18s;
}
.button:hover { background: var(--gold-high); border-color: var(--gold-high); }
.button:active { background: var(--gold-low); border-color: var(--gold-low); }
.button.is-secondary { background: transparent; color: var(--text); border-color: var(--faint); }
.button.is-secondary:hover { background: transparent; color: var(--gold); border-color: var(--gold); }
.button span { transition: transform .3s cubic-bezier(.2, .7, .2, 1); }
.button:hover span { transform: translateX(4px); }
.button.is-secondary span { color: var(--gold); }

/* ---------- Page shell and shared actions ---------- */
.landing { position: relative; isolation: isolate; display: flex; flex-direction: column; min-height: 100svh; }
.wordmark-agent { font-style: italic; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 14px 18px; }

@media (max-width: 760px) {
  .actions { flex-direction: column; width: 100%; }
  .actions .button { width: 100%; white-space: normal; text-align: center; }
}
@media (max-width: 760px) and (max-height: 520px) {
  .actions { flex-direction: row; width: auto; }
  .actions .button { width: auto; }
}

/* ---------- Rows (install, plans) ---------- */
.list-page { display: flex; flex-direction: column; min-height: 100svh; }
.list-main { width: min(1120px, 100% - 2 * var(--gutter)); margin: 0 auto; padding: clamp(40px, 7vh, 88px) 0 96px; flex: 1; }
.list-title { margin: 0 0 clamp(28px, 4vh, 44px); }
.list-title h1 { margin: 0; color: var(--gold); font-size: clamp(34px, 4.4vw, 56px); line-height: 1; font-weight: 600; letter-spacing: -.02em; }
.list-title p { margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.4; }

.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); counter-reset: row; }
.rows > li {
  display: grid;
  grid-template-columns: 44px minmax(120px, .6fr) minmax(0, 2fr) minmax(140px, .9fr);
  align-items: center; column-gap: 24px;
  min-height: 92px; padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.row-no { color: var(--gold); font: 500 13px/1 var(--mono); letter-spacing: .02em; }
.row-no::before { counter-increment: row; content: counter(row, decimal-leading-zero); }
.row-name { margin: 0; font-size: clamp(18px, 1.6vw, 22px); font-weight: 500; letter-spacing: -.015em; line-height: 1.1; }
.row-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; text-align: right; }
.row-note code { font-size: .85em; white-space: nowrap; }
.row-note a { color: var(--text); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 4px; }
.row-note a:hover { text-decoration-color: var(--gold); }

.command {
  display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 56px;
  padding: 4px 4px 4px 16px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface);
}
.command code { flex: 1; min-width: 0; font-size: 14px; line-height: 1.6; color: var(--text); overflow-wrap: anywhere; }
.copy {
  flex: none; min-width: 72px; min-height: 44px; padding: 6px 12px;
  border: 1px solid transparent; border-radius: 6px; background: transparent;
  color: var(--gold); font: 500 12px/1 var(--sans); letter-spacing: .02em; cursor: pointer;
  transition: background-color .15s;
}
.copy:hover { background: #382442; }
.copy:active { background: #493052; }
.rows > li.is-signalled .row-no { animation: blink .5s step-end 2; }
@keyframes blink { 0%, 49.99% { color: var(--text); } 50%, 100% { color: var(--gold); } }

.list-foots { display: flex; flex-wrap: wrap; gap: 4px 32px; margin-top: 36px; }
.list-foot { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-size: 14px; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 5px; }
.list-foot:hover { color: var(--gold); text-decoration-color: var(--gold); }

/* Shared site footer, a sibling of <main> on every public page. */
.site-footer { width: min(1120px, 100% - 2 * var(--gutter)); margin: 0 auto; padding: 20px 0 clamp(32px, 6vh, 56px); border-top: 1px solid var(--line); }
.site-footer .list-foots { margin-top: 0; gap: 0 28px; }
.site-footer .list-foot { font-size: 13px; }

/* Skip link for keyboard users; surfaces that ship their own rule keep it. */
.skip-link { position: absolute; left: var(--gutter); top: -80px; z-index: 10; min-height: 44px; padding: 12px; background: var(--surface); color: var(--text); }
.skip-link:focus { top: 12px; }

@media (max-width: 760px) {
  .rows > li {
    grid-template-columns: 32px 1fr;
    grid-template-areas: "no name" "cmd cmd" "note note";
    row-gap: 12px; column-gap: 14px; min-height: 0; padding: 22px 0;
  }
  .row-no { grid-area: no; }
  .row-name { grid-area: name; }
  .rows .command { grid-area: cmd; }
  .row-note { grid-area: note; text-align: left; }
  .command { padding-left: 12px; }
  .command code { font-size: 13px; }
}

/* ---------- Plans ---------- */
.plans > li { grid-template-columns: minmax(90px, .5fr) minmax(90px, .5fr) minmax(0, 1.4fr) auto; min-height: 104px; }
.plans .button { min-height: 48px; padding: 10px 22px; font-size: 14px; }
.plan-price { margin: 0; font-size: clamp(22px, 2vw, 28px); font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.plan-price span { color: var(--muted); font-size: 13px; font-weight: 400; letter-spacing: 0; margin-left: 2px; }
.plan-offer { margin: 0; color: var(--muted); font-size: 14px; }
.plan-offer strong { color: var(--text); font-weight: 500; }
.plans-note { margin: 16px 0 0; max-width: 72ch; color: var(--muted); font-size: 14px; line-height: 1.55; }
.plans-note a, .faq a { color: var(--text); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 4px; }
.plans-note a:hover, .faq a:hover { color: var(--gold); text-decoration-color: var(--gold); }
.section-title { margin: 0 0 16px; color: var(--text); font-size: clamp(22px, 2.2vw, 28px); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }

.usage { margin-top: clamp(48px, 7vh, 80px); }
.table-scroll { overflow-x: auto; }
.usage-table { width: 100%; min-width: 420px; border-collapse: collapse; font-size: 15px; }
.usage-table th, .usage-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.usage-table th:first-child { padding-left: 0; text-align: left; }
.usage-table tr > :last-child { padding-right: 0; }
.usage-table thead th { color: var(--muted); font: 400 12px/1 var(--mono); letter-spacing: .02em; }
.usage-table tbody th { color: var(--text); font-weight: 500; }
.usage-table td { color: var(--text); font: 400 14px/1 var(--mono); }

.faq { margin-top: clamp(48px, 7vh, 80px); max-width: 760px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary { display: flex; align-items: center; min-height: 56px; padding: 12px 32px 12px 0; position: relative; color: var(--text); font-size: 16px; font-weight: 500; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; color: var(--gold); font-size: 20px; font-weight: 400; }
.faq details[open] summary::after { content: "−"; }
.faq summary:hover { color: var(--gold); }
.faq details p { margin: 0 0 18px; max-width: 68ch; color: var(--muted); font-size: 15px; line-height: 1.6; }

@media (max-width: 760px) {
  .plans > li {
    grid-template-columns: auto 1fr;
    grid-template-areas: "name price" "offer offer" "cta cta";
    row-gap: 12px; column-gap: 14px; padding: 22px 0;
  }
  .plans .row-name { grid-area: name; }
  .plans .plan-price { grid-area: price; text-align: right; }
  .plans .plan-offer { grid-area: offer; }
  .plans .button { grid-area: cta; width: 100%; }
  .usage-table { min-width: 0; font-size: 14px; }
  .usage-table th, .usage-table td { padding-inline: 6px; }
  .usage-table td { font-size: 12px; }
  /* Long model names wrap so all four columns fit a 360px phone. */
  .usage-table tbody th { white-space: normal; font-size: 14px; line-height: 1.3; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
