/* ============================================================
   mob5824m — portfolio stylesheet
   Design tokens live at the top; tweak those to reskin the site.
   ============================================================ */

:root {
  --accent: #7c8cff;
  --accent-2: #4dd4c0;
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1120px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

/* Dark (default) */
[data-theme="dark"] {
  --bg: #0a0b10;
  --bg-2: #0f111a;
  --surface: rgba(255, 255, 255, .035);
  --surface-2: rgba(255, 255, 255, .06);
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .18);
  --text: #e8eaf2;
  --muted: #969cb3;
  --shadow: 0 18px 50px rgba(0, 0, 0, .5);
  --grid-line: rgba(255, 255, 255, .028);
  --ship: #4ade80;                 /* shipped / completed */
  --next: #fb923c;                 /* queued / not started */
}

/* Light */
[data-theme="light"] {
  --bg: #fbfbfd;
  --bg-2: #f2f3f8;
  --surface: rgba(10, 12, 30, .025);
  --surface-2: rgba(10, 12, 30, .05);
  --border: rgba(10, 12, 30, .1);
  --border-strong: rgba(10, 12, 30, .22);
  --text: #14161f;
  --muted: #5c6274;
  --shadow: 0 18px 44px rgba(20, 22, 40, .12);
  --grid-line: rgba(10, 12, 30, .035);
  --ship: #16a34a;                 /* shipped / completed */
  --next: #ea580c;                 /* queued / not started */
  --accent: #5462f0;
  --accent-2: #0f9d8c;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 90px; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .35s var(--ease), color .35s var(--ease);
}

img { max-width: 100%; display: block; }
a { color: inherit; }

.container { width: min(100% - 2.5rem, var(--maxw)); margin-inline: auto; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: .7rem 1.1rem;
  border-radius: 0 0 var(--radius-sm) 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Background decoration ─────────────────────────────────── */
.bg-grid {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 35%, transparent 100%);
}
.bg-glow {
  position: fixed; z-index: -1; pointer-events: none;
  top: -30vh; left: 50%; transform: translateX(-50%);
  width: 130vw; height: 90vh;
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--accent) 26%, transparent), transparent 72%),
    radial-gradient(closest-side, color-mix(in srgb, var(--accent-2) 16%, transparent), transparent 70%);
  background-position: 30% 40%, 72% 15%;
  background-size: 62% 100%, 55% 85%;
  background-repeat: no-repeat;
  filter: blur(28px);
  opacity: .75;
}
[data-theme="light"] .bg-glow { opacity: .5; }

/* ── Header ────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.site-header.scrolled { border-bottom-color: var(--border); }

.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 1rem; }

.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 7px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 1px var(--border-strong), 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent);
}
.brand-name { font-family: var(--mono); font-size: .95rem; }

.nav-links { display: flex; align-items: center; gap: 1.6rem; }
.nav-links a {
  text-decoration: none; color: var(--muted); font-size: .93rem; font-weight: 500;
  position: relative; padding: .25rem 0; transition: color .2s;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 1.5px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .28s var(--ease);
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { width: 100%; }

.theme-toggle {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); cursor: pointer;
  transition: transform .25s var(--ease), background .2s, border-color .2s;
}
.theme-toggle:hover { transform: rotate(18deg) scale(1.06); border-color: var(--border-strong); }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
[data-theme="dark"]  .icon-sun  { display: block; }
[data-theme="dark"]  .icon-moon { display: none; }
[data-theme="light"] .icon-sun  { display: none; }
[data-theme="light"] .icon-moon { display: block; }

.nav-toggle {
  display: none; flex-direction: column; gap: 5px; justify-content: center;
  width: 40px; height: 38px; padding: 0 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer;
}
.nav-toggle span { display: block; height: 2px; background: var(--text); border-radius: 2px; transition: transform .3s var(--ease), opacity .2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Hero ──────────────────────────────────────────────────── */
.hero { padding: clamp(3.5rem, 11vw, 7.5rem) 0 clamp(2.5rem, 6vw, 4rem); }

.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  margin: 0 0 1.4rem; padding: .34rem .85rem .34rem .6rem;
  font-size: .8rem; font-weight: 500; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
}
.dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-2) 70%, transparent);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.hero-title {
  margin: 0 0 1.2rem;
  font-size: clamp(2.3rem, 7vw, 4.4rem);
  line-height: 1.06;
  letter-spacing: -.035em;
  font-weight: 800;
  max-width: 16ch;
}
.grad {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.typer { font-family: var(--font); }
.caret {
  display: inline-block; width: 3px; height: .82em; margin-left: .06em;
  background: var(--accent); vertical-align: -.06em; border-radius: 2px;
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-role {
  margin: -.4rem 0 1rem;
  font-family: var(--mono);
  font-size: clamp(.9rem, 1.5vw, 1.02rem);
  color: var(--accent);
  letter-spacing: -.01em;
}

.hero-sub { max-width: 58ch; color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.12rem); margin: 0 0 2rem; }

.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .78rem 1.4rem; border-radius: 999px;
  font-size: .94rem; font-weight: 600; text-decoration: none;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .22s var(--ease), box-shadow .22s, background .2s, border-color .2s, color .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  color: #08090f;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 32%, transparent);
}
.btn-primary:hover { box-shadow: 0 16px 34px color-mix(in srgb, var(--accent) 42%, transparent); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--border-strong); background: var(--surface-2); }

.stats {
  display: flex; flex-wrap: wrap; gap: clamp(1.5rem, 5vw, 3.4rem);
  list-style: none; margin: 3.2rem 0 0; padding: 0;
}
.stats li strong { display: block; font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }
.stats li span { font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

/* ── Sections ──────────────────────────────────────────────── */
.section { padding: clamp(3.5rem, 8vw, 6rem) 0; }

.section-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 1.4rem; margin-bottom: 2.4rem;
}
.section-title {
  margin: 0 0 .35rem;
  font-size: clamp(1.7rem, 3.6vw, 2.4rem);
  letter-spacing: -.03em; font-weight: 700;
}
.section-sub { margin: 0; color: var(--muted); font-size: .96rem; }

/* ── Filters ───────────────────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.filter {
  padding: .42rem .95rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); font-size: .84rem; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: all .2s var(--ease);
}
.filter:hover { color: var(--text); border-color: var(--border-strong); }
.filter[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  color: var(--text);
}

/* ── Project grid ──────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.15rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform .3s var(--ease), border-color .3s, box-shadow .3s, background .3s;
}

.project {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  padding: 1.5rem; text-align: left; width: 100%;
  font: inherit; color: inherit; cursor: pointer;
  animation: cardIn .45s var(--ease) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } }

.project::before {
  content: ""; position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%),
              color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%);
  transition: opacity .3s; pointer-events: none;
}
.project:hover {
  transform: translateY(-5px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.project:hover::before { opacity: 1; }
.project.featured { grid-column: span 2; }

.project-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.05rem; }

.thumb {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  font-size: 1.4rem; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-icon {
  width: 24px; height: 24px;
  color: var(--accent);
  transition: color .3s var(--ease), transform .3s var(--ease);
}
.project:hover .thumb-icon { color: var(--accent-2); transform: scale(1.08); }

.meta { display: flex; align-items: center; gap: .5rem; font-size: .74rem; color: var(--muted); font-family: var(--mono); }

.badge {
  padding: .18rem .55rem; border-radius: 999px; font-size: .68rem;
  letter-spacing: .04em; text-transform: uppercase; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface-2); font-family: var(--font);
}
/* Badge colours mirror the timeline dots: in-flight work takes the accent,
   queued work goes orange. */
.badge.live     { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 45%, transparent); }
.badge.progress { color: var(--accent);   border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.badge.next     { color: var(--next);     border-color: color-mix(in srgb, var(--next) 45%, transparent); }
.badge.archived { color: var(--muted); }

.project h3 { margin: 0 0 .45rem; font-size: 1.18rem; letter-spacing: -.015em; font-weight: 650; }
.project p  { margin: 0 0 1.15rem; color: var(--muted); font-size: .93rem; flex: 1; }

.tags { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; margin: 0; padding: 0; }
.tag {
  padding: .22rem .6rem; border-radius: 7px; font-size: .74rem;
  font-family: var(--mono); color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
}

.project .arrow {
  margin-top: 1.1rem; font-size: .84rem; font-weight: 600;
  color: var(--accent); display: inline-flex; align-items: center; gap: .35rem;
}
.project .arrow span { transition: transform .25s var(--ease); }
.project:hover .arrow span { transform: translateX(4px); }

.empty { text-align: center; color: var(--muted); padding: 3rem 0; }

/* Placeholder card shown while PROJECTS is still empty */
.project.placeholder {
  cursor: default;
  border-style: dashed;
  border-color: var(--border-strong);
  background: transparent;
}
.project.placeholder:hover { transform: none; box-shadow: none; }
.project.placeholder:hover::before { opacity: 0; }
.project.placeholder .thumb { border-style: dashed; opacity: .7; }
.project.placeholder h3 { opacity: .85; }
.project.placeholder .tag { opacity: .5; }
.project.placeholder code {
  font-family: var(--mono);
  font-size: .85em;
  padding: .1em .4em;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

/* ── About ─────────────────────────────────────────────────── */
.about { display: grid; grid-template-columns: 1.5fr 1fr; gap: 2.5rem; align-items: start; }
.about-copy p { color: var(--muted); max-width: 62ch; }
/* Lead paragraph reads as the opening statement */
.about-copy p:first-of-type {
  font-size: clamp(1.02rem, 1.5vw, 1.14rem);
  color: var(--text);
  line-height: 1.6;
}
.about-card { padding: 1.6rem; position: sticky; top: 92px; }
.about-card h3 { margin: 0 0 1.1rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }

.skills { display: flex; flex-wrap: wrap; gap: .45rem; list-style: none; padding: 0; margin: 1.7rem 0 0; }
.skills li {
  padding: .34rem .78rem; border-radius: 8px; font-size: .82rem;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  transition: transform .2s var(--ease), border-color .2s;
}
.skills li:hover { transform: translateY(-2px); border-color: var(--border-strong); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1.25rem 1.3rem; border-left: 1px solid var(--border); }
.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline li::before {
  content: ""; position: absolute; left: -4.5px; top: .5rem;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px var(--bg);
}
.timeline .when { display: block; font-family: var(--mono); font-size: .74rem; color: var(--accent); margin-bottom: .1rem; }
.timeline .what { font-size: .9rem; color: var(--muted); }

/* Shipped entries: green dot, green label, and the connector to the next
   item runs green for its first half before returning to the normal line. */
.timeline li.shipped { border-left-color: transparent; }
.timeline li.shipped::before {
  background: var(--ship);
  box-shadow: 0 0 0 3px var(--bg), 0 0 10px color-mix(in srgb, var(--ship) 55%, transparent);
}
.timeline li.shipped .when { color: var(--ship); }
.timeline li.shipped::after {
  content: ""; position: absolute; left: -1px; width: 1px;
  /* Runs dot-centre to dot-centre: the next dot sits .5rem + 4px into the
     following item, so this has to overshoot its own box to reach it. */
  top: calc(.5rem + 4px); bottom: calc(-.5rem - 4px);
  background: linear-gradient(to bottom, var(--ship) 50%, var(--border) 50%);
}
/* Between two finished items the whole segment is green. */
.timeline li.shipped:has(+ li.shipped)::after {
  background: var(--ship);
}
/* Nothing follows the last entry, so stop at its own edge and fade out. */
.timeline li.shipped:last-child::after {
  bottom: 0;
  background: linear-gradient(to bottom, var(--ship), transparent);
}

/* Queued entries: orange dot and label to separate "not started" from
   "in flight". */
.timeline li.next::before {
  background: var(--next);
  box-shadow: 0 0 0 3px var(--bg), 0 0 10px color-mix(in srgb, var(--next) 55%, transparent);
}
.timeline li.next .when { color: var(--next); }

/* ── CTA ───────────────────────────────────────────────────── */
.cta { text-align: center; padding: clamp(2.4rem, 6vw, 3.8rem) 1.5rem; }
.cta h2 { margin: 0 0 .7rem; font-size: clamp(1.6rem, 4vw, 2.3rem); letter-spacing: -.03em; }
.cta p { margin: 0 auto 1.9rem; color: var(--muted); max-width: 46ch; }
.cta-actions { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center; }

/* Copy-to-clipboard button (Discord handle) */
.copy-btn { font: inherit; }
.copy-btn.copied {
  color: var(--accent-2);
  border-color: color-mix(in srgb, var(--accent-2) 55%, transparent);
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
}

/* ── Footer ────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); padding: 1.9rem 0; margin-top: 2rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; }
.footer-inner p { margin: 0; font-size: .85rem; color: var(--muted); }
.footer-link { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--border); transition: color .2s, border-color .2s; }
.footer-link:hover { color: var(--text); border-bottom-color: var(--border-strong); }
.to-top { font-size: .85rem; color: var(--muted); text-decoration: none; transition: color .2s; }
.to-top:hover { color: var(--text); }

/* ── Modal ─────────────────────────────────────────────────── */
.modal {
  width: min(100% - 2rem, 740px);
  max-height: 88vh;
  overflow-y: auto;
  padding: 0; border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2); color: var(--text);
  box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(4, 5, 12, .68); backdrop-filter: blur(5px); }
.modal[open] { animation: modalIn .3s var(--ease); }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }

.modal-body { padding: 2rem; }
.modal-close {
  position: absolute; top: .9rem; right: .9rem;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer; font-size: .8rem; line-height: 1;
  transition: color .2s, border-color .2s;
  z-index: 10;
}
.modal-close:hover { color: var(--text); border-color: var(--border-strong); }
.modal-close svg { width: 13px; height: 13px; display: block; margin: auto; }

.modal-body h3 { margin: .3rem 0 .5rem; font-size: 1.55rem; letter-spacing: -.025em; }
.modal-body .lede { color: var(--muted); margin: 0 0 1.3rem; }
.modal-body ul.hl { margin: 0 0 1.5rem; padding-left: 1.1rem; color: var(--muted); font-size: .93rem; }
.modal-body ul.hl li { margin-bottom: .4rem; }

/* ── Modal instructions (Install & Usage) ── */
.modal-section {
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
}
.modal-section-title {
  margin: 0 0 .75rem;
  font-size: 1.02rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--accent);
  letter-spacing: -.015em;
}
.modal-section-title .section-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}
.modal-steps {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text);
  font-size: .92rem;
}
.modal-step-item {
  margin-bottom: .85rem;
}
.modal-step-item:last-child {
  margin-bottom: 0;
}
.step-desc {
  margin-bottom: .25rem;
  line-height: 1.55;
}
.step-note {
  color: var(--muted);
  font-size: .88rem;
  font-weight: 400;
}
.code-block-wrap {
  position: relative;
  margin: .35rem 0 .45rem;
}
.code-block {
  margin: 0;
  padding: .65rem .85rem;
  padding-right: 4.4rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--text);
  line-height: 1.45;
}
.code-block code {
  font-family: inherit;
  white-space: pre-wrap;
  word-break: break-all;
}
.copy-code-btn {
  position: absolute;
  right: .5rem;
  top: .45rem;
  font-size: .72rem;
  font-family: var(--mono);
  padding: .22rem .55rem;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all .2s;
}
.copy-code-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.copy-code-btn.copied {
  color: var(--ship);
  border-color: var(--ship);
}

.modal-links { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.4rem; }
.modal-links .btn { padding: .6rem 1.15rem; font-size: .88rem; }

/* ── Reveal on scroll ──────────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .about { grid-template-columns: 1fr; }
  .about-card { position: static; }  /* sticky only makes sense beside the copy */
  .project.featured { grid-column: span 1; }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute; inset: 68px 0 auto; flex-direction: column; align-items: stretch;
    gap: .3rem; padding: 1rem 1.25rem 1.5rem;
    background: color-mix(in srgb, var(--bg) 96%, transparent);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: opacity .25s var(--ease), transform .25s var(--ease);
  }
  .nav-links.open { transform: none; opacity: 1; pointer-events: auto; }
  .nav-links a { padding: .7rem 0; font-size: 1rem; border-bottom: 1px solid var(--border); }
  .nav-links a::after { display: none; }
  .theme-toggle { margin-top: .9rem; }
  .grid { grid-template-columns: 1fr; }
  .section-head { align-items: flex-start; }
  .stats { gap: 1.6rem 2.2rem; }
  .modal-body { padding: 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}

/* ── No-JS fallback cards ──────────────────────────────────── */
.noscript-card { cursor: default; }
.noscript-card h3 { margin: 0 0 .45rem; font-size: 1.18rem; font-weight: 650; letter-spacing: -.015em; }
.noscript-card p { color: var(--muted); font-size: .93rem; margin: 0 0 .8rem; }
.noscript-card a { color: var(--accent); }

/* ── Print ─────────────────────────────────────────────────────
   Flatten to ink-friendly black on white and expose link targets. */
@media print {
  .bg-grid, .bg-glow, .site-header, .filters, .to-top,
  .theme-toggle, .nav-toggle, .modal, .hero-actions, .cta-actions { display: none !important; }

  html, body { background: #fff !important; color: #000 !important; }

  .container { width: 100%; }
  .section { padding: 1rem 0; page-break-inside: avoid; }
  .hero { padding: 0 0 1rem; }

  .card, .project {
    border: 1px solid #bbb !important;
    background: #fff !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  .grid { display: block; }
  .project { margin-bottom: .6rem; }
  .project.featured { grid-column: auto; }

  .hero-title, .section-title, h1, h2, h3 { color: #000 !important; }
  .grad { -webkit-text-fill-color: #000 !important; color: #000 !important; background: none !important; }
  p, .hero-sub, .section-sub, .tag, .meta, .timeline .what { color: #222 !important; }

  .thumb-icon { color: #000 !important; }
  .about { display: block; }
  .about-card { position: static; }

  /* Show URLs so a printed copy is still useful */
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .75em; color: #555; word-break: break-all; }
}

/* ── Modal prev/next ───────────────────────────────────────── */
.modal-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; margin-top: 1.6rem; padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}
.modal-step {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .9rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); font: inherit; font-size: .85rem; font-weight: 500;
  cursor: pointer; transition: color .2s, border-color .2s, background .2s, transform .2s var(--ease);
}
.modal-step:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-1px); }
.modal-count { font-family: var(--mono); font-size: .76rem; color: var(--muted); }

/* ── Active nav link (scrollspy) ───────────────────────────── */
.nav-links a[aria-current="true"] { color: var(--text); }
.nav-links a[aria-current="true"]::after { width: 100%; }

@media print { .modal-nav { display: none !important; } }

/* ── Project screenshots ───────────────────────────────────────
   `shot:` renders a wide banner across the top of the card and a
   full-width image in the dialog. Top-anchored so the header of a
   tall page screenshot stays visible in the crop. */
.shot {
  margin: -1.5rem -1.5rem 1.25rem;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  aspect-ratio: 16 / 9;
}
.shot img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top center;
  transition: transform .5s var(--ease), filter .4s var(--ease);
  filter: saturate(.92);
}
.project:hover .shot img { transform: scale(1.035); filter: saturate(1); }

/* With a banner the small icon tile is redundant */
.project.has-shot .thumb { display: none; }
.project.has-shot .project-top { justify-content: flex-end; margin-bottom: .75rem; }

.modal-shot {
  margin: -2rem -2rem 1.4rem;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  max-height: 320px;
}
.modal-shot img { width: 100%; height: auto; display: block; object-position: top center; }

@media (max-width: 720px) {
  .modal-shot { margin: -1.6rem -1.6rem 1.1rem; max-height: 220px; object-fit: cover; }
}
@media print {
  .shot, .modal-shot { break-inside: avoid; }
  .project.has-shot .thumb { display: grid; }
}

/* ── Legal & Policy Pages (Terms of Service, Privacy Policy) ── */
.legal-page {
  padding: 3rem 0 5rem;
}
.legal-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.legal-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--accent);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .3rem .85rem;
  margin-bottom: 1rem;
}
.legal-title {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.15;
  margin: 0 0 .75rem;
}
.legal-meta {
  color: var(--muted);
  font-size: .9rem;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}
.legal-meta span strong {
  color: var(--text);
  font-weight: 600;
}
.legal-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 3rem;
  align-items: start;
}
@media (max-width: 860px) {
  .legal-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  /* In the single-column layout, a sticky TOC would cover the legal text. */
  .legal-layout .legal-nav {
    position: static;
  }
}
.legal-nav {
  position: sticky;
  top: 5rem;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.legal-nav-title {
  font-size: .75rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: .4rem;
}
.legal-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: .85rem;
  padding: .35rem .5rem;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.legal-nav a:hover,
.legal-nav a[aria-current="true"] {
  color: var(--text);
  background: var(--surface-2);
}
.legal-content {
  color: var(--text);
  line-height: 1.7;
  font-size: .95rem;
}
.legal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  margin-bottom: 1.75rem;
}
.legal-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.legal-card h2 .section-num {
  font-family: var(--mono);
  font-size: .85rem;
  color: var(--accent);
  background: var(--surface-2);
  padding: .15rem .5rem;
  border-radius: 6px;
}
.legal-card p {
  margin: 0 0 1rem;
  color: var(--text);
}
.legal-card p:last-child {
  margin-bottom: 0;
}
.legal-card ul, .legal-card ol {
  margin: 0 0 1rem;
  padding-left: 1.4rem;
}
.legal-card li {
  margin-bottom: .45rem;
  color: var(--text);
}
.legal-card li strong {
  color: var(--text);
}
.legal-highlight-box {
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  padding: .9rem 1.1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1rem 0;
  font-size: .9rem;
}
.legal-table-wrapper {
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.legal-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: .85rem;
}
.legal-table th, .legal-table td {
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border);
}
.legal-table th {
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
}
.legal-table tr:last-child td {
  border-bottom: none;
}
