/* StemNest Learning Hub — learn.stemnestacademy.co.uk */
:root {
  --bg: #f6f8fc; --card: #ffffff; --ink: #172033; --ink-2: #475569; --muted: #6b7a90; --line: #e3e8f1;
  --blue: #1a56db; --blue-ink: #1e40af; --blue-soft: #e8f0fe; --purple: #7c3aed; --purple-soft: #f1ebfe;
  --orange: #f97316; --green: #0e9f6e; --code-bg: #0f172a; --code-ink: #e2e8f0; --code-bar: #1e293b;
  --shadow: 0 2px 14px rgba(23, 32, 51, .06); --radius: 18px;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif; --display: 'Fredoka', 'Nunito', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1424; --card: #151e33; --ink: #e8edf6; --ink-2: #b6c2d6; --muted: #8796ad; --line: #26324b;
    --blue: #6b9bff; --blue-ink: #a9c4ff; --blue-soft: #1a2747; --purple: #b79bff; --purple-soft: #261d45;
    --code-bg: #0a0f1c; --code-bar: #141c2e; --shadow: 0 2px 14px rgba(0, 0, 0, .3);
  }
}
:root[data-theme="dark"] {
  --bg: #0d1424; --card: #151e33; --ink: #e8edf6; --ink-2: #b6c2d6; --muted: #8796ad; --line: #26324b;
  --blue: #6b9bff; --blue-ink: #a9c4ff; --blue-soft: #1a2747; --purple: #b79bff; --purple-soft: #261d45;
  --code-bg: #0a0f1c; --code-bar: #141c2e; --shadow: 0 2px 14px rgba(0, 0, 0, .3);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.65; overflow-x: hidden; }
img { max-width: 100%; height: auto; }
a { color: var(--blue); }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.center { text-align: center; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 100; background: var(--card); padding: 8px 14px; border-radius: 8px; }

/* Header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 66px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { height: 42px; width: auto; }
.brand span { font-family: var(--display); font-weight: 600; font-size: 17px; color: var(--purple); border-left: 2px solid var(--line); padding-left: 10px; }
.site-header nav { display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap; }
.site-header nav a { text-decoration: none; color: var(--ink-2); font-weight: 800; font-size: 15px; }
.site-header nav a:hover { color: var(--blue); }
.nav-cta { background: var(--orange); color: #fff !important; padding: 8px 16px; border-radius: 50px; }
@media (max-width: 720px) {
  .site-header { position: static; }
  .header-row { gap: 6px; }
  .site-header nav { gap: 6px 12px; width: 100%; justify-content: space-between; }
  .site-header nav a { font-size: 14px; }
  .nav-cta { padding: 6px 12px; }
  .hide-sm { display: none; }
}

/* Hero */
.hero { background: linear-gradient(135deg, #1a56db 0%, #6d28d9 100%); color: #fff; padding: 48px 0 40px; }
.hero-small { padding: 30px 0 28px; }
.hero h1 { font-family: var(--display); font-weight: 600; font-size: clamp(32px, 6vw, 52px); line-height: 1.1; margin: 4px 0 10px; }
.hero-sub { font-size: 18px; max-width: 680px; margin: 0 0 22px; opacity: .95; }
.eyebrow { margin: 0; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; font-size: 13px; opacity: .85; }
.hero .crumbs, .hero .crumbs a { color: #fff; opacity: .9; }
.hero-cats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.hero .chip { background: rgba(255, 255, 255, .16); color: #fff; }

/* Search */
.search { position: relative; max-width: 620px; }
.search input { width: 100%; padding: 15px 20px; border-radius: 50px; border: 0; font: inherit; font-size: 16px; box-shadow: 0 8px 30px rgba(0, 0, 0, .18); color: #172033; background: #fff; }
.search input:focus { outline: 3px solid #fbbf24; }
.results { position: absolute; left: 0; right: 0; top: calc(100% + 8px); background: var(--card); color: var(--ink); border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .2); overflow: hidden; z-index: 30; text-align: left; }
.results a { display: block; padding: 12px 18px; text-decoration: none; color: var(--ink); border-top: 1px solid var(--line); }
.results a:first-child { border-top: 0; }
.results a:hover, .results a:focus { background: var(--blue-soft); }
.results strong { display: block; font-weight: 800; }
.results span { font-size: 13px; color: var(--muted); }
.results .none { padding: 14px 18px; color: var(--muted); font-weight: 700; }

/* Layout + cards */
.with-side { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; padding-top: 32px; padding-bottom: 48px; }
@media (max-width: 920px) { .with-side { grid-template-columns: 1fr; } }
.section-title { font-family: var(--display); font-weight: 600; font-size: 26px; margin: 0 0 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); display: flex; flex-direction: column; transition: transform .15s ease; }
.card:hover { transform: translateY(-3px); }
.card .cover { display: block; width: 100%; height: auto; aspect-ratio: 32 / 15; }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { font-size: 19px; line-height: 1.3; margin: 2px 0; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--blue); }
.card p { margin: 0; color: var(--ink-2); font-size: 15px; flex: 1; }
.meta { color: var(--muted); font-size: 14px; font-weight: 700; }
.chip { display: inline-block; align-self: flex-start; padding: 4px 12px; border-radius: 50px; font-size: 13px; font-weight: 800; text-decoration: none; }
.chip-learn-by-doing { background: var(--blue-soft); color: var(--blue-ink); }
.chip-tech-explained { background: var(--purple-soft); color: var(--purple); }

/* Sidebar */
.sidebar, .post-side { display: flex; flex-direction: column; gap: 20px; }
.side-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.side-box h2, .toc h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.side-cat { display: flex; justify-content: space-between; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 800; }
.side-cat:hover, .side-cat.on { background: var(--blue-soft); }
.count { color: var(--muted); }
.trial-box { background: linear-gradient(160deg, #fff7ed, #ffedd5); color: #431407; border-radius: var(--radius); padding: 22px; text-align: center; border: 1px solid #fed7aa; }
.trial-box h2 { font-family: var(--display); font-weight: 600; font-size: 22px; margin: 4px 0 6px; color: #9a3412; }
.trial-box p { margin: 0 0 14px; font-size: 15px; }
.trial-emoji { font-size: 34px; }
.trial-wide { margin: 36px 0 20px; }
.btn { display: inline-block; background: var(--orange); color: #fff; text-decoration: none; font-weight: 900; padding: 11px 24px; border-radius: 50px; }
.btn:hover { filter: brightness(1.05); }

/* Article */
.crumbs { font-size: 14px; font-weight: 700; color: var(--muted); padding-top: 18px; }
.crumbs a { color: var(--muted); }
.post-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 40px; padding-top: 10px; padding-bottom: 30px; }
.post-side { position: sticky; top: 90px; align-self: start; }
@media (max-width: 980px) { .post-layout { grid-template-columns: 1fr; } .post-side { position: static; } .post-side .toc { display: none; } }
.post-head h1 { font-family: var(--display); font-weight: 600; font-size: clamp(30px, 5vw, 44px); line-height: 1.15; margin: 12px 0 10px; }
.lede { font-size: 19px; color: var(--ink-2); margin: 0 0 10px; }
.post-cover { margin: 22px 0 8px; border-radius: var(--radius); overflow: hidden; }
.post-cover .cover { display: block; width: 100%; height: auto; }
.toc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.toc ol, .toc-mobile ol { margin: 0; padding-left: 20px; font-size: 15px; }
.toc li, .toc-mobile li { margin: 5px 0; }
.toc a, .toc-mobile a { color: var(--ink-2); text-decoration: none; font-weight: 700; }
.toc a:hover { color: var(--blue); }
.toc-mobile { display: none; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin: 14px 0; }
.toc-mobile summary { font-weight: 900; cursor: pointer; }
@media (max-width: 980px) { .toc-mobile { display: block; } }

.prose { font-size: 18px; }
.prose h2 { font-family: var(--display); font-weight: 600; font-size: 28px; line-height: 1.25; margin: 42px 0 12px; scroll-margin-top: 90px; }
.prose h3 { font-size: 21px; margin: 28px 0 8px; scroll-margin-top: 90px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose li { margin: 6px 0; }
.prose blockquote { margin: 20px 0; padding: 14px 18px; background: var(--blue-soft); border-left: 5px solid var(--blue); border-radius: 12px; }
.prose blockquote p:last-child { margin: 0; }
.prose code { font-family: ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace; font-size: .88em; background: var(--blue-soft); color: var(--blue-ink); padding: 2px 6px; border-radius: 6px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.prose img { border-radius: 12px; }
.code { margin: 18px 0 22px; border-radius: 14px; overflow: hidden; background: var(--code-bg); }
.code-bar { display: flex; justify-content: space-between; align-items: center; background: var(--code-bar); color: #94a3b8; font-size: 13px; font-weight: 800; padding: 6px 8px 6px 14px; }
.copy { font: inherit; font-size: 12px; font-weight: 800; background: #334155; color: #e2e8f0; border: 0; border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; }
.code code { background: none; color: var(--code-ink); padding: 0; font-size: 14.5px; line-height: 1.6; }
.table-wrap { overflow-x: auto; margin: 18px 0 22px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 16px; background: var(--card); }
.prose th, .prose td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--blue-soft); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tag { font-size: 13px; font-weight: 800; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 50px; padding: 3px 10px; }
.share { font-size: 14px; font-weight: 800; color: var(--muted); margin: 10px 0 0; }
.related { padding-bottom: 50px; }
.related h2 { font-family: var(--display); font-weight: 600; font-size: 26px; }
.page-title { font-family: var(--display); font-weight: 600; font-size: clamp(30px, 5vw, 42px); margin: 34px 0 6px; }

/* highlight.js (dark) */
.hljs-comment, .hljs-quote { color: #7d8ba1; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-name { color: #c792ea; }
.hljs-string, .hljs-attr, .hljs-selector-attr { color: #c3e88d; }
.hljs-number, .hljs-built_in, .hljs-type { color: #f78c6c; }
.hljs-title, .hljs-section, .hljs-selector-id, .hljs-selector-class { color: #82aaff; }
.hljs-attribute, .hljs-property, .hljs-variable, .hljs-template-variable { color: #ffcb6b; }
.hljs-tag, .hljs-meta, .hljs-punctuation { color: #89ddff; }

/* Footer */
.site-footer { background: var(--card); border-top: 1px solid var(--line); padding: 36px 0 18px; margin-top: 20px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 28px; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-grid img { height: 40px; width: auto; }
.footer-grid p { color: var(--ink-2); font-size: 15px; }
.footer-grid h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 0 10px; }
.footer-grid a { display: block; color: var(--ink-2); text-decoration: none; font-weight: 700; font-size: 15px; margin: 6px 0; }
.footer-grid a:hover { color: var(--blue); }
.footer-grid p a { display: inline; }
.copyright { color: var(--muted); font-size: 13px; margin-top: 20px; }

/* Admin posts with their own cover image */
img.cover { object-fit: cover; background: var(--blue-soft); }
.post-cover img.cover { display: block; width: 100%; aspect-ratio: 16 / 7; }
