/* 3VLabs COA library. Palette, faces and radii follow the store
   (aji-peptides: app/globals.css light surface + olive band, lib/theme.ts). */

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/assets/fonts/space-grotesk-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-latin.woff2") format("woff2");
}

:root {
  /* light working surface (store: [data-surface="light"]): bone-ivory ground
     (--color-ink), lighter surface for panels, lightest for cards */
  --bg: #f3f0e8;
  --surface: #faf8f2;
  --surface-2: #eee9dd;
  --card: #fdfcf8;
  --line: #cfc4b2;
  --line-strong: #7a6a4c;
  --text: #263c2d;
  --muted: #435c44;
  --heading: #20271c;
  --accent: #6e5c38;
  --accent-hover: #5d4d2e;
  --accent-dim: #f0e8d6;
  --on-accent: #fbf9f4;
  --foil: #b89b62;
  --warn: #7a4f00;
  --warn-dim: #f6e8c8;
  --ok: #2e5a3a;
  --ok-dim: #e3ecdf;
  /* olive band (store: [data-surface="dark"]) */
  --olive: #2e4736;
  --olive-text: #e9e6da;
  --olive-muted: #c7cabb;
  --olive-accent: #d2bf92;

  --font-display: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --radius-card: 1.125rem;
  --radius-hard: 0.25rem;
  --gutter: 16px;
  --max: 72rem;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.skip {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 10;
  background: var(--heading); color: var(--on-accent); padding: 0.6rem 1rem;
  border-radius: var(--radius-hard); text-decoration: none;
}
.skip:focus { top: 0.5rem; color: var(--on-accent); }

/* ── header ─────────────────────────────────────────────────────────────── */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; }
.brand img { width: 118px; height: auto; }
.store-link {
  font-size: 0.875rem; font-weight: 500; text-decoration: none; color: var(--text);
  padding: 0.5rem 0; white-space: nowrap;
}
.store-link:hover { color: var(--accent); text-decoration: underline; }

/* ── intro ──────────────────────────────────────────────────────────────── */
.intro { padding: 1.25rem 0 1rem; }
.eyebrow {
  margin: 0 0 0.5rem; font-family: var(--font-mono); font-size: 0.75rem;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent);
}
h1, h2, h3 { font-family: var(--font-display); color: var(--heading); font-weight: 500; }
h1 { margin: 0; font-size: clamp(2.1rem, 8vw, 3.75rem); line-height: 1.02; letter-spacing: -0.03em; }
.lede { margin: 0.75rem 0 0; max-width: 40rem; font-size: 1rem; color: var(--muted); }

.stats {
  list-style: none; margin: 1.25rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem;
  border-top: 1px solid var(--line); padding-top: 0.9rem;
}
.stats li { display: flex; align-items: baseline; gap: 0.4rem; font-size: 0.9rem; color: var(--muted); }
.stat-n { font-size: 1.25rem; color: var(--heading); font-weight: 600; }
.stat-d { color: var(--heading); font-weight: 500; }

.ruo {
  margin: 1.1rem 0 0; padding: 0.7rem 0.9rem; font-size: 0.875rem; color: var(--text);
  background: var(--surface-2); border-left: 3px solid var(--foil); border-radius: var(--radius-hard);
}
.ruo-tag {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin-right: 0.35rem;
}

/* ── controls ───────────────────────────────────────────────────────────── */
.controls {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  margin: 0 calc(var(--gutter) * -1); padding: 0.75rem var(--gutter) 0.6rem;
  border-bottom: 1px solid var(--line);
}
.search label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--heading); margin-bottom: 0.3rem; }
.search input {
  width: 100%; min-height: 2.9rem; padding: 0.6rem 0.9rem;
  font: inherit; font-size: 1rem; /* 16px keeps iOS from zooming */
  color: var(--heading); background: var(--card);
  border: 1px solid var(--line-strong); border-radius: 0.6rem;
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: #6d7a66; }
/* WebKit's own clear (x) in the brand accent instead of system blue */
.search input::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  width: 1.15rem; height: 1.15rem; margin-left: 0.5rem;
  background: url("/assets/clear.svg") center / contain no-repeat;
}
.search input:focus-visible { outline-offset: 0; }

.chips { display: flex; gap: 0.4rem; margin-top: 0.6rem; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; min-height: 2.25rem; padding: 0.35rem 0.8rem;
  font: inherit; font-size: 0.8125rem; font-weight: 500; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
}
.chip:hover { border-color: var(--line-strong); }
.chip[aria-pressed="true"] { background: var(--heading); color: var(--on-accent); border-color: var(--heading); }
.chip-n { font-family: var(--font-mono); font-size: 0.75rem; opacity: 0.75; margin-left: 0.15rem; }
.result-count { margin: 0.5rem 0 0; font-size: 0.8125rem; color: var(--muted); }

/* ── library ────────────────────────────────────────────────────────────── */
.library { padding: 0.5rem 0 1rem; }
.library:focus { outline: none; }
.line { padding-top: 1.5rem; scroll-margin-top: 9rem; }
.line-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; margin-bottom: 0.8rem; }
.line h2 { margin: 0; font-size: 1.5rem; letter-spacing: -0.015em; }
.line-count { margin: 0; font-size: 0.8125rem; color: var(--muted); }

.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
.card {
  display: flex; flex-direction: column; gap: 0.6rem;
  padding: 1rem; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-card);
  scroll-margin-top: 10rem;
}
.card:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.card-head { display: flex; flex-direction: column; gap: 0.15rem; }
.code {
  margin: 0; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.1em; color: var(--accent);
}
.name { margin: 0; font-size: 1.125rem; line-height: 1.25; letter-spacing: -0.01em; }
.spec { margin: 0; font-size: 0.875rem; color: var(--muted); }

.status { margin: 0; display: inline-flex; align-items: center; gap: 0.4rem; align-self: flex-start;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em; padding: 0.2rem 0.6rem; border-radius: 999px; }
.status .dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: currentColor; }
.status-on { color: var(--ok); background: var(--ok-dim); }
.status-pending { color: var(--warn); background: var(--warn-dim); }
.pending-note { margin: 0; font-size: 0.875rem; color: var(--muted); }

.facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem;
  padding: 0.7rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts div { min-width: 0; }
.facts dt { font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0.1rem 0 0; font-size: 0.9rem; color: var(--heading); font-weight: 500; }

.action { margin: auto 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem;
  padding: 0.55rem 1.15rem; font: inherit; font-size: 0.9375rem; font-weight: 600;
  color: var(--on-accent); background: var(--accent); border: 1px solid var(--accent);
  border-radius: 999px; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-quiet { color: var(--accent); background: transparent; }
.btn-quiet:hover { color: var(--on-accent); }
.file-meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }

.empty { text-align: center; padding: 2.5rem 1rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-card); margin-top: 1.5rem; }
.empty p { margin: 0 0 0.8rem; color: var(--muted); }

/* ── about ──────────────────────────────────────────────────────────────── */
.about { margin: 1.5rem 0 2.5rem; padding: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
.about h2 { margin: 0 0 0.6rem; font-size: 1.25rem; }
.about p { margin: 0.55rem 0 0; font-size: 0.9375rem; max-width: 46rem; }
.about strong { color: var(--heading); }

/* ── footer ─────────────────────────────────────────────────────────────── */
.site-footer { background: var(--olive); color: var(--olive-text); border-top: 2px solid var(--foil); padding: 2rem 0 2.25rem; }
.footer-grid { display: flex; flex-direction: column; gap: 1rem; }
.footer-brand img { width: 128px; height: auto; }
.footer-text p { margin: 0.25rem 0; font-size: 0.9rem; }
.site-footer a { color: var(--olive-accent); }
.site-footer a:hover { color: #e3d6b4; }
.site-footer :focus-visible { outline-color: var(--olive-accent); }
.footer-small { color: var(--olive-muted); font-size: 0.8125rem !important; }

/* ── 404 ────────────────────────────────────────────────────────────────── */
.notfound { padding-top: 4rem; padding-bottom: 4rem; }
.notfound h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); }

/* ── phones: get the first certificate near the fold, keep the sticky bar slim ── */
@media (max-width: 639.98px) {
  .intro { padding: 1rem 0 0.75rem; }
  .eyebrow { margin-bottom: 0.35rem; }
  h1 { font-size: 2rem; }
  .lede { margin-top: 0.5rem; font-size: 0.9375rem; }
  .lede-more { display: none; }
  .stats { margin-top: 0.75rem; padding-top: 0.6rem; gap: 0.25rem 1rem; }
  .stats li { font-size: 0.8125rem; }
  .stat-n { font-size: 1.05rem; }
  .ruo { margin-top: 0.75rem; padding: 0.55rem 0.75rem; font-size: 0.8125rem; }
  .controls { padding: 0.5rem var(--gutter) 0.35rem; }
  .search input { min-height: 2.75rem; padding-top: 0.5rem; padding-bottom: 0.5rem; }
  /* the placeholder names what to search; the label stays for screen readers */
  .search label {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .chips { margin-top: 0.4rem; }
  .result-count { margin-top: 0.25rem; font-size: 0.75rem; line-height: 1.3; }
  .library { padding-top: 0; }
  .line { padding-top: 1rem; scroll-margin-top: 8rem; }
  .card { scroll-margin-top: 8.5rem; }
}

/* ── larger screens ─────────────────────────────────────────────────────── */
@media (min-width: 640px) {
  :root { --gutter: 24px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand img { width: 139px; }
  .intro { padding: 2.75rem 0 1.5rem; }
  .lede { font-size: 1.0625rem; }
  .controls { display: grid; grid-template-columns: minmax(0, 1fr); }
  .footer-grid { flex-direction: row; align-items: center; justify-content: space-between; }
  .footer-text { text-align: right; }
}
@media (min-width: 1024px) {
  :root { --gutter: 32px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .controls { grid-template-columns: minmax(16rem, 26rem) 1fr; align-items: end; column-gap: 1.25rem; }
  .chips { margin-top: 0; flex-wrap: wrap; }
  .result-count { grid-column: 1 / -1; }
  .about { padding: 1.75rem 2rem; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media print {
  .controls, .skip, .store-link { display: none !important; }
  .card { break-inside: avoid; }
  .site-footer { background: none; color: #000; }
}
