/* ===== DESIGN TOKENS ===== */
:root {
  /* Type scale */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.5rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 5rem);

  /* Spacing */
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem;
  --space-12: 3rem; --space-16: 4rem; --space-20: 5rem; --space-24: 6rem; --space-32: 8rem;

  /* Content widths */
  --content-narrow: 680px;
  --content-default: 960px;
  --content-wide: 1200px;

  /* Radius */
  --radius-sm: 0.375rem; --radius-md: 0.5rem; --radius-lg: 0.75rem; --radius-xl: 1rem;

  /* Transition */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Font families */
  --font-display: 'Zodiak', 'Georgia', serif;
  --font-body: 'Satoshi', 'Inter', 'Helvetica Neue', sans-serif;
}

/* ===== LIGHT MODE (default) ===== */
:root, [data-theme='light'] {
  --color-bg: #faf8f4;
  --color-surface: #f3f0ea;
  --color-surface-2: #ece8e0;
  --color-border: #ddd8ce;
  --color-divider: #e5e0d7;

  --color-text: #2a2520;
  --color-text-muted: #6d685f;
  --color-text-faint: #a09a90;

  --color-primary: #1a7a7a;
  --color-primary-hover: #155f5f;
  --color-primary-active: #104a4a;
  --color-primary-light: #e6f3f3;

  --color-accent: #c45a3c;
  --color-accent-hover: #a84b30;
  --color-accent-light: #fdf0ec;

  --shadow-sm: 0 1px 2px oklch(0.25 0.02 60 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.25 0.02 60 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.25 0.02 60 / 0.12);
}

/* ===== DARK MODE ===== */
[data-theme='dark'] {
  --color-bg: #1a1917;
  --color-surface: #242220;
  --color-surface-2: #2e2c29;
  --color-border: #3a3835;
  --color-divider: #333130;

  --color-text: #d4d0c8;
  --color-text-muted: #8a857c;
  --color-text-faint: #5a5750;

  --color-primary: #4aadaa;
  --color-primary-hover: #5dc0bd;
  --color-primary-active: #3d9090;
  --color-primary-light: #1e2e2e;

  --color-accent: #e0805e;
  --color-accent-hover: #eda080;
  --color-accent-light: #2e2220;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #1a1917; --color-surface: #242220; --color-surface-2: #2e2c29;
    --color-border: #3a3835; --color-divider: #333130;
    --color-text: #d4d0c8; --color-text-muted: #8a857c; --color-text-faint: #5a5750;
    --color-primary: #4aadaa; --color-primary-hover: #5dc0bd; --color-primary-active: #3d9090; --color-primary-light: #1e2e2e;
    --color-accent: #e0805e; --color-accent-hover: #eda080; --color-accent-light: #2e2220;
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2); --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3); --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
  }
}

/* ===== GLOBAL LAYOUT ===== */
.container { max-width: var(--content-default); margin-inline: auto; padding-inline: var(--space-4); }
.container--narrow { max-width: var(--content-narrow); }
.container--wide { max-width: var(--content-wide); }

/* ===== HEADER / NAV ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: oklch(from var(--color-bg) l c h / 0.92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-divider);
  transition: box-shadow 0.3s ease;
}
.site-header.scrolled { box-shadow: var(--shadow-sm); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--content-wide); margin-inline: auto;
  padding: var(--space-3) var(--space-4);
}
.logo { display: flex; align-items: center; gap: var(--space-2); text-decoration: none; color: var(--color-text); }
.logo svg { flex-shrink: 0; }
.logo-text { font-family: var(--font-display); font-weight: 500; font-size: var(--text-sm); letter-spacing: 0.01em; }

.nav-links { display: flex; align-items: center; gap: var(--space-5); list-style: none; }
.nav-links a {
  font-size: var(--text-sm); color: var(--color-text-muted); text-decoration: none;
  padding: var(--space-1) 0; position: relative;
}
.nav-links a:hover, .nav-links a.active { color: var(--color-primary); }
.nav-links a.active::after {
  content: ''; position: absolute; bottom: -2px; left: 0; right: 0;
  height: 2px; background: var(--color-primary); border-radius: 1px;
}

.theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  color: var(--color-text-muted);
}
.theme-toggle:hover { color: var(--color-text); background: var(--color-surface); }

.mobile-menu-btn { display: none; width: 36px; height: 36px; align-items: center; justify-content: center; color: var(--color-text-muted); }
.mobile-menu-btn:hover { color: var(--color-text); }

/* ===== HERO ===== */
.hero {
  padding: clamp(var(--space-16), 10vw, var(--space-32)) var(--space-4);
  text-align: left;
  max-width: var(--content-wide); margin-inline: auto;
}
.hero-badge {
  display: inline-block;
  font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--color-accent); background: var(--color-accent-light);
  padding: var(--space-1) var(--space-3); border-radius: 2px;
  margin-bottom: var(--space-6);
}
.hero h1 {
  font-family: var(--font-display); font-weight: 500;
  font-size: var(--text-3xl); line-height: 1.05;
  color: var(--color-text); margin-bottom: var(--space-4);
}
.hero-subtitle {
  font-family: var(--font-display); font-weight: 400;
  font-size: var(--text-xl); color: var(--color-primary);
  margin-bottom: var(--space-6); line-height: 1.25;
}
.hero-description {
  font-size: var(--text-base); color: var(--color-text-muted);
  max-width: 60ch; line-height: 1.7;
}
.hero-meta {
  margin-top: var(--space-8);
  font-size: var(--text-xs); color: var(--color-text-faint);
  display: flex; flex-wrap: wrap; gap: var(--space-2);
}
.hero-meta span { display: inline-flex; align-items: center; gap: var(--space-1); }

/* ===== SECTIONS ===== */
section {
  padding: clamp(var(--space-12), 6vw, var(--space-24)) var(--space-4);
}
section:nth-child(even) { background: var(--color-surface); }
.section-header {
  max-width: var(--content-wide); margin-inline: auto;
  margin-bottom: var(--space-10);
}
.section-label {
  font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--color-primary); margin-bottom: var(--space-2);
}
.section-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: var(--text-xl); color: var(--color-text);
}
.section-intro {
  margin-top: var(--space-4);
  font-size: var(--text-base); color: var(--color-text-muted);
  max-width: 65ch; line-height: 1.7;
}
.section-content {
  max-width: var(--content-wide); margin-inline: auto;
}

/* ===== DEFINITION BOX ===== */
.definition-box {
  background: var(--color-primary-light);
  border-left: 3px solid var(--color-primary);
  padding: var(--space-6) var(--space-8);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  margin-bottom: var(--space-8);
  max-width: var(--content-narrow);
}
.definition-box p {
  font-size: var(--text-base); color: var(--color-text);
  font-style: italic; line-height: 1.7;
}
.literate-person { margin-top: var(--space-6); }
.literate-person p { font-style: normal; font-weight: 500; margin-bottom: var(--space-2); color: var(--color-text); }
.literate-person ul { padding-left: var(--space-6); }
.literate-person li {
  font-size: var(--text-base); color: var(--color-text-muted);
  margin-bottom: var(--space-2); line-height: 1.6; font-style: normal;
  max-width: 65ch;
}
.literate-person li::marker { color: var(--color-primary); }

/* ===== PROSE ===== */
.prose { max-width: 65ch; }
.prose p { margin-bottom: var(--space-4); line-height: 1.7; color: var(--color-text-muted); }
.prose p:last-child { margin-bottom: 0; }

/* ===== PRINCIPLE CARDS ===== */
.principles-list { display: flex; flex-direction: column; gap: var(--space-8); }

.principle-card {
  background: var(--color-bg);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}
section:nth-child(even) .principle-card { background: var(--color-surface-2); }
.principle-card:hover { box-shadow: var(--shadow-md); }

.principle-header {
  padding: var(--space-6) var(--space-8);
  cursor: default;
}
.principle-number {
  font-family: var(--font-display); font-weight: 500;
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--color-primary); margin-bottom: var(--space-2);
}
.principle-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: var(--text-lg); color: var(--color-text);
  margin-bottom: var(--space-4);
}
.principle-summary {
  font-size: var(--text-base); color: var(--color-text-muted);
  line-height: 1.7; max-width: 65ch;
}

.concepts-toggle {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-sm); font-weight: 500;
  color: var(--color-primary); padding: var(--space-2) 0;
  margin-top: var(--space-4);
}
.concepts-toggle:hover { color: var(--color-primary-hover); }
.concepts-toggle svg {
  transition: transform 0.3s ease; width: 16px; height: 16px;
}
.concepts-toggle.open svg { transform: rotate(180deg); }

.concepts-body {
  max-height: 0; overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  border-top: 1px solid var(--color-divider);
}
.concepts-body.open { max-height: 2000px; }
.concepts-list {
  padding: var(--space-6) var(--space-8);
  display: flex; flex-direction: column; gap: var(--space-4);
}
.concept-item {
  display: flex; gap: var(--space-3);
  font-size: var(--text-base); line-height: 1.7; color: var(--color-text-muted);
}
.concept-id {
  font-family: var(--font-body); font-weight: 600;
  color: var(--color-primary); flex-shrink: 0;
  min-width: 2rem;
}

/* ===== SCOPE TABLE ===== */
.scope-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scope-table {
  width: 100%; border-spacing: 0;
  font-size: var(--text-sm);
}
.scope-table thead th {
  background: var(--color-primary); color: #fff;
  padding: var(--space-3) var(--space-4);
  text-align: left; font-weight: 600;
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em;
}
.scope-table thead th:first-child { border-radius: var(--radius-md) 0 0 0; }
.scope-table thead th:last-child { border-radius: 0 var(--radius-md) 0 0; }
.scope-table tbody td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: top; line-height: 1.6;
  color: var(--color-text-muted);
}
.scope-table tbody tr:last-child td { border-bottom: none; }
.scope-table tbody td:first-child {
  font-weight: 600; color: var(--color-text); white-space: nowrap;
}
.scope-table tbody td:nth-child(2) { color: var(--color-text); min-width: 180px; }
.scope-table tbody tr:nth-child(even) td { background: var(--color-surface); }

/* ===== FRAMEWORK CARDS ===== */
.frameworks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: var(--space-6);
}
.framework-card {
  background: var(--color-bg);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
section:nth-child(even) .framework-card { background: var(--color-surface-2); }
.framework-card h3 {
  font-family: var(--font-display); font-weight: 500;
  font-size: var(--text-lg); color: var(--color-text);
  margin-bottom: var(--space-3);
}
.framework-card p {
  font-size: var(--text-sm); line-height: 1.7;
  color: var(--color-text-muted);
}

/* ===== PARTICIPATE ===== */
.participate-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: var(--space-4); margin-top: var(--space-8);
}
.participate-item {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-bg);
  border-radius: var(--radius-md);
  border: 1px solid oklch(from var(--color-text) l c h / 0.06);
}
section:nth-child(even) .participate-item { background: var(--color-surface-2); }
.participate-item .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary);
  flex-shrink: 0; margin-top: 0.5em;
}
.participate-item strong { color: var(--color-text); display: block; font-size: var(--text-sm); margin-bottom: var(--space-1); }
.participate-item span { font-size: var(--text-xs); color: var(--color-text-muted); line-height: 1.5; }

.cta-box {
  margin-top: var(--space-10);
  background: var(--color-primary-light);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
}
.cta-box h3 {
  font-family: var(--font-display); font-weight: 500;
  font-size: var(--text-lg); color: var(--color-text); margin-bottom: var(--space-3);
}
.cta-box p { font-size: var(--text-base); color: var(--color-text-muted); line-height: 1.7; max-width: 65ch; }

/* ===== REFERENCES ===== */
.references-list { display: flex; flex-direction: column; gap: var(--space-3); }
.reference-item {
  font-size: var(--text-sm); line-height: 1.6; color: var(--color-text-muted);
  padding-left: var(--space-6); text-indent: calc(-1 * var(--space-6));
}
.reference-item a { color: var(--color-primary); text-decoration: none; }
.reference-item a:hover { text-decoration: underline; }

/* ===== FOOTER ===== */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-divider);
  padding: var(--space-8) var(--space-4);
}
.footer-inner {
  max-width: var(--content-wide); margin-inline: auto;
  display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: center; gap: var(--space-4);
}
.footer-text { font-size: var(--text-xs); color: var(--color-text-faint); }
.footer-links { display: flex; gap: var(--space-4); }
.footer-links a {
  font-size: var(--text-xs); color: var(--color-text-muted);
  text-decoration: none;
}
.footer-links a:hover { color: var(--color-primary); }

/* ===== SCROLL REVEAL ===== */
.reveal {
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: flex; }

  .nav-links.open {
    display: flex; flex-direction: column;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--color-bg); border-bottom: 1px solid var(--color-divider);
    padding: var(--space-4); gap: var(--space-3);
  }

  .hero { padding: var(--space-12) var(--space-4); }
  .hero h1 { font-size: var(--text-2xl); }

  .principle-header { padding: var(--space-4) var(--space-5); }
  .concepts-list { padding: var(--space-4) var(--space-5); }

  .definition-box { padding: var(--space-4) var(--space-5); }

  .scope-table { font-size: var(--text-xs); }
  .scope-table thead th, .scope-table tbody td { padding: var(--space-2) var(--space-3); }
}

@media (max-width: 480px) {
  .hero h1 { font-size: clamp(1.75rem, 1rem + 3vw, 2.5rem); }
  .hero-subtitle { font-size: var(--text-lg); }
}
