/* ============================================================
   PORTFOLIO v2 — terminal / HUD edition (orage.studio inspired)
   THEME — change these variables to restyle the whole site
   ============================================================ */
:root {
  --bg: #000000;            /* page background */
  --surface: #0a0a0a;       /* window body */
  --bar: #ffffff;           /* window title bar */
  --bar-ink: #000000;       /* text on title bar */
  --text: #f2f2f2;          /* main text */
  --muted: #8a8a8a;         /* secondary text */
  --line: #ffffff;          /* window borders */
  --border: #3a3a3a;        /* inner borders */
  --font-mono: "JetBrains Mono", "Consolas", monospace;
  --font-display: "Sora", sans-serif;
  --radius: 12px;           /* windows and cards */
  --radius-sm: 6px;         /* buttons, tags, small boxes */
}

/* ============================================================
   DUSK MODE — warm, low-glare variant of the theme above.
   Activated by <html data-theme="dusk">. The default theme is
   untouched; this block only overrides the color variables.
   ============================================================ */
[data-theme="dusk"] {
  --bg: #000000;            /* pure black page background */
  --surface: #0b0b0b;       /* window body, a touch lifted off --bg */
  --bar: #000000;           /* true black title bar (white in the default theme) */
  --bar-ink: #e4e4e4;       /* light text on the title bar */
  --text: #e4e4e4;          /* slightly dimmed body text */
  --muted: #808080;         /* neutral gray secondary text */
  --line: #000000;          /* true black borders (white in the default theme) */
  --border: #1a1a1a;        /* inner borders, near-black */
}

/* In dusk, highlights read as dark-on-cream rather than cream-on-dark,
   so .invert flips the other way than it does in the default theme. */
[data-theme="dusk"] .invert {
  background: #000000;
  color: var(--text);
}

/* --line is used both as a border color and as the white fill behind
   buttons, the footer and hover states. Dusk keeps the borders visible
   but makes every one of those fills true black. */
[data-theme="dusk"] .btn {
  background: #000000;
  color: var(--text);
}
[data-theme="dusk"] .btn:hover {
  background: #000000;
  border-color: var(--text);
  color: #ffffff;
}
[data-theme="dusk"] .btn-ghost { background: transparent; }
[data-theme="dusk"] .btn-ghost:hover {
  background: #000000;
  color: var(--text);
}
[data-theme="dusk"] .project-card:hover .project-link {
  background: #000000;
  color: var(--text);
}
[data-theme="dusk"] .footer {
  background: #000000;
  color: var(--text);
}

/* Shadows and texture gradients, dimmed to match the softer dusk contrast. */
[data-theme="dusk"] .window { box-shadow: 8px 8px 0 rgba(255, 255, 255, 0.06); }
[data-theme="dusk"] .window:hover { border-color: var(--muted); } /* --line is black in dusk */
[data-theme="dusk"] .project-card:hover { box-shadow: 5px 5px 0 rgba(255, 255, 255, 0.10); }
/* Grid lines drawn as a solid very-dark gray rather than a translucent
   white, so they sit just barely above the black background. */
[data-theme="dusk"] .grid-bg {
  background-image:
    linear-gradient(#0c0c0c 1px, transparent 1px),
    linear-gradient(90deg, #010101 1px, transparent 1px);
}
[data-theme="dusk"] .project-thumb:not(.thumb-cutoff) {
  background:
    repeating-linear-gradient(45deg, transparent, transparent 10px,
      rgba(255, 255, 255, 0.04) 10px, rgba(255, 255, 255, 0.04) 11px);
}

/* Theme toggle button in the top bar */
.theme-toggle {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: transparent;
  border: 0;                 /* icon only, no box around it */
  color: var(--muted);
  padding: 0;
  /* fixed square, icon centered in it, so both moons sit on the same point */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.25s, text-shadow 0.25s;
}
.theme-toggle:hover { color: var(--text); }
/* slim top bar: file path + centered live coords + toggle, not sticky.
   .topbar.topbar-slim (two classes) outweighs the sticky .topbar rule below. */
.topbar.topbar-slim { justify-content: space-between; position: relative; }
/* live coordinate readout centered on the page, independent of the path/toggle */
.topbar-coords { position: absolute; left: 50%; transform: translateX(-50%); }

/* collapsed tab: hidden until the full header scrolls away, then it floats
   top-left with the path on top and the live coordinates smaller underneath */
.scroll-tab {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  text-transform: uppercase;
  line-height: 1.3;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.scroll-tab.visible { opacity: 1; transform: translateY(0); }
.scroll-tab .win-coords { font-size: 0.6rem; opacity: 0.55; }

/* Dusk active: the toggle glows white so the current mode is obvious. */
[data-theme="dusk"] .theme-toggle {
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
}
[data-theme="dusk"] .theme-toggle:hover {
  text-shadow: 0 0 10px #ffffff;
}

/* ============ Base ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2 { font-family: var(--font-display); }
.invert { background: var(--line); color: var(--bg); padding: 0 8px; }

/* faint background grid, like a design tool canvas */
.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 10px 10px;
  pointer-events: none;
  z-index: 0;
}

main { max-width: 1200px; margin: 0 auto; padding: 40px 24px 0; position: relative; z-index: 1; }

/* ============ Top bar ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
  text-transform: uppercase;
}
.path { color: var(--text); }
.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ============ Windows ============ */
/* Omarchy/Hyprland-style tiles: no title bar, rounded corners, dim border
   that lights up on the hovered ("focused") window. */
.window {
  position: relative; /* anchor for the corner labels */
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 56px;
  box-shadow: 8px 8px 0 rgba(255, 255, 255, 0.08);
  transition: border-color 0.2s;
}
.window:hover { border-color: var(--line); }
/* the old title bar is now just two corner labels floating over the box */
.window-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  font-size: 0.65rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
}
.win-coords { font-variant-numeric: tabular-nums; opacity: 0.6; }
.win-title { opacity: 0; transition: opacity 0.2s; white-space: nowrap; order: 0; } /* filename: hidden until hover, on the left of every window bar */
.window:hover .win-title { opacity: 1; }
.window-bar .win-coords { order: 1; } /* category label (CTF // …, INDEX) on the right */
.win-controls { display: none; }
/* hero: filename (.exe) always visible (fades in on load), on the right like every other window */
#win-hero .win-title { opacity: 1; animation: heroTitleFade 0.9s ease both; }
@keyframes heroTitleFade { from { opacity: 0; } to { opacity: 1; } }
.window-body { padding: 44px 40px; }

/* ============ Tiles (Hyprland-style master-stack) ============
   Wrap several .window sections in <div class="tiles">. The .tile-main
   window takes the left column at full height; the rest stack on the right. */
.tiles {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  margin-bottom: 56px;
  scroll-margin-top: 70px; /* so the sticky top bar doesn't cover it when jumped to */
}
.tiles .window { margin-bottom: 0; }
.tiles .tile-main { grid-row: span 2; }
.tiles .window-body { padding: 40px 28px 28px; } /* extra top room for the corner labels */
/* side windows are already framed, so drop the inner box and divider */
.tiles .about-facts { border: none; padding: 0; }
.tiles .hero-stats { margin-top: 0; padding-top: 0; border-top: none; gap: 40px; justify-content: center; text-align: center;}
.about-facts li { display: flex; gap: 1ch; }
.about-facts em { flex: 1; }

/* ============ Buttons ============ */
.btn {
  display: inline-block;
  background: var(--line);
  color: var(--bg);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 12px 24px;
  border: 1px solid var(--line);
  transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--bg); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--line); color: var(--bg); }

/* ============ Hero ============ */
.hero h1 {
  font-size: clamp(2.4rem, 6.5vw, 4.4rem);
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1.1;
  margin-bottom: 24px;
}
.hero-sub { color: var(--muted); font-size: 0.95rem; margin-bottom: 36px; }
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }
.hero-stats {
  display: flex;
  gap: 56px;
  list-style: none;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}
.hero-stats strong { font-family: var(--font-display); font-size: 1.7rem; display: block; }
.hero-stats span { color: var(--muted); font-size: 0.75rem; letter-spacing: 1px; }
/* clickable stat (CTF counter) — same hover as project cards; negative margin keeps it aligned with the other stats */
.stat-link {
  display: block;
  padding: 6px 12px;
  margin: -6px -12px;
  transition: background 0.15s, color 0.15s;
}
.stat-link:hover { background: var(--line); color: var(--bg); } /* same inverted highlight as the demo link */
.stat-link:hover strong, .stat-link:hover span { color: var(--bg); }

/* ============ Section headings ============ */
h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 700; letter-spacing: -1px; margin-bottom: 8px; }
.section-sub { color: var(--muted); font-size: 0.9rem; margin-bottom: 36px; }

/* ============ Projects ============ */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}
.project-card {
  position: relative; /* anchor for the stretched project-link overlay */
  border: 1px solid var(--border);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.project-card:hover { border-color: var(--line); box-shadow: 5px 5px 0 rgba(255, 255, 255, 0.12); }
.project-thumb {
  height: 160px;
  border-bottom: 1px solid var(--border);
  background:
    repeating-linear-gradient(45deg, transparent, transparent 10px,
      rgba(255,255,255,0.03) 10px, rgba(255, 255, 255, 0.03) 11px);
  display: flex;
  align-items: center;
  justify-content: center;
}
/* a transparent cut-out of the site's top half, sitting straight on the black card */
.thumb-cutoff { background-color: var(--bg); background-size: cover; background-position: center top; background-repeat: no-repeat; }
/* a thumb drawn in code: a few mono lines, one highlighted, instead of a screenshot */
.thumb-code { display: block; padding: 16px 18px; overflow: hidden; background: var(--bg); }
.thumb-code pre { font-family: var(--font-mono); font-size: 0.66rem; line-height: 1.75; color: var(--muted); white-space: pre; font-variant-ligatures: none; } /* no ligatures: keep <!-- as typed, not an arrow */
.thumb-code .t-hi { color: var(--text); }
.thumb-code .t-bad { color: #f87171; text-shadow: 0 0 6px rgba(248, 113, 113, 0.45); }
.thumb-code .t-ok { color: #4ade80; text-shadow: 0 0 6px rgba(74, 222, 128, 0.45); }
/* Thumbnail label — replace the div with an <img> when you have screenshots */
.project-thumb::after {
  content: attr(data-label);
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 2px;
}
.project-body { padding: 24px; }
.project-tags { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  border: 1px solid var(--border);
  padding: 4px 12px;
  color: var(--muted);
}
.project-body h3 { font-size: 1.05rem; margin-bottom: 8px; }
.project-body p { color: var(--muted); font-size: 0.85rem; margin-bottom: 16px; }
.project-link { font-size: 0.85rem; font-weight: 700; }
/* stretch the link over the whole card so the card itself is clickable */
.project-link::after { content: ""; position: absolute; inset: 0; }
.project-card:hover .project-link { background: var(--line); color: var(--bg); }

/* ============ About ============ */
.about-facts {
  list-style: none;
  border: 1px solid var(--border);
  padding: 24px;
  display: grid;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--muted);
}
.about-facts em { color: var(--text); font-style: normal; }

/* ============ Skills ============ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
  margin-top: 28px;
}
.skill-col { border: 1px solid var(--border); padding: 24px; }
.skill-col h3 { font-size: 0.85rem; letter-spacing: 2px; margin-bottom: 16px; }
.skill-col ul { list-style: none; display: grid; gap: 10px; }
.skill-col li { color: var(--muted); font-size: 0.85rem; padding-left: 20px; position: relative; }
.skill-col li::before { content: ">"; color: var(--text); position: absolute; left: 0; }

/* ============ Contact ============ */
.contact { text-align: center; }
.contact h2 { max-width: 640px; margin: 0 auto 16px; }
.contact > p { color: var(--muted); font-size: 0.9rem; margin-bottom: 32px; }
.contact-links { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* ============ Footer ============ */
.footer {
  background: var(--line);
  border-top: 1px solid var(--line);
  text-align: center;
  padding: 24px;
  color: var(--bar-ink);
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  position: relative;
  z-index: 1;
}

/* ============ Cursor coordinate readout ============ */
#cursor-coords {
  position: fixed;
  left: -100px;
  top: -100px;
  transform: translateX(-50%);
  font-size: 0.45rem;
  color: var(--text);
  background: none;
  border: 1px solid var(--line); /* same frame as the collapsed tab and the windows */
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  pointer-events: none;
  z-index: 9999;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ============ Write-ups page ============ */
/* difficulty colors: each write-up window and log tag glows its color */
.easy { --diff: #4ade80; }
.med  { --diff: #fbbf24; }
.hard { --diff: #f87171; }
.writeup { scroll-margin-top: 70px; } /* log links don't land under the sticky top bar */
/* page-type marker (INDEX, CASE STUDY, CTF // MED): centered across the top of the window on every page;
   the file name stays on the right. It carries its own top offset so the file name isn't pushed down. */
.window-bar .win-coords {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
}
/* on write-ups the marker glows in the difficulty color (only the label, not the whole box) */
.writeup .win-coords {
  color: var(--diff);
  opacity: 1;
  text-shadow: 0 0 6px color-mix(in srgb, var(--diff) 45%, transparent);
}
.wu-log { list-style: none; display: grid; gap: 10px; font-size: 0.9rem; }
.wu-log a {
  display: flex;
  gap: 1ch;
  align-items: baseline;
  padding: 6px 10px;
  margin: -6px -10px;         /* keep text aligned despite the padding */
  border-radius: var(--radius-sm);
  transition: background 0.18s, box-shadow 0.18s;
}
/* hover: soft rectangle in the challenge's own color, dim and slightly blurred */
.wu-log a:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--diff) 16%, transparent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--diff) 14%, transparent);
}
.wu-log em { color: var(--muted); font-style: normal; font-size: 0.75rem; margin-left: auto; } /* category pinned to the right so the row fills the width */
/* case study page */
.inline-link { color: var(--text); text-decoration: underline; }
.case-hero {
  height: auto; /* keeps the ratio now that the img has width/height attributes */
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 20px 0 8px;
}
.asset-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 14px;
  margin: 14px 0 8px;
}
.asset {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #d6d6d6; /* SVGs are drawn for a light page; soft gray so it isn't a glaring white block */
  padding: 14px;
  text-align: center;
}
.asset img { width: 100%; height: 90px; object-fit: contain; }
.asset span { display: block; margin-top: 8px; font-size: 0.65rem; color: #000; letter-spacing: 1px; text-transform: uppercase; }
.asset-wide { grid-column: span 2; }

.wu-back { margin: 0 0 20px; font-size: 0.85rem; }
.wu-back a { color: var(--muted); }
.wu-back a:hover { color: var(--text); }
.diff-tag {
  color: var(--diff);
  font-size: 0.75rem;
  font-weight: 700;
  text-shadow: 0 0 6px color-mix(in srgb, var(--diff) 45%, transparent);
}
.writeup h3 { font-size: 0.95rem; letter-spacing: 1px; margin: 28px 0 8px; }
.writeup p { color: var(--muted); font-size: 0.9rem; max-width: 75ch; }
.writeup code { color: var(--text); }
/* reading text is set in Sora; mono is kept for labels, paths, tags and code */
.writeup p { font-family: var(--font-display); font-weight: 400; }
.writeup .section-sub, .writeup code, .writeup pre { font-family: var(--font-mono); }
.writeup pre {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 16px;
  margin: 14px 0;
  white-space: pre-wrap; overflow-wrap: anywhere; /* long code wraps to the box width instead of scrolling */
  font-size: 0.8rem;
}

/* ============ Rounded corners on everything ============ */
.project-card, .skill-col { border-radius: var(--radius); overflow: hidden; }
.btn, .tag, .theme-toggle, .about-facts, .stat-link { border-radius: var(--radius-sm); }

/* ============ Mobile ============ */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; font-size: 0.7rem; }
  .hero-stats { gap: 30px; }
  .win-title { display: none; }
  .topbar { padding: 10px 12px; font-size: 0.65rem; gap: 8px; }
  .path { font-size: 0.6rem; }
  /* phones: the homepage keeps the readout centered on the page itself (not on the gap left between the path and the moon);
     sub-pages have long paths and no toggle, so there it sits on the right instead of overlapping the path */
  .topbar-coords:last-child { position: static; transform: none; margin-left: auto; }
  .hero h1 { font-size: 1.8rem; margin-bottom: 16px; word-break: break-word; line-height: 1.15; } .hero h1 .invert { display: block; margin: 2px 0; }
  .hero-sub { font-size: 0.85rem; }
  .hero-actions { gap: 10px; }
  .hero-stats { gap: 24px; margin-top: 32px; padding-top: 18px; }
  .window-body { padding: 24px 16px; }
  .window-bar { padding: 5px 10px; font-size: 0.65rem; }
  .win-coords { min-width: 0; } /* no fixed width: it pushed the centered difficulty label off-center */
  /* write-ups on phones: tag stays on one line, category drops under the title, code wraps */
  .diff-tag { white-space: nowrap; flex-shrink: 0; }
  .wu-log a { flex-wrap: wrap; }
  .wu-log em { flex-basis: 100%; margin-left: 0; }
  .writeup pre { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; font-size: 0.72rem; }
  .writeup p code { overflow-wrap: anywhere; }
  .window:has(.window-bar .win-coords) .window-body { padding-top: 40px; } /* room so the centered marker doesn't sit on the title */
  .project-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .project-thumb { height: 100px; }
  .thumb-code { padding: 9px 10px; }
  .thumb-code pre { font-size: 0.46rem; line-height: 1.7; }
  .project-thumb::after { font-size: 0.6rem; letter-spacing: 1px; }
  .project-body { padding: 12px; }
  .project-tags { gap: 6px; margin-bottom: 10px; }
  .tag { font-size: 0.55rem; padding: 2px 6px; }
  .project-body h3 { font-size: 0.85rem; }
  .project-body p { font-size: 0.7rem; margin-bottom: 12px; }
  .project-link { font-size: 0.7rem; }
  .about-facts { padding: 16px; font-size: 0.75rem; }
  .tiles { grid-template-columns: 1fr; gap: 16px; }
  .tiles .tile-main { grid-row: auto; }
  .tiles .window-body { padding: 20px 16px; }
  .tiles .about-facts { padding: 0; }
  .tiles .hero-stats { gap: 24px; }
  .skills-grid { grid-template-columns: 1fr; }
  .skill-col { padding: 16px; }
  .contact h2 { font-size: 1.4rem; }
  .contact-links { gap: 10px; }
  .btn { padding: 10px 16px; font-size: 0.75rem; }
  #cursor-coords { display: none; }
}
/* sub-pages: the collapsed tab is a link back a page, clickable only while shown */
a.scroll-tab.visible { pointer-events: auto; cursor: pointer; }
a.scroll-tab:hover { background: #bdbdbd; border-color: #bdbdbd; color: var(--bg); } /* soft grey, not full white */
a.scroll-tab:hover .win-coords { opacity: 0.85; } /* Y value darker against the grey */
a.scroll-tab:hover .path { color: inherit; }

/* never leave a lone word on the last line: titles and log rows split into even
   lines whatever their length; body text just avoids a one-word last line */
h1, h2, h3, .wu-log a, .wu-log em { text-wrap: balance; }
.writeup p, .section-sub, .hero-sub { text-wrap: pretty; }

/* main call-to-action: the filled button is clearly bigger than the outline one beside it */
.hero-actions, .contact-links { align-items: center; }
.hero-actions .btn:not(.btn-ghost), .contact-links .btn:not(.btn-ghost) { font-size: 1rem; padding: 16px 32px; }
@media (max-width: 720px) {
  .hero-actions .btn:not(.btn-ghost), .contact-links .btn:not(.btn-ghost) { font-size: 0.85rem; padding: 12px 20px; }
}

/* ============ Write-up reference block (framework version, under the prose) ============ */
.wu-ref { margin-top: 8px; }
.writeup ol, .writeup .wu-ref ul { color: var(--muted); font-family: var(--font-display); font-size: 0.9rem; max-width: 75ch; padding-left: 22px; }
.writeup .wu-ref li { margin: 6px 0; }
.writeup li code, .writeup p code { overflow-wrap: anywhere; }

/* ============ Write-up Index: definitions listed at the end of each write-up ============ */
.idx-list { list-style: none; display: grid; gap: 12px; max-width: 75ch; padding: 0; }
.idx-list li { position: relative; padding-left: 28px; border-left: 2px solid transparent; font-size: 0.85rem; color: var(--muted); font-family: var(--font-display); scroll-margin-top: 24px; }
.idx-list li:target { border-left-color: var(--text); color: var(--text); }
.idx-n { position: absolute; left: 8px; top: 1px; font-family: var(--font-mono); font-size: 0.72rem; color: var(--text); }
.idx-term { display: block; color: var(--text); font-weight: 600; margin-bottom: 2px; }
.idx-list code { font-family: var(--font-mono); color: var(--text); overflow-wrap: anywhere; }

/* numbered term in the text: dotted underline + superscript number, like an Obsidian footnote */
.fn { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
.fn:hover, .fn:focus-visible, .fn[aria-expanded="true"] { color: var(--text); }
.fn sup { font-family: var(--font-mono); font-size: 0.62em; color: var(--text); margin-left: 1px; }

/* definition box shown under a clicked term */
.fn-pop { position: absolute; z-index: 50; max-width: 320px; padding: 12px 14px; background: var(--surface); color: var(--text); border: 1px solid var(--text); border-radius: var(--radius-sm); font-family: var(--font-display); font-size: 0.8rem; line-height: 1.5; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }
.fn-pop strong { display: block; margin-bottom: 4px; font-family: var(--font-mono); font-size: 0.75rem; }
.fn-pop code { font-family: var(--font-mono); }


/* ============ Scrollbars: thin, rounded, theme-coloured (every page) ============ */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 55%, transparent) transparent; } /* Chrome 121+, Edge, Firefox */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 55%, transparent); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }
