/* =============================================================================
   Portfolio stylesheet
   ========================================================================== */

:root {
  --bg:        #05080c;
  --bg-2:      #0a0f15;
  --bg-3:      #101821;
  --line:      #17222e;
  --line-2:    #24344a;
  --text:      #e8eef6;
  --text-2:    #97a6b8;
  --text-3:    #627387;
  --accent:    #2bd4ff;
  --accent-2:  #6cf2c2;
  --warn:      #ffb454;
  --ink-on-accent: #021118;
  --grid:      rgba(43, 212, 255, .045);
  --glow:      rgba(43, 212, 255, .22);

  --shadow-1:  0 1px 2px rgba(0,0,0,.20);
  --shadow-2:  0 14px 32px -14px rgba(0,0,0,.62);

  --radius:    14px;
  --maxw:      1140px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, "SF Mono", Consolas, "Courier New", monospace;
}

html[data-theme="light"] {
  --bg:     #f7f8fa;
  --bg-2:   #ffffff;
  --bg-3:   #eef1f5;
  --line:   #dde3ea;
  --line-2: #c8d2de;
  --text:   #141a21;
  --text-2: #4d5a69;
  --text-3: #77848f;
  --accent: #0a74a8;
  --accent-2: #0b7f62;
  --grid:   rgba(10, 116, 168, .06);
  --glow:   rgba(10, 116, 168, .16);
  --ink-on-accent: #ffffff;
  --shadow-1: 0 1px 2px rgba(16,32,52,.07);
  --shadow-2: 0 14px 30px -16px rgba(16,32,52,.28);
}

* { box-sizing: border-box; }

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

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: var(--mono);
  font-size: 0.87em;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}
img { max-width: 100%; display: block; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- header ------------------------------------------------------- */

header.site {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
header.site .wrap {
  display: flex; align-items: center; gap: 20px;
  height: 62px;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  font-weight: 700; letter-spacing: -0.01em; color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--ink-on-accent); font-size: 13px; font-weight: 800; letter-spacing: 0.02em;
}
nav.main { margin-left: auto; display: flex; align-items: center; gap: 4px; }
nav.main a {
  color: var(--text-2); font-size: 14.5px; font-weight: 500;
  padding: 7px 12px; border-radius: 8px;
}
nav.main a:hover { color: var(--text); background: var(--bg-3); text-decoration: none; }

.ctrl {
  display: flex; align-items: center; gap: 6px;
  margin-left: 8px; padding-left: 14px; border-left: 1px solid var(--line);
}
.ctrl button {
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--text-2); background: transparent;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 9px; cursor: pointer; line-height: 1.4;
}
.ctrl button:hover { color: var(--text); border-color: var(--line-2); background: var(--bg-3); }
.langbtn { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.langbtn button { border: 0; border-radius: 0; padding: 5px 10px; }
.langbtn button[aria-pressed="true"] { background: var(--accent); color: var(--ink-on-accent); }
.langbtn button[aria-pressed="true"]:hover { background: var(--accent); color: var(--ink-on-accent); }

/* ---------- hero --------------------------------------------------------- */

.hero {
  padding: 76px 0 56px; border-bottom: 1px solid var(--line);
  position: relative; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(64% 116% at 6% -14%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 62%),
    radial-gradient(46% 96% at 99% -6%, color-mix(in srgb, var(--accent-2) 11%, transparent), transparent 60%);
}
.hero .wrap { position: relative; }
.hero .eyebrow {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--accent-2); margin-bottom: 18px;
}
.hero h1 {
  margin: 0 0 12px; font-size: clamp(34px, 5.2vw, 56px);
  line-height: 1.08; letter-spacing: -0.03em; font-weight: 800;
}
.hero .role {
  margin: 0 0 6px; font-size: clamp(17px, 2.2vw, 21px);
  color: var(--text); font-weight: 600;
}
.hero .school { margin: 0 0 26px; color: var(--text-3); font-size: 15px; }
.hero .tagline { max-width: 68ch; color: var(--text-2); font-size: 17px; margin: 0 0 30px; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 44px; }

/* The intro column and the portrait sit side by side; the stats row below
   still spans the full width, so its 4-up grid is untouched. */
.hero-top { display: flex; align-items: flex-start; gap: clamp(24px, 4vw, 52px); }
.hero-intro { flex: 1 1 auto; min-width: 0; }
.hero-portrait { flex: 0 0 auto; margin-top: 6px; }
.hero-portrait img {
  display: block; width: 200px; height: 200px;
  border-radius: 50%; object-fit: cover; object-position: center;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  outline: 6px solid color-mix(in srgb, var(--accent) 16%, transparent);
  outline-offset: -1px;
  box-shadow: var(--shadow-1);
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 600;
  padding: 10px 17px; border-radius: 10px;
  border: 1px solid var(--line-2); color: var(--text); background: var(--bg-2);
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--ink-on-accent); }
.btn.primary:hover { filter: brightness(1.1); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.stat {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-1);
}
.stat .v {
  font-family: var(--mono); font-size: 22px; font-weight: 700;
  color: var(--accent-2); letter-spacing: -0.02em;
}
.stat .l { font-size: 13px; color: var(--text-3); margin-top: 2px; }

/* ---------- sections ----------------------------------------------------- */

section { padding: 72px 0; border-bottom: 1px solid var(--line); }
.sec-head { margin-bottom: 32px; }
.sec-head h2 {
  margin: 0; font-size: clamp(24px, 3.2vw, 33px);
  letter-spacing: -0.022em; font-weight: 800;
}
.sec-head p { margin: 8px 0 0; color: var(--text-3); font-size: 15.5px; }

/* ---------- filters ------------------------------------------------------ */

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filters button {
  font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text-2);
}
.filters button:hover { color: var(--text); border-color: var(--line-2); }
.filters button[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: var(--ink-on-accent);
}
.filters button .n {
  margin-left: 8px; font-family: var(--mono);
  font-size: 11.5px; font-weight: 600; opacity: .55;
}
.filters button[aria-pressed="true"] .n { opacity: .72; }

/* ---------- project cards ------------------------------------------------ */

.grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; grid-auto-flow: row dense; }

.card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-1);
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.card:hover {
  border-color: var(--line-2); transform: translateY(-3px);
  box-shadow: var(--shadow-2);
}
.card.wide { grid-column: 1 / -1; }
.card.hidden { display: none; }

/* Figures and board renders are authored on white, so the plate is white in
   both themes — the letterboxing then disappears into the artwork instead of
   framing it with a dark border. */
.card .shot {
  background: #ffffff; border-bottom: 1px solid var(--line);
  aspect-ratio: 16 / 9; overflow: hidden; position: relative;
}
/* A featured card runs the full grid width, which makes a 2.6:1 letterbox out
   of a shot area that is mostly filled by ~1.3:1 photographs. Turning it on its
   side gives the image a ~1.25:1 well instead — the ratio the renders and CAD
   captures actually are. */
.card.wide { flex-direction: row; align-items: stretch; }
.card.wide .shot {
  flex: 0 0 44%; aspect-ratio: 4 / 3; height: auto; min-height: 330px;
  /* Do NOT let the well stretch to the card's height: an expanded card is
     ~2000px tall, and a stretched `cover` photo becomes a vertical sliver of
     whatever happens to be in the middle of the frame. Fixed ratio, top
     aligned — the text column grows past it instead. */
  align-self: flex-start;
  border-bottom: 0; border-right: 1px solid var(--line);
}
.card .shot img {
  width: 100%; height: 100%; object-fit: contain; object-position: center;
  background: #ffffff;
}
/* Diagrams must never be cropped, so `contain` is the default and the white
   plate hides the letterboxing. Photographs carry no text and look better
   filling the well — those opt in with `fit: "cover"` in data.js. */
.card .shot img.cover { object-fit: cover; }
.card .shot.plain {
  display: grid; place-items: center;
  background: var(--bg-3);
  background:
    radial-gradient(120% 120% at 20% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    var(--bg-3);
}
.card .shot.plain span {
  font-family: var(--mono); font-size: 44px; font-weight: 800;
  color: var(--accent-2);
  color: color-mix(in srgb, var(--accent-2) 70%, transparent);
  letter-spacing: -0.04em;
}

.card .meta { padding: 22px 22px 24px; display: flex; flex-direction: column; flex: 1; }
.card .yr {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em;
  color: var(--text-3); text-transform: uppercase; margin-bottom: 8px;
}
.card h3 {
  margin: 0 0 8px; font-size: 19.5px; line-height: 1.28;
  letter-spacing: -0.015em; font-weight: 700;
}
.card .sub { margin: 0 0 15px; color: var(--text-2); font-size: 14.8px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tags span {
  font-family: var(--mono); font-size: 11.5px;
  padding: 3px 8px; border-radius: 6px;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text-3);
}

.card .toggle {
  margin-top: auto; align-self: flex-start;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  background: transparent; border: 0; padding: 0;
  color: var(--accent);
}
.card .toggle:hover { text-decoration: underline; }

.detail { display: none; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.detail.open { display: block; animation: detail-in .2s ease both; }
@keyframes detail-in {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: none; }
}
.detail p { margin: 0 0 13px; color: var(--text-2); font-size: 15px; }
.detail p:last-child { margin-bottom: 0; }
.detail b { color: var(--text); font-weight: 650; }
.detail .extra-shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 12px; margin-top: 16px; }
.detail .extra-shots img {
  border: 1px solid var(--line); border-radius: 10px;
  background: #ffffff; padding: 0;
  /* Figures are a mix of landscape photos, portrait photos and diagrams. Left
     at natural height the auto-fit rows are sized by the tallest cell and the
     grid goes ragged, so every cell is the same 4:3 well. `contain` (not
     `cover`) because a cropped schematic loses the labels that make it useful —
     the white plate absorbs the letterboxing, same as the card shots. */
  width: 100%; aspect-ratio: 4 / 3; object-fit: contain; object-position: center;
}

/* ---------- skills ------------------------------------------------------- */

.skillgrid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
.skillcard {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 21px;
  box-shadow: var(--shadow-1);
}
.skillcard h3 {
  margin: 0 0 13px; font-size: 14px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent-2);
}
.skillcard ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.skillcard li {
  font-size: 13.2px; padding: 4px 10px; border-radius: 7px;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text-2);
}

.langrow { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 24px; }
.langrow div {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 17px; font-size: 14px;
}
.langrow strong { color: var(--text); font-weight: 650; }
.langrow em { color: var(--text-3); font-style: normal; }

/* ---------- about -------------------------------------------------------- */
.about { max-width: 72ch; }
.about p { margin: 0 0 16px; color: var(--text-2); font-size: 16.5px; line-height: 1.7; }
.interests { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.interests li {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 16px; font-size: 14px; color: var(--text);
}

/* ---------- experience --------------------------------------------------- */

.timeline { border-left: 2px solid var(--line); padding-left: 28px; margin-left: 6px; }
.tl-item { position: relative; padding-bottom: 34px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -35px; top: 7px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg);
}
.tl-item .period {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--accent-2); margin-bottom: 5px;
}
.tl-item h3 { margin: 0 0 3px; font-size: 18px; font-weight: 700; letter-spacing: -0.012em; }
.tl-item .org { margin: 0 0 9px; color: var(--text-3); font-size: 14.5px; font-weight: 500; }
.tl-item .det { margin: 0; color: var(--text-2); font-size: 15px; max-width: 74ch; }

/* ---------- contact / footer -------------------------------------------- */

#contact { border-bottom: 0; }
.contact-box {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 18px; padding: 40px;
  box-shadow: var(--shadow-1);
  position: relative; overflow: hidden;
}
.contact-box::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(52% 130% at 100% 0%,
              color-mix(in srgb, var(--accent) 12%, transparent), transparent 62%);
}
.contact-box > * { position: relative; }
.contact-box p { color: var(--text-2); max-width: 60ch; margin: 0 0 24px; font-size: 16px; }
.contact-links { display: flex; flex-wrap: wrap; gap: 10px; }

footer.site {
  border-top: 1px solid var(--line); padding: 26px 0;
  color: var(--text-3); font-size: 13.5px;
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between;
}

/* ---------- accessibility ------------------------------------------------ */

/* Keyboard users had no focus indicator anywhere on the page. */
:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}
.langbtn button:focus-visible { outline-offset: -2px; border-radius: 0; }

.skip {
  position: fixed; top: 12px; left: 50%; z-index: 100;
  transform: translateX(-50%) translateY(-250%);
  background: var(--accent); color: var(--ink-on-accent);
  font-size: 14px; font-weight: 700;
  padding: 11px 20px; border-radius: 10px;
  box-shadow: var(--shadow-2);
  transition: transform .18s ease;
}
.skip:focus { transform: translateX(-50%) translateY(0); text-decoration: none; }

::selection { background: color-mix(in srgb, var(--accent) 34%, transparent); }

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

/* ---------- tech layer: grid, glow, motion ------------------------------- */

/* Blueprint grid behind everything, fading out towards the bottom of the
   viewport so it never competes with body text. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(120% 80% at 50% 0%, #000 30%, transparent 85%);
          mask-image: radial-gradient(120% 80% at 50% 0%, #000 30%, transparent 85%);
}
section, footer.site { background: transparent; }

/* scroll progress, drawn along the bottom edge of the sticky header */
.progress {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: 0 50%; transform: scaleX(0);
  box-shadow: 0 0 10px var(--glow);
}

nav.main a { position: relative; }
nav.main a.active { color: var(--text); }
nav.main a::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px;
  border-radius: 2px; background: var(--accent);
  transform: scaleX(0); transition: transform .25s ease;
}
nav.main a.active::after { transform: scaleX(1); }

.brand .mark {
  background-size: 200% 200%;
  animation: mark-shift 6s ease-in-out infinite;
  box-shadow: 0 0 18px var(--glow);
}
@keyframes mark-shift { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

/* hero: animated circuit traces on a canvas, fading out at the bottom */
.hero-fx {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
  opacity: .9;
}
.hero h1 {
  background: linear-gradient(100deg, var(--text) 30%, var(--accent) 70%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .eyebrow::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 10px;
  border-radius: 50%; background: var(--accent-2); vertical-align: 1px;
  box-shadow: 0 0 0 0 var(--accent-2);
  animation: ping 2.2s ease-out infinite;
}
@keyframes ping {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-2) 60%, transparent); }
  100% { box-shadow: 0 0 0 10px transparent; }
}
.hero .role .typed { font-family: var(--mono); font-weight: 600; font-size: .92em; color: var(--accent); }
.hero .role .caret {
  display: inline-block; width: .55em; height: 1.05em; margin-left: 2px;
  vertical-align: -3px; background: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* portrait: a slowly rotating conic ring */
.hero-portrait { position: relative; padding: 5px; border-radius: 50%; }
.hero-portrait:not(:empty)::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent), transparent 30%, var(--accent-2) 55%, transparent 80%, var(--accent));
  animation: spin 9s linear infinite;
  filter: drop-shadow(0 0 12px var(--glow));
}
.hero-portrait img { position: relative; outline: 0; border: 4px solid var(--bg); }
@keyframes spin { to { transform: rotate(360deg); } }

.btn { transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease, filter .2s ease; }
.btn:hover { box-shadow: 0 0 0 1px var(--accent), 0 8px 24px -10px var(--glow); transform: translateY(-1px); }
.btn.primary { box-shadow: 0 6px 22px -8px var(--glow); }

.stat {
  position: relative; overflow: hidden;
  background: color-mix(in srgb, var(--bg-2) 82%, transparent);
  backdrop-filter: blur(6px);
}
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.stat .v { color: var(--text); }

/* numbered section headers: "01 // Projects" */
main { counter-reset: sec; }
section { counter-increment: sec; }
.sec-head h2::before {
  content: counter(sec, decimal-leading-zero) " //";
  display: block; margin-bottom: 8px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 600;
  letter-spacing: .14em; color: var(--accent);
}
.sec-head h2::after {
  content: ""; display: block; width: 56px; height: 2px; margin-top: 14px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

/* cards: a glow that follows the cursor (--mx/--my set from main.js) */
.card { position: relative; isolation: isolate; }
.card::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  border-radius: inherit; opacity: 0; transition: opacity .25s ease;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), var(--glow), transparent 45%);
  mix-blend-mode: screen;
}
html[data-theme="light"] .card::after { mix-blend-mode: multiply; opacity: 0; }
.card:hover::after { opacity: .55; }
html[data-theme="light"] .card:hover::after { opacity: .35; }
.card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2));
  box-shadow: var(--shadow-2), 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent), 0 18px 50px -24px var(--glow);
}
.card .shot img { transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.card:hover .shot img { transform: scale(1.035); }
.card .yr { color: var(--accent); }
.tags span { transition: border-color .2s ease, color .2s ease; }
.card:hover .tags span { border-color: var(--line-2); color: var(--text-2); }
.card .toggle::after { content: " →"; display: inline-block; transition: transform .2s ease; }
.card .toggle:hover::after { transform: translateX(3px); }
.card .toggle[aria-expanded="true"]::after { content: " ↑"; }

.filters button { transition: background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease; }
.filters button[aria-pressed="true"] { box-shadow: 0 0 18px -4px var(--glow); }

.skillcard, .langrow div, .contact-box { transition: border-color .2s ease, transform .2s ease; }
.skillcard:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); transform: translateY(-2px); }
.skillcard li { transition: color .2s ease, border-color .2s ease; }
.skillcard li:hover { color: var(--text); border-color: var(--accent); }

.timeline { border-left-color: transparent; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: -2px; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2) 60%, var(--line));
}
.tl-item::before { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent), 0 0 14px var(--glow); }

.contact-box { border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); }

/* scroll reveal: only armed once main.js has added .fx to <html>, so the
   page is fully visible without JavaScript and in print */
.fx .reveal {
  opacity: 0; transform: translateY(18px);
  transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1);
  transition-delay: var(--d, 0ms);
}
.fx .reveal.in { opacity: 1; transform: none; }
.fx .card.reveal.in { transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1), border-color .18s ease, box-shadow .18s ease; transition-delay: var(--d, 0ms), var(--d, 0ms), 0ms, 0ms; }
.fx .card.reveal.in:hover { transform: translateY(-4px); transition-delay: 0ms; }
.card.pop { animation: pop .45s cubic-bezier(.2,.7,.2,1) both; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }

/* ---------- responsive --------------------------------------------------- */

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .card.wide { flex-direction: column; }
  .card.wide .shot {
    flex: none; aspect-ratio: 16 / 9; height: auto; min-height: 0;
    border-bottom: 1px solid var(--line); border-right: 0;
  }
  .skillgrid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }

  /* Too narrow to keep a 200px column beside the headline — stack instead. */
  .hero-top { flex-direction: column-reverse; align-items: flex-start; gap: 0; }
  .hero-portrait { margin: 0 0 24px; }
  .hero-portrait img { width: 132px; height: 132px; }

  /* Was `nav.main a { display: none }` — that left small screens with no
     navigation at all. Wrap the header instead and let the links scroll. */
  header.site .wrap {
    height: auto; flex-wrap: wrap; gap: 10px 14px;
    padding-top: 11px; padding-bottom: 11px;
  }
  nav.main {
    order: 3; width: 100%; margin-left: 0; gap: 2px;
    overflow-x: auto; scrollbar-width: none;
  }
  nav.main::-webkit-scrollbar { display: none; }
  nav.main a { white-space: nowrap; font-size: 14px; padding: 6px 11px; }
  .ctrl { margin-left: auto; }
}
@media (max-width: 560px) {
  .skillgrid { grid-template-columns: 1fr; }
  .hero { padding: 48px 0 40px; }
  section { padding: 52px 0; }
  .contact-box { padding: 26px; }
  .wrap { padding: 0 18px; }
}

/* ---------- print -------------------------------------------------------- */

@media print {
  :root { --bg:#fff; --bg-2:#fff; --bg-3:#f4f6f8; --line:#ccc; --line-2:#aaa;
          --text:#000; --text-2:#333; --text-3:#666; --accent:#0b4f9e; --accent-2:#0a6b56; }
  header.site, .ctrl, .filters, .card .toggle, footer.site, .skip { display: none !important; }
  body { font-size: 11pt; }
  section { padding: 18px 0; border: 0; break-inside: avoid; }
  .card { break-inside: avoid; border: 1px solid #ccc; }
  .grid { grid-template-columns: 1fr; }
  .detail { display: block !important; }
  .card .shot { aspect-ratio: auto; height: 150px; }
  .card.wide { flex-direction: column; }
  .card.wide .shot { flex: none; aspect-ratio: auto; height: 150px; min-height: 0; border-right: 0; }
  a { color: #000; }
  /* screen depth and decorative washes only muddy a printed page */
  * { box-shadow: none !important; }
  .hero::before, .contact-box::before { display: none; }
  .hero-top { flex-direction: row; align-items: flex-start; gap: 20px; }
  .hero-portrait { margin: 0; }
  .hero-portrait img { width: 108px; height: 108px; outline: 0; border: 1px solid #aaa; }
  .hero-fx, .progress, body::before, .card::after, .hero-portrait::before, .hero .role .caret { display: none !important; }
  .hero h1 { background: none; -webkit-text-fill-color: currentColor; color: #000; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
