/* =========================================================================
   Teacher Tech Tools — global styles
   Plain CSS, no build step. Design tokens live in :root.
   Type: Space Grotesk (headings) + Inter (body), with system fallbacks.
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --brand:        #0f766e;   /* deep teal */
  --brand-dark:   #115e56;
  --brand-2:      #14b8a6;   /* bright teal (gradients/accents) */
  --brand-soft:   #e6faf6;   /* tinted surface */
  --brand-line:   #b8ece4;
  --accent:       #f59e0b;   /* amber — CTAs / highlights */
  --accent-soft:  #fef6e7;

  --ink:          #0f172a;   /* slate-900 */
  --ink-soft:     #475569;
  --ink-faint:    #64748b;
  --line:         #e6e9ee;
  --line-strong:  #d4dae2;
  --bg:           #ffffff;
  --bg-soft:      #f7f9fa;
  --bg-sunk:      #f0f3f5;
  --bg-code:      #0f1b2d;

  --nav-bg:       #0f172a;
  --nav-ink:      #cbd5e1;

  --brand-ink:    #115e56;   /* readable teal text on tinted surfaces */
  --note-bg:      #eef1fe;   /* note callout */
  --note-line:    #6366f1;
  --row-alt:      #fbfcfd;   /* zebra table rows */
  --field-bg:     #ffffff;   /* inputs, ghost buttons */
  --hero-1:       #115e56;   /* hero gradient stops */
  --hero-2:       #0f766e;
  --hero-3:       #0c8074;

  --radius:       14px;
  --radius-sm:    9px;
  --shadow:       0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.04);
  --shadow-md:    0 4px 14px rgba(15,23,42,.08);
  --shadow-lg:    0 18px 40px rgba(15,23,42,.14);

  --sidebar-w:    272px;
  --toc-w:        212px;
  --maxw:         1200px;
  --font:         "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head:    "Space Grotesk", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); text-decoration: underline; }
img { max-width: 100%; }

h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 2.15rem; margin: .1em 0 .45em; }
h2 { font-size: 1.5rem; margin: 1.9em 0 .5em; }
h3 { font-size: 1.15rem; margin: 1.5em 0 .4em; }

p { margin: 0 0 1em; }
code { font-family: "SF Mono", "Cascadia Code", Consolas, Menlo, monospace; font-size: .9em;
  background: var(--bg-sunk); padding: .12em .4em; border-radius: 5px; color: var(--brand-dark); }
.code code, pre code { background: none; padding: 0; color: inherit; }

/* icons render at text color, sized by context */
.icon { display: inline-flex; vertical-align: middle; }
.icon svg { width: 1em; height: 1em; display: block; }

/* ---------- Top navigation ---------------------------------------------- */
.topnav {
  background: var(--nav-bg);
  color: var(--nav-ink);
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.topnav__inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 4px;
  padding: 0 20px; min-height: 60px;
}
.topnav__brand {
  font-family: var(--font-head);
  font-weight: 700; font-size: 1.18rem; color: #fff;
  display: flex; align-items: center; gap: 10px; margin-right: 14px; white-space: nowrap;
  letter-spacing: -.02em;
}
.topnav__brand:hover { text-decoration: none; color: #fff; }
.topnav__brand .logo {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.topnav__brand .logo svg { width: 20px; height: 20px; }
.topnav__brand .accent { color: var(--brand-2); }

.topnav__links { display: flex; gap: 2px; flex: 1; flex-wrap: nowrap; min-width: 0; }
.topnav__links a {
  color: var(--nav-ink); padding: 8px 11px; border-radius: 8px;
  font-size: .93rem; font-weight: 500; white-space: nowrap;
}
/* keep links from ever painting over the search box on the desktop row */
.topnav__search { flex: none; }
.topnav__links a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.topnav__links a.active { background: rgba(20,184,166,.16); color: #5eead4; }

/* Topics dropdown (holds the section links so the bar scales to any count) */
.topnav__topics { position: relative; display: inline-flex; }
.topnav__topicsbtn {
  display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; cursor: pointer;
  color: var(--nav-ink); font-family: var(--font); font-size: .93rem; font-weight: 500;
  padding: 8px 11px; border-radius: 8px;
}
.topnav__topicsbtn:hover { background: rgba(255,255,255,.08); color: #fff; }
.topnav__topicsbtn.active { background: rgba(20,184,166,.16); color: #5eead4; }
.topnav__topicsbtn .caret svg { width: 15px; height: 15px; }
.topnav__dropdown {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; min-width: 234px;
  background: var(--nav-bg); border: 1px solid rgba(255,255,255,.1); border-radius: 12px;
  padding: 8px; box-shadow: var(--shadow-lg); z-index: 60;
}
.topnav__dropdown.open { display: block; }
.topnav__dropdown a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: var(--nav-ink); font-size: .92rem; white-space: nowrap; font-weight: 500;
}
.topnav__dropdown a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.topnav__dropdown a.active { background: rgba(20,184,166,.16); color: #5eead4; }
.topnav__dropdown a .icon svg { width: 18px; height: 18px; color: var(--brand-2); }

.nav-toggle {
  display: none; background: none; border: 0; color: var(--nav-ink);
  cursor: pointer; padding: 8px; border-radius: 8px;
}
.nav-toggle:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-toggle svg { width: 22px; height: 22px; display: block; }

.topnav__search { display: flex; align-items: center; margin-left: 8px; }
.topnav__search input {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  color: #fff; border-radius: 9px 0 0 9px; padding: 8px 12px; font-size: .9rem;
  width: 150px; font-family: inherit;
}
.topnav__search input::placeholder { color: #7c8ba1; }
.topnav__search input:focus { outline: none; background: rgba(255,255,255,.14); width: 190px; border-color: var(--brand-2); }
.topnav__search button {
  background: var(--brand); border: 1px solid var(--brand); color: #fff; cursor: pointer;
  padding: 8px 11px; border-radius: 0 9px 9px 0; display: grid; place-items: center;
}
.topnav__search button svg { width: 16px; height: 16px; display: block; }
.topnav__search button:hover { background: var(--brand-2); border-color: var(--brand-2); }

/* ---------- Layout: sidebar + content ----------------------------------- */
.layout {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); align-items: start;
}
.sidebar {
  position: sticky; top: 60px; align-self: start;
  height: calc(100vh - 60px); overflow-y: auto;
  border-right: 1px solid var(--line); padding: 26px 16px 48px; background: var(--bg-soft);
}
.sidebar__title {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-faint); font-weight: 700; margin: 0 8px 10px;
}
.sidebar__cat {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-head); font-weight: 600; padding: 6px 8px 14px; color: var(--ink);
}
.sidebar__cat .icon svg { width: 20px; height: 20px; color: var(--brand); }
.sidebar ul { list-style: none; margin: 2px 0 22px; padding: 0; }
.sidebar li a {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px; color: var(--ink-soft); border-radius: 9px;
  font-size: .92rem; border-left: 3px solid transparent; margin-bottom: 1px;
}
.sidebar li a:hover { background: var(--bg-sunk); color: var(--ink); text-decoration: none; }
.sidebar li a.active { background: var(--brand-soft); color: var(--brand-ink); border-left-color: var(--brand); font-weight: 600; }
.sidebar li a .icon svg { width: 17px; height: 17px; color: currentColor; opacity: .85; }
.sidebar__lessons li a { padding-left: 26px; }
.sidebar li .soon {
  display: block; padding: 8px 12px 8px 26px; color: var(--ink-faint); font-size: .92rem; cursor: default;
}
.sidebar li .soon::after {
  content: "soon"; font-size: .6rem; text-transform: uppercase; letter-spacing: .06em;
  background: var(--bg-sunk); color: var(--ink-faint); padding: 2px 7px; border-radius: 20px;
  margin-left: 7px; vertical-align: middle; font-weight: 600;
}

.content { padding: 34px 48px 90px; min-width: 0; }
.content > *:first-child { margin-top: 0; }

.crumbs { font-size: .82rem; color: var(--ink-faint); margin-bottom: 10px; letter-spacing: .01em; }
.crumbs a { color: var(--ink-faint); }
.crumbs a:hover { color: var(--brand); }

/* page title with icon */
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: .3em; }
.page-head h1 { margin: 0; }
.page-head .icon {
  flex: none; width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center; background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand-line);
}
.page-head .icon svg { width: 24px; height: 24px; color: var(--brand); }

/* ---------- Content components ------------------------------------------ */
.lead { font-size: 1.12rem; color: var(--ink-soft); line-height: 1.6; }

.callout {
  border: 1px solid var(--line); border-left: 4px solid var(--brand);
  background: var(--bg-soft); padding: 15px 18px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 22px 0;
}
.callout p:last-child { margin-bottom: 0; }
.callout.tip  { border-left-color: var(--brand); background: var(--brand-soft); }
.callout.warn { border-left-color: var(--accent); background: var(--accent-soft); }
.callout.note { border-left-color: var(--note-line); background: var(--note-bg); }
.callout__label {
  font-family: var(--font-head); font-weight: 600; display: block; margin-bottom: 3px;
  font-size: .92rem; color: var(--ink);
}

/* "Try it Yourself" interactive box */
.tryit {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  margin: 24px 0; box-shadow: var(--shadow);
}
.tryit__head {
  background: var(--bg-soft); padding: 12px 18px;
  font-family: var(--font-head); font-weight: 600; font-size: .92rem;
  display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line);
}
.tryit__head::before {
  content: ""; width: 0; height: 0; flex: none;
  border-left: 8px solid var(--accent); border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.tryit__body { padding: 18px; }
.tryit__body label { display: block; font-weight: 600; font-size: .88rem; margin: 12px 0 5px; color: var(--ink-soft); }
.tryit textarea, .tryit input[type=text], .tryit select {
  width: 100%; font-family: inherit; font-size: .95rem; padding: 11px 12px;
  border: 1px solid var(--line-strong); border-radius: 9px; background: var(--field-bg); color: var(--ink);
}
.tryit textarea:focus, .tryit input:focus, .tryit select:focus { outline: 2px solid var(--brand-line); border-color: var(--brand); }
.tryit textarea { min-height: 88px; resize: vertical; }
.tryit__out {
  margin-top: 16px; background: var(--bg-code); color: #e2e8f0; padding: 15px; border-radius: 9px;
  white-space: pre-wrap; font-family: "SF Mono", Consolas, monospace; font-size: .86rem; min-height: 42px; line-height: 1.55;
}
.tryit__out:empty::before { content: "Your result will appear here."; color: #64748b; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
  padding: 11px 20px; border-radius: 10px; font-weight: 600; font-size: .95rem; font-family: var(--font);
  transition: background .12s, transform .12s, box-shadow .12s;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); text-decoration: none; color: #fff; transform: translateY(-1px); }
.btn svg { width: 18px; height: 18px; }
.btn--accent { background: var(--accent); border-color: var(--accent); color: #422006; }
.btn--accent:hover { background: #fbbf24; border-color: #fbbf24; color: #422006; }
.btn--ghost { background: var(--field-bg); color: var(--brand-ink); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-dark); }

/* code block with copy */
.code { position: relative; background: var(--bg-code); color: #e2e8f0; border-radius: var(--radius-sm); margin: 20px 0; overflow: hidden; }
.code pre { margin: 0; padding: 18px; overflow-x: auto; font-size: .87rem; line-height: 1.6; }
.code__copy {
  position: absolute; top: 9px; right: 9px; background: rgba(255,255,255,.1); color: #cbd5e1;
  border: 1px solid rgba(255,255,255,.12); padding: 5px 11px; border-radius: 7px; cursor: pointer;
  font-size: .76rem; font-family: var(--font);
}
.code__copy:hover { background: rgba(255,255,255,.2); color: #fff; }

/* tables */
table.data { border-collapse: collapse; width: 100%; margin: 20px 0; font-size: .93rem; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
table.data th, table.data td { border-bottom: 1px solid var(--line); padding: 11px 14px; text-align: left; vertical-align: top; }
table.data th { background: var(--bg-soft); font-family: var(--font-head); font-weight: 600; font-size: .88rem; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:nth-child(even) td { background: var(--row-alt); }

/* checklist */
ul.check { list-style: none; padding-left: 0; }
ul.check li { padding-left: 30px; position: relative; margin: 8px 0; }
ul.check li::before {
  content: ""; position: absolute; left: 0; top: .16em; width: 18px; height: 18px;
  border-radius: 50%; background: var(--brand-soft);
  box-shadow: inset 0 0 0 1.5px var(--brand);
}
ul.check li::after {
  content: ""; position: absolute; left: 0; top: .16em; width: 18px; height: 18px;
  background-color: var(--brand);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' d='M6 12.5l3.8 3.8L18 8'/%3E%3C/svg%3E") center / 11px 11px no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' d='M6 12.5l3.8 3.8L18 8'/%3E%3C/svg%3E") center / 11px 11px no-repeat;
}

/* prev / next pager */
.pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 52px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a { flex: 1; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft); transition: border-color .12s, background .12s; }
.pager a:hover { border-color: var(--brand-line); background: var(--brand-soft); text-decoration: none; }
.pager .next { text-align: right; }
.pager small { display: block; color: var(--ink-faint); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-bottom: 2px; }
.pager b { color: var(--brand-ink); font-family: var(--font-head); font-weight: 600; }

/* ---------- Homepage ---------------------------------------------------- */
.hero {
  position: relative; overflow: hidden; text-align: center; color: #fff;
  padding: 84px 20px 90px;
  background: radial-gradient(1100px 500px at 50% -10%, var(--hero-3) 0%, transparent 60%),
              linear-gradient(160deg, var(--hero-1) 0%, var(--hero-2) 55%, var(--hero-3) 100%);
}
.hero::after {
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.14) 1px, transparent 1px);
  background-size: 22px 22px; mask-image: linear-gradient(to bottom, rgba(0,0,0,.6), transparent 70%);
}
.hero > * { position: relative; z-index: 1; }
.hero__eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: #a7f3d9; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18);
  padding: 6px 14px; border-radius: 30px; margin-bottom: 22px;
}
.hero h1 { color: #fff; font-size: 2.9rem; margin: 0 0 16px; letter-spacing: -.02em; }
.hero p { font-size: 1.18rem; max-width: 660px; margin: 0 auto 30px; color: #e0fbf4; line-height: 1.55; }
.hero__note { display: block; margin-top: 16px; font-size: .85rem; color: #b6ede1; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section-pad { padding: 64px 0; }
.section-title { text-align: center; margin-bottom: 8px; }
.section-sub { text-align: center; color: var(--ink-faint); margin-top: 0; margin-bottom: 40px; font-size: 1.02rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; background: var(--bg);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s; display: block; color: var(--ink);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--brand-line); text-decoration: none; }
.card__icon {
  width: 52px; height: 52px; border-radius: 13px; display: grid; place-items: center;
  background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand-line); margin-bottom: 14px;
}
.card__icon svg { width: 26px; height: 26px; color: var(--brand); }
.card h3 { margin: 0 0 7px; }
.card p { color: var(--ink-soft); font-size: .94rem; margin: 0 0 12px; }
.card__more { color: var(--brand-ink); font-weight: 600; font-size: .9rem; display: inline-flex; align-items: center; gap: 5px; }
.card__more svg { width: 15px; height: 15px; }

.band { background: var(--bg-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* ---------- Footer ------------------------------------------------------ */
.footer { background: var(--nav-bg); color: #94a3b8; padding: 52px 20px 34px; }
.footer__inner { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 34px; }
.footer h4 { color: #e2e8f0; font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; margin: 0 0 12px; }
.footer a { color: #94a3b8; font-size: .9rem; display: block; padding: 4px 0; }
.footer a:hover { color: #5eead4; text-decoration: none; }
.footer__brand { font-family: var(--font-head); font-weight: 700; color: #fff; font-size: 1.12rem; display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.footer__brand .logo { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand-2), var(--brand)); }
.footer__brand .logo svg { width: 17px; height: 17px; color: #fff; }
.footer p { color: #94a3b8; }
.footer__legal { max-width: var(--maxw); margin: 30px auto 0; padding-top: 20px; border-top: 1px solid #1e293b; font-size: .82rem; color: #64748b; }

/* ---------- Responsive -------------------------------------------------- */
/* Collapse the primary nav links into the menu before they can crowd the search box. */
@media (max-width: 1080px) {
  .nav-toggle[data-toggle="menu"] { display: grid; place-items: center; }
  .topnav__links {
    display: none; position: absolute; top: 60px; left: 0; right: 0; background: var(--nav-bg);
    flex-direction: column; padding: 8px; gap: 2px; border-bottom: 1px solid rgba(255,255,255,.08);
    box-shadow: var(--shadow-lg);
  }
  .topnav__links.open { display: flex; }
  .topnav__links a { white-space: normal; }
  /* the Topics dropdown flattens into the mobile menu */
  .topnav__topics { display: block; }
  .topnav__topicsbtn { display: none; }
  .topnav__dropdown {
    display: block; position: static; background: none; border: 0; box-shadow: none;
    padding: 0; min-width: 0;
  }
}

/* Collapse the left content sidebar into a slide-in panel. */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 60px; left: 0; bottom: 0; width: 288px; height: auto; z-index: 40;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 24px 20px 64px; }
  .nav-toggle[data-toggle="sidebar"] { display: grid; place-items: center; }
  .topnav__search input { width: 104px; }
  .topnav__search input:focus { width: 128px; }
  .footer__inner { grid-template-columns: 1fr; gap: 22px; }
  .hero { padding: 60px 18px 64px; }
  .hero h1 { font-size: 2.1rem; }
}

/* Small phones: keep the wordmark readable but stop the top bar overflowing.
   The search collapses to an icon that opens the search page. */
@media (max-width: 600px) {
  .topnav__inner { padding: 0 12px; }
  .topnav__brand { font-size: 1.04rem; margin-right: 8px; }
  .topnav__brand .logo { width: 30px; height: 30px; }
  .topnav__brand .logo svg { width: 18px; height: 18px; }
  .topnav__search input { display: none; }
  .topnav__search button { border-radius: 9px; }
}

/* scrim behind mobile sidebar */
.scrim { display: none; position: fixed; inset: 60px 0 0 0; background: rgba(15,23,42,.4); z-index: 39; }
.scrim.open { display: block; }

/* ---------- Screenshot placeholder / figure ---------------------------- */
figure.shot { margin: 26px 0; }
figure.shot img { display: block; width: 100%; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.shot__ph {
  border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--bg-soft);
  padding: 34px 24px; text-align: center; color: var(--ink-faint);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.shot__ph svg { width: 38px; height: 38px; opacity: .55; color: var(--brand); }
.shot__ph b { font-family: var(--font-head); color: var(--ink-soft); font-size: .95rem; }
.shot__ph .desc { font-size: .92rem; color: var(--ink-soft); max-width: 460px; }
.shot__ph small { font-size: .78rem; opacity: .8; }
figure.shot figcaption { font-size: .85rem; color: var(--ink-faint); margin-top: 9px; text-align: center; }

/* ---------- Theme toggle button ---------------------------------------- */
.theme-btn {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); color: var(--nav-ink);
  cursor: pointer; padding: 8px; border-radius: 9px; display: grid; place-items: center; margin-left: 6px;
}
.theme-btn:hover { background: rgba(255,255,255,.16); color: #fff; }
.theme-btn svg { width: 18px; height: 18px; display: block; }

/* ---------- Dark mode --------------------------------------------------- */
/* Token overrides. Explicit choice wins via [data-theme]; otherwise follow the OS. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #0d9488; --brand-dark: #0b7d72; --brand-2: #2dd4bf;
    --brand-soft: #10312f; --brand-line: #1d514b; --brand-ink: #5eead4;
    --accent: #fbbf24; --accent-soft: #33270f;
    --ink: #e6edf5; --ink-soft: #aab7c6; --ink-faint: #7e8da3;
    --line: #243244; --line-strong: #33445a;
    --bg: #0b1220; --bg-soft: #111b2d; --bg-sunk: #0e1728; --bg-code: #060d1a;
    --nav-bg: #0c1526; --nav-ink: #cbd5e1;
    --note-bg: #1a2138; --note-line: #818cf8;
    --row-alt: #0f1a2c; --field-bg: #0e1728;
    --hero-1: #0c3d3a; --hero-2: #0f5850; --hero-3: #0a6a60;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.3);
    --shadow-md: 0 4px 14px rgba(0,0,0,.45);
    --shadow-lg: 0 18px 40px rgba(0,0,0,.55);
  }
}
:root[data-theme="dark"] {
  --brand: #0d9488; --brand-dark: #0b7d72; --brand-2: #2dd4bf;
  --brand-soft: #10312f; --brand-line: #1d514b; --brand-ink: #5eead4;
  --accent: #fbbf24; --accent-soft: #33270f;
  --ink: #e6edf5; --ink-soft: #aab7c6; --ink-faint: #7e8da3;
  --line: #243244; --line-strong: #33445a;
  --bg: #0b1220; --bg-soft: #111b2d; --bg-sunk: #0e1728; --bg-code: #060d1a;
  --nav-bg: #0c1526; --nav-ink: #cbd5e1;
  --note-bg: #1a2138; --note-line: #818cf8;
  --row-alt: #0f1a2c; --field-bg: #0e1728;
  --hero-1: #0c3d3a; --hero-2: #0f5850; --hero-3: #0a6a60;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 14px rgba(0,0,0,.45);
  --shadow-lg: 0 18px 40px rgba(0,0,0,.55);
}

/* ---------- Table of contents (right rail, wide screens) --------------- */
.toc { display: none; }
@media (min-width: 1081px) {
  .layout.has-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w); }
  .toc {
    display: block; position: sticky; top: 76px; align-self: start;
    max-height: calc(100vh - 96px); overflow-y: auto;
    padding: 22px 8px 30px 20px; border-left: 1px solid var(--line); font-size: .85rem;
  }
}
.toc__title { font-family: var(--font-head); font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-faint); font-weight: 700; margin-bottom: 10px; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li a {
  display: block; padding: 5px 10px; color: var(--ink-faint); line-height: 1.35;
  border-left: 2px solid transparent; border-radius: 0 6px 6px 0;
}
.toc li a:hover { color: var(--ink); text-decoration: none; }
.toc li a.active { color: var(--brand-ink); border-left-color: var(--brand); background: var(--brand-soft); font-weight: 600; }

/* ---------- Progress bar (section / homepage) -------------------------- */
.progress { margin: 6px 0 26px; }
.progress__track { height: 8px; border-radius: 20px; background: var(--bg-sunk); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.progress__fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .35s ease; }
.progress__label { font-size: .8rem; color: var(--ink-faint); margin-top: 7px; font-weight: 500; }
.progress__label b { color: var(--brand-ink); font-weight: 700; }

/* compact progress inside a section card */
.card__progress { margin-top: 12px; }
.card__progress .progress__track { height: 6px; }
.card__progress .progress__label { font-size: .74rem; margin-top: 6px; }

/* ---------- "Mark complete" control ------------------------------------ */
.lesson-complete {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 44px 0 0; padding: 16px 18px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--bg-soft);
}
.lesson-complete.is-done { border-color: var(--brand-line); background: var(--brand-soft); }
.btn--complete { background: var(--field-bg); color: var(--brand-ink); border-color: var(--line-strong); }
.btn--complete:hover { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-ink); }
.lesson-complete.is-done .btn--complete { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn--complete svg { width: 17px; height: 17px; }
.lesson-complete__hint { font-size: .88rem; color: var(--ink-soft); }

/* completed marker in the sidebar lesson list */
.sidebar__lessons a.done { position: relative; }
.sidebar__lessons a.done::after {
  content: ""; width: 15px; height: 15px; margin-left: auto; flex: none;
  background-color: var(--brand);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' d='M6 12.5l3.8 3.8L18 8'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' d='M6 12.5l3.8 3.8L18 8'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* completed badge on a section-lesson card */
.card.done { border-color: var(--brand-line); }
.card__done { display: inline-flex; align-items: center; gap: 5px; color: var(--brand-ink); font-size: .78rem; font-weight: 700; margin-bottom: 8px; }
.card__done svg { width: 15px; height: 15px; }

/* ---------- Reading time ----------------------------------------------- */
.reading-time { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-faint); font-size: .85rem; margin: 0 0 1.1em; }
.reading-time svg { width: 15px; height: 15px; }

/* ---------- Heading anchor links --------------------------------------- */
.content h2.has-hash { position: relative; }
.content h2 .hash {
  margin-left: .4em; color: var(--ink-faint); font-weight: 400; text-decoration: none;
  opacity: 0; transition: opacity .12s, color .12s; font-size: .8em;
}
.content h2:hover .hash, .content h2 .hash:focus { opacity: 1; }
.content h2 .hash:hover { color: var(--brand); }
.content h2 .hash.copied { opacity: 1; color: var(--brand); }
.content h2 .hash.copied::after {
  content: "Link copied"; position: absolute; margin-left: 8px; font-size: .6em;
  font-family: var(--font); color: var(--brand-ink); background: var(--brand-soft);
  padding: 2px 7px; border-radius: 20px; white-space: nowrap; vertical-align: middle;
}

/* ---------- "Read next" related lessons -------------------------------- */
.related { margin-top: 44px; }
.related__title { margin: 0 0 14px; }

/* ---------- Overall progress + reset (homepage) ------------------------ */
.overall { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center; max-width: 560px; margin: 0 auto 34px; }
.overall .progress { flex: 1; min-width: 240px; margin: 0; }
.btn--sm { padding: 7px 13px; font-size: .84rem; }

/* ---------- "Start here" path list ------------------------------------- */
.pathlist { list-style: none; counter-reset: step; padding: 0; margin: 26px 0; }
.pathlist li {
  counter-increment: step; position: relative; padding: 16px 18px 16px 64px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft); margin-bottom: 14px;
}
.pathlist li::before {
  content: counter(step); position: absolute; left: 16px; top: 16px;
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff;
  font-family: var(--font-head); font-weight: 700; display: grid; place-items: center;
}
.pathlist .step-sec { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--brand-ink); font-weight: 700; }
.pathlist h3 { margin: 3px 0 4px; font-size: 1.08rem; }
.pathlist p { margin: 0; color: var(--ink-soft); font-size: .93rem; }

/* ---------- Accessibility ---------------------------------------------- */
.skip-link {
  position: absolute; left: 12px; top: -64px; z-index: 100;
  background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 9px;
  font-weight: 600; box-shadow: var(--shadow-lg); transition: top .15s ease;
}
.skip-link:focus { top: 12px; text-decoration: none; color: #fff; }
main:focus { outline: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 5px; }
.topnav :focus-visible, .footer :focus-visible, .hero :focus-visible { outline-color: var(--brand-2); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
