/* ── Design Tokens ── */
:root {
  --bg: #fbf9f4;
  --bg-alt: #f3efe6;
  --text: #2d3436;
  --text-muted: #636e72;
  --primary: #49B6E5;
  --primary-dark: #2d8bb8;
  --secondary: #263D5B;
  --surface: #ffffff;
  --success: #16A34A;
  --warning: #D97706;
  --danger: #DC2626;
  --shadow: #2d3436;
  --border: #2d3436;
  --radius-sketch: 255px 15px 225px 15px / 15px 225px 15px 255px;
  --radius-sketch-sm: 15px 255px 15px 255px / 255px 15px 225px 15px;
  --font-display: 'Delius Swash Caps', cursive;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

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

a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--primary); }

img { max-width: 100%; height: auto; }

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

/* ── Nav ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  backdrop-filter: blur(8px);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--secondary);
  font-weight: 700;
}

.nav-links { display: flex; gap: 24px; }

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s;
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--secondary);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--secondary);
}

/* ── Hero ── */
.hero {
  position: relative;
  padding: 100px 0 60px;
  overflow: hidden;
  text-align: center;
}

.hero-bg-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(45, 52, 54, 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

.hero-content { position: relative; }

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  color: var(--secondary);
  line-height: 1.2;
  margin-bottom: 20px;
}

.highlight {
  position: relative;
  display: inline;
}

.highlight::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: -6px;
  right: -6px;
  height: 14px;
  background: rgba(73, 182, 229, 0.3);
  border-radius: var(--radius-sketch-sm);
  z-index: -1;
  transform: rotate(-0.8deg);
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 32px;
  line-height: 1.8;
}

.hero-ctas { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.hero-img {
  margin-top: 48px;
  border-radius: var(--radius-sketch);
  border: 2px solid var(--border);
  box-shadow: 4px 4px 0 var(--shadow);
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 12px 28px;
  font-family: var(--font-display);
  font-size: 16px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 4px 4px 0 var(--shadow);
  border-radius: var(--radius-sketch);
}

.btn-secondary {
  background: var(--surface);
  color: var(--secondary);
  box-shadow: 4px 4px 0 var(--shadow);
  border-radius: var(--radius-sketch-sm);
}

.btn:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow);
}

.btn-small {
  padding: 8px 18px;
  font-size: 14px;
  box-shadow: 3px 3px 0 var(--shadow);
  border-radius: var(--radius-sketch);
  background: var(--primary);
  color: #fff;
}

.btn-small:hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--shadow);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
}

.btn-outline:hover { color: var(--text); }

/* ── Sections ── */
.section {
  padding: 80px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  color: var(--secondary);
  text-align: center;
  margin-bottom: 12px;
}

.section-intro {
  text-align: center;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 48px;
  font-size: 1.05rem;
}

/* ── Cards (sketchy style) ── */
.card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sketch);
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 24px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.card:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow);
}

/* ── Pipeline Flow ── */
.pipeline-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pipe-step {
  text-align: center;
  min-width: 120px;
  max-width: 150px;
  flex: 0 0 auto;
}

.pipe-step h3 {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--secondary);
  margin-bottom: 4px;
}

.pipe-step p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.pipe-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.pipe-arrow {
  font-size: 24px;
  color: var(--primary);
  font-weight: 700;
  flex: 0 0 auto;
}

/* ── Stats Row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat {
  text-align: center;
  padding: 28px 16px;
}

.stat-number {
  display: block;
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--primary-dark);
  font-weight: 700;
}

.stat-label {
  display: block;
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Book Table ── */
.book-table-wrap {
  overflow-x: auto;
  margin-bottom: 32px;
}

.book-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.book-table thead {
  background: var(--secondary);
  color: #fff;
}

.book-table th {
  font-family: var(--font-display);
  padding: 12px 16px;
  text-align: left;
  font-weight: 400;
}

.book-table td {
  padding: 10px 16px;
  border-bottom: 1px solid #e0ddd4;
}

.book-table tbody tr:hover {
  background: rgba(73, 182, 229, 0.06);
}

/* ── JSONL Sample ── */
.jsonl-sample {
  padding: 0;
  overflow: hidden;
}

.jsonl-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--secondary);
  border-bottom: 2px solid var(--border);
}

.jsonl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.jsonl-dot.red { background: #e74c3c; }
.jsonl-dot.yellow { background: #f39c12; }
.jsonl-dot.green { background: #2ecc71; }

.jsonl-filename {
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-left: 8px;
}

.jsonl-code {
  padding: 20px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
  color: var(--text);
  overflow-x: auto;
  min-height: 120px;
}

/* ── m2m100 ── */
.m2m-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.m2m-card h3 {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--secondary);
  margin-bottom: 8px;
}

.m2m-card p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.7;
}

.m2m-card a {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Tech Stack ── */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 20px;
}

.tech-card {
  text-align: center;
  padding: 28px 16px;
}

.tech-emoji {
  font-size: 32px;
  display: block;
  margin-bottom: 12px;
}

.tech-card h3 {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--secondary);
  margin-bottom: 4px;
}

.tech-card p {
  font-size: 13px;
  color: var(--text-muted);
}

.idbe-link {
  text-decoration: none;
  font-size: 16px;
}
.idbe-link[href="#"] {
  opacity: 0.3;
  cursor: default;
}
.lang-switch {
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  padding: 4px 10px;
  border: 2px solid var(--secondary);
  border-radius: 20px;
  color: var(--secondary);
  transition: background 0.2s, color 0.2s;
  margin-left: 4px;
}
.lang-switch:hover {
  background: var(--secondary);
  color: #fff;
}

/* ── Metrics Table ── */
.subsection-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--secondary);
  text-align: center;
  margin: 48px 0 8px;
}

.badge-wip {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--warning);
  color: #fff;
  padding: 3px 10px;
  border-radius: 12px;
  vertical-align: middle;
  margin-left: 8px;
}

.th-group {
  text-align: center;
  border-bottom: 2px solid rgba(255,255,255,0.3);
}

.metrics-table {
  table-layout: fixed;
}

.metrics-table th:first-child,
.metrics-table td:first-child {
  width: 30%;
  text-align: left;
}

.metrics-table td:not(:first-child),
.metrics-table th:not(:first-child) {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
}

.metric-placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

/* ── About ── */
#about {
  padding: 60px 0;
}

.about-card {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.about-card h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--secondary);
  margin-bottom: 12px;
}

.about-card p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 20px;
}

.about-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 32px 0;
  border-top: 2px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
}

.footer-sub {
  margin-top: 6px;
  font-size: 12px;
}

.footer-sub a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Scroll Reveal ── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 2px solid var(--border);
    padding: 16px 24px;
    gap: 16px;
  }
  .nav-toggle { display: block; }

  .hero { padding: 60px 0 40px; }
  .hero h1 { font-size: 1.8rem; }

  .pipeline-flow { flex-direction: column; gap: 12px; }
  .pipe-arrow { transform: rotate(90deg); }
  .pipe-step { max-width: 100%; }

  .section { padding: 56px 0; }

  .stats-row { grid-template-columns: repeat(2, 1fr); }

  .m2m-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .tech-grid { grid-template-columns: repeat(2, 1fr); }
}
