/* =========================================================
   1. THEME VARIABLES
   Edit colors, fonts, spacing, shadows, and radius here.
   ========================================================= */
:root {
  /* Fonts */
  --font-body: Inter, system-ui, sans-serif;
  --font-display: "IBM Plex Mono", monospace;
  --font-serif: "Playfair Display", Georgia, serif;

  /* Light Theme Colors */
  --bg: #f7f4ec;
  --bg-wash: #eef4f0;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --ink: #142026;
  --ink-soft: #33464f;
  --muted: #6b7a80;

  /* Accents */
  --accent: #2aa89a;
  --accent-2: #7c5cff;
  --accent-3: #b36b3d;
  --accent-soft: rgba(42, 168, 154, 0.14);
  --accent-2-soft: rgba(124, 92, 255, 0.12);

  /* Lines and shadows */
  --line: rgba(20, 32, 38, 0.12);
  --line-strong: rgba(20, 32, 38, 0.2);
  --shadow-soft: 0 20px 60px rgba(20, 32, 38, 0.1);
  --shadow-subtle: 0 10px 28px rgba(20, 32, 38, 0.07);

  /* Layout */
  --max-width: 1200px;
  --content-width: 820px;
  --header-height: 76px;
  --section-padding: 92px 20px;
  --radius-card: 8px;
  --radius-pill: 999px;

  /* Scroll fade */
  --scroll-fade-size: 120px;
  --scroll-fade-color: var(--bg);
}

/*
html[data-theme="dark"] {
  --bg: #101719;
  --bg-wash: #141f22;
  --surface: rgba(23, 32, 35, 0.76);
  --surface-strong: rgba(23, 32, 35, 0.94);
  --ink: #eff7f4;
  --ink-soft: #c4d5d0;
  --muted: #91a5a0;
  --line: rgba(239, 247, 244, 0.14);
  --line-strong: rgba(239, 247, 244, 0.24);
  --scroll-fade-color: var(--bg);
}
*/

/* =========================================================
   2. BASE RESET
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  background: linear-gradient(135deg, var(--bg), var(--bg-wash) 54%, #f3efe2);
  line-height: 1.6;
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

/* =========================================================
   3. TYPOGRAPHY
   ========================================================= */
h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2 {
  max-width: 920px;
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(3.3rem, 9vw, 8rem);
}

h2 {
  font-size: clamp(2.2rem, 5vw, 4.7rem);
}

h3 {
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.2;
}

p {
  color: var(--ink-soft);
}

.section-kicker {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-lede,
.hero-lede {
  max-width: 720px;
  color: var(--ink-soft);
  font-size: clamp(1.08rem, 2vw, 1.32rem);
  line-height: 1.55;
}

/* =========================================================
   4. LAYOUT
   ========================================================= */
#site-main {
  position: relative;
  z-index: 1;
}

.section {
  position: relative;
  min-height: 60vh;
  padding: var(--section-padding);
  scroll-margin-top: 96px;
}

.section-inner {
  width: min(100%, var(--max-width));
  margin: 0 auto;
}

.section-heading {
  display: grid;
  gap: 18px;
  max-width: var(--content-width);
  margin-bottom: 34px;
}

.noscript-message,
.include-error {
  width: min(calc(100% - 40px), var(--content-width));
  margin: 96px auto 0;
  padding: 18px 20px;
  color: #5b2f22;
  background: rgba(255, 240, 226, 0.9);
  border: 1px solid rgba(179, 107, 61, 0.36);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-subtle);
}

/* =========================================================
   5. HEADER / NAVIGATION
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--header-height);
  padding: 16px clamp(16px, 4vw, 42px);
  background: rgba(247, 244, 236, 0.78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
}

.brand__mark {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(10px, 2vw, 24px);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 500;
}

.site-nav a {
  padding: 8px 0;
  transition: color 180ms ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--ink);
}

/* =========================================================
   6. SCROLL PROGRESS + FADE FRAME
   ========================================================= */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1002;
  width: 100%;
  height: 3px;
  background: transparent;
}

.scroll-progress__bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  transform-origin: left center;
}

.scroll-frame {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 998;
}

.scroll-frame::before,
.scroll-frame::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: var(--scroll-fade-size);
}

.scroll-frame::before {
  top: 0;
  background: linear-gradient(to bottom, var(--scroll-fade-color), transparent);
}

.scroll-frame::after {
  bottom: 0;
  background: linear-gradient(to top, var(--scroll-fade-color), transparent);
}

/* =========================================================
   7. BACKGROUND LOGO
   ========================================================= */
.background-logo {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 0;
  width: min(76vw, 720px);
  color: var(--ink);
  opacity: 0.17;
  transform: translate3d(-50%, -50%, 0) rotate(0deg);
  transform-origin: center;
  pointer-events: none;
  will-change: transform, opacity;
}

.background-logo :is(img, svg) {
  display: block;
  width: 100%;
  height: auto;
}

.site-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 34px clamp(16px, 4vw, 42px);
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.site-footer p {
  color: var(--muted);
  font-size: 0.88rem;
}

.footer-links {
  display: flex;
  gap: 16px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--ink);
}

/* =========================================================
   8. HERO
   ========================================================= */
.section-hero {
  display: grid;
  align-items: center;
  min-height: calc(100vh - var(--header-height));
  padding-top: 64px;
}

.hero-layout {
  display: grid;
  gap: 26px;
  width: min(100%, var(--max-width));
  margin: 0 auto;
}

.hero-actions,
.connect-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-2px);
}

.button-primary {
  color: #fff;
  background: #183338;
  border-color: #183338;
}

.button-secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.52);
}

/* =========================================================
   9. CARDS / PAPER SURFACES
   ========================================================= */
.paper,
.content-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px);
}

.paper {
  display: grid;
  gap: 20px;
  width: min(100%, var(--content-width));
  margin: 0 auto;
  padding: clamp(24px, 5vw, 54px);
}

.paper p + p {
  margin-top: 4px;
}

.paper-split {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  align-items: start;
  width: min(100%, var(--max-width));
  gap: clamp(24px, 5vw, 64px);
}

.content-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 158px;
  padding: 22px;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.content-card:hover {
  transform: translateY(-3px);
  border-color: rgba(42, 168, 154, 0.34);
  box-shadow: 0 24px 70px rgba(20, 32, 38, 0.13);
}

.content-card p {
  font-size: 0.96rem;
}

/* =========================================================
   10. GRIDS / FLOW STACK
   ========================================================= */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.card-grid-wide {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.flow-stack {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.flow-card {
  position: relative;
  display: grid;
  min-height: 72px;
  place-items: center;
  padding: 14px 10px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.flow-card::after {
  content: "";
  position: absolute;
  right: -11px;
  width: 11px;
  height: 1px;
  background: var(--line-strong);
}

.flow-card:last-child::after {
  display: none;
}

/* =========================================================
   11. SECTION-SPECIFIC STYLES
   ========================================================= */
.section-philosophy,
.section-vision {
  min-height: auto;
}

.section-cognition-model .paper {
  width: min(100%, 1040px);
}

.section-experiments {
  padding-top: 72px;
}

.note-list {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.note-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.note-item span {
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.note-item strong {
  color: var(--ink);
  font-weight: 600;
}

/* =========================================================
   12. REVEAL ANIMATIONS
   ========================================================= */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* =========================================================
   13. PARTICLE CANVAS
   ========================================================= */
.particle-canvas {
  position: fixed;
  inset: 0;
  z-index: 997;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* =========================================================
   14. RESPONSIVE RULES
   ========================================================= */
@media (max-width: 900px) {
  :root {
    --section-padding: 76px 18px;
    --scroll-fade-size: 92px;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .card-grid,
  .card-grid-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow-stack {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .flow-card::after {
    display: none;
  }

  .paper-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  :root {
    --header-height: 112px;
    --section-padding: 64px 16px;
  }

  h1 {
    font-size: clamp(3rem, 17vw, 5rem);
  }

  .brand__text {
    font-size: 0.86rem;
  }

  .site-nav {
    gap: 16px;
    font-size: 0.74rem;
  }

  .section-hero {
    min-height: calc(100vh - var(--header-height));
  }

  .paper {
    padding: 24px;
  }

  .card-grid,
  .card-grid-wide,
  .flow-stack {
    grid-template-columns: 1fr;
  }

  .note-item {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* =========================================================
   15. REDUCED MOTION RULES
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .particle-canvas {
    display: none;
  }
}
