/* =========================================================
   Sven Kugener – Portfolio
   All content is rendered from content/site.json (see js/app.js)
   ========================================================= */

:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --container: 1160px;
  --nav-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* dark (default) */
  --bg: #07090f;
  --bg-elev: #0c1019;
  --surface: rgba(20, 26, 38, .72);
  --surface-solid: #111623;
  --surface-hover: rgba(28, 36, 52, .85);
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #e8ebf2;
  --text-muted: #97a0b5;
  --text-faint: #636c82;
  --accent: #34d399;
  --accent-2: #60a5fa;
  --accent-ink: #04130c;
  --accent-soft: rgba(52, 211, 153, .12);
  --accent-2-soft: rgba(96, 165, 250, .12);
  --grid-dot: rgba(255, 255, 255, .055);
  --glow-1: rgba(52, 211, 153, .16);
  --glow-2: rgba(96, 165, 250, .14);
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 50px -20px rgba(0, 0, 0, .7);
  --code-bg: rgba(255, 255, 255, .06);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-elev: #ffffff;
  --surface: rgba(255, 255, 255, .8);
  --surface-solid: #ffffff;
  --surface-hover: #ffffff;
  --border: rgba(12, 20, 40, .09);
  --border-strong: rgba(12, 20, 40, .18);
  --text: #0d1324;
  --text-muted: #4f5a70;
  --text-faint: #8a93a6;
  --accent: #059669;
  --accent-2: #2563eb;
  --accent-ink: #ffffff;
  --accent-soft: rgba(5, 150, 105, .1);
  --accent-2-soft: rgba(37, 99, 235, .09);
  --grid-dot: rgba(12, 20, 40, .07);
  --glow-1: rgba(16, 185, 129, .14);
  --glow-2: rgba(59, 130, 246, .12);
  --shadow: 0 1px 2px rgba(12, 20, 40, .04), 0 18px 40px -22px rgba(12, 20, 40, .25);
  --code-bg: rgba(12, 20, 40, .06);
  color-scheme: light;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
body::before {
  /* dotted grid */
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 40%, transparent 100%);
  pointer-events: none;
}
body::after {
  /* ambient glows */
  content: "";
  position: fixed;
  inset: -20vh -10vw auto;
  height: 90vh;
  z-index: -1;
  background:
    radial-gradient(40% 50% at 20% 20%, var(--glow-1), transparent 70%),
    radial-gradient(35% 45% at 85% 10%, var(--glow-2), transparent 70%);
  filter: blur(20px);
  pointer-events: none;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  letter-spacing: -.02em;
  margin: 0 0 .5em;
  font-weight: 600;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}
main { flex: 1; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.gradient-text {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- navigation ---------- */
.nav {
  position: sticky;
  top: 12px;
  z-index: 50;
  margin: 12px auto 0;
  width: min(var(--container), calc(100% - 24px));
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--nav-h);
  padding: 0 10px 0 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-elev) 70%, transparent);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  box-shadow: var(--shadow);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  white-space: nowrap;
}
.nav-logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 700;
}
.nav-links {
  display: flex;
  gap: 2px;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
}
.nav-links a {
  display: block;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: .92rem;
  color: var(--text-muted);
  transition: color .2s, background-color .2s;
}
.nav-links a:hover { color: var(--text); background: var(--surface-hover); }
.nav-links a[aria-current="page"] { color: var(--text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.nav-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color .2s, border-color .2s, background-color .2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-hover); }
.nav-toggle { display: none; }
.theme-toggle .fa-sun { display: none; }
:root[data-theme="light"] .theme-toggle .fa-sun { display: inline; }
:root[data-theme="light"] .theme-toggle .fa-moon { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  font-size: .95rem;
  line-height: 1.2;
  cursor: pointer;
  transition: transform .2s var(--ease), background-color .2s, border-color .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.btn-primary {
  border-color: transparent;
  background: linear-gradient(100deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2)));
  color: var(--accent-ink);
  box-shadow: 0 10px 30px -12px var(--accent);
}
.btn-primary:hover { box-shadow: 0 14px 34px -10px var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* dropdown (CV) */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 190px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .2s, transform .2s var(--ease), visibility .2s;
  z-index: 20;
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown.open .fa-chevron-down { transform: rotate(180deg); }
.dropdown .fa-chevron-down { font-size: .7em; transition: transform .2s; }
.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: .92rem;
}
.dropdown-menu a:hover { background: var(--accent-soft); color: var(--text); }
.dropdown-menu a i { color: var(--accent); }

/* ---------- hero ---------- */
.hero { padding: clamp(56px, 10vw, 120px) 0 clamp(48px, 7vw, 88px); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, .9fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 6px 14px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--text-muted);
}
.eyebrow .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 8px transparent; } }
.hero h1 {
  font-size: clamp(2.8rem, 7.5vw, 5.2rem);
  font-weight: 700;
  letter-spacing: -.04em;
  margin-bottom: 20px;
}
.hero-subtitle {
  max-width: 34em;
  margin: 0 0 32px;
  font-size: clamp(1.05rem, 1.6vw, 1.22rem);
  color: var(--text-muted);
}
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-top: 44px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.stat-value { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; line-height: 1; }
.stat-label { margin-top: 6px; font-size: .82rem; color: var(--text-faint); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .06em; }

.portrait {
  position: relative;
  aspect-ratio: 4 / 5;
  max-width: 400px;
  margin-left: auto;
  width: 100%;
}
.portrait::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius-lg) + 1px);
  background: linear-gradient(140deg, var(--accent), transparent 40%, transparent 60%, var(--accent-2));
  z-index: 0;
}
.portrait img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
}
.portrait-tag {
  position: absolute;
  z-index: 2;
  left: -18px;
  bottom: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-elev) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  font-family: var(--font-mono);
  font-size: .8rem;
}
.portrait-tag i { color: var(--accent); }

/* ---------- sections ---------- */
.section { padding: clamp(48px, 7vw, 88px) 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.section-kicker {
  display: block;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--accent);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.section-title { font-size: clamp(1.8rem, 3.4vw, 2.5rem); margin: 0; }
.link-arrow { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 500; font-size: .95rem; }
.link-arrow i { transition: transform .2s var(--ease); }
.link-arrow:hover i { transform: translateX(4px); }

.card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  transition: transform .3s var(--ease), border-color .3s, background-color .3s;
}
a.card:hover, .card.hoverable:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--surface-hover); }

.icon-tile {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-2-soft));
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 1.15rem;
}

/* about */
.about-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 20px; }
.about-card { padding: clamp(24px, 3vw, 36px); }
.about-card h2, .about-card h3 { font-size: 1.4rem; display: flex; align-items: center; gap: 14px; }
.about-card p { margin: 0; color: var(--text-muted); }
.about-card.primary p { font-size: 1.12rem; color: var(--text); }

/* overview */
.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.overview-card { display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.overview-card h3 { font-size: 1.25rem; margin: 6px 0 0; }
.overview-card p { margin: 0; color: var(--text-muted); flex: 1; }

/* ---------- page header ---------- */
.page-header { position: relative; padding: clamp(48px, 8vw, 96px) 0 clamp(32px, 5vw, 56px); overflow: hidden; }
.page-header h1 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.page-header h1 .icon-tile { width: 56px; height: 56px; font-size: 1.4rem; border-radius: 16px; }
.page-header .lead { max-width: 42em; margin: 0; font-size: 1.15rem; color: var(--text-muted); }
.page-header .note { margin: 10px 0 0; font-family: var(--font-mono); font-size: .85rem; color: var(--text-faint); }
.page-header .subtitle-accent { margin: 0 0 18px; font-weight: 600; font-size: 1.15rem; color: var(--accent); }
.page-header.has-banner { min-height: 420px; display: flex; align-items: flex-end; }
.page-header.has-banner .container { position: relative; z-index: 2; }
.banner-bg { position: absolute; inset: 0; z-index: 0; }
.banner-bg img { width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.banner-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 40%, transparent) 0%, var(--bg) 96%);
}
.breadcrumb { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 24px; color: var(--text-muted); font-size: .92rem; }
.breadcrumb:hover { color: var(--accent); }
.breadcrumb i { transition: transform .2s var(--ease); }
.breadcrumb:hover i { transform: translateX(-4px); }

/* ---------- tags & chips ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: .74rem;
  letter-spacing: .02em;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
}
.tag[data-tag="school"] { color: var(--accent-2); background: var(--accent-2-soft); border-color: color-mix(in srgb, var(--accent-2) 30%, transparent); }
.tag[data-tag="private"] { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 32px; }
.filter-btn {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: .92rem;
  transition: all .2s;
}
.filter-btn:hover { color: var(--text); border-color: var(--border-strong); }
.filter-btn[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.filter-btn .count { margin-left: 6px; opacity: .6; font-family: var(--font-mono); font-size: .8em; }

/* ---------- projects ---------- */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 22px; }
.project-card { display: flex; flex-direction: column; overflow: hidden; }
.project-card[hidden] { display: none; }
.project-media {
  position: relative;
  aspect-ratio: 16 / 8;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(120% 100% at 0% 0%, var(--accent-soft), transparent 60%),
    radial-gradient(120% 100% at 100% 100%, var(--accent-2-soft), transparent 60%),
    var(--bg-elev);
}
.project-media img.cover { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.project-media img.logo { position: absolute; inset: 0; margin: auto; max-width: 42%; max-height: 62%; object-fit: contain; }
.project-card:hover .project-media img.cover { transform: scale(1.05); }
.project-media .placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2.6rem;
  color: var(--accent);
}
.project-media .placeholder span { font-family: var(--font-display); font-weight: 700; font-size: 2.2rem; letter-spacing: -.03em; }
.project-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 16px 16px;
  pointer-events: none;
}
.project-body { display: flex; flex-direction: column; gap: 12px; flex: 1; padding: 22px 24px 24px; }
.project-body h3 { margin: 0; font-size: 1.3rem; }
.project-body p { margin: 0; color: var(--text-muted); font-size: .95rem; flex: 1; }
.project-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.project-foot .go {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all .25s var(--ease);
}
.project-card:hover .go { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); transform: rotate(-45deg); }

/* project detail */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 48px; align-items: start; }
.detail-aside { position: sticky; top: calc(var(--nav-h) + 40px); display: flex; flex-direction: column; gap: 16px; }
.aside-card { padding: 22px; }
.aside-card h4 { margin: 0 0 12px; font-family: var(--font-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); font-weight: 500; }
.aside-card .logo { max-width: 160px; max-height: 140px; margin: 4px auto; object-fit: contain; }
.toc { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.toc a { display: block; padding: 6px 10px; border-left: 2px solid var(--border); color: var(--text-muted); font-size: .9rem; transition: all .2s; }
.toc a:hover, .toc a.active { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.aside-card .btn { width: 100%; justify-content: center; }
.aside-card .btn + .btn { margin-top: 10px; }

.prose { font-size: 1.04rem; color: var(--text-muted); }
.prose > :first-child { margin-top: 0; }
.prose h2 {
  margin: 2.4em 0 .8em;
  font-size: 1.65rem;
  color: var(--text);
  scroll-margin-top: calc(var(--nav-h) + 40px);
}
.prose h2::before { content: "# "; color: var(--accent); font-family: var(--font-mono); font-weight: 400; opacity: .8; }
.prose h3 { margin: 1.8em 0 .6em; font-size: 1.18rem; color: var(--text); display: flex; align-items: center; gap: 10px; }
.prose h3 i { color: var(--accent); width: 1.3em; text-align: center; }
.prose p { margin: 0 0 1.1em; }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose ul, .prose ol { margin: 0 0 1.3em; padding: 0; list-style: none; display: grid; gap: 10px; }
.prose ol { counter-reset: li; }
.prose li { position: relative; padding: 12px 16px 12px 40px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.prose ul > li::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 1.35em;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transform: rotate(45deg);
}
.prose ol > li { counter-increment: li; }
.prose ol > li::before { content: counter(li); position: absolute; left: 14px; top: 12px; font-family: var(--font-mono); font-size: .85rem; color: var(--accent); }
.prose code {
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--code-bg);
  font-family: var(--font-mono);
  font-size: .86em;
  color: var(--text);
  word-break: break-word;
}
.prose pre { overflow-x: auto; padding: 16px; border-radius: 12px; background: var(--code-bg); border: 1px solid var(--border); }
.prose pre code { padding: 0; background: none; }
.prose blockquote { margin: 0 0 1.2em; padding: 4px 20px; border-left: 3px solid var(--accent); color: var(--text); }
.prose img { border-radius: 12px; border: 1px solid var(--border); margin: 1em 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5em 0; }
.prose table { width: 100%; border-collapse: collapse; margin-bottom: 1.2em; font-size: .95rem; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }

.videos { display: grid; gap: 24px; }
.video-card { overflow: hidden; }
.video-card video { width: 100%; background: #000; }
.video-card h3 { margin: 0; padding: 16px 20px; font-size: 1.05rem; display: flex; align-items: center; gap: 10px; }
.video-card h3 i { color: var(--accent); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 64px; }
.pager a { padding: 20px 22px; display: flex; flex-direction: column; gap: 4px; }
.pager a.next { text-align: right; grid-column: 2; }
.pager small { color: var(--text-faint); font-family: var(--font-mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.pager span { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }

/* ---------- skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.skill-card { padding: 28px; }
.skill-card header { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.skill-card h2 { margin: 0; font-size: 1.3rem; }
.skill-card header .count { margin-left: auto; font-family: var(--font-mono); font-size: .8rem; color: var(--text-faint); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  font-size: .9rem;
  color: var(--text);
  transition: border-color .2s, color .2s, transform .2s var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* ---------- certificates ---------- */
.cert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.cert-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 32px 24px 26px; overflow: hidden; }
.cert-card .badge-icon { position: absolute; top: 16px; right: 18px; color: var(--text-faint); font-size: 1.1rem; }
.cert-card img { width: 140px; height: 140px; object-fit: contain; margin-bottom: 10px; filter: drop-shadow(0 12px 24px rgba(0,0,0,.25)); transition: transform .4s var(--ease); }
.cert-card:hover img { transform: scale(1.06) rotate(-2deg); }
.cert-card .issuer { font-family: var(--font-mono); font-size: .75rem; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.cert-card h3 { margin: 0; font-size: 1.1rem; flex: 1; }
.cert-card .link-arrow { margin-top: 8px; }

/* ---------- externals (timeline) ---------- */
.timeline { position: relative; display: grid; gap: 20px; max-width: 860px; }
.timeline::before { content: ""; position: absolute; left: 23px; top: 10px; bottom: 10px; width: 2px; background: linear-gradient(var(--accent), var(--accent-2), transparent); opacity: .35; }
.timeline-item { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 22px; }
.timeline-item .icon-tile { background: var(--bg-elev); position: relative; z-index: 1; }
.timeline-item .card { padding: 24px 26px; }
.timeline-item h3 { margin: 0 0 4px; font-size: 1.25rem; }
.timeline-item .meta { margin: 0 0 12px; font-family: var(--font-mono); font-size: .82rem; color: var(--accent); }
.timeline-item p:last-child { margin: 0; color: var(--text-muted); }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; }
.contact-card { display: flex; flex-direction: column; gap: 14px; padding: 30px 28px; overflow: hidden; }
.contact-card .icon-tile { width: 56px; height: 56px; font-size: 1.5rem; color: #fff; border: 0; background: var(--brand, var(--accent)); box-shadow: 0 12px 30px -12px var(--brand, var(--accent)); }
.contact-card h3 { margin: 6px 0 0; font-size: 1.3rem; }
.contact-card p { margin: 0; color: var(--text-muted); word-break: break-word; flex: 1; }
.contact-card::after { content: ""; position: absolute; right: -60px; top: -60px; width: 160px; height: 160px; border-radius: 50%; background: var(--brand, var(--accent)); opacity: .08; filter: blur(10px); transition: opacity .3s; }
.contact-card:hover::after { opacity: .18; }
.info-box { display: flex; align-items: center; gap: 18px; margin-top: 28px; padding: 22px 26px; }
.info-box p { margin: 0; font-size: 1.05rem; }

/* ---------- footer ---------- */
.footer { margin-top: 64px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--bg-elev) 60%, transparent); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 28px 24px; flex-wrap: wrap; }
.footer p { margin: 0; color: var(--text-faint); font-size: .9rem; }
.socials { display: flex; gap: 8px; }

/* ---------- states ---------- */
.empty, .error-state { padding: 80px 0; text-align: center; color: var(--text-muted); }
.error-state h1 { font-size: clamp(3rem, 10vw, 6rem); margin-bottom: 8px; }
.preview-bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 18px;
  border-radius: 999px;
  background: #f59e0b;
  color: #1c1300;
  font-weight: 600;
  font-size: .9rem;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.5);
}
.preview-bar button { border: 0; border-radius: 999px; padding: 6px 12px; background: rgba(0,0,0,.15); cursor: pointer; font-weight: 600; }
.loader { display: grid; place-items: center; min-height: 60vh; }
.loader::after { content: ""; width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

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

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { order: -1; max-width: 280px; margin: 0; }
  .portrait-tag { left: auto; right: -12px; bottom: 18px; }
  .about-grid { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-aside { position: static; order: -1; }
  .detail-aside .toc-card { display: none; }
}
@media (max-width: 820px) {
  .nav-toggle { display: grid; }
  .nav-links {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface-solid);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .2s, transform .2s var(--ease), visibility .2s;
  }
  .nav.open .nav-links { opacity: 1; visibility: visible; transform: none; }
  .nav-links a { padding: 12px 16px; border-radius: 12px; font-size: 1rem; }
  .nav-actions { margin-left: auto; }
}
@media (max-width: 560px) {
  .container { padding: 0 16px; }
  .nav { width: calc(100% - 16px); top: 8px; margin-top: 8px; }
  .nav-inner { padding-left: 12px; }
  .nav-brand .brand-text { display: none; }
  .hero-stats { gap: 20px; }
  .projects-grid, .cert-grid, .skills-grid, .contact-grid { grid-template-columns: 1fr; }
  .pager { grid-template-columns: 1fr; }
  .pager a.next { grid-column: 1; }
  .timeline::before { left: 19px; }
  .timeline-item { grid-template-columns: 40px minmax(0, 1fr); gap: 14px; }
  .timeline-item .icon-tile { width: 40px; height: 40px; font-size: 1rem; }
  .prose li { padding: 10px 12px 10px 34px; }
  .prose ul > li::before { left: 14px; }
  .footer-inner { justify-content: center; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
@media print {
  body::before, body::after, .nav, .footer, .preview-bar { display: none; }
  .reveal { opacity: 1; transform: none; }
}
