/* ==========================================================================
   patryk-sadowski.pl — site.css
   Plain modern CSS: no build step, no framework, no third-party requests.

   1  Tokens (dark default, light via [data-theme="light"])
   2  Base
   3  Layout
   4  Components (buttons, chips, cards, badges, icons)
   5  Page sections (header, hero, CT Viewer, stack, experience, ...)
   6  Dialog (email reveal)
   7  Motion
   ========================================================================== */

/* 1 · TOKENS --------------------------------------------------------------- */
:root {
  color-scheme: dark;

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "Cascadia Code", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* palette: same slate + blue identity as the previous version */
  --bg: #0f172a;
  --bg-rgb: 15 23 42;
  --card: #1e293b;
  --card-soft: rgb(30 41 59 / .55);
  --border: #334155;
  --border-soft: rgb(51 65 85 / .7);
  --text: #cbd5e1;
  --muted: #94a3b8;
  --heading: #f8fafc;
  --primary: #3b82f6;
  --primary-strong: #2563eb;       /* button background: white text = 5.2:1 */
  --primary-text: #60a5fa;
  --primary-rgb: 59 130 246;
  --accent: #22d3ee;
  --accent-rgb: 34 211 238;
  --gold: #fbbf24;
  --gold-rgb: 251 191 36;
  --ok: #34d399;
  --ok-rgb: 52 211 153;
  --danger: #f87171;
  --grid-rgb: 148 163 184;
  --shadow: 0 1px 2px rgb(0 0 0 / .25), 0 14px 32px -14px rgb(0 0 0 / .55);

  --radius: .9rem;
  --radius-sm: .6rem;
  --container: 68rem;
  --gutter: clamp(1.25rem, 4vw, 2rem);
  --nav-h: 4rem;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f8fafc;
  --bg-rgb: 248 250 252;
  --card: #ffffff;
  --card-soft: rgb(255 255 255 / .75);
  --border: #cbd5e1;
  --border-soft: rgb(203 213 225 / .85);
  --text: #334155;
  --muted: #5b6b80;
  --heading: #0f172a;
  --primary: #2563eb;
  --primary-strong: #2563eb;
  --primary-text: #1d4ed8;
  --primary-rgb: 37 99 235;
  --accent: #0e7490;
  --accent-rgb: 14 116 144;
  --gold: #b45309;
  --gold-rgb: 180 83 9;
  --ok: #047857;
  --ok-rgb: 4 120 87;
  --danger: #b91c1c;
  --grid-rgb: 15 23 42;
  --shadow: 0 1px 2px rgb(15 23 42 / .06), 0 14px 32px -16px rgb(15 23 42 / .2);
}

/* 2 · BASE ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 1rem);
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }

a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .22em; }

::selection { background: var(--primary); color: #fff; }
:focus-visible { outline: 2px solid var(--primary-text); outline-offset: 3px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  padding: .6rem 1rem; border-radius: .5rem;
  background: var(--primary-strong); color: #fff; font-weight: 600;
}
.skip-link:focus { top: 1rem; text-decoration: none; }

/* inline SVG sprite lives at the top of <body> */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon--fill { fill: currentColor; stroke: none; }

/* 3 · LAYOUT --------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: clamp(2.25rem, 5vw, 3.75rem); }

.section-head { margin-bottom: 2rem; }
.section-head h2 {
  padding-bottom: .65rem;
  border-bottom: 1px solid var(--border-soft);
  font-size: clamp(1.6rem, 3.2vw, 2rem);
  line-height: 1.2;
  letter-spacing: -.02em;
  color: var(--heading);
}
.section-head p { margin-top: .9rem; max-width: 46rem; color: var(--muted); }

.eyebrow {
  margin-bottom: .6rem;
  font: 500 .78rem/1.2 var(--font-mono);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--primary-text);
}

/* 4 · COMPONENTS ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 2.75rem; padding: .6rem 1.2rem;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: .95rem; font-weight: 600; line-height: 1.2; cursor: pointer;
  transition: background-color .2s, border-color .2s, transform .2s, box-shadow .2s;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--primary-strong); color: #fff; box-shadow: 0 6px 18px -8px rgb(var(--primary-rgb) / .8); }
.btn--primary:hover { background: #1d4ed8; transform: translateY(-1px); }
.btn--ghost { background: var(--card); border-color: var(--border); color: var(--heading); }
.btn--ghost:hover { border-color: var(--muted); transform: translateY(-1px); }
.btn__meta { font: 500 .7rem var(--font-mono); color: var(--muted); padding-left: .5rem; border-left: 1px solid var(--border); }

.socials { display: flex; align-items: center; gap: .25rem; margin-left: .25rem; }
.socials a {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
  border-radius: var(--radius-sm); color: var(--muted); transition: color .2s, background-color .2s;
}
.socials a:hover { color: var(--heading); background: rgb(var(--primary-rgb) / .1); text-decoration: none; }
.socials .icon { width: 1.5rem; height: 1.5rem; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; }
.chip {
  padding: .3rem .6rem;
  border: 1px solid var(--border-soft); border-radius: .45rem;
  background: rgb(var(--bg-rgb) / .55);
  font: 500 .74rem/1.2 var(--font-mono); color: var(--muted);
}
.stack .chip, .ct-card .chip {
  border-color: rgb(var(--primary-rgb) / .45);
  background: rgb(var(--primary-rgb) / .12);
  color: var(--primary-text);
}

.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .22rem .6rem; border-radius: 999px;
  border: 1px solid var(--border); background: rgb(var(--bg-rgb) / .5);
  font: 600 .7rem/1.2 var(--font-mono); letter-spacing: .02em; color: var(--muted); white-space: nowrap;
}
.badge { align-self: flex-start; }
@media (min-width: 48rem) { .card__side .badge { align-self: flex-end; } }
.badge--live { border-color: rgb(var(--ok-rgb) / .45); color: var(--ok); }
.badge--wip { border-color: rgb(var(--primary-rgb) / .45); color: var(--primary-text); }

.dot { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }

.card {
  display: flex; flex-direction: column;
  padding: clamp(1.1rem, 2.5vw, 1.6rem);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  transition: border-color .2s, transform .2s;
}
@media (hover: hover) {
  .card:hover { border-color: rgb(var(--primary-rgb) / .55); }
}
.card__head { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.card__head:last-child { margin-bottom: 0; }
@media (min-width: 48rem) {
  .card__head { flex-direction: row; justify-content: space-between; align-items: flex-start; gap: 1.5rem; }
  .card__side { text-align: right; }
}
.card__title { font-size: 1.15rem; line-height: 1.35; font-weight: 700; color: var(--heading); }
.card__org { margin-top: .15rem; font-weight: 500; color: var(--primary-text); }
.card__side { display: flex; flex-direction: column; gap: .15rem; flex: none; font: 400 .8rem/1.5 var(--font-mono); color: var(--muted); }
.card__side strong { font-weight: 600; color: var(--text); }
.card__note { margin-top: .4rem; color: var(--muted); font-size: .95rem; }
.card .chips { margin-top: auto; padding-top: 1.1rem; }

.bullets { list-style: none; padding: 0; display: grid; gap: .55rem; }
.bullets li { position: relative; padding-left: 1.15rem; }
.bullets li::before {
  content: ""; position: absolute; left: 0; top: .7em;
  width: .4rem; height: .4rem; border-radius: 1px;
  background: rgb(var(--accent-rgb) / .9); transform: rotate(45deg);
}

.link-arrow { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; }
.link-arrow .icon { width: 1rem; height: 1rem; transition: transform .2s; }
.link-arrow:hover .icon { transform: translateX(2px); }

/* 5 · PAGE SECTIONS -------------------------------------------------------- */

/* 5.1 header / nav */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgb(var(--bg-rgb) / .82);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
}
.nav { position: relative; display: flex; align-items: center; gap: .6rem; min-height: var(--nav-h); }

.brand { display: inline-flex; align-items: center; gap: .65rem; margin-right: auto; font: 600 .95rem/1 var(--font-mono); color: var(--heading); }
.brand:hover { text-decoration: none; }
.brand__mark { width: 2.1rem; height: 2.1rem; border: 1px solid rgb(var(--primary-rgb) / .45); border-radius: .55rem; }
.brand__name { display: none; }
.brand__name span { color: var(--muted); }
@media (min-width: 30rem) { .brand__name { display: inline; } }

.nav__links {
  position: absolute; top: 100%; left: 0; right: 0;
  display: none; flex-direction: column;
  padding: .4rem var(--gutter) 1rem;
  background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
}
.nav__links.is-open { display: flex; }
.nav__links a { padding: .8rem .25rem; border-bottom: 1px solid var(--border-soft); color: var(--text); font-weight: 500; }
.nav__links a:hover { color: var(--heading); text-decoration: none; }
.nav__links a[aria-current="true"] { color: var(--primary-text); }

.controls {
  display: flex; align-items: center; gap: .15rem; padding: .2rem;
  border: 1px solid var(--border); border-radius: .7rem; background: var(--card);
}
.icon-btn {
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem;
  border: 0; border-radius: .5rem; background: transparent; color: var(--muted); cursor: pointer;
  transition: color .2s, background-color .2s;
}
.icon-btn:hover { color: var(--primary-text); background: rgb(var(--primary-rgb) / .12); }
.controls .divider { width: 1px; height: 1.2rem; margin-inline: .15rem; background: var(--border); }
.lang { display: flex; gap: .1rem; }
.lang a {
  display: grid; place-items: center; min-width: 2.25rem; height: 2.25rem; padding-inline: .45rem;
  border-radius: .5rem; font: 600 .78rem/1 var(--font-mono); color: var(--muted);
}
.lang a:hover { color: var(--heading); text-decoration: none; background: rgb(var(--primary-rgb) / .12); }
.lang a[aria-current="true"] { background: var(--primary-strong); color: #fff; }

.icon-sun { display: block; }
.icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }

.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-menu { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

@media (min-width: 70rem) {
  .nav { gap: 1.25rem; }
  .nav__links {
    position: static; display: flex; flex-direction: row; gap: .1rem;
    padding: 0; background: none; border: 0; box-shadow: none;
  }
  .nav__links a { position: relative; padding: .5rem .7rem; border: 0; border-radius: .5rem; font-size: .9rem; }
  .nav__links a::after {
    content: ""; position: absolute; left: .7rem; right: .7rem; bottom: .15rem; height: 2px;
    border-radius: 2px; background: var(--primary); transform: scaleX(0); transition: transform .25s;
  }
  .nav__links a[aria-current="true"] { color: var(--heading); }
  .nav__links a[aria-current="true"]::after { transform: scaleX(1); }
  .nav-toggle { display: none; }
}

/* without JS the menu stays visible as a plain wrapped row */
html:not(.js) .nav { flex-wrap: wrap; padding-block: .5rem; }
html:not(.js) .nav__links { position: static; display: flex; flex-direction: row; flex-wrap: wrap; gap: .25rem 1rem; width: 100%; order: 5; padding: 0; background: none; border: 0; box-shadow: none; }
html:not(.js) .nav__links a { padding: .3rem 0; border: 0; }
html:not(.js) .nav-toggle { display: none; }

/* 5.2 hero */
.hero { position: relative; isolation: isolate; padding-block: clamp(2.5rem, 7vw, 5rem) clamp(1.5rem, 4vw, 2.5rem); }
.hero::before,
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.hero::before {
  background:
    radial-gradient(52rem 26rem at 12% -8%, rgb(var(--primary-rgb) / .18), transparent 62%),
    radial-gradient(36rem 22rem at 92% 6%, rgb(var(--accent-rgb) / .1), transparent 62%);
}
.hero::after {
  background-image:
    linear-gradient(rgb(var(--grid-rgb) / .075) 1px, transparent 1px),
    linear-gradient(90deg, rgb(var(--grid-rgb) / .075) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(75% 95% at 28% 0%, #000 0%, transparent 78%);
  mask-image: radial-gradient(75% 95% at 28% 0%, #000 0%, transparent 78%);
}

.hero__grid { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 62rem) {
  .hero__grid { grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); gap: 3.5rem; }
}

.status {
  display: inline-flex; align-items: center; gap: .6rem; margin-bottom: 1.4rem; padding: .35rem .85rem;
  border: 1px solid rgb(var(--ok-rgb) / .4); border-radius: 999px; background: rgb(var(--ok-rgb) / .08);
  font: 500 .76rem/1.35 var(--font-mono); color: var(--ok);
}
.status .dot { box-shadow: 0 0 0 0 rgb(var(--ok-rgb) / .6); animation: pulse 2.4s ease-out infinite; }

.hero h1 {
  font-size: clamp(2.6rem, 7vw, 4.25rem); line-height: 1.04; font-weight: 800;
  letter-spacing: -.035em; color: var(--heading);
}
.hero__role { margin-top: .9rem; font-size: clamp(1.3rem, 2.8vw, 1.7rem); font-weight: 600; letter-spacing: -.01em; color: var(--primary-text); }
.hero__lead { max-width: 38rem; margin-top: 1.25rem; font-size: clamp(1.03rem, 1.5vw, 1.18rem); color: var(--muted); }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: 2rem; }

/* decorative terminal: always dark, in both themes */
.terminal {
  border: 1px solid #263349; border-radius: var(--radius); background: #0a1120; overflow: hidden;
  box-shadow: var(--shadow), 0 0 70px -30px rgb(59 130 246 / .55);
  font: 400 .8rem/1.8 var(--font-mono); color: #cbd5e1;
}
.terminal__bar { display: flex; align-items: center; gap: .4rem; padding: .6rem .9rem; border-bottom: 1px solid #1c2840; background: #0e1628; }
.terminal__bar span { margin-left: .6rem; font-size: .72rem; color: #64748b; }
.terminal__body { max-height: 21rem; padding: 1rem 1.15rem 1.15rem; overflow: auto; cursor: text; }
.terminal__body div { white-space: pre; }
.t-prompt { color: #34d399; }
.t-path { color: #60a5fa; }
.t-dim { color: #64748b; }
.t-key { color: #fbbf24; }
.t-val { color: #a5f3fc; }
.t-cursor { display: inline-block; width: .55em; height: 1.05em; margin-left: .15em; vertical-align: text-bottom; background: #60a5fa; animation: blink 1.15s steps(1) infinite; }

.proof { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 21rem)); gap: .75rem 1rem; margin-top: clamp(2rem, 5vw, 3.25rem); }
.proof li {
  display: flex; gap: .75rem; align-items: flex-start; padding: .9rem 1rem;
  border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--card-soft);
}
.proof .icon { margin-top: .12rem; width: 1.4rem; height: 1.4rem; color: var(--primary-text); }
.proof strong { display: block; font-size: .9rem; line-height: 1.3; color: var(--heading); }
.proof span { display: block; margin-top: .2rem; font-size: .78rem; line-height: 1.4; color: var(--muted); }
.proof li:first-child { border-color: rgb(var(--gold-rgb) / .4); background: linear-gradient(135deg, rgb(var(--gold-rgb) / .1), var(--card-soft) 70%); }
.proof li:first-child .icon { color: var(--gold); }

/* 5.3 CT Viewer flagship */
.ct-card {
  padding: clamp(1.25rem, 3vw, 2.25rem);
  border: 1px solid transparent; border-radius: calc(var(--radius) + .35rem);
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    linear-gradient(135deg, rgb(var(--primary-rgb) / .9), rgb(var(--accent-rgb) / .6) 45%, rgb(var(--primary-rgb) / .1) 80%) border-box;
  box-shadow: var(--shadow), 0 0 70px -34px rgb(var(--primary-rgb) / .7);
}

.award {
  display: flex; gap: 1rem; align-items: flex-start; padding: 1rem 1.15rem;
  border: 1px solid rgb(var(--gold-rgb) / .4); border-radius: var(--radius);
  background: linear-gradient(135deg, rgb(var(--gold-rgb) / .13), rgb(var(--gold-rgb) / .03));
}
.award .icon { width: 1.9rem; height: 1.9rem; margin-top: .1rem; color: var(--gold); }
.award strong { display: block; font-size: 1.02rem; line-height: 1.35; color: var(--heading); }
.award p { margin-top: .3rem; font-size: .92rem; color: var(--muted); }

.ct-grid { display: grid; gap: 2rem; margin-top: 1.75rem; }
@media (min-width: 62rem) {
  .ct-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 24rem); gap: 2.75rem; align-items: start; }
  .viz { max-width: none; margin-inline: 0; position: sticky; top: calc(var(--nav-h) + 1rem); }
}
.ct-lead { font-size: 1.1rem; line-height: 1.65; color: var(--text); }

.facts dt { margin-top: 1.25rem; font: 600 .74rem/1.2 var(--font-mono); letter-spacing: .09em; text-transform: uppercase; color: var(--primary-text); }
.facts dd { margin-top: .4rem; }
.facts dd .bullets { margin-top: .65rem; }

.facts + .chips { margin-top: 1.4rem; }
.credits { display: grid; gap: .35rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border-soft); font-size: .9rem; color: var(--muted); }
.credits strong { color: var(--text); font-weight: 600; }
.ct-links { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; margin-top: 1.25rem; }

.viz { max-width: 34rem; margin-inline: auto; overflow: hidden; border: 1px solid #1f2c45; border-radius: var(--radius); background: radial-gradient(120% 90% at 50% 25%, #12213f, #090f1c 72%); box-shadow: 0 0 60px -28px rgb(34 211 238 / .45); }
.viz iframe { display: block; width: 100%; aspect-ratio: 1 / 1; border: 0; background: #000; }
.viz figcaption a { color: #5eead4; font-weight: 600; }
.viz canvas { width: 100%; aspect-ratio: 1 / 1; cursor: grab; touch-action: pan-y; }
.viz canvas:active { cursor: grabbing; }
.viz canvas:focus-visible { outline-offset: -3px; }
.viz figcaption { padding: .7rem .95rem; border-top: 1px solid #1f2c45; background: rgb(6 10 20 / .65); font: 400 .72rem/1.55 var(--font-mono); color: #94a3b8; }

.pipeline { display: grid; gap: 1.1rem; margin-top: 2.25rem; counter-reset: step; }
@media (min-width: 62rem) { .pipeline { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.2rem; } }
.pipeline li {
  position: relative; counter-increment: step; padding: 1rem 1.05rem 1.1rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: rgb(var(--bg-rgb) / .55);
}
.pipeline li::before { content: "0" counter(step); display: block; margin-bottom: .45rem; font: 500 .7rem/1 var(--font-mono); letter-spacing: .1em; color: var(--primary-text); }
.pipeline li:not(:last-child)::after {
  content: ""; position: absolute; width: .6rem; height: .6rem;
  border-top: 2px solid var(--primary); border-right: 2px solid var(--primary);
  bottom: -.78rem; left: 50%; transform: translateX(-50%) rotate(135deg);
}
@media (min-width: 62rem) {
  .pipeline li:not(:last-child)::after { bottom: auto; left: auto; right: -.95rem; top: 50%; transform: translateY(-50%) rotate(45deg); }
}
.pipeline strong { display: block; font-size: .95rem; line-height: 1.3; color: var(--heading); }
.pipeline span { display: block; margin-top: .3rem; font-size: .82rem; line-height: 1.5; color: var(--muted); }

/* 5.4 about + stack */
.about-grid { display: grid; gap: 2.5rem; }
@media (min-width: 62rem) { .about-grid { grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 3.5rem; } }
.prose p + p { margin-top: 1rem; }
.prose p:last-child { padding: .85rem 1rem; border-left: 2px solid var(--primary); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: rgb(var(--primary-rgb) / .08); }
.stack { display: grid; gap: 1.4rem 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.stack h3 { margin-bottom: .55rem; font: 600 .76rem/1.3 var(--font-mono); letter-spacing: .07em; text-transform: uppercase; color: var(--heading); }
.also { margin-top: 1.6rem; padding-top: 1.1rem; border-top: 1px dashed var(--border); font-size: .88rem; color: var(--muted); }
.also strong { color: var(--text); font-weight: 600; }

/* 5.5 experience / projects / education */
.stack-list { display: grid; gap: 1rem; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 27rem), 1fr)); }
.card p { margin: 0; }
.card .bullets { margin-bottom: 0; }
.card--project .card__head { margin-bottom: .8rem; }
.card--project p { color: var(--muted); }
.card--project a { font-weight: 600; }
.subhead { margin: 2.2rem 0 1rem; font: 600 .8rem/1.2 var(--font-mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }

/* 5.6 beyond the code */
.tiles { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.tile { padding: 1.2rem 1.25rem; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--card-soft); transition: border-color .2s, transform .2s; }
@media (hover: hover) { .tile:hover { border-color: rgb(var(--accent-rgb) / .5); transform: translateY(-2px); } }
.tile__icon { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; margin-bottom: .9rem; border: 1px solid rgb(var(--accent-rgb) / .35); border-radius: .7rem; background: rgb(var(--accent-rgb) / .1); color: var(--accent); }
.tile__icon .icon { width: 1.4rem; height: 1.4rem; }
.tile h3 { font-size: 1.02rem; line-height: 1.3; color: var(--heading); }
.tile p { margin-top: .35rem; font-size: .92rem; color: var(--muted); }

/* 5.7 contact + footer */
.contact {
  text-align: center; padding: clamp(1.75rem, 4vw, 3rem) clamp(1.25rem, 4vw, 2.5rem);
  background: radial-gradient(60% 140% at 50% 0%, rgb(var(--primary-rgb) / .16), transparent 70%), var(--card);
}
.contact p { max-width: 36rem; margin-inline: auto; color: var(--muted); }
.contact__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: 1.5rem; }

.site-footer { padding-block: 2rem 2.5rem; border-top: 1px solid var(--border-soft); font-size: .85rem; color: var(--muted); }
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem 1.5rem; }

/* 404 */
.notfound { display: grid; place-content: center; justify-items: center; gap: 1rem; min-height: 100vh; padding: 2rem var(--gutter); text-align: center; }
.notfound h1 { font: 800 clamp(4rem, 14vw, 8rem)/1 var(--font-mono); letter-spacing: -.05em; color: var(--primary-text); }
.notfound p { max-width: 28rem; color: var(--muted); }

/* 6 · DIALOG (email reveal) ------------------------------------------------ */
.dialog {
  width: min(28rem, calc(100% - 2rem)); padding: 0; overflow: visible;
  border: 1px solid var(--border); border-radius: calc(var(--radius) + .2rem);
  background: var(--card); color: var(--text); box-shadow: 0 30px 80px -20px rgb(0 0 0 / .65);
}
.dialog::backdrop { background: rgb(2 6 23 / .62); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.dialog[open] { animation: pop .25s cubic-bezier(.2, .9, .3, 1.2); }
.dialog[open]::backdrop { animation: fade .25s ease; }
.dialog__body { position: relative; padding: clamp(1.4rem, 4vw, 2rem); text-align: center; }
.dialog__close { position: absolute; top: .75rem; right: .75rem; }
.dialog h2 { margin-bottom: .75rem; font-size: 1.4rem; line-height: 1.25; color: var(--heading); }
.dialog p { color: var(--muted); }

.captcha { display: flex; align-items: center; justify-content: center; gap: .75rem; margin: 1.4rem 0 1rem; }
.captcha__q {
  padding: .5rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: rgb(var(--bg-rgb) / .6); font: 700 1.25rem/1.3 var(--font-mono); color: var(--heading);
}
.captcha input {
  width: 5.25rem; padding: .55rem .5rem; border: 1px solid var(--muted); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--heading); font: 600 1.25rem/1.3 var(--font-mono); text-align: center;
}
.captcha input:focus { outline: 2px solid var(--primary-text); outline-offset: 2px; }
.form-error { min-height: 1.4rem; margin-bottom: .75rem; font-size: .88rem; color: var(--danger); }
.dialog .btn { width: 100%; }
.dialog.is-shaking { animation: shake .4s ease-in-out; }

.email-out { display: grid; justify-items: center; gap: 1rem; padding-top: .5rem; }
.email-out > .icon { width: 2.75rem; height: 2.75rem; color: var(--ok); }
.email-out a { font: 700 1.2rem/1.4 var(--font-mono); word-break: break-all; }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 1; }

/* 7 · MOTION --------------------------------------------------------------- */
@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgb(var(--ok-rgb) / .55); } 70%, 100% { box-shadow: 0 0 0 .55rem rgb(var(--ok-rgb) / 0); } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* scroll-driven reveal: CSS only, content stays visible where unsupported */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .reveal { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 32%; }
  }
}

/* short colour crossfade only while the theme is being switched */
.theme-switching, .theme-switching *, .theme-switching *::before, .theme-switching *::after {
  transition: background-color .3s, border-color .3s, color .3s, fill .3s, stroke .3s !important;
}

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

/* secondary achievements listed under a parent card */
.bullets--sub { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--border); font-size: .92rem; color: var(--muted); }
.bullets--sub strong { color: var(--text); font-weight: 600; }

/* interactive terminal prompt */
.t-line { display: flex; align-items: baseline; gap: .55ch; margin: 0; }
.t-line label { white-space: pre; }
.t-line input { flex: 1; min-width: 4ch; padding: 0; border: 0; background: transparent; color: #e2e8f0; font: inherit; caret-color: #60a5fa; outline: none; }
.t-line input::placeholder { color: #475569; }
.t-log div { white-space: pre-wrap; word-break: break-word; }
.t-err { color: #f87171; }
.terminal__body { scrollbar-width: thin; scrollbar-color: #334155 transparent; }

/* terminal window controls: red closes until reload, yellow folds the window, green enlarges it */
.tdot { position: relative; width: .65rem; height: .65rem; padding: 0; border: 0; border-radius: 50%; cursor: pointer; transition: filter .15s, transform .15s; }
.tdot::after { content: ""; position: absolute; inset: -.3rem; }
.tdot--close { background: #f87171; } .tdot--min { background: #fbbf24; } .tdot--max { background: #34d399; }
.tdot:hover { filter: brightness(1.25); transform: scale(1.15); }
.tdot:focus-visible { outline: 2px solid #60a5fa; outline-offset: 2px; }
.terminal { transition: opacity .25s, transform .25s; }
.terminal.is-closing { opacity: 0; transform: scale(.94) translateY(6px); pointer-events: none; }
.terminal.is-folded .terminal__body { display: none; }
.terminal.is-large .terminal__body { max-height: 34rem; }
.terminal[hidden] { display: none !important; }

/* taller terminal next to the headline on wide screens */
@media (min-width: 62rem) {
  .terminal__body { min-height: 25rem; max-height: 28rem; }
  .terminal.is-large .terminal__body { max-height: 38rem; min-height: 34rem; }
}

/* terminal follows the light theme too */
:root[data-theme="light"] .terminal { border-color: #cbd5e1; background: #ffffff; color: #1e293b; box-shadow: var(--shadow), 0 0 60px -34px rgb(37 99 235 / .45); }
:root[data-theme="light"] .terminal__bar { border-bottom-color: #e2e8f0; background: #f1f5f9; }
:root[data-theme="light"] .terminal__bar span { color: #64748b; }
:root[data-theme="light"] .terminal .t-prompt { color: #047857; }
:root[data-theme="light"] .terminal .t-path { color: #1d4ed8; }
:root[data-theme="light"] .terminal .t-dim { color: #64748b; }
:root[data-theme="light"] .terminal .t-key { color: #b45309; }
:root[data-theme="light"] .terminal .t-val { color: #0e7490; }
:root[data-theme="light"] .terminal .t-err { color: #b91c1c; }
:root[data-theme="light"] .t-line input { color: #0f172a; caret-color: #1d4ed8; }
:root[data-theme="light"] .t-line input::placeholder { color: #94a3b8; }
:root[data-theme="light"] .terminal__body { scrollbar-color: #cbd5e1 transparent; }
.terminal, .terminal * { transition-property: color, background-color, border-color; transition-duration: .3s; }
.terminal { transition-property: opacity, transform, color, background-color, border-color; }

/* 404 page */
.nf { position: relative; isolation: isolate; display: grid; place-items: center; min-height: 100vh; padding: 3rem var(--gutter); }
.nf::before, .nf::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.nf::before { background: radial-gradient(48rem 26rem at 12% 0%, rgb(var(--primary-rgb) / .2), transparent 62%), radial-gradient(34rem 22rem at 92% 100%, rgb(var(--accent-rgb) / .12), transparent 62%); }
.nf::after { background-image: linear-gradient(rgb(var(--grid-rgb) / .07) 1px, transparent 1px), linear-gradient(90deg, rgb(var(--grid-rgb) / .07) 1px, transparent 1px); background-size: 44px 44px; -webkit-mask-image: radial-gradient(80% 90% at 50% 40%, #000, transparent 80%); mask-image: radial-gradient(80% 90% at 50% 40%, #000, transparent 80%); }
.nf__grid { display: grid; gap: 2.5rem; width: 100%; max-width: 68rem; align-items: center; }
@media (min-width: 62rem) { .nf__grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 3.5rem; } }
.glitch { position: relative; margin: .1rem 0 0; font: 800 clamp(5rem, 17vw, 9.5rem)/1 var(--font-mono); letter-spacing: -.06em; color: var(--heading); }
.glitch::before, .glitch::after { content: attr(data-text); position: absolute; inset: 0; opacity: 0; }
.glitch::before { color: #22d3ee; clip-path: inset(0 0 52% 0); animation: glitch-a 3.4s infinite steps(1); }
.glitch::after { color: #f43f5e; clip-path: inset(52% 0 0 0); animation: glitch-b 2.9s infinite steps(1); }
:root[data-theme="light"] .glitch::before { color: #0e7490; }
:root[data-theme="light"] .glitch::after { color: #be123c; }
@keyframes glitch-a { 0%, 90%, 100% { opacity: 0; transform: none; } 91% { opacity: 1; transform: translate(-6px, 1px); } 94% { opacity: 1; transform: translate(5px, -2px); } 97% { opacity: 1; transform: translate(-2px, 0); } }
@keyframes glitch-b { 0%, 84%, 100% { opacity: 0; transform: none; } 85% { opacity: 1; transform: translate(6px, -1px); } 88% { opacity: 1; transform: translate(-5px, 2px); } 91% { opacity: 1; transform: translate(2px, 0); } }
.nf__lead { margin-top: .4rem; font-size: clamp(1.4rem, 3.2vw, 1.9rem); font-weight: 700; letter-spacing: -.01em; color: var(--primary-text); }
.nf__sub { max-width: 32rem; margin-top: .5rem; color: var(--muted); }
.nf__term { margin-top: 1.75rem; }
.nf__term .terminal__body { min-height: 14rem; max-height: none; cursor: default; }
.nf__actions { justify-content: flex-start; margin-top: 1.5rem; }
@media (prefers-reduced-motion: reduce) { .glitch::before, .glitch::after { display: none; } }

/* single-column 404 */
.nf__grid { max-width: 40rem; grid-template-columns: 1fr !important; }
