/* ==========================================================================
   SYJ EDUCATE — Design System
   Signature concept: the "build log" — this platform teaches by shipping
   real commits, so the visual language borrows from git diffs and terminal
   output (+add green / -remove red / amber in-progress) instead of a
   generic SaaS palette.
   ========================================================================== */

:root {
  /* ---- Color tokens ---- */
  --ink: #12141a;
  --ink-raised: #171b23;
  --surface: #1c212b;
  --surface-2: #232a36;
  --border: #2b3240;
  --border-soft: #232936;

  --text: #eaecef;
  --text-muted: #9aa4b2;
  --text-faint: #626c7a;

  --add: #3fb950;      /* shipped / correct / go */
  --add-dim: #1c3a24;
  --remove: #f85149;   /* hard / breaking / stop */
  --remove-dim: #3a1e1c;
  --focus: #58a6ff;     /* links / in-progress */
  --focus-dim: #17263c;
  --warn: #d29922;      /* advanced / caution */
  --warn-dim: #332707;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  --container: 1160px;
  --nav-h: 72px;
}

:root[data-theme="light"] {
  --ink: #f7f8fa;
  --ink-raised: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --border: #dde1e7;
  --border-soft: #e6e9ee;

  --text: #12141a;
  --text-muted: #4b5563;
  --text-faint: #7a8494;

  --add-dim: #e3f6e7;
  --remove-dim: #fbe6e5;
  --focus-dim: #e6f0ff;
  --warn-dim: #fbf1da;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2.4rem, 5vw, 3.8rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; color: var(--text-muted); }
a { color: var(--focus); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--font-mono); }

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

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

/* ---- Skip link / a11y ---- */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 1000;
  background: var(--add); color: #06210c; padding: 12px 18px;
  border-radius: 0 0 8px 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--ink) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .dot { color: var(--add); }
.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  color: var(--text-muted); font-size: 0.92rem; font-weight: 500;
  padding: 8px 12px; border-radius: var(--radius-sm);
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); background: var(--surface); text-decoration: none; }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-toggle { display: none; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 0.92rem;
  padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--add); color: #06210c; }
.btn-primary:hover { background: #4fd160; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface); }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }

.theme-toggle {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer;
}
.theme-toggle svg { width: 18px; height: 18px; }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero { padding: 72px 0 56px; position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 48px; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--add);
  background: var(--add-dim); border: 1px solid color-mix(in srgb, var(--add) 40%, transparent);
  padding: 6px 12px; border-radius: 999px; margin-bottom: 20px;
}
.eyebrow .pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--add); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.hero h1 span.hl { color: var(--add); }
.hero-lede { font-size: 1.1rem; max-width: 46ch; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-stats { display: flex; gap: 28px; margin-top: 40px; flex-wrap: wrap; }
.stat .num { font-family: var(--font-mono); font-size: 1.6rem; font-weight: 700; color: var(--text); }
.stat .label { font-size: 0.82rem; color: var(--text-faint); }

/* Terminal signature element */
.terminal {
  background: var(--ink-raised); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: 0 30px 60px -30px rgba(0,0,0,0.6);
}
.terminal-bar {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft); background: var(--surface);
}
.terminal-bar .tdot { width: 10px; height: 10px; border-radius: 50%; }
.tdot.r { background: var(--remove); } .tdot.y { background: var(--warn); } .tdot.g { background: var(--add); }
.terminal-bar .tpath { margin-left: 8px; font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-faint); }
.terminal-body { padding: 20px; font-family: var(--font-mono); font-size: 0.86rem; min-height: 260px; }
.terminal-body .line { margin-bottom: 6px; white-space: pre-wrap; }
.terminal-body .add { color: var(--add); }
.terminal-body .rem { color: var(--remove); }
.terminal-body .muted { color: var(--text-faint); }
.terminal-body .cmd { color: var(--focus); }
.caret { display: inline-block; width: 7px; height: 1em; background: var(--add); vertical-align: text-bottom; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ==========================================================================
   Marquee
   ========================================================================== */
.marquee-wrap { border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); overflow: hidden; padding: 18px 0; background: var(--surface); }
.marquee { display: flex; gap: 48px; width: max-content; animation: scroll 28s linear infinite; }
.marquee span { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-faint); white-space: nowrap; }
.marquee span strong { color: var(--text-muted); }
@keyframes scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ==========================================================================
   Sections
   ========================================================================== */
section { padding: 88px 0; }
.section-head { max-width: 640px; margin: 0 auto 48px; text-align: center; }
.section-head.left { text-align: left; margin: 0 0 40px; }
.section-head .eyebrow { margin-bottom: 16px; }

.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 26px; transition: border-color 0.2s ease, transform 0.2s ease;
}
.card:hover { border-color: color-mix(in srgb, var(--add) 45%, var(--border)); transform: translateY(-2px); }
.card .icon { width: 40px; height: 40px; margin-bottom: 16px; color: var(--add); }
.card h3 { margin-bottom: 8px; font-size: 1.1rem; }
.card p { font-size: 0.92rem; margin-bottom: 0; }

/* Track cards */
.track-card { display: flex; flex-direction: column; gap: 14px; }
.track-top { display: flex; align-items: center; justify-content: space-between; }
.diff-badge {
  font-family: var(--font-mono); font-size: 0.72rem; padding: 3px 9px; border-radius: 999px;
  border: 1px solid transparent;
}
.diff-beginner { color: var(--add); background: var(--add-dim); border-color: color-mix(in srgb, var(--add) 40%, transparent); }
.diff-intermediate { color: var(--warn); background: var(--warn-dim); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.diff-advanced { color: var(--remove); background: var(--remove-dim); border-color: color-mix(in srgb, var(--remove) 40%, transparent); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border-soft); padding: 3px 8px; border-radius: 5px; }
.track-meta { display: flex; gap: 16px; font-size: 0.8rem; color: var(--text-faint); font-family: var(--font-mono); }
.track-card .btn { margin-top: 4px; align-self: flex-start; }

/* Roadmap timeline (genuinely sequential -> numbering is meaningful) */
.timeline { position: relative; padding-left: 32px; }
.timeline::before { content: ""; position: absolute; left: 10px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 40px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-num {
  position: absolute; left: -32px; top: 0; width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--add); color: var(--add);
  font-family: var(--font-mono); font-size: 0.7rem; display: grid; place-items: center;
}
.timeline-item.done .timeline-num { background: var(--add); color: #06210c; }
.timeline-item.wip .timeline-num { border-color: var(--warn); color: var(--warn); }
.timeline-status { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.timeline-item.done .timeline-status { color: var(--add); }
.timeline-item.wip .timeline-status { color: var(--warn); }
.timeline-item.todo .timeline-status { color: var(--text-faint); }

/* Testimonials */
.testimonial { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 24px; }
.testimonial p { color: var(--text); font-size: 0.96rem; }
.testimonial .who { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); }
.who .name { font-size: 0.86rem; font-weight: 600; color: var(--text); }
.who .role { font-size: 0.78rem; color: var(--text-faint); }

/* Architecture diagram */
.arch-diagram { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.arch-node { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; text-align: center; font-family: var(--font-mono); font-size: 0.8rem; }
.arch-node .l { display: block; color: var(--text-faint); font-size: 0.7rem; margin-bottom: 6px; }

/* Ecosystem links */
.eco-grid { grid-template-columns: repeat(3, 1fr); }
.eco-card { display: flex; align-items: center; gap: 14px; }
.eco-card .badge { width: 42px; height: 42px; border-radius: var(--radius-sm); background: var(--surface-2); display: grid; place-items: center; color: var(--focus); flex-shrink: 0; }
.eco-card .meta { min-width: 0; }
.eco-card .meta strong { display: block; font-size: 0.94rem; color: var(--text); }
.eco-card .meta span { font-size: 0.78rem; color: var(--text-faint); font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

/* FAQ (question-answer, structured for AEO/GEO) */
.faq-item { border-bottom: 1px solid var(--border-soft); }
.faq-q {
  width: 100%; text-align: left; background: none; border: none; color: var(--text);
  font-family: var(--font-display); font-size: 1.02rem; font-weight: 600;
  padding: 20px 0; cursor: pointer; display: flex; justify-content: space-between; gap: 16px; align-items: center;
}
.faq-q .chev { transition: transform 0.2s ease; color: var(--text-faint); flex-shrink: 0; }
.faq-item[open] .faq-q .chev { transform: rotate(180deg); }
.faq-a { padding: 0 0 20px; color: var(--text-muted); font-size: 0.95rem; max-width: 68ch; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary { list-style: none; }

/* Newsletter */
.newsletter { background: linear-gradient(145deg, var(--surface), var(--surface-2)); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 48px; text-align: center; }
.newsletter-form { display: flex; gap: 10px; max-width: 420px; margin: 20px auto 0; }
.newsletter-form input {
  flex: 1; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--ink); color: var(--text); font-family: var(--font-body); font-size: 0.92rem;
}
.form-note { font-size: 0.76rem; color: var(--text-faint); margin-top: 10px; }

/* Generic forms (contact) */
.form-field { margin-bottom: 18px; text-align: left; }
.form-field label { display: block; font-size: 0.86rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-field input, .form-field textarea, .form-field select {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--ink-raised); color: var(--text); font-family: var(--font-body); font-size: 0.94rem;
}
.form-field textarea { resize: vertical; min-height: 130px; }
.form-hint { font-size: 0.78rem; color: var(--text-faint); margin-top: 4px; }

/* Breadcrumbs */
.breadcrumbs { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-faint); margin-bottom: 20px; }
.breadcrumbs a { color: var(--text-faint); }
.breadcrumbs .sep { margin: 0 6px; }
.breadcrumbs .current { color: var(--text-muted); }

.page-hero { padding: 56px 0 40px; border-bottom: 1px solid var(--border-soft); }
.page-hero p.lede { max-width: 60ch; font-size: 1.05rem; }

/* Table of contents (docs-style pages) */
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px 24px; margin-bottom: 32px; }
.toc h2 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); margin-bottom: 10px; }
.toc ol { margin: 0; padding-left: 20px; font-size: 0.92rem; }
.toc li { margin-bottom: 6px; }

.prose h2 { margin-top: 2.2em; }
.prose h3 { margin-top: 1.6em; }
.prose ul, .prose ol { color: var(--text-muted); }
.prose li { margin-bottom: 0.4em; }

/* Footer */
.site-footer { border-top: 1px solid var(--border-soft); padding: 56px 0 32px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 32px; margin-bottom: 40px; }
.footer-col h3 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); margin-bottom: 14px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 10px; }
.footer-col a { color: var(--text-muted); font-size: 0.9rem; }
.footer-col a:hover { color: var(--text); }
.footer-brand p { max-width: 32ch; font-size: 0.88rem; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding-top: 24px; border-top: 1px solid var(--border-soft); }
.footer-bottom p { margin: 0; font-size: 0.82rem; color: var(--text-faint); }
.social-row { display: flex; gap: 10px; }
.social-row a { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-muted); }
.social-row a:hover { color: var(--text); border-color: var(--focus); }

/* 404 */
.error-page { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 60px 24px; }
.error-code { font-family: var(--font-mono); font-size: clamp(4rem, 12vw, 8rem); color: var(--remove); font-weight: 700; line-height: 1; }

/* Skip-to / util */
.center { text-align: center; }
.mt-lg { margin-top: 48px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .grid-3, .grid-4, .eco-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .arch-diagram { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .nav-links { position: fixed; top: var(--nav-h); left: 0; right: 0; bottom: 0; background: var(--ink);
    flex-direction: column; align-items: stretch; padding: 16px; gap: 4px; display: none; overflow-y: auto; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 14px 12px; font-size: 1rem; }
  .nav-toggle { display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
  .grid-3, .grid-4, .grid-2, .eco-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .newsletter-form { flex-direction: column; }
  section { padding: 64px 0; }
}
