/* ============================================================
   miniRobo.io — companion site for the miniRobo YouTube series
   One stylesheet, no build step. Edit freely.
   ============================================================ */

:root {
  color-scheme: dark;
  --bg:        #0d1117;
  --bg-soft:   #141b25;
  --bg-card:   #161d28;
  --border:    #243040;
  --text:      #e6edf3;
  --text-dim:  #9aa7b5;
  --accent:    #4169e1;   /* royal blue */
  --accent-2:  #f5a623;   /* amber */
  --danger:    #ff6b6b;
  --header-bg: rgba(13,17,23,.82);
  --radius:    14px;
  --maxw:      1080px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Day theme — toggled by the header button, persisted in localStorage */
:root[data-theme="light"] {
  color-scheme: light;
  --bg:        #f6f8fb;
  --bg-soft:   #eceff5;
  --bg-card:   #ffffff;
  --border:    #d7deea;
  --text:      #1c2533;
  --text-dim:  #5b6877;
  --accent-2:  #b96f00;   /* darker amber for contrast on light */
  --danger:    #d64545;
  --header-bg: rgba(246,248,251,.85);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

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

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex; align-items: center; gap: 18px;
  height: 62px;
}
.brand {
  display: flex; align-items: center; gap: 0;
  font-weight: 800; font-size: 1.65rem; color: var(--text);
  letter-spacing: -.02em;
}
.brand:hover { text-decoration: none; }
.brand .logo { width: 45px; height: 45px; }
.brand .dot { color: var(--accent); }
.nav-links { margin-left: auto; display: flex; gap: 22px; align-items: center; }
.nav-links a { color: var(--text-dim); font-weight: 600; font-size: .95rem; }
.nav-links a:hover, .nav-links a.active { color: var(--text); text-decoration: none; }
.nav-yt {
  background: var(--accent); color: #06211d !important;
  padding: 8px 14px; border-radius: 999px; font-weight: 700;
}
.nav-yt:hover { background: #5fe6d6; text-decoration: none; }
.nav-toggle { display: none; background: none; border: 0; color: var(--text); font-size: 1.5rem; cursor: pointer; }
.theme-toggle {
  background: none; border: 0; border-radius: 999px;
  width: 32px; height: 32px; flex: none; cursor: pointer;
  display: grid; place-items: center; font-size: 1.05rem; line-height: 1;
  color: var(--text-dim); opacity: .65;
}
.theme-toggle:hover { opacity: 1; color: var(--text); }
.logo-light { display: none; }
:root[data-theme="light"] .logo-light { display: inline-block; }
:root[data-theme="light"] .logo-dark { display: none; }

/* ---------- Hero ---------- */
.hero {
  padding: 84px 0 64px;
  background:
    radial-gradient(900px 380px at 80% -10%, rgba(45,212,191,.14), transparent 60%),
    radial-gradient(700px 320px at 0% 10%, rgba(245,166,35,.08), transparent 55%);
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  line-height: 1.05; margin: 0 0 18px; letter-spacing: -.03em;
}
.hero h1 .accent { color: var(--accent); }
.hero p.lead { font-size: 1.2rem; color: var(--text-dim); max-width: 620px; margin: 0 0 28px; }
.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 30px; }

.hero.compact { padding: 52px 0 44px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 44px; align-items: center; }
.hero-photo { display: block; width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }

.eyebrow {
  font-family: var(--mono); font-size: .8rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 14px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px; font-weight: 700; font-size: .98rem;
  border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--accent); color: #06211d; }
.btn-primary:hover { background: #5fe6d6; text-decoration: none; }
.btn-ghost { border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); text-decoration: none; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Pills / tags ---------- */
.pill {
  font-family: var(--mono); font-size: .78rem; padding: 5px 11px;
  border: 1px solid var(--border); border-radius: 999px; color: var(--text-dim);
  background: var(--bg-soft);
}
.pill.accent { color: var(--accent); border-color: rgba(45,212,191,.4); }

/* ---------- Sections ---------- */
section { padding: 56px 0; }
section h2 { font-size: 1.8rem; letter-spacing: -.02em; margin: 0 0 8px; }
section .section-sub { color: var(--text-dim); margin: 0 0 32px; max-width: 640px; }

/* ---------- Episode grid ---------- */
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.ep-card {
  display: block; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; transition: border-color .15s, transform .15s;
  color: var(--text);
}
.ep-card:hover { border-color: var(--accent); transform: translateY(-3px); text-decoration: none; }
.ep-card .ep-num { font-family: var(--mono); color: var(--accent); font-size: .82rem; letter-spacing: .1em; }
.ep-card h3 { margin: 8px 0 6px; font-size: 1.25rem; }
.ep-card .ep-part { color: var(--accent-2); font-family: var(--mono); font-size: .85rem; }
.ep-card p { color: var(--text-dim); font-size: .95rem; margin: 10px 0 0; }
.ep-card .ep-meta { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.ep-card.coming-soon {
  border-style: dashed;
  border-color: rgba(245,166,35,.35);
  pointer-events: none; cursor: default;
}
.ep-card.coming-soon .soon-tag { color: var(--accent-2); font-family: var(--mono); font-size: .82rem; letter-spacing: .1em; }

/* ---------- Feature row ---------- */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 22px; }
.feature { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.feature .ic { font-size: 1.6rem; }
.feature h3 { margin: 12px 0 6px; font-size: 1.15rem; }
.feature p { color: var(--text-dim); margin: 0; font-size: .95rem; }

/* ---------- Episode page ---------- */
.ep-hero { padding: 56px 0 34px; border-bottom: 1px solid var(--border);
  background: radial-gradient(800px 320px at 85% -20%, rgba(45,212,191,.12), transparent 60%); }
.ep-hero .ep-num { font-family: var(--mono); color: var(--accent); letter-spacing: .14em; text-transform: uppercase; font-size: .85rem; }
.ep-hero h1 { font-size: clamp(1.9rem, 5vw, 2.9rem); margin: 10px 0 14px; letter-spacing: -.02em; }
.ep-hero .ep-part-tag { color: var(--accent-2); font-family: var(--mono); }

.video-embed {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  background: linear-gradient(135deg, #10212a, #0d1117);
  border: 1px dashed var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px;
  color: #9aa7b5; margin: 28px 0; /* placeholder box stays dark in both themes */
}
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: var(--radius); }
.video-embed .play { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: #06211d;
  display: grid; place-items: center; font-size: 1.6rem; }

.layout { display: grid; grid-template-columns: 1fr 320px; gap: 40px; align-items: start; }
.layout .main-col h2 { font-size: 1.4rem; margin: 34px 0 12px; }
.layout .main-col h2:first-child { margin-top: 0; }

.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; margin-bottom: 20px;
}
.card h3 { margin: 0 0 14px; font-size: 1.05rem; }

.sidebar { position: sticky; top: 84px; }

/* download / parts lists */
.dl-list, .parts-list { list-style: none; margin: 0; padding: 0; }
.dl-list li, .parts-list li { padding: 11px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: baseline; }
.dl-list li:last-child, .parts-list li:last-child { border-bottom: 0; }
.dl-list a { font-weight: 600; }
.dl-list .ftype { font-family: var(--mono); font-size: .72rem; color: var(--text-dim); border: 1px solid var(--border); padding: 2px 7px; border-radius: 6px; }
.parts-list .pn { font-weight: 600; }
.parts-list .pd { color: var(--text-dim); font-size: .9rem; }

.note { background: rgba(245,166,35,.08); border-left: 3px solid var(--accent-2); padding: 12px 16px; border-radius: 8px; color: var(--text); font-size: .95rem; }
.note.warn { background: rgba(255,107,107,.08); border-left-color: var(--danger); }

/* code blocks */
/* code blocks stay dark in both themes, so they need fixed light text */
pre { background: #0a0e14; color: #e6edf3; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; overflow-x: auto; font-family: var(--mono); font-size: .85rem; line-height: 1.55; }
code { font-family: var(--mono); font-size: .9em; background: var(--bg-soft); padding: 2px 6px; border-radius: 5px; }
pre code { background: none; padding: 0; }

/* diagram image */
.diagram { display: block; width: 100%; border: 1px solid var(--border); border-radius: var(--radius); margin: 18px 0 6px; background: var(--bg); }
/* portrait diagrams (pin maps) are sized for phone legibility — cap them on desktop */
.diagram.pinout { max-width: 460px; margin-left: auto; margin-right: auto; }
.diagram-cap { color: var(--text-dim); font-size: .85rem; margin: 0 0 8px; }

.spec-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.spec-table td { padding: 8px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.spec-table td:first-child { color: var(--text-dim); width: 42%; }

/* prev / next */
.ep-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 48px; flex-wrap: wrap; }
.ep-nav a { flex: 1; min-width: 200px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; color: var(--text); }
.ep-nav a:hover { border-color: var(--accent); text-decoration: none; }
.ep-nav .dir { font-family: var(--mono); font-size: .75rem; color: var(--text-dim); }
.ep-nav a.next { text-align: right; }

/* ---------- CTA band ---------- */
.cta-band { background: linear-gradient(135deg, rgba(45,212,191,.12), rgba(245,166,35,.08));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; text-align: center; }
.cta-band h2 { margin: 0 0 10px; }
.cta-band p { color: var(--text-dim); margin: 0 0 22px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0; color: var(--text-dim); font-size: .9rem; margin-top: 40px; }
.site-footer .cols { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; }
.site-footer a { color: var(--text-dim); }
.site-footer a:hover { color: var(--text); }
.site-footer .foot-brand { font-weight: 800; color: var(--text); }
.disclaimer { margin-top: 24px; font-size: .8rem; color: #6b7785; max-width: 640px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .nav-links {
    position: absolute; top: 62px; left: 0; right: 0;
    background: var(--bg-soft); border-bottom: 1px solid var(--border);
    flex-direction: column; align-items: stretch; gap: 0; padding: 8px 0; display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 20px; }
  .nav-toggle { display: block; margin-left: auto; padding: 8px; }
}

@media (max-width: 480px) {
  .nav { gap: 10px; }
  .brand { font-size: 1.3rem; }
  .brand .logo { width: 36px; height: 36px; }
  .hero { padding: 56px 0 44px; }
  section { padding: 40px 0; }
  pre { padding: 14px; font-size: .8rem; }
  .cta-band { padding: 28px 20px; }
}
