/*
 * Trawl's pages (pricing, download, licence, legal…), in the Citefy Labs design.
 * Colours and fonts come from /brand/tokens.css, the header and footer from
 * /brand/chrome.css — both shared with the Next.js pages — so this file only
 * styles page content. The class names are the ones the page scripts build
 * (assets/js): keep them. No inline styles anywhere: the CSP forbids them.
 */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--background); color: var(--foreground);
  font-family: var(--cl-sans); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-wrap: break-word;
  transition: background-color .3s, color .3s;
}
img { max-width: 100%; height: auto; }

a { color: inherit; font-weight: 500; text-decoration: underline; text-decoration-color: color-mix(in oklab, var(--foreground) 35%, transparent); text-underline-offset: 4px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; border-radius: 0.5rem; }

.skip { position: absolute; left: 1rem; top: -3rem; z-index: 60; background: var(--card); color: var(--foreground); padding: 0.5rem 0.9rem; border-radius: 999px; border: 1px solid var(--border); }
.skip:focus { top: 0.75rem; }

/* ── Layout ─────────────────────────────────────────────────────────── */
.wrap { width: 100%; max-width: 64rem; margin: 0 auto; padding: 0 1.5rem; }
.narrow { max-width: 48rem; }
[id] { scroll-margin-top: 8rem; }
main.wrap { padding-top: 4.5rem; position: relative; isolation: isolate; }
/* The main site's hero grid (the bg-grid utility), fading out under the title. */
main::before {
  content: ""; position: absolute; z-index: -1; top: 0; left: 50%; width: 100vw; height: 26rem; transform: translateX(-50%);
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent); mask-image: linear-gradient(to bottom, #000 40%, transparent);
  pointer-events: none;
}
body { overflow-x: hidden; }

/* ── Type: the main site's scale ────────────────────────────────────── */
h1, h2, h3 { font-family: var(--cl-display); letter-spacing: -0.03em; color: var(--foreground); }
h1 { font-size: clamp(2.6rem, 6vw, 4.25rem); line-height: 0.95; font-weight: 700; margin: 0 0 1.25rem; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.05; font-weight: 700; margin: 3.5rem 0 1rem; }
h3 { font-size: 1.3rem; line-height: 1.15; font-weight: 700; margin: 2rem 0 0.5rem; }
p, ul, ol { margin: 0 0 1rem; }
li { margin-bottom: 0.4rem; }
ul, ol { padding-left: 1.25rem; }
li::marker { color: var(--muted-foreground); }
.lede { font-size: 1.125rem; color: var(--muted-foreground); max-width: 42rem; margin-bottom: 2rem; }
.muted, .hint { color: var(--muted-foreground); }
.small { font-size: 0.9rem; }
strong, b { font-weight: 600; }
code, kbd, .mono { font-family: var(--cl-mono); font-size: 0.88em; }
code { background: var(--secondary); padding: 0.1em 0.4em; border-radius: 0.4rem; }
pre { background: var(--ink); color: var(--ink-foreground); padding: 1rem 1.25rem; border-radius: 1rem; overflow-x: auto; font-size: 0.88rem; line-height: 1.55; }
pre code { background: none; padding: 0; color: inherit; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* ── Blocks ─────────────────────────────────────────────────────────── */
.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem; }
.hero > div { flex: 1 1 20rem; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 1.6rem; padding: 1.75rem;
  transition: box-shadow .2s, border-color .2s;
}
.card:hover { box-shadow: var(--shadow-float); }
.card h2, .card h3 { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.25rem; margin: 1.25rem 0 2rem; }
.stack > * + * { margin-top: 1.25rem; }

/* Buttons: the main site's pills. */
.button, main button {
  font: inherit; font-weight: 600; font-size: 0.95rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 2.9rem; padding: 0.6rem 1.5rem; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  background: var(--foreground); color: var(--background);
  transition: transform .15s, background-color .15s;
}
.button:hover, main button:hover { transform: scale(1.03); }
.button.secondary, main button.secondary { background: transparent; color: var(--foreground); border-color: var(--foreground); }
.button.secondary:hover, main button.secondary:hover { background: var(--secondary); transform: none; }
.button.danger, main button.danger { background: transparent; color: var(--destructive); border-color: currentColor; }
main button[disabled], .button[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.trust { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; list-style: none; padding: 0; margin: -0.5rem 0 1.5rem; font-family: var(--cl-mono); font-size: 0.75rem; color: var(--muted-foreground); }
.trust li { display: flex; align-items: center; gap: 0.4rem; margin: 0; }
.trust li::before { content: ""; width: 0.375rem; height: 0.375rem; border-radius: 999px; background: var(--accent); }
#not-mac { margin-bottom: 2rem; }
#next-steps { margin: 1.5rem 0 2rem; border-color: color-mix(in oklab, var(--accent) 60%, var(--border)); }
#next-steps:focus { outline: none; }
.button-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin: 1.5rem 0; }
.linklike { background: none; border: 0; padding: 0; min-height: 0; color: inherit; font-weight: inherit; text-decoration: underline; text-underline-offset: 4px; }
.linklike:hover { transform: none; }

/* Forms */
form { margin: 1.25rem 0; }
.field { margin-bottom: 1.25rem; }
label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
.hint { display: block; font-weight: 400; font-size: 0.9rem; margin-top: 0.15rem; }
input[type="text"], input[type="email"], input[type="search"] {
  font: inherit; width: 100%; max-width: 30rem; min-height: 2.9rem; padding: 0.55rem 1.1rem;
  border-radius: 999px; border: 1px solid var(--border); background: var(--background); color: var(--foreground);
  transition: border-color .15s;
}
input:focus { border-color: var(--foreground); outline: none; }
input:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.turnstile { margin: 0.75rem 0; min-height: 65px; }

/* Messages */
.status { border-radius: 1.25rem; padding: 0.9rem 1.25rem; margin: 1.25rem 0; border: 1px solid var(--border); background: var(--card); }
.status:empty { display: none; }
.status.ok { background: color-mix(in oklab, var(--accent) 22%, var(--card)); border-color: color-mix(in oklab, var(--accent) 60%, var(--border)); }
.status.error { background: color-mix(in oklab, var(--destructive) 10%, var(--card)); border-color: var(--destructive); }
.status.info { background: var(--card); }

.draft-banner {
  display: inline-flex; align-items: center; gap: 0.5rem; margin: 0 0 1.5rem; padding: 0.35rem 0.9rem;
  border-radius: 999px; border: 1px solid color-mix(in oklab, var(--trawl) 55%, var(--border));
  background: color-mix(in oklab, var(--trawl) 14%, var(--card));
  font-family: var(--cl-mono); font-size: 0.75rem; letter-spacing: 0.02em;
}
.decide { background: color-mix(in oklab, var(--trawl) 25%, transparent); padding: 0 0.3em; border-radius: 0.3rem; font-weight: 600; }

/* Pricing (the plan cards are built by assets/js/pricing.js) */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1.25rem; margin: 1.75rem 0; }
.plan h3 { margin-top: 0; font-size: 1.5rem; }
.plan table { width: 100%; border-collapse: collapse; margin: 0.75rem 0 0.5rem; }
.plan th, .plan td { text-align: left; padding: 0.75rem 0; border-bottom: 1px solid var(--border); vertical-align: middle; font-weight: 500; }
.plan tr:last-child th, .plan tr:last-child td { border-bottom: 0; }
.plan td:last-child { text-align: right; }
.price { font-family: var(--cl-display); font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.plan button { min-height: 2.4rem; padding: 0.4rem 1.1rem; font-size: 0.875rem; }

/* Facts, keys, Macs */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.5rem; margin: 1rem 0; }
.facts dt { color: var(--muted-foreground); font-family: var(--cl-mono); font-size: 0.8rem; text-transform: uppercase; padding-top: 0.2rem; }
.facts dd { margin: 0; min-width: 0; }
.key { font-family: var(--cl-mono); font-size: 1.1rem; letter-spacing: 0.04em; word-break: break-all; }
.hash { font-family: var(--cl-mono); font-size: 0.85rem; word-break: break-all; }
.macs { list-style: none; padding: 0; margin: 0.5rem 0 1rem; }
.macs li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); margin: 0; }

/* Questions and release notes */
/* Scoped to main, so the header's menu (a details element too) is left alone. */
main details { margin: 0.6rem 0; border: 1px solid var(--border); background: var(--card); border-radius: 1rem; padding: 0.9rem 1.4rem; }
main summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
main summary::-webkit-details-marker { display: none; }
main summary::after { content: "+"; transition: transform .2s; }
main details[open] summary::after { transform: rotate(45deg); }
main details > :not(summary) { margin-top: 0.75rem; color: var(--muted-foreground); }
main details > :last-child { margin-bottom: 0; }
.notes-entry { margin-bottom: 2rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); }
.notes-entry h2 { margin: 0 0 0.25rem; }
.tag { display: inline-block; font-family: var(--cl-mono); font-size: 0.72rem; padding: 0.1rem 0.6rem; border-radius: 999px; border: 1px solid var(--border); color: var(--muted-foreground); vertical-align: middle; }

/* Legal pages and tables */
.legal h2 { font-size: clamp(1.35rem, 2.4vw, 1.6rem); margin-top: 2.75rem; }
.legal p, .legal li { color: color-mix(in oklab, var(--foreground) 82%, var(--muted-foreground)); }
.table-scroll { overflow-x: auto; margin: 1.25rem 0 2rem; border: 1px solid var(--border); border-radius: 1.5rem; background: var(--card); }
.table-scroll table, .legal table { border-collapse: collapse; width: 100%; font-size: 0.92rem; margin: 0; }
.table-scroll th, .table-scroll td, .legal td, .legal th { text-align: left; vertical-align: top; padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--border); }
.table-scroll tr:last-child > * { border-bottom: 0; }
.table-scroll thead th { font-family: var(--cl-mono); font-size: 0.72rem; font-weight: 400; text-transform: uppercase; color: var(--muted-foreground); }
.table-scroll tbody th { font-weight: 600; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 560px) {
  main.wrap { padding-top: 3rem; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 0.75rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
