/* ── CertifiedHacker.nl Design System ── */

/* ── Self-hosted Fonts ── */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ── Custom Properties ── */
:root {
  --bg: #0d1117;
  --bg-elevated: #161b22;
  --bg-surface: #1c2128;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #2dd4bf;
  --accent2: #f97316;
  --accent-dim: rgba(45, 212, 191, 0.15);
  --accent2-dim: rgba(249, 115, 22, 0.15);
  --accent3: #818cf8;
  --accent3-dim: rgba(129, 140, 248, 0.15);
  --code-bg: #161b22;
  --success: #3fb950;
  --danger: #f85149;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.2);
  --transition: 150ms ease;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 { color: #fff; font-weight: 600; line-height: 1.3; }
h1 { font-size: 2.4em; letter-spacing: -0.5px; }
h2 { font-size: 1.7em; margin: 2em 0 0.6em; padding-bottom: 0.4em; border-bottom: 2px solid var(--border); }
h3 { font-size: 1.3em; margin: 1.6em 0 0.4em; color: var(--accent); }
h4 { font-size: 1.1em; margin: 1.2em 0 0.3em; color: var(--accent2); }
p { margin: 0.8em 0; }
strong { color: #fff; }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { text-decoration: underline; color: #5eead4; }
ul, ol { padding-left: 1.5em; margin: 0.6em 0; }
li { margin: 0.3em 0; }
hr { border: none; border-top: 1px solid var(--border); margin: 2.5em 0; }
img { max-width: 100%; height: auto; border-radius: var(--radius); }

/* ── Site Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.site-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1em;
  color: #fff;
}
.site-logo:hover { text-decoration: none; color: var(--accent); }
.site-logo img { height: 32px; width: auto; }
.site-nav { display: flex; gap: 24px; align-items: center; }
.site-nav a {
  color: var(--text-muted);
  font-size: 0.9em;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.site-nav a:hover, .site-nav a.active {
  color: var(--accent);
  text-decoration: none;
  border-bottom-color: var(--accent);
}
.site-nav a.nav-ib {
  color: var(--accent2);
  border-bottom-color: transparent;
}
.site-nav a.nav-ib:hover { border-bottom-color: var(--accent2); }

/* Mobile nav toggle */
.nav-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.5em; cursor: pointer; }

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 100px 24px 80px;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}
.hero::before {
  content: '';
  position: absolute;
  top: -40%;
  left: 20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.12) 0%, transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  top: -20%;
  right: 15%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.08) 0%, transparent 70%);
  pointer-events: none;
}
.hero-content { position: relative; z-index: 1; }
.hero-logo { height: 72px; width: auto; margin-bottom: 24px; }
.hero h1 { font-size: 3em; margin-bottom: 12px; }
.hero h1 .highlight-teal { color: var(--accent); }
.hero h1 .highlight-orange { color: var(--accent2); }
.hero .subtitle {
  color: var(--text-muted);
  font-size: 1.15em;
  max-width: 640px;
  margin: 0 auto 40px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1em;
  text-decoration: none;
  transition: all var(--transition);
  border: 2px solid transparent;
  cursor: pointer;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary {
  background: var(--accent);
  color: #0d1117;
}
.btn-primary:hover { background: #5eead4; color: #0d1117; box-shadow: 0 4px 20px rgba(45, 212, 191, 0.3); }
.btn-secondary {
  background: var(--accent2);
  color: #fff;
}
.btn-secondary:hover { background: #fb923c; box-shadow: 0 4px 20px rgba(249, 115, 22, 0.3); }
.btn-cloud {
  background: var(--accent3);
  color: #fff;
}
.btn-cloud:hover { background: #6366f1; box-shadow: 0 4px 20px rgba(129, 140, 248, 0.3); color: #fff; }
.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-lg { padding: 16px 36px; font-size: 1.1em; border-radius: var(--radius-lg); }

.hero-buttons { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }

/* ── Container ── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 900px; margin: 0 auto; padding: 0 24px; }

/* ── Section ── */
.section { padding: 60px 0; }
.section-title {
  text-align: center;
  margin-bottom: 40px;
}
.section-title h2 { border-bottom: none; margin-top: 0; }
.section-title p { color: var(--text-muted); max-width: 600px; margin: 8px auto 0; }

/* ── Feature Row ── */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin: 40px 0;
}
.feature {
  text-align: center;
  padding: 32px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.feature-icon {
  font-size: 2em;
  margin-bottom: 12px;
}
.feature h3 { color: #fff; font-size: 1.1em; margin: 0 0 6px; }
.feature p { color: var(--text-muted); font-size: 0.9em; margin: 0; }

/* ── Cards ── */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition);
}
.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.card-link { text-decoration: none; color: inherit; display: block; }
.card-link:hover { text-decoration: none; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Chapter cards */
.chapter-card { position: relative; padding-left: 72px; min-height: 80px; }
.chapter-card .chapter-num {
  position: absolute;
  left: 20px;
  top: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9em;
}
.chapter-card.teal .chapter-num { background: var(--accent-dim); color: var(--accent); }
.chapter-card.orange .chapter-num { background: var(--accent2-dim); color: var(--accent2); }
.chapter-card.indigo .chapter-num { background: var(--accent3-dim); color: var(--accent3); }
.chapter-card h4 { margin: 0 0 6px; color: #fff; font-size: 1em; }
.chapter-card p { margin: 0; color: var(--text-muted); font-size: 0.88em; }

/* ── Two Column Preview ── */
.book-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin: 40px 0;
}
.book-section { }
.book-section h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.book-section .chapter-list { list-style: none; padding: 0; }
.book-section .chapter-list li {
  padding: 8px 12px;
  border-radius: var(--radius);
  margin: 4px 0;
  transition: background var(--transition);
}
.book-section .chapter-list li:hover { background: var(--bg-surface); }
.book-section .chapter-list a { color: var(--text); font-size: 0.92em; }
.book-section .chapter-list a:hover { color: var(--accent); }
.book-section .chapter-list .ch-num {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-right: 8px;
  font-size: 0.85em;
}

/* ── Tutorial Cards ── */
.tutorial-card { position: relative; }
.tutorial-card .badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 600;
  margin-bottom: 10px;
}
.badge-beginner { background: rgba(45, 212, 191, 0.15); color: var(--accent); }
.badge-gevorderd { background: rgba(249, 115, 22, 0.15); color: var(--accent2); }
.badge-expert { background: rgba(248, 81, 73, 0.15); color: var(--danger); }
.badge-web { background: var(--accent-dim); color: var(--accent); }
.badge-netwerk { background: var(--accent2-dim); color: var(--accent2); }
.badge-cloud { background: var(--accent3-dim); color: var(--accent3); }
.badge-ib { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.tutorial-card h4 { margin: 0 0 6px; color: #fff; font-size: 1em; }
.tutorial-card p { margin: 0; color: var(--text-muted); font-size: 0.88em; }

/* ── Breadcrumb ── */
.breadcrumb {
  padding: 12px 0;
  font-size: 0.85em;
  color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 8px; }

/* ── Chapter Page Layout ── */
.chapter-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  min-height: calc(100vh - 64px);
}

/* Sidebar / ToC */
.chapter-sidebar {
  position: sticky;
  top: 88px;
  height: fit-content;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 16px;
}
.chapter-sidebar::-webkit-scrollbar { width: 4px; }
.chapter-sidebar::-webkit-scrollbar-track { background: transparent; }
.chapter-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.chapter-sidebar nav { font-size: 0.85em; }
.chapter-sidebar nav > ul { list-style: none; padding: 0; }
.chapter-sidebar nav ul ul { padding-left: 14px; }
.chapter-sidebar nav li { margin: 2px 0; }
.chapter-sidebar nav a {
  display: block;
  padding: 4px 10px;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  transition: all var(--transition);
  text-decoration: none;
}
.chapter-sidebar nav a:hover {
  color: var(--accent);
  background: var(--accent-dim);
  border-left-color: var(--accent);
}
.chapter-sidebar nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

/* Chapter content */
.chapter-content {
  max-width: 800px;
  padding-bottom: 80px;
}
.chapter-content h1 { margin-bottom: 0.6em; }
.chapter-content h2 { scroll-margin-top: 80px; }
.chapter-content h3 { scroll-margin-top: 80px; }

/* ── Code Blocks ── */
code {
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.88em;
  background: var(--bg-surface);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
}
pre {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 1em 0;
  line-height: 1.5;
}
pre code {
  background: none;
  padding: 0;
  color: var(--text);
  font-size: 0.88em;
}
/* Pandoc syntax highlighting overrides */
pre.sourceCode { position: relative; }
code.sourceCode span.co { color: var(--text-muted); } /* comments */
code.sourceCode span.st { color: #a5d6ff; } /* strings */
code.sourceCode span.kw { color: #ff7b72; } /* keywords */
code.sourceCode span.fu { color: #d2a8ff; } /* functions */
code.sourceCode span.dv { color: #79c0ff; } /* numbers */
code.sourceCode span.op { color: var(--text); } /* operators */
code.sourceCode span.dt { color: #ffa657; } /* data types */
code.sourceCode span.va { color: #ffa657; } /* variables */

/* ── Blockquotes ── */
blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.2em 0;
  padding: 12px 20px;
  color: var(--text-muted);
  background: var(--accent-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
}
blockquote p:first-child { margin-top: 0; }
blockquote p:last-child { margin-bottom: 0; }

/* IB tip blockquote (via lua filter) */
blockquote.ib-tip {
  border-left-color: var(--accent2);
  background: var(--accent2-dim);
}
blockquote.ib-tip strong { color: var(--accent2); }

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.92em;
}
th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--accent);
  font-weight: 600;
  background: var(--bg-surface);
}
tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Prev/Next Navigation ── */
.chapter-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.chapter-nav a {
  display: block;
  padding: 16px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all var(--transition);
}
.chapter-nav a:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}
.chapter-nav .nav-label {
  display: block;
  font-size: 0.78em;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.chapter-nav .nav-title { color: var(--accent); font-weight: 500; }
.chapter-nav .next { text-align: right; }
.chapter-nav .prev:empty, .chapter-nav .next:empty { visibility: hidden; }

/* ── IB Reference Box ── */
.ib-reference {
  background: var(--bg-elevated);
  border: 1px solid var(--accent2);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 40px 0;
}
.ib-reference h3 { color: var(--accent2); margin-top: 0; }

/* ── Footer ── */
.site-footer {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-muted);
  font-size: 0.85em;
  border-top: 1px solid var(--border);
  margin-top: 60px;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }
.site-footer .footer-ib {
  margin: 8px auto 0;
  font-size: 0.92em;
}
.site-footer .footer-ib a {
  color: var(--accent);
  font-weight: 500;
}
.site-footer .footer-ib a:hover { color: var(--accent2); }
.site-footer .disclaimer {
  max-width: 600px;
  margin: 12px auto 0;
  font-size: 0.9em;
  color: #6e7681;
}

/* ── Responsive ── */
@media (max-width: 1200px) {
  .chapter-layout { grid-template-columns: 240px 1fr; gap: 28px; }
}

@media (max-width: 900px) {
  .chapter-layout { grid-template-columns: 1fr; }
  .chapter-sidebar {
    position: static;
    max-height: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 24px;
  }
  .book-preview { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2.2em; }
  .site-nav { display: none; }
  .site-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    gap: 12px;
  }
  .nav-toggle { display: block; }
}

@media (max-width: 600px) {
  .hero { padding: 60px 16px 50px; }
  .hero h1 { font-size: 1.8em; }
  .hero-buttons { flex-direction: column; align-items: center; }
  .btn-lg { width: 100%; justify-content: center; }
  .card-grid { grid-template-columns: 1fr; }
  .chapter-nav { grid-template-columns: 1fr; }
  .container, .container-narrow { padding: 0 16px; }
  body { font-size: 15px; }
}

/* ── Utility ── */
.text-teal { color: var(--accent); }
.text-orange { color: var(--accent2); }
.text-danger { color: var(--danger); }
.text-ib { color: #a78bfa; }
.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 20px; }
.mb-xl { margin-bottom: 40px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mt-2 { margin-top: 1em; }
.mb-2 { margin-bottom: 1em; }
.text-center { text-align: center; }
.page-subtitle { max-width: 700px; margin-bottom: 40px; }
.section-elevated { background: var(--bg-elevated); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.flex-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.card-grid-spaced { margin-bottom: 40px; }
h2.heading-accent { border-bottom-color: var(--accent); }
h2.heading-accent2 { border-bottom-color: var(--accent2); }
h2.heading-danger { border-bottom-color: var(--danger); }
h2.heading-ib { border-bottom-color: #a78bfa; }
h2.heading-accent3 { border-bottom-color: var(--accent3); }
.text-cloud { color: var(--accent3); }

/* ── Floating Donate Button ── */
.donate-float {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--accent2);
  color: #fff;
  font-weight: 600;
  font-size: 0.92em;
  text-decoration: none;
  border-radius: 50px;
  box-shadow: 0 4px 20px rgba(249, 115, 22, 0.4);
  transition: all 0.3s ease;
}
.donate-float:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 28px rgba(249, 115, 22, 0.55);
  text-decoration: none;
  color: #fff;
}
.donate-float:active {
  transform: translateY(-1px) scale(1.02);
}
.donate-float svg {
  width: 18px;
  height: 18px;
  fill: #fff;
  flex-shrink: 0;
  animation: donate-pulse 2s ease-in-out infinite;
}
@keyframes donate-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}
@media (max-width: 600px) {
  .donate-float {
    bottom: 16px;
    right: 16px;
    padding: 10px 16px;
    font-size: 0.85em;
  }
}
