/* =========================================================================
   The Invisible Engineer — styles
   Palette & type inspired by Anthropic / Claude (claude.ai & docs.claude.com).
   Claude's own faces (Styrene B, Galaxie Copernicus, Tiempos) are proprietary,
   so we use the closest royalty-free (SIL OFL) equivalents:
     - Inter      -> body / UI (grotesque sans, stands in for Styrene B)
     - Newsreader -> headings  (transitional serif, stands in for Copernicus/Tiempos)
   Anthropic warm ivory + clay palette drives the colours below.
   ========================================================================= */

/* ---------- Design tokens: LIGHT (default) ---------- */
:root {
  color-scheme: light;

  /* Anthropic warm neutrals */
  --bg:          #F0EEE6; /* signature Claude ivory */
  --surface:     #FBFAF5; /* card / content panel */
  --surface-2:   #F4F2EA;
  --border:      #E0DDD0;
  --border-strong:#D6D2C4;

  --text:        #1A1915; /* warm near-black */
  --text-muted:  #6E6A60;
  --text-subtle: #8B8578;

  /* Claude clay accent */
  --accent:        #D97757; /* Claude coral/clay */
  --accent-hover:  #C15F3C; /* Crail, darker */
  --accent-contrast:#FFFFFF;
  --accent-soft:   rgba(217, 119, 87, 0.10);

  --quote-bar:   var(--accent);
  --shadow:      0 1px 2px rgba(20, 19, 15, .04), 0 8px 28px rgba(20, 19, 15, .07);
  --ring:        rgba(217, 119, 87, .45);

  /* Type */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system,
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Newsreader", ui-serif, Georgia, "Times New Roman", serif;

  /* Layout */
  --measure: 68ch;
  --radius:  14px;
  --radius-sm: 10px;
}

/* ---------- Design tokens: DARK ---------- */
[data-theme="dark"] {
  color-scheme: dark;

  --bg:          #1B1A17; /* warm charcoal */
  --surface:     #242320;
  --surface-2:   #2B2A26;
  --border:      #38362F;
  --border-strong:#45423A;

  --text:        #ECEAE0;
  --text-muted:  #A8A296;
  --text-subtle: #857F73;

  --accent:        #E28B6D; /* lift coral for contrast on dark */
  --accent-hover:  #EDA184;
  --accent-contrast:#1B1A17;
  --accent-soft:   rgba(226, 139, 109, 0.14);

  --quote-bar:   var(--accent);
  --shadow:      0 1px 2px rgba(0,0,0,.30), 0 10px 30px rgba(0,0,0,.45);
  --ring:        rgba(226, 139, 109, .55);
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: clamp(1rem, 0.96rem + 0.25vw, 1.125rem);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
  min-height: 100dvh;
}

/* Subtle warm gradient wash behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 50% at 100% 0%, var(--accent-soft), transparent 70%),
    radial-gradient(50% 40% at 0% 100%, var(--accent-soft), transparent 70%);
  pointer-events: none;
}

::selection { background: var(--accent); color: var(--accent-contrast); }

/* ---------- Skip link (a11y) ---------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: .5rem;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: .6rem 1rem;
  border-radius: var(--radius-sm);
  z-index: 100;
}
.skip-link:focus { left: .75rem; }

/* ---------- Layout shell ---------- */
.page {
  width: 100%;
  max-width: 900px;
  margin-inline: auto;
  padding: clamp(1rem, 4vw, 2.5rem);
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}
.brandmark {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  font-size: .95rem;
}
.brandmark .dot {
  width: .85rem; height: .85rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  flex: none;
}

/* ---------- Theme switcher (segmented control) ---------- */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.theme-switch button {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease;
}
.theme-switch button:hover { color: var(--text); }
.theme-switch button svg { width: 17px; height: 17px; display: block; }
.theme-switch button[aria-checked="true"] {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow);
}
.theme-switch button:focus-visible,
.brandmark:focus-visible,
a:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------- Content card ---------- */
.container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.4rem, 5vw, 3.25rem);
  overflow: hidden; /* keep the accent rule inside rounded corners */
}

/* ---------- Hero ---------- */
.hero { text-align: center; margin-bottom: clamp(1.75rem, 5vw, 3rem); }
.eyebrow {
  display: inline-block;
  font-size: .74rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1rem;
}
h1 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(2.15rem, 1.4rem + 3.4vw, 3.75rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 .75rem;
  color: var(--text);
}
.lede {
  color: var(--text-muted);
  font-style: italic;
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem);
  max-width: 46ch;
  margin: 0 auto;
}

/* ---------- Sections ---------- */
main { max-width: var(--measure); margin-inline: auto; }
section + section { margin-top: clamp(2.25rem, 6vw, 3.5rem); }

h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(1.5rem, 1.15rem + 1.6vw, 2.15rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 1rem;
  color: var(--text);
}
h2::before {
  content: "";
  display: block;
  width: 2.5rem;
  height: 3px;
  border-radius: 3px;
  background: var(--accent);
  margin-bottom: 1rem;
}

p { margin: 0 0 1.15rem; }
p:last-child { margin-bottom: 0; }

/* Opening statement paragraph — larger, editorial lead */
.statement {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 1.05rem + 1.35vw, 1.85rem);
  line-height: 1.42;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 clamp(2rem, 5vw, 2.75rem);
}

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

/* ---------- Blockquotes ---------- */
blockquote {
  margin: 1.75rem 0;
  padding: 1.1rem 1.4rem;
  border-left: 3px solid var(--quote-bar);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.1rem, 1.02rem + 0.5vw, 1.3rem);
  line-height: 1.5;
  color: var(--text);
}
blockquote p { margin: 0; }
blockquote cite {
  display: block;
  margin-top: .75rem;
  font-family: var(--font-sans);
  font-style: normal;
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--text-muted);
}
blockquote cite::before { content: "— "; }

/* ---------- Divider ---------- */
.rule {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: clamp(2.25rem, 6vw, 3.5rem) 0;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  margin-top: clamp(1.75rem, 5vw, 2.75rem);
  color: var(--text-subtle);
  font-size: .85rem;
}
.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* ---------- Small screens ---------- */
@media (max-width: 420px) {
  .brandmark span.label { display: none; }
  .topbar { margin-bottom: 1.25rem; }
}
