/* ============================================
   MemOS Paper — Aetherium Research Design System
   Palette: Deep Navy / Electric Blue / Cyan / Violet
   ============================================ */

:root {
  --bg: #0e1322;
  --surface-lowest: #090e1c;
  --surface-low: #161b2b;
  --surface: #1a1f2f;
  --surface-high: #25293a;
  --surface-highest: #2f3445;
  --primary: #a4c9ff;
  --primary-container: #4d93e5;
  --secondary: #a2e7ff;
  --tertiary: #dcb8ff;
  --text: #dee1f7;
  --text-muted: #c1c7d3;
  --outline: #8b919d;
  --outline-subtle: #414751;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-heading: 'Newsreader', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-label: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'Fira Code', 'Courier New', monospace;

  --radius: 12px;
  --radius-sm: 6px;
  --radius-full: 9999px;
}

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

html { scroll-behavior: smooth; }

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

/* ── Container ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Navigation ── */
.site-nav {
  position: sticky;
  top: 28px; /* below Flecto header */
  z-index: 9000;
  background: rgba(9, 14, 28, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(65, 71, 81, 0.4);
  padding: 10px 24px;
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-badge {
  background: linear-gradient(135deg, var(--primary), var(--primary-container));
  color: #00315d;
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 10px;
  border-radius: var(--radius-full);
}
.nav-title {
  font-family: var(--font-label);
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-sm { font-size: 12px; padding: 4px 14px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-label);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow 0.2s, opacity 0.2s;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-container));
  color: #00315d;
}
.btn-primary:hover { box-shadow: 0 0 20px rgba(164, 201, 255, 0.4); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--outline);
  color: var(--primary);
}
.btn-ghost:hover { border-color: var(--primary); }

/* ── Hero ── */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 120px 0 80px;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(14, 19, 34, 0.55) 0%,
    rgba(14, 19, 34, 0.85) 50%,
    rgba(14, 19, 34, 0.97) 100%
  );
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
}
.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.chip {
  background: var(--surface-high);
  color: var(--text-muted);
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  transition: color 0.2s;
}
.chip:hover { color: var(--secondary); }
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 58px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 16px;
}
.hero-authors {
  font-family: var(--font-label);
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.hero-affil {
  font-family: var(--font-label);
  font-size: 12px;
  color: var(--outline);
  margin-bottom: 28px;
}
.hero-abstract {
  border-left: 3px solid var(--primary);
  padding-left: 20px;
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 36px;
  max-width: 720px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.hero-stat-badge {
  display: inline-block;
  font-family: var(--font-label);
  font-size: 12px;
  color: var(--secondary);
  letter-spacing: 0.04em;
}

/* ── Sections ── */
.section { padding: 80px 0; }
.section-dark { background: var(--surface-lowest); }
.section-title {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: clamp(26px, 3vw, 36px);
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.25;
}
.section-lead {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 720px;
  margin-bottom: 48px;
  line-height: 1.8;
}
.sub-heading {
  font-family: var(--font-heading);
  font-size: 22px;
  color: var(--text);
  margin: 48px 0 16px;
}

/* ── Benchmark ── */
.bench-grid {
  display: grid;
  grid-template-columns: 180px 1fr 220px;
  gap: 24px;
  align-items: start;
}
.bench-stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  box-shadow: 0 24px 48px -12px rgba(0,0,0,0.5);
}
.stat-number {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}
.stat-label {
  font-family: var(--font-label);
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}
.bench-figure img {
  width: 100%;
  border-radius: var(--radius);
}
.bench-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.metric-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.metric-name {
  font-family: var(--font-label);
  font-size: 13px;
  color: var(--text-muted);
}
.metric-badge {
  font-family: var(--font-label);
  font-size: 12px;
  font-weight: 700;
  color: var(--secondary);
  background: rgba(162, 231, 255, 0.1);
  padding: 2px 10px;
  border-radius: var(--radius-full);
}

/* ── Two-column layout ── */
.two-col-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
  margin-top: 24px;
}
.col-text p { color: var(--text-muted); margin-bottom: 16px; }
.col-figure figure img { width: 100%; border-radius: var(--radius); }

/* ── Figures ── */
figure { margin: 0; }
figcaption {
  font-family: var(--font-label);
  font-size: 12px;
  color: var(--outline);
  margin-top: 10px;
  line-height: 1.5;
}
.figure-wide img {
  width: 100%;
  border-radius: var(--radius);
  margin: 32px 0 0;
}
.figure-wide figcaption { margin-bottom: 16px; }
.figure-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 48px;
}
.figure-pair img { width: 100%; border-radius: var(--radius); }

/* ── Stage cards ── */
.stage-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 40px;
}
.stage-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: 0 24px 48px -12px rgba(0,0,0,0.5);
}
.stage-num {
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 8px;
}
.stage-card h3 {
  font-family: var(--font-heading);
  font-size: 16px;
  color: var(--text);
  margin-bottom: 10px;
}
.stage-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Featured card accent ── */
.featured-card {
  border-top: 2px solid;
  border-image: linear-gradient(90deg, var(--tertiary), var(--secondary)) 1;
}

/* ── Tables ── */
.table-wrapper {
  overflow-x: auto;
  margin: 24px 0;
  border-radius: var(--radius);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
}
.data-table th {
  background: var(--surface-high);
  color: var(--text-muted);
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 16px;
  text-align: left;
}
.data-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--surface-high);
  color: var(--text-muted);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table .highlight-row td {
  background: rgba(164, 201, 255, 0.06);
  color: var(--text);
}

/* ── Memory types ── */
.memory-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 32px 0;
}
.mem-type-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: 0 24px 48px -12px rgba(0,0,0,0.5);
}
.mem-type-icon { font-size: 32px; margin-bottom: 12px; }
.mem-type-card h4 {
  font-family: var(--font-heading);
  font-size: 18px;
  color: var(--text);
  margin-bottom: 10px;
}
.mem-type-card p { font-size: 14px; color: var(--text-muted); line-height: 1.6; }

/* ── Code card ── */
.code-card {
  background: var(--surface-lowest);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
}
.code-label {
  font-family: var(--font-label);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--secondary);
  margin-bottom: 12px;
}
.code-card pre {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
}

/* ── Architecture layers ── */
.arch-layers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 32px 0;
}
.arch-layer-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: 0 24px 48px -12px rgba(0,0,0,0.5);
}
.arch-layer-title {
  font-family: var(--font-heading);
  font-size: 18px;
  color: var(--primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--outline-subtle);
}
.arch-layer-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.arch-layer-card li {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.arch-layer-card strong { color: var(--text); }

/* ── Applications ── */
.app-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 32px;
}
.app-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: 0 24px 48px -12px rgba(0,0,0,0.5);
}
.app-icon { font-size: 28px; margin-bottom: 12px; }
.app-card h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  color: var(--text);
  margin-bottom: 10px;
}
.app-card p { font-size: 14px; color: var(--text-muted); line-height: 1.6; }

/* ── Conclusion ── */
.conclusion-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: 0 24px 48px -12px rgba(0,0,0,0.5);
  border-top: 2px solid;
  border-image: linear-gradient(90deg, var(--tertiary), var(--primary)) 1;
}
.conclusion-card p {
  color: var(--text-muted);
  margin-bottom: 16px;
  font-size: 16px;
  line-height: 1.8;
}
.conclusion-card p:last-child { margin-bottom: 0; }

/* ── References ── */
.references-details {
  border: 1px solid var(--outline-subtle);
  border-radius: var(--radius);
  overflow: hidden;
}
.references-summary {
  font-family: var(--font-label);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 20px 24px;
  cursor: pointer;
  background: var(--surface);
  list-style: none;
}
.references-summary:hover { color: var(--primary); }
.references-list {
  padding: 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.references-list li {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Footer ── */
.site-footer {
  background: var(--surface-lowest);
  padding: 32px 0;
  border-top: 1px solid var(--outline-subtle);
}
.footer-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.footer-home, .footer-link {
  font-family: var(--font-label);
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
}
.footer-home:hover, .footer-link:hover { text-decoration: underline; }
.footer-sep { color: var(--outline); }
.footer-copy {
  font-family: var(--font-label);
  font-size: 13px;
  color: var(--outline);
}

/* ── Explanation UI ── */
.flecto-note, .flecto-callout, .flecto-card, .flecto-panel {
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 24px 0;
  background: var(--surface-high);
}
.flecto-note { border-left: 3px solid var(--primary); font-size: 14px; }
.flecto-callout { border-left: 3px solid var(--secondary); background: rgba(162, 231, 255, 0.06); }
.flecto-card {
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  border: 1px solid var(--outline-subtle);
}
.flecto-panel {
  background: var(--surface);
  border: 1px solid var(--outline-subtle);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.flecto-note::before, .flecto-callout::before, .flecto-card::before, .flecto-panel::before {
  content: '🤖 AI explanation';
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #60a5fa;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 0.5em;
}

/* ── Reveal animation ── */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }
  .reveal.visible {
    opacity: 1;
    transform: none;
  }
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .bench-grid { grid-template-columns: 1fr; }
  .two-col-layout { grid-template-columns: 1fr; }
  .stage-grid { grid-template-columns: repeat(2, 1fr); }
  .figure-pair { grid-template-columns: 1fr; }
  .memory-type-grid { grid-template-columns: 1fr; }
  .arch-layers { grid-template-columns: 1fr; }
  .app-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .stage-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 30px; }
}
