/* tutorials.pmanko.dev — Shared Editorial Light-Mode Stylesheet
   Aligned with research-site/assets/style.css: crisp light surfaces for reading,
   dark code blocks (#11212f) for dev familiarity, dependency-free CSS layout. */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --panel: #f8fafb;
  --border: #e3e7ec;
  --border-2: #eef1f4;
  --ink: #162232;
  --ink-dim: #5a6675;
  --ink-faint: #8893a2;
  --accent: #1f6f8b;
  --accent-soft: #e2eef2;
  --ai: #5b53b0;
  --ai-soft: #eeecf9;
  --good: #2e7d52;
  --good-soft: #e6f4ec;
  --warn: #a9710f;
  --warn-soft: #fdf3e1;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --code-bg: #11212f;
  --code-ink: #e6eef4;
  --code-dim: #8ba3b8;
  --shadow: 0 1px 2px rgba(16, 32, 48, 0.04), 0 2px 10px rgba(16, 32, 48, 0.05);
  --shadow-lg: 0 8px 30px rgba(16, 32, 48, 0.10);
  --radius: 12px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- HOME / CATALOG INDEX ---------- */
body.home .wrap {
  max-width: 1060px;
  margin: 0 auto;
  padding: 48px 28px 90px;
}
.home .hero {
  border-bottom: 1px solid var(--border);
  padding-bottom: 26px;
  margin-bottom: 30px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 800;
  margin: 0 0 8px;
}
.home .hero h1 {
  font-size: 34px;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 12px;
}
.home .hero p {
  font-size: 16.5px;
  color: var(--ink-dim);
  max-width: 72ch;
  margin: 0 0 8px;
}
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: #16596f;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 650;
}
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.ai { background: var(--ai-soft); color: var(--ai); }

.sec-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 800;
  margin: 32px 0 14px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.card.active:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
  text-decoration: none;
}
.card.feature { border-top: 3px solid var(--accent); }
.card.planned {
  background: var(--panel);
  opacity: 0.78;
  border-top: 3px solid var(--border);
}
.card .k {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 800;
}
.card h3 {
  margin: 8px 0 8px;
  font-size: 18.5px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.card p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-dim);
  line-height: 1.55;
}
.card-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--ink-dim);
}

/* ---------- DOC / TUTORIAL TWO-COLUMN LAYOUT ---------- */
body.doc .layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #fbfcfd, #eef2f5);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
}
.sidebar .brand {
  display: flex;
  flex-direction: column;
  padding: 2px 8px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sidebar .brand a {
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.sidebar .brand span {
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-top: 2px;
  font-family: var(--mono);
}
.sidebar .nav-group-label {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 800;
  padding: 8px 10px 4px;
}
.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sidebar li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--ink-dim);
  font-size: 13px;
  font-weight: 550;
  border: 1px solid transparent;
}
.sidebar li a:hover {
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  border-color: var(--border-2);
}
.sidebar li a .badge {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
}
.sidebar-box {
  margin-top: 16px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  box-shadow: var(--shadow);
}
.sidebar-box h4 {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}
.sidebar-box .cmd {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 8px 10px;
  border-radius: 6px;
  overflow-x: auto;
  margin-top: 6px;
  line-height: 1.45;
}

body.doc main {
  min-width: 0;
  padding: 38px 5vw 100px;
  max-width: 1040px;
}

.dochead {
  border-bottom: 1px solid var(--border);
  padding-bottom: 22px;
  margin-bottom: 28px;
}
.dochead h1 {
  font-size: 31px;
  letter-spacing: -0.02em;
  margin: 6px 0 10px;
  line-height: 1.18;
}
.dochead .lead {
  color: var(--ink-dim);
  font-size: 16.5px;
  margin: 0 0 12px;
  max-width: 75ch;
}

/* ---------- MODULE SECTIONS & PROSE ---------- */
.module-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
  scroll-margin-top: 24px;
}
.module-header {
  border-bottom: 1px solid var(--border-2);
  padding-bottom: 14px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.module-header h2 {
  font-size: 22px;
  letter-spacing: -0.015em;
  margin: 4px 0 0;
  color: var(--ink);
}
.prose h3 {
  font-size: 17px;
  margin: 24px 0 8px;
  color: var(--ink);
}
.prose p, .prose li {
  font-size: 15.5px;
  color: var(--ink);
  max-width: 76ch;
}
.prose p { margin: 11px 0; }
.prose ul, .prose ol { padding-left: 22px; margin: 10px 0; }
.prose li { margin: 5px 0; }

.callout {
  margin: 16px 0;
  padding: 14px 18px;
  border-left: 3.5px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 10px 10px 0;
  font-size: 14.5px;
  color: #134b5f;
}
.callout.warn {
  border-left-color: var(--warn);
  background: var(--warn-soft);
  color: #6e4806;
}
.callout.good {
  border-left-color: var(--good);
  background: var(--good-soft);
  color: #1b5234;
}
.callout strong { color: inherit; }

.math-box {
  margin: 16px 0;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  font-size: 15px;
}

code {
  font-family: var(--mono);
  font-size: 13px;
  background: #eef1f4;
  border: 1px solid var(--border-2);
  border-radius: 5px;
  padding: 1px 6px;
  color: #162232;
}

/* ---------- DARK CODE BLOCKS (DEV ENVIRONMENT CONTRAST) ---------- */
.code-card {
  margin: 20px 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #1e3346;
  background: var(--code-bg);
  box-shadow: var(--shadow);
}
.code-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  background: #0c1824;
  border-bottom: 1px solid #1e3346;
  color: var(--code-dim);
  font-family: var(--mono);
  font-size: 12px;
}
.code-card-header .title {
  color: #e6eef4;
  font-weight: 600;
}
.copy-btn {
  background: #192d3f;
  color: #e6eef4;
  border: 1px solid #2b455d;
  border-radius: 6px;
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  cursor: pointer;
  transition: background 0.15s;
}
.copy-btn:hover { background: #233f58; }
.code-card pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--code-ink);
  background: var(--code-bg);
}
.code-card pre code {
  background: none;
  border: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

/* ---------- INTERACTIVE SIMULATOR PANELS ---------- */
.lab-panel {
  margin: 22px 0;
  padding: 20px 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.lab-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.lab-header h4 {
  margin: 2px 0 0;
  font-size: 16px;
  color: var(--ink);
}
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 11px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.btn-secondary.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.sim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  align-items: start;
}
.control-group {
  margin-bottom: 12px;
}
.control-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink);
  margin-bottom: 4px;
}
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 13px;
}
.metric-card .k {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.metric-card .v {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 2px 0;
}
.metric-card .sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-dim);
}
.text-good { color: var(--good) !important; }
.text-warn { color: var(--warn) !important; }
.text-danger { color: var(--danger) !important; }
.text-accent { color: var(--accent) !important; }

.reading-bar {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border-2);
  font-size: 13px;
  color: var(--ink-dim);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}
.reading-bar strong {
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  color: var(--ink-faint);
}

@media (max-width: 860px) {
  body.doc .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  body.doc main { padding: 24px 18px 70px; }
  .module-section { padding: 20px 18px; }
}
