/* OpenSpec UI homepage.
   Palette is defined once on :root; the dark block only redefines tokens, so a
   colour can never exist in one theme and not the other. */

:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --surface: #ffffff;
  --border: #e3e6ea;
  --text: #14161a;
  --text-muted: #5d646e;
  --accent: #2f6feb;
  --accent-contrast: #ffffff;
  --ok-bg: #e7f5ec;
  --ok-text: #14683a;
  --err-bg: #fdeceb;
  --err-text: #a12622;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .05);

  --wrap: 1080px;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216;
    --bg-alt: #151a20;
    --surface: #171d24;
    --border: #262e37;
    --text: #e8ecf1;
    --text-muted: #98a2af;
    --accent: #6c9bff;
    --accent-contrast: #0f1216;
    --ok-bg: #10291c;
    --ok-text: #6ede9f;
    --err-bg: #2b1614;
    --err-text: #ff9b93;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
  }
}

:root[data-theme="dark"] {
  --bg: #0f1216;
  --bg-alt: #151a20;
  --surface: #171d24;
  --border: #262e37;
  --text: #e8ecf1;
  --text-muted: #98a2af;
  --accent: #6c9bff;
  --accent-contrast: #0f1216;
  --ok-bg: #10291c;
  --ok-text: #6ede9f;
  --err-bg: #2b1614;
  --err-text: #ff9b93;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
a { color: var(--accent); }

h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 .5em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 0 0 1rem; }
h3 { font-size: 1.125rem; margin: 0 0 .5rem; }

code, .mono { font-family: var(--mono); font-size: .92em; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: 680px; }
.muted { color: var(--text-muted); }

.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;
}

/* Off-canvas rather than display:none — automated submitters commonly skip
   hidden inputs, and skipping is exactly what we do not want them to do. */
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.skip-link {
  position: absolute; left: -9999px;
  background: var(--accent); color: var(--accent-contrast);
  padding: 10px 16px; border-radius: 0 0 var(--radius) 0; z-index: 10;
}
.skip-link:focus { left: 0; top: 0; }

/* --- Header ------------------------------------------------------------ */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 5;
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 650; color: var(--text); text-decoration: none;
}
.brand-mark { color: var(--accent); font-size: 1.2em; }
.nav { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; margin-left: auto; }
.nav a { color: var(--text-muted); text-decoration: none; font-size: .95rem; }
.nav a:hover { color: var(--text); }
.theme-toggle {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  border-radius: var(--radius); width: 36px; height: 36px; cursor: pointer;
}
.theme-toggle:hover { color: var(--text); }

@media (max-width: 640px) {
  .nav { display: none; }
}

/* --- Sections ---------------------------------------------------------- */

.hero { padding: 72px 0 56px; }
.section { padding: 64px 0; }
.section.alt { background: var(--bg-alt); }

.eyebrow {
  text-transform: uppercase; letter-spacing: .08em;
  font-size: .78rem; font-weight: 650; color: var(--accent); margin: 0 0 12px;
}
.lede { font-size: 1.125rem; color: var(--text-muted); max-width: 62ch; margin: 0 0 28px; }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 32px; }

.button {
  display: inline-block; padding: 11px 20px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  text-decoration: none; font-weight: 550; font-size: .95rem;
  cursor: pointer;
}
.button:hover { border-color: var(--accent); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.button.primary:hover { filter: brightness(1.08); }
.button.small { padding: 7px 14px; font-size: .88rem; }

/* --- Versions ---------------------------------------------------------- */

.version-chips { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0; }
.chip {
  display: inline-flex; align-items: baseline; gap: 8px;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; background: var(--surface); font-size: .87rem;
}
.chip-name { color: var(--text-muted); }
.chip-version { font-family: var(--mono); font-weight: 600; color: var(--accent); }
.chip time { color: var(--text-muted); font-size: .82rem; }

.release-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.release-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 22px; box-shadow: var(--shadow);
}
.release-card header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.release-card h3 { margin: 0; }
.version-badge {
  font-family: var(--mono); font-size: .82rem; font-weight: 600;
  color: var(--accent); background: var(--bg-alt);
  border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px;
}
.change-list { list-style: none; margin: 14px 0; padding: 0; font-size: .92rem; }
.change-list li { display: flex; gap: 8px; margin-bottom: 6px; }
.change-kind {
  flex: none; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
  border-radius: 4px; padding: 1px 6px; height: fit-content; margin-top: 3px;
  background: var(--bg-alt); border: 1px solid var(--border); color: var(--text-muted);
}
.kind-major { color: var(--err-text); }
.kind-minor { color: var(--accent); }
.card-links { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 16px 0 0; font-size: .9rem; }

/* --- Screenshots ------------------------------------------------------- */

.tab-list { display: flex; gap: 6px; margin-bottom: 24px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  padding: 8px 16px; border-radius: var(--radius); cursor: pointer; font-size: .92rem;
  font-family: inherit;
}
.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

/* Without scripting every panel stays visible, each under its own heading;
   the tab script hides the inactive ones and the headings with them. */
.js-on .panel-heading { display: none; }
.tab-panel + .tab-panel { margin-top: 40px; }

.shots { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.shots figure { margin: 0; }
.shots img {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); background: var(--surface);
}
.shots figcaption { margin-top: 8px; font-size: .87rem; color: var(--text-muted); }

/* --- Features and FAQ -------------------------------------------------- */

.feature-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.feature p { margin: 0; color: var(--text-muted); }
.feature-icon { font-size: 1.4rem; display: block; margin-bottom: 8px; }

.faq-item { border-bottom: 1px solid var(--border); padding: 16px 0; }
.faq-item summary { cursor: pointer; font-weight: 600; }
.faq-item p { color: var(--text-muted); }

/* --- Forms ------------------------------------------------------------- */

.inline-form { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 12px; }
.inline-form input[type="email"] { flex: 1 1 260px; }

.stacked-form { margin: 20px 0 12px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .9rem; font-weight: 550; margin-bottom: 6px; }

input[type="email"], input[type="text"], textarea {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 1rem;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--err-text); }
textarea { resize: vertical; }

.form-msg { border-radius: var(--radius); padding: 11px 14px; margin: 8px 0 0; font-size: .92rem; }
.form-ok { background: var(--ok-bg); color: var(--ok-text); }
.form-err { background: var(--err-bg); color: var(--err-text); }
.field-errors { font-size: .87rem; color: var(--err-text); margin: 8px 0 0; padding-left: 20px; }
.fine-print { font-size: .85rem; color: var(--text-muted); margin: 10px 0 0; }

/* --- Footer ------------------------------------------------------------ */

.site-footer { border-top: 1px solid var(--border); padding: 32px 0; margin-top: 24px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; font-size: .9rem; }
.footer-inner p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
