/* Apex Solver site. Flat, one near-white accent (inverted to near-black in light mode), system fonts, no frameworks. */

:root {
  --bg: #f4f4f2;
  --surface: #fafaf8;
  --surface-2: #e9e9e5;
  --line: #d5d5d0;
  --line-strong: #a9a9a2;
  --text: #17191c;
  --muted: #52575e;
  --accent: #17191c;
  --accent-ink: #f6f6f4;
  --accent-hover: #2c3036;
  --danger: #a4271c;
  --danger-bg: #f8e6e2;
  --radius: 6px;
  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 32px);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111316;
    --surface: #16191d;
    --surface-2: #1c2025;
    --line: #2a2f36;
    --line-strong: #444b55;
    --text: #ecebe6;
    --muted: #a0a5ac;
    --accent: #f1f0eb;
    --accent-ink: #111316;
    --accent-hover: #d9d8d2;
    --danger: #ff9e92;
    --danger-bg: #2b1815;
  }
}

/* ---------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.015em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.5rem); letter-spacing: -.025em; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2.15rem); }
h3 { font-size: 1.075rem; letter-spacing: -.005em; }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.measure { max-width: 65ch; }

.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }

.skip { position: absolute; left: 8px; top: -60px; z-index: 30; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: var(--radius); font-weight: 600; }
.skip:focus { top: 8px; }

/* Placeholder marker: anything the owner must still fill in */
.ph {
  font-family: var(--mono);
  font-size: .85em;
  border: 1px dashed var(--line-strong);
  border-radius: 4px;
  padding: 0 .35em;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 44px; padding: 0 20px;
  border-radius: var(--radius); border: 1px solid transparent;
  font: 600 .95rem/1 var(--font); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), transform .12s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--text); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .875rem; }
.btn-lg { min-height: 52px; padding: 0 28px; font-size: 1.05rem; }
.btn[aria-disabled="true"], .btn:disabled { background: var(--surface-2); color: var(--muted); border-color: var(--line); cursor: not-allowed; transform: none; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.link-arrow { font-weight: 600; }
.link-arrow::after { content: " \2192"; }

/* ---------- header */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; text-decoration: none; font-size: 1.05rem; white-space: nowrap; }
.brand img { border-radius: 4px; }
.nav { margin-left: auto; }
.nav ul, .menu ul { list-style: none; margin: 0; padding: 0; }
.nav ul { display: flex; gap: 4px; }
.nav a { display: block; padding: 8px 12px; border-radius: var(--radius); text-decoration: none; color: var(--muted); font-size: .95rem; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.menu { display: none; position: relative; }
.menu summary {
  list-style: none; cursor: pointer; min-height: 40px; padding: 0 14px; display: inline-flex; align-items: center;
  border: 1px solid var(--line-strong); border-radius: var(--radius); font-weight: 600; font-size: .9rem;
}
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { background: var(--surface-2); }
.menu nav {
  position: fixed; left: 0; right: 0; top: 64px;
  background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px var(--gutter) 16px;
}
.menu nav a { display: block; padding: 12px 4px; text-decoration: none; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
.menu nav li:last-child a { border-bottom: 0; }
.menu nav a[aria-current="page"] { font-weight: 700; }

@media (max-width: 880px) {
  .nav { display: none; }
  .menu { display: block; }
  .nav-cta { margin-left: auto; }
}
@media (max-width: 420px) {
  .nav-cta { display: none; }
  .menu { margin-left: auto; }
}

/* ---------- sections */
.section { padding-block: clamp(56px, 8vw, 104px); border-top: 1px solid var(--line); }
.section-tight { padding-block: clamp(32px, 5vw, 56px); border-top: 0; }
.section-head { max-width: 65ch; margin-bottom: 32px; }
.eyebrow { font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.lede { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--muted); max-width: 52ch; }

.page-head { padding-top: clamp(40px, 6vw, 72px); padding-bottom: 8px; }
.page-head h1 { margin-bottom: .35em; }
.page-404 { min-height: 50vh; padding-bottom: 72px; }

/* ---------- hero */
.hero { padding-top: clamp(40px, 6vw, 80px); padding-bottom: clamp(48px, 7vw, 96px); }
.hero-copy { max-width: 880px; margin-bottom: clamp(32px, 5vw, 48px); }
.hero-copy h1 { max-width: 24ch; }
@media (prefers-reduced-motion: no-preference) {
  .hero-copy, .shot-hero { animation: rise .7s var(--ease) both; }
  .shot-hero { animation-delay: .08s; }
  @keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
}

/* ---------- screenshots */
.shot { margin: 0; }
.shot picture, .shot > img {
  display: block; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface);
}
.shot img { width: 100%; }
.shot figcaption { font-size: .875rem; color: var(--muted); margin-top: 10px; }
.shot-strip { margin-block: 24px 32px; }

/* ---------- split */
.split { display: grid; gap: 32px; align-items: center; }
.split-copy p { max-width: 52ch; }
@media (min-width: 900px) {
  .split { grid-template-columns: 5fr 7fr; gap: 56px; }
  .split-flip { grid-template-columns: 7fr 5fr; }
  .split-flip .split-copy { order: 2; }
}

.inline-list { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.inline-list li { border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 12px; font-size: .875rem; }

/* ---------- steps */
.steps { list-style: none; margin: 32px 0 0; padding: 0; display: grid; gap: 28px; counter-reset: step; }
.steps li { border-top: 2px solid var(--text); padding-top: 18px; counter-increment: step; }
.steps h3::before { content: counter(step) ".  "; color: var(--muted); font-family: var(--mono); font-weight: 400; }
.steps p { color: var(--muted); margin: 0; }
@media (min-width: 640px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .steps { grid-template-columns: repeat(4, 1fr); } }

/* ---------- facts (2x2 hairline grid) */
.facts { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 32px; }
.fact { background: var(--bg); padding: clamp(20px, 3vw, 32px); }
.fact-tint { background: var(--surface-2); }
.fact p { color: var(--muted); margin: 0; max-width: 52ch; }
.fact a { color: var(--text); }
@media (min-width: 720px) { .facts { grid-template-columns: 1fr 1fr; } }
@media (max-width: 719px) { .fact { background: var(--bg); } .fact:nth-child(even) { background: var(--surface-2); } }

/* ---------- features */
.feature-cols { display: grid; gap: 28px; }
.feature-cols p, .feature-grid p { color: var(--muted); margin: 0; }
@media (min-width: 800px) { .feature-cols { grid-template-columns: repeat(3, 1fr); gap: 40px; } }
.feature-grid { display: grid; gap: 28px 40px; margin-top: 28px; }
.feature-grid > div { padding-top: 16px; border-top: 1px solid var(--line); }
@media (min-width: 640px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .feature-grid { grid-template-columns: repeat(3, 1fr); } }

.spec { margin: 20px 0 0; display: grid; gap: 0; }
.spec > div { display: grid; gap: 4px; padding: 12px 0; border-top: 1px solid var(--line); }
.spec > div:last-child { border-bottom: 1px solid var(--line); }
.spec dt { font-weight: 600; }
.spec dd { margin: 0; color: var(--muted); }
@media (min-width: 640px) { .spec > div { grid-template-columns: 9rem 1fr; gap: 16px; } }
.spec-wide { max-width: 860px; margin-bottom: 24px; }
.compare-table dd span { display: block; }

/* ---------- FAQ */
.faq { border-top: 1px solid var(--line); margin-block: 16px 20px; max-width: 820px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; list-style: none; padding: 16px 40px 16px 0; position: relative; font-weight: 600;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  font: 400 1.4rem/1 var(--mono); color: var(--muted); transition: transform .2s var(--ease);
}
.faq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq details p { color: var(--muted); padding-bottom: 16px; margin: 0; max-width: 65ch; }
.faq details a { color: var(--text); }

/* ---------- CTA band */
.cta-band { background: var(--surface-2); }
.cta-row { display: grid; gap: 20px; align-items: center; }
.cta-row p { color: var(--muted); margin: 0; }
@media (min-width: 900px) { .cta-row { grid-template-columns: 1fr auto; } }

/* ---------- notices / alerts */
.notice { border: 1px solid var(--line); border-left: 3px solid var(--text); background: var(--surface-2); padding: 14px 16px; border-radius: var(--radius); margin: 0 0 24px; max-width: 860px; }
.notice p { margin: 0; }
.notice p + p { margin-top: .5em; }
.notice-legal { border-left-style: dashed; }
.notice-warn { border-left-color: var(--danger); }
.alert { border: 1px solid var(--danger); background: var(--danger-bg); color: var(--text); padding: 14px 16px; border-radius: var(--radius); margin-bottom: 24px; max-width: 860px; }
.alert strong { color: var(--danger); }
.alert .code { display: block; margin-top: 6px; font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.status-msg:empty { display: none; }
.status-msg { color: var(--muted); font-size: .9rem; margin: 12px 0 0; }

/* ---------- pricing */
.plans { display: grid; gap: 20px; }
@media (min-width: 800px) { .plans { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); } }
.plan { border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(22px, 3vw, 32px); background: var(--surface); display: flex; flex-direction: column; gap: 14px; }
.plan:first-child { border-color: var(--line-strong); }
.plan-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.plan h2 { font-size: 1.35rem; margin: 0; }
.plan-model { color: var(--muted); font-size: .9rem; margin: 0; }
.plan-price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 4px 0 0; }
.plan-price strong { font: 600 clamp(2rem, 4vw, 2.6rem)/1 var(--font-display); letter-spacing: -.02em; }
.plan-price span { color: var(--muted); }
.plan ul { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.plan li { padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.plan li strong { color: var(--text); font-weight: 600; }
.plan .btn { margin-top: auto; width: 100%; }
.badge { font: 600 .72rem/1 var(--mono); letter-spacing: .04em; text-transform: uppercase; border: 1px dashed var(--line-strong); color: var(--muted); padding: 5px 7px; border-radius: 4px; }
.sk { display: block; height: 14px; border-radius: 4px; background: var(--surface-2); }
.sk-title { width: 40%; height: 20px; }
.sk-price { width: 55%; height: 40px; }
.sk-btn { height: 44px; margin-top: 12px; }
@media (prefers-reduced-motion: no-preference) {
  .sk { animation: pulse 1.4s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: .5; } }
}

/* ---------- download */
.download-grid { display: grid; gap: 40px; }
@media (min-width: 900px) { .download-grid { grid-template-columns: 5fr 7fr; gap: 64px; align-items: start; } }
.download-card { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: clamp(22px, 3vw, 32px); background: var(--surface); }
.dl-version { display: grid; gap: 2px; margin-bottom: 4px; }
.dl-version strong { font: 600 1.6rem/1.2 var(--font-display); font-variant-numeric: tabular-nums; }
.download-card .btn { width: 100%; margin: 16px 0 4px; }
.numbered { padding-left: 1.3em; margin: 0 0 24px; }
.numbered li { margin-bottom: 14px; padding-left: 4px; color: var(--muted); }
.numbered li strong { color: var(--text); }

/* ---------- forms / account */
.account-grid { display: grid; gap: 40px; }
@media (min-width: 900px) { .account-grid { grid-template-columns: 7fr 5fr; gap: 64px; } }
.form { max-width: 560px; }
.form-gate { border: 0; margin: 0; padding: 0; min-width: 0; }
.form-gate:disabled { opacity: .6; }
.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field label { font-weight: 600; }
.field input {
  width: 100%; min-height: 48px; padding: 10px 14px;
  font: 500 1rem/1.3 var(--mono); letter-spacing: .03em; text-transform: uppercase;
  color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.field input::placeholder { color: var(--muted); opacity: 1; text-transform: none; }
.field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.help { margin: 0; font-size: .875rem; color: var(--muted); }
.field-error { margin: 0; font-size: .9rem; color: var(--danger); font-weight: 600; }
.aside-note { border-top: 2px solid var(--text); padding-top: 16px; }
.aside-note h2 { font-size: 1.1rem; }
.aside-note p { color: var(--muted); }
.aside-note a { color: var(--text); }
.btn[data-busy="true"] { opacity: .7; cursor: progress; }

.summary { display: flex; flex-wrap: wrap; gap: 16px 48px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 40px; max-width: 860px; }
.summary > div { min-width: 120px; }
.build-box { max-width: 860px; margin: 0 0 40px; }
.build-box p { color: var(--muted); max-width: 65ch; }
.build-box p[data-build-text] { color: var(--text); }
.build-box .btn { margin: 4px 0 12px; }
.summary dt { font-size: .8rem; color: var(--muted); }
.summary dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.machines { width: 100%; max-width: 860px; border-collapse: collapse; }
.machines th, .machines td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.machines th { font-size: .8rem; font-weight: 600; color: var(--muted); }
.machines td:last-child, .machines th:last-child { text-align: right; }
.machines .name { font-weight: 600; overflow-wrap: anywhere; }
.confirm { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.confirm span { font-size: .875rem; color: var(--muted); }
.empty { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 20px; color: var(--muted); max-width: 860px; }
@media (max-width: 639px) {
  .machines thead { display: none; }
  .machines, .machines tbody, .machines tr, .machines td { display: block; width: 100%; }
  .machines tr { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; background: var(--surface); }
  .machines td { border: 0; padding: 2px 0; text-align: left !important; }
  .machines td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
  .machines td:last-child { padding-top: 10px; }
  .machines td:last-child .btn { width: 100%; }
  .confirm { justify-content: flex-start; }
}

/* ---------- docs / prose */
.doc-layout { display: grid; gap: 32px; }
@media (min-width: 1000px) { .doc-layout { grid-template-columns: 220px 1fr; gap: 64px; align-items: start; } .toc { position: sticky; top: 88px; } }
.toc h2 { font-size: .85rem; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 5px 0 5px 14px; text-decoration: none; color: var(--muted); font-size: .95rem; }
.toc a:hover { color: var(--text); }
.prose { max-width: 70ch; }
.prose h2 { font-size: clamp(1.3rem, 2vw, 1.6rem); margin-top: 2em; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--muted); }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { color: var(--text); }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 8px; }

/* ---------- changelog */
.releases { display: grid; gap: 0; max-width: 820px; }
.release { display: grid; gap: 8px; padding: 28px 0; border-top: 1px solid var(--line); }
.release:first-child { border-top: 0; padding-top: 8px; }
.release header { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.release h2 { font-family: var(--mono); font-size: 1.3rem; letter-spacing: 0; margin: 0; }
.release header p { margin: 0; }
.release ul { margin: 0; padding-left: 1.2em; color: var(--muted); }
.release li { margin-bottom: 6px; }
@media (min-width: 760px) { .release { grid-template-columns: 200px 1fr; gap: 24px; } .release header { display: block; } }

/* ---------- footer */
.site-footer { border-top: 1px solid var(--line); padding-top: 48px; margin-top: 0; font-size: .925rem; }
.footer-grid { display: grid; gap: 32px; grid-template-columns: 1fr 1fr; }
.footer-brand { grid-column: 1 / -1; }
.footer-brand p { color: var(--muted); margin-top: 10px; max-width: 32ch; }
.site-footer h2 { font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 10px; letter-spacing: 0; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-footer nav a { text-decoration: none; overflow-wrap: anywhere; }
.site-footer nav a:hover { text-decoration: underline; }
.footer-base { border-top: 1px solid var(--line); margin-top: 40px; padding-block: 20px 28px; color: var(--muted); font-size: .85rem; }
.footer-base p { margin: 0; }
@media (min-width: 800px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } .footer-brand { grid-column: auto; } }
