/* Lydian shared theme
   Used by every Lydian site (consulting and Labs). It holds the colour and
   type tokens, base elements, buttons, the header, the footer and cards.
   Page-specific layout lives in each site's own stylesheet.

   Two themes, switched by tokens only:
     dark   deep navy ground, cyan for structure, amber for emphasis
     light  warm paper ground, burnt orange for structure, blue for emphasis
   The page follows the visitor's system setting; the header toggle overrides
   it by setting data-theme="light" or "dark" on <html> (shared/site.js).
   When you change a light value, change it in BOTH light blocks below. */

:root {
  color-scheme: dark;
  --bg: #060a12;
  --bg-alt: #0a101c;
  --panel: #0d1524;
  --line: rgba(148, 190, 233, 0.16);
  --line-strong: rgba(148, 190, 233, 0.32);
  --text: #e8f0fa;
  --text-soft: #cfdaea;
  --text-dim: #9aabc0;
  --accent: #45e0ff;
  --accent-dim: rgba(69, 224, 255, 0.14);
  --accent-2: #ffb03a;
  --btn-bg: #45e0ff;
  --btn-bg-hover: #7beaff;
  --on-accent: #06121a;
  --header-bg: rgba(6, 10, 18, 0.86);
  --logo-accent: #f78b45;
  /* Hero animation colours, as "r,g,b" so the script can vary their opacity */
  --hero-bg: #060a12;
  --hero-a: 69, 224, 255;
  --hero-b: 255, 176, 58;
  --hero-fill: 1;   /* 1 = lit cells are filled solid (dark), 0 = soft fill under a ring (light) */
  --hero-lit: 0;    /* light only: strength of the soft fill on lit cells */
  --hero-tint: 0;   /* light only: faint fill on every cell, by its score */
  --hero-wash: 0;   /* light only: faint wash towards the right edge */

  --font-display: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "Cascadia Code", Consolas, monospace;
  --header-h: 76px;
  --radius: 10px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f6f5f2;
    --bg-alt: #eceae4;
    --panel: #ffffff;
    --line: #dcd9d2;
    --line-strong: #b9b4a8;
    --text: #121820;
    --text-soft: #2a3442;
    --text-dim: #4a5563;
    --accent: #a8430a;
    --accent-dim: rgba(244, 123, 42, 0.13);
    --accent-2: #1f5f99;
    --btn-bg: #f47b2a;
    --btn-bg-hover: #f78b45;
    --on-accent: #1a0f06;
    --header-bg: rgba(255, 255, 255, 0.92);
    --hero-bg: #ffffff;
    --hero-a: 244, 123, 42;
    --hero-b: 31, 95, 153;
    --hero-fill: 0;
    --hero-lit: 0.36;
    --hero-tint: 0.10;
    --hero-wash: 0.05;
  }
  /* Areas that stay dark navy on a light page: the Labs header and the footers */
  :root:not([data-theme="dark"]) .on-dark {
    --bg: #0f1620;
    --panel: #141c27;
    --line: #263040;
    --line-strong: #46536a;
    --text: #f2f1ee;
    --text-dim: #b3bcc8;
    --accent: #f78b45;
    --header-bg: rgba(15, 22, 32, 0.95);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f5f2;
  --bg-alt: #eceae4;
  --panel: #ffffff;
  --line: #dcd9d2;
  --line-strong: #b9b4a8;
  --text: #121820;
  --text-soft: #2a3442;
  --text-dim: #4a5563;
  --accent: #a8430a;
  --accent-dim: rgba(244, 123, 42, 0.13);
  --accent-2: #1f5f99;
  --btn-bg: #f47b2a;
  --btn-bg-hover: #f78b45;
  --on-accent: #1a0f06;
  --header-bg: rgba(255, 255, 255, 0.92);
  --hero-bg: #ffffff;
  --hero-a: 244, 123, 42;
  --hero-b: 31, 95, 153;
  --hero-fill: 0;
  --hero-lit: 0.36;
  --hero-tint: 0.10;
  --hero-wash: 0.05;
}
:root[data-theme="light"] .on-dark {
  --bg: #0f1620;
  --panel: #141c27;
  --line: #263040;
  --line-strong: #46536a;
  --text: #f2f1ee;
  --text-dim: #b3bcc8;
  --accent: #f78b45;
  --header-bg: rgba(15, 22, 32, 0.95);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
code { font-family: var(--font-mono); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }

.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 32px;
}

.c-accent { color: var(--accent); }
.c-accent-2 { color: var(--accent-2); }

.eyebrow {
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 26px;
  border-radius: 6px;
  border: 1px solid transparent;
  font: 600 16px/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-primary { background: var(--btn-bg); color: var(--on-accent); }
.btn-primary:hover { background: var(--btn-bg-hover); }
.btn-outline { border-color: var(--text); color: var(--text); min-height: 44px; padding: 0 18px; font-size: 15px; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-text { color: var(--text); padding: 0 6px; font-weight: 500; text-decoration: underline; text-underline-offset: 4px; }
.btn-text:hover { color: var(--accent); }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--header-bg);
  color: var(--text);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-row { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.logo { height: 26px; width: auto; display: block; flex: none; }
.logo .logo-letters { stroke: currentColor; }
.logo .logo-dot { fill: currentColor; }
.logo .logo-brackets { stroke: var(--logo-accent); }
.brand-sub { font-weight: 500; font-size: 14px; color: var(--text-dim); white-space: nowrap; }
.brand-tag { font-weight: 600; font-size: 13px; letter-spacing: 0.18em; color: var(--logo-accent); }
.site-nav { display: flex; align-items: center; gap: 28px; }
.site-nav a:not(.btn) { color: var(--text); text-decoration: none; font-size: 15px; padding: 12px 0; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.site-nav .btn { white-space: nowrap; }
.site-nav a:not(.btn):hover { color: var(--accent); }
.site-nav a[aria-current="page"] { color: var(--accent); }
.ext-icon { width: 14px; height: 14px; flex: none; }
.header-tools { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 1px solid transparent; border-radius: 6px; color: var(--text); cursor: pointer; padding: 0; }
.icon-btn:hover { border-color: var(--line-strong); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .icon-moon { display: none; }
.menu-btn { display: none; border-color: var(--line-strong); flex-direction: column; gap: 5px; }
.menu-btn span { display: block; width: 20px; height: 2px; background: currentColor; }

/* Sections */
.section { padding: 96px 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { display: flex; flex-direction: column; gap: 14px; max-width: 720px; margin-bottom: 48px; }
.section h2 { font-size: clamp(28px, 3vw, 40px); line-height: 1.15; }

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}
.card h3 { font-size: 21px; line-height: 1.25; letter-spacing: 0; }
.card p { color: var(--text-dim); font-size: 15px; }

/* Footer */
.site-footer { padding: 48px 0; background: var(--bg); color: var(--text-dim); font-size: 14px; border-top: 1px solid var(--line); }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px; }
.footer-row > div { display: flex; flex-direction: column; gap: 10px; max-width: 400px; }
.footer-brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.footer-brand .logo { height: 22px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: flex-start; }
.site-footer a { color: var(--text); }
.site-footer nav a { text-decoration: none; padding: 6px 0; }
.site-footer nav a:hover { color: var(--accent); }

/* Light theme: show the moon (switch to dark) instead of the sun */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="dark"]) .theme-toggle .icon-moon { display: block; }
}
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* Just above the menu breakpoint the full nav is tight: drop the wordmark's sub-label */
@media (max-width: 1040px) {
  .site-header .brand-sub { display: none; }
  .site-nav { gap: 22px; }
}

@media (max-width: 900px) {
  .container { padding: 0 20px; }
  .section { padding: 56px 0; }
  .section-head { margin-bottom: 28px; }
  .card { padding: 20px; }
  .card h3 { font-size: 18px; }
  .footer-row { gap: 20px; }
  .site-header .brand-sub { display: none; }

  /* Collapsing menu */
  .menu-btn { display: inline-flex; }
  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 20px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .site-nav.is-open { display: flex; }
  .site-nav a:not(.btn) { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .site-nav .btn { margin-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .card { transition: none; }
}
