/* ============================================================================
   Test0 site styles
   ----------------------------------------------------------------------------
   - Single stylesheet, no preprocessor, no build step.
   - Light + dark theme via CSS custom properties on [data-theme].
   - Default theme follows the OS preference; user can override via the toggle
     in the header (see theme.js).
   - Edit colour tokens in :root and [data-theme="dark"] to retune the palette;
     everything downstream uses the tokens.
   - Normal contrast — body text is at least WCAG AA against the background.
   ========================================================================= */

/* ---------- Tokens: light theme (default) -------------------------------
   Palette is brand-driven, not generic-tech-blue.
   Accent = #2728d8 (the indigo from the app's test0.svg).
   Surfaces are warm paper / charcoal — explicitly NOT neutral-grey, so
   the page reads as a distinct product site rather than a default
   docs/chat layout.
   ----------------------------------------------------------------------- */

:root {
  /* Surfaces — warm whites */
  --bg:           #f6f3ec;     /* warm paper */
  --bg-elevated:  #fffdf7;     /* cards a touch lighter than bg */
  --bg-subtle:    #ece7d8;     /* zebra rows, hover states */
  --border:       #d4cdb8;

  /* Text */
  --fg:           #1a1a23;     /* near-black with cool tint vs warm bg */
  --fg-muted:     #4a4a55;
  --fg-subtle:    #777283;

  /* Accents (brand indigo) */
  --accent:       #2728d8;     /* primary brand colour from test0.svg */
  --accent-hover: #1a1ba8;
  --accent-fg:    #ffffff;     /* text on accent backgrounds */

  /* Status — pulled toward warm tones so they fit the palette */
  --ok:    #2e7d32;
  --warn:  #c0610b;
  --err:   #c0312f;

  /* Layout */
  --maxw: 880px;          /* content column max width */
  --radius: 6px;
  --gap: 1rem;

  /* Type */
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
               Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "Consolas", "Source Code Pro",
               monospace;
}

/* ---------- Tokens: dark theme -------------------------------------------
   Dashboard-inspired: warm near-black base (think dashboard at night),
   brand indigo lifted to a brighter shade for readability on dark.
   ------------------------------------------------------------------------ */

[data-theme="dark"] {
  --bg:           #15161d;     /* near-black, slight cool tint */
  --bg-elevated:  #1d1e27;
  --bg-subtle:    #262833;
  --border:       #353746;

  --fg:           #e8e6df;     /* warm off-white, easy on the eyes */
  --fg-muted:     #a8a59c;
  --fg-subtle:    #6f6c63;

  --accent:       #7b7cff;     /* indigo, lightened for dark-bg legibility */
  --accent-hover: #9c9dff;
  --accent-fg:    #0d0e16;

  --ok:    #66bb6a;
  --warn:  #ffa726;
  --err:   #ef5350;
}

/* ---------- Reset (minimal) -------------------------------------------- */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  /* Prevent FOUC when theme.js applies stored choice. */
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* ---------- Layout: header + main + footer ----------------------------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.site-header-inner,
.site-main,
.site-footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1rem 1.25rem;
}

.site-header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand img {
  height: 28px;
  width: 28px;
  display: block;
}

.brand:hover { color: var(--accent); }

.nav {
  display: flex;
  gap: 1.25rem;
  flex: 1;
}

.nav a {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--accent);
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  border-radius: var(--radius);
  padding: 0.35rem 0.7rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--fg);
  border-color: var(--accent);
}

.site-main {
  padding-top: 2rem;
  padding-bottom: 4rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--fg-subtle);
  font-size: 0.85rem;
}

.site-footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer a { color: var(--fg-muted); }

/* ---------- Typography ------------------------------------------------- */

h1, h2, h3, h4 {
  color: var(--fg);
  line-height: 1.25;
  margin: 2rem 0 0.75rem;
}

h1 { font-size: 2rem;   letter-spacing: -0.02em; margin-top: 0; }
h2 { font-size: 1.4rem; letter-spacing: -0.01em; }
h3 { font-size: 1.1rem; }

p   { margin: 0 0 1rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.4rem; }
li  { margin-bottom: 0.3rem; }

a {
  color: var(--accent);
  text-underline-offset: 2px;
}
a:hover { color: var(--accent-hover); }

code, pre, kbd {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background: var(--bg-subtle);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  overflow-x: auto;
  line-height: 1.45;
}

pre code {
  background: transparent;
  padding: 0;
}

kbd {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.05em 0.4em;
  font-size: 0.85em;
}

blockquote {
  margin: 1rem 0;
  padding: 0.4rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--fg-muted);
  background: var(--bg-elevated);
  border-radius: 0 var(--radius) var(--radius) 0;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ---------- Hero (used on the landing page) ----------------------------
   The hero pairs a large logo with the headline + tagline. On narrow
   screens the logo stacks above the text so it doesn't squish.
   ----------------------------------------------------------------------- */

.hero {
  padding: 2.5rem 0 1.5rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem 2rem;
  align-items: center;
}
.hero .hero-logo {
  width: 140px;
  height: 140px;
  display: block;
}
.hero .hero-text { grid-column: 2; }
.hero .hero-text h1 { margin-top: 0; }
.hero .tagline {
  font-size: 1.15rem;
  color: var(--fg-muted);
  max-width: 36em;
  margin-bottom: 1.5rem;
}
.hero .cta-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .hero .hero-text { grid-column: 1; }
  .hero .hero-logo { width: 96px; height: 96px; }
}

/* ---------- Buttons ---------------------------------------------------- */

.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--fg);
  text-decoration: none;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.1s ease, border-color 0.1s ease;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-fg);
}

/* ---------- Feature grid (landing page) -------------------------------- */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1rem 0 2rem;
}

.feature {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.feature h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.feature p  { margin: 0; color: var(--fg-muted); font-size: 0.92rem; }

/* ---------- Download cards (downloads.html) ---------------------------- */

.download {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
}

.download h3 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.download .meta {
  color: var(--fg-subtle);
  font-size: 0.85rem;
  font-family: var(--font-mono);
}
.download p { margin: 0.3rem 0 0; color: var(--fg-muted); font-size: 0.92rem; }

@media (max-width: 520px) {
  .download {
    grid-template-columns: 1fr;
  }
}

/* ---------- Tables (docs etc.) ---------------------------------------- */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

th, td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--fg-muted);
  font-weight: 600;
  background: var(--bg-subtle);
}

/* ---------- Utilities -------------------------------------------------- */

.muted    { color: var(--fg-muted); }
.subtle   { color: var(--fg-subtle); }
.small    { font-size: 0.88rem; }
.center   { text-align: center; }
.callout  {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 1rem 0;
}
.callout-warn { border-left: 3px solid var(--warn); }
.callout-info { border-left: 3px solid var(--accent); }
