/* ===== PR.FT3_25 · Kit A micro:bit — LED Portugal ===== */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3350;
  --accent: #00d4aa;
  --accent2: #6c63ff;
  --accent3: #ff6b6b;
  --accent4: #ffd166;
  --text: #e8eaf6;
  --text-dim: #8892b0;
  --code-bg: #0d1117;
  --nav-bg: #13161f;
  --radius: 12px;
  --radius-sm: 8px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
}

/* ===== NAV ===== */
nav {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  overflow-x: auto;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 100;
  scrollbar-width: none;
}
nav::-webkit-scrollbar { display: none; }
nav a {
  display: inline-block;
  padding: .65rem .75rem;
  color: var(--text-dim);
  text-decoration: none;
  font-size: .8rem;
  font-weight: 700;
  border-bottom: 3px solid transparent;
  transition: color .2s, border-color .2s;
}
nav a:hover, nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
nav a.brand {
  color: var(--accent);
  font-size: .85rem;
  margin-right: .5rem;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  padding: .75rem 2rem;
  font-size: .82rem;
  color: var(--text-dim);
}
.breadcrumb a { color: var(--text-dim); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 .4rem; }

/* ===== BADGE ===== */
.badge {
  display: inline-block;
  padding: .2rem .7rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 800;
  background: var(--accent);
  color: #000;
  margin-bottom: 1.2rem;
}
.badge.inter { background: var(--accent2); color: #fff; }
.badge.adv { background: var(--accent3); color: #fff; }

/* ===== MAIN LAYOUT ===== */
main {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ===== PAGE HEADER ===== */
.page-header {
  margin-bottom: 2.5rem;
}
.page-header h1 {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: .75rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.meta {
  display: flex;
  gap: 1.2rem;
  font-size: .85rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.meta span { display: flex; align-items: center; gap: .35rem; }

/* ===== TOC ===== */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent2);
  border-radius: var(--radius-sm);
  padding: 1.2rem 1.5rem;
  margin-bottom: 2rem;
  font-size: .9rem;
}
.toc strong { display: block; margin-bottom: .6rem; font-size: .85rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.toc a { color: var(--text-dim); text-decoration: none; display: block; padding: .15rem 0; transition: color .15s; }
.toc a:hover { color: var(--accent); }
.toc a::before { content: "→ "; color: var(--accent2); }

/* ===== SECTION HEADERS ===== */
h2 {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text);
  margin: 2.5rem 0 1.2rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--border);
}
h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  margin: 1.8rem 0 .8rem;
}
h4 {
  font-size: .95rem;
  font-weight: 800;
  color: var(--text-dim);
  margin: 1.5rem 0 .5rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
p { margin-bottom: 1rem; }

/* ===== STAT GRID ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
  margin: 1.5rem 0;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
}
.stat-card .label { font-size: .72rem; color: var(--text-dim); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.stat-card .value { font-size: 1.4rem; font-weight: 900; color: var(--accent); margin: .25rem 0; }
.stat-card .sub { font-size: .78rem; color: var(--text-dim); }

/* ===== FEATURE GRID ===== */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
}
.feature-card .icon { font-size: 1.8rem; margin-bottom: .5rem; }
.feature-card h4 { margin: 0 0 .4rem; font-size: .9rem; color: var(--text); text-transform: none; letter-spacing: 0; }
.feature-card p { font-size: .82rem; color: var(--text-dim); margin: 0; }
.feature-card code { font-size: .75rem; color: var(--accent2); background: var(--code-bg); padding: .1rem .3rem; border-radius: 3px; }

/* ===== STEPS ===== */
.steps { counter-reset: steps; display: flex; flex-direction: column; gap: 1rem; margin: 1.5rem 0; }
.step { display: flex; gap: 1rem; align-items: flex-start; }
.step-num {
  counter-increment: steps;
  min-width: 2rem; height: 2rem;
  background: var(--accent2);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: .85rem; flex-shrink: 0;
}
.step-body h4 { margin: 0 0 .25rem; font-size: .9rem; color: var(--text); text-transform: none; letter-spacing: 0; }
.step-body p { margin: 0; font-size: .88rem; color: var(--text-dim); }

/* ===== PINOUT LIST ===== */
.pinout { display: flex; flex-direction: column; gap: .4rem; margin: 1.2rem 0; }
.pin-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .6rem 1rem;
  font-size: .88rem;
}
.pin-badge {
  background: var(--accent2);
  color: #fff;
  border-radius: 6px;
  padding: .15rem .6rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.pin-badge.gnd { background: #444; }
.pin-badge.pwr { background: var(--accent3); }
.pin-badge.analog { background: var(--accent4); color: #000; }
.pin-badge.pwm { background: var(--accent); color: #000; }
.pin-desc { color: var(--text-dim); font-size: .85rem; }

/* ===== CODE BLOCK ===== */
.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.2rem 0;
}
.code-header {
  background: var(--surface2);
  padding: .6rem 1.2rem;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.code-header::before { content: "●●●"; color: var(--border); letter-spacing: .15em; font-size: .7rem; }
pre {
  padding: 1.2rem;
  overflow-x: auto;
  font-size: .82rem;
  line-height: 1.6;
}
code {
  font-family: 'JetBrains Mono', monospace;
  color: #a8ff78;
}
pre code { color: #cdd6f4; }

/* ===== CALLOUTS ===== */
.callout {
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  margin: 1.2rem 0;
  font-size: .9rem;
  border-left: 4px solid;
}
.callout.info { background: #0d2235; border-color: #38bdf8; color: #bae6fd; }
.callout.warn { background: #2d1f00; border-color: var(--accent4); color: #fde68a; }
.callout.tip  { background: #0d2820; border-color: var(--accent); color: #a7f3d0; }
.callout strong { display: block; margin-bottom: .25rem; }

/* ===== TABLE ===== */
table { width: 100%; border-collapse: collapse; margin: 1.2rem 0; font-size: .88rem; }
th {
  background: var(--surface2);
  color: var(--text-dim);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: .75rem;
  padding: .7rem 1rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
}
td { padding: .6rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); }
tr:hover td { background: var(--surface); }
td code { font-size: .78rem; color: var(--accent2); background: var(--code-bg); padding: .1rem .3rem; border-radius: 3px; }

/* ===== CHALLENGE BOX ===== */
.challenge {
  background: linear-gradient(135deg, #1a1d27, #1e1a35);
  border: 1px solid var(--accent2);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 2.5rem;
}
.challenge h4 { color: var(--accent2); margin: 0 0 .75rem; font-size: 1rem; text-transform: none; letter-spacing: 0; }
.challenge ul { list-style: none; padding: 0; }
.challenge ul li { padding: .3rem 0; font-size: .9rem; color: var(--text-dim); }
.challenge ul li::before { content: "🏆 "; }

/* ===== NAV ARROWS ===== */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-nav a {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .8rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: .9rem;
  transition: border-color .2s, color .2s;
  flex: 1;
  min-width: 160px;
}
.page-nav a:hover { border-color: var(--accent); color: var(--accent); }
.page-nav a.next { justify-content: flex-end; margin-left: auto; }

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 2rem;
  font-size: .8rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}
footer a { color: var(--accent); text-decoration: none; }

/* ===== CIRCUIT DIAGRAM ===== */
.circuit-diagram {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.2rem 0;
  text-align: center;
  overflow-x: auto;
}
.circuit-diagram svg { max-width: 100%; }

/* ===== MAKECODE BLOCK VISUAL ===== */
.makecode-block {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: #4c97ff;
  color: white;
  border-radius: 6px;
  padding: .3rem .8rem;
  font-weight: 700;
  font-size: .82rem;
  margin: .2rem;
}
.makecode-block.green { background: #59c059; }
.makecode-block.red { background: #ff6680; }
.makecode-block.purple { background: #9966ff; }
.makecode-block.yellow { background: #ffab19; color: #000; }
.makecode-block.orange { background: #ff8c1a; }
