/* React Learning Environment — Shared Dark Theme */

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

/* Design tokens */
:root {
  --bg:         #0d1117;
  --surface:    #161b22;
  --surface-2:  #21262d;
  --border:     #30363d;
  --text:       #c9d1d9;
  --text-muted: #8b949e;
  --accent:     #ff5ca8;
  --green:      #3fb950;
  --yellow:     #d29922;
  --red:        #f85149;
  --radius:     6px;
  --font-sans:  -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono:  'Courier New', Courier, monospace;
}

/* Base */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
}

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

/* ── Navigation ──────────────────────────────────────────────────── */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

nav .container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

nav .brand {
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  font-size: 15px;
  margin-right: 16px;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}

nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

nav a.active {
  color: var(--accent);
  background: rgba(255, 92, 168, 0.1);
}

/* ── Main ────────────────────────────────────────────────────────── */
main {
  padding: 40px 0 80px;
}

/* ── Typography ──────────────────────────────────────────────────── */
h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 36px 0 12px;
  color: var(--accent);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 24px 0 8px;
  color: var(--text);
}

p {
  margin-bottom: 14px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul, ol {
  padding-left: 22px;
  margin-bottom: 14px;
}

li {
  margin-bottom: 5px;
  font-size: 15px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.card-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
}

/* Nav grid (home page) */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 36px;
}

.nav-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
  display: block;
}

.nav-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  text-decoration: none;
}

.nav-card-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 4px;
}

.nav-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Tables ──────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin-bottom: 24px;
}

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

th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ── Badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.badge-locked   { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-current  { background: rgba(255,92,168,0.12); color: var(--accent); border: 1px solid rgba(255,92,168,0.4); }
.badge-complete { background: rgba(63,185,80,0.12); color: var(--green);  border: 1px solid rgba(63,185,80,0.4); }
.badge-gate     { background: rgba(210,153,34,0.12); color: var(--yellow); border: 1px solid rgba(210,153,34,0.4); }
.badge-layer    { background: rgba(255,92,168,0.08); color: var(--accent); border: 1px solid var(--border); font-size: 10px; }

/* ── Code ────────────────────────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 3px;
  color: #e6edf3;
}

pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  margin-bottom: 16px;
}

pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.75;
}

/* ── Alerts ──────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  border-left: 3px solid;
  line-height: 1.55;
}

.alert-info    { background: rgba(255,92,168,0.08);  border-color: var(--accent); }
.alert-warning { background: rgba(210,153,34,0.08);  border-color: var(--yellow); }
.alert-success { background: rgba(63,185,80,0.08);   border-color: var(--green); }
.alert-danger  { background: rgba(248,81,73,0.08);   border-color: var(--red); }

/* ── Progress ────────────────────────────────────────────────────── */
.progress-wrap {
  margin: 12px 0 20px;
}

.progress-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

.progress-bar-bg {
  background: var(--surface-2);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* ── Prompt log entries ──────────────────────────────────────────── */
.prompt-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 16px;
}

.prompt-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 10px;
  display: flex;
  gap: 16px;
}

.prompt-text {
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

/* ── Divider ─────────────────────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* ── Layer section header ────────────────────────────────────────── */
.layer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 36px 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.layer-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.layer-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── Commit review ───────────────────────────────────────────────── */
.commit-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 16px;
}

.commit-hash {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--yellow);
}

/* ── Hero diagram (opens every session, before the pre-quiz) ────────── */
.hero-diagram {
  background: #111111;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px 18px;
  margin: 18px 0 24px;
}

.hero-diagram svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 560px;
  margin: 0 auto;
}

.hero-caption {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin: 10px 0 0;
  font-style: italic;
}

/* ── Concept diagrams (real inline SVG, like the source course) ─────── */
.diagram-svg {
  background: #111111;
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
}

.diagram-svg-opening {
  border: 1px solid var(--border);
  margin: 14px 0 28px;
}

.diagram-caption-text {
  font-size: 11px;
  color: var(--text-muted);
  margin: 10px 0 0;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  h1 { font-size: 22px; }
  .nav-grid { grid-template-columns: 1fr 1fr; }
  nav .container { gap: 4px; }
}
/* Academy-wide publication status watermark. */
body::after { content: "DRAFT"; position: fixed; left: 50%; top: 50%; z-index: 999; transform: translate(-50%, -50%) rotate(-28deg); color: rgba(255, 92, 168, 0.09); font-size: clamp(88px, 18vw, 240px); font-weight: 900; letter-spacing: 0.08em; line-height: 1; pointer-events: none; user-select: none; white-space: nowrap; }

/* Balanced academy palette: pink identifies the family; supporting colors carry meaning. */
:root {
  --accent: #58a6ff;
  --academy-pink: #ff5ca8;
  --diagram-blue: #58a6ff;
  --diagram-cyan: #39c5cf;
  --diagram-violet: #a371f7;
  --diagram-green: #3fb950;
  --diagram-amber: #d29922;
  --diagram-coral: #ff7b72;
}
nav .brand { color: var(--academy-pink); }
svg :is(rect, circle, ellipse, path, line, polyline, polygon):nth-of-type(6n + 1) { stroke: var(--diagram-blue) !important; }
svg :is(rect, circle, ellipse, path, line, polyline, polygon):nth-of-type(6n + 2) { stroke: var(--diagram-cyan) !important; }
svg :is(rect, circle, ellipse, path, line, polyline, polygon):nth-of-type(6n + 3) { stroke: var(--diagram-violet) !important; }
svg :is(rect, circle, ellipse, path, line, polyline, polygon):nth-of-type(6n + 4) { stroke: var(--diagram-green) !important; }
svg :is(rect, circle, ellipse, path, line, polyline, polygon):nth-of-type(6n + 5) { stroke: var(--diagram-amber) !important; }
svg :is(rect, circle, ellipse, path, line, polyline, polygon):nth-of-type(6n) { stroke: var(--diagram-coral) !important; }
svg marker path { fill: var(--diagram-blue) !important; }
