/* ---------- Tokens ---------- */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --border: #e1e5ec;
  --text: #161b26;
  --muted: #5a6475;
  --accent: #1f3a68;
  --accent-hover: #2b4f8c;
  --accent-soft: #e4ebf6;
  --on-accent: #ffffff;
  --gold: #9a6b00;
  --gold-soft: #fbf1d9;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
  --radius: 14px;
  --max: 1120px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --surface: #151b24;
    --surface-2: #1c2430;
    --border: #273141;
    --text: #e7ecf3;
    --muted: #9aa5b5;
    --accent: #8fb0e8;
    --accent-hover: #adc6f0;
    --accent-soft: #1d2a40;
    --on-accent: #0d1117;
    --gold: #f0c35a;
    --gold-soft: #3a2f14;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img, video { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
.container { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .container { padding: 0 24px; } }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; gap: 12px;
}
.brand { font-weight: 700; color: var(--text); white-space: nowrap; }
.brand:hover { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--muted); font-weight: 500; font-size: 15px;
  padding: 6px 10px; border-radius: 8px;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.nav .icon-link { padding: 6px; display: none; }
@media (min-width: 560px) { .nav .icon-link { display: inline-flex; } }

/* ---------- Buttons & icons ---------- */
.icon { width: 20px; height: 20px; fill: currentColor; flex: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 10px; font-weight: 600; font-size: 15px;
  border: 1px solid transparent; transition: background .15s, border-color .15s, color .15s;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 7px 12px; font-size: 14px; border-radius: 8px; }
.btn-sm .icon { width: 16px; height: 16px; }

/* ---------- Home ---------- */
.hero {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 56px 0 72px;
}
.hero-photo {
  width: 152px; height: 152px; border-radius: 50%; object-fit: cover;
  border: 4px solid var(--surface); box-shadow: var(--shadow);
}
.hero h1 { font-size: clamp(32px, 6vw, 48px); margin-top: 24px; }
.hero .tagline { color: var(--accent); font-weight: 600; font-size: 18px; margin: 8px 0 0; }
.hero .bio { max-width: 640px; color: var(--muted); font-size: 17px; margin: 24px 0 0; }
.hero .bio + .bio { margin-top: 12px; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 32px; }
.hero-actions .btn { min-width: 180px; }
.socials { display: flex; gap: 8px; margin-top: 28px; }
.socials a {
  display: inline-flex; width: 42px; height: 42px; align-items: center; justify-content: center;
  border-radius: 50%; color: var(--muted); border: 1px solid var(--border); background: var(--surface);
}
.socials a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Page heading ---------- */
.page-head { padding: 40px 0 24px; }
.page-head h1 { font-size: clamp(28px, 5vw, 38px); }
.page-head p { color: var(--muted); margin: 8px 0 0; max-width: 680px; }
.page-head-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- CV page ---------- */
.cv-frame {
  max-width: 920px; margin: 0 auto 56px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.cv-frame img { width: 100%; height: auto; }

/* ---------- Portfolio ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filter {
  font: inherit; font-size: 14px; font-weight: 500; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; cursor: pointer;
}
.filter:hover { color: var(--text); border-color: var(--muted); }
.filter[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.grid { display: grid; grid-template-columns: 1fr; gap: 20px; padding-bottom: 56px; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.card[hidden] { display: none; }
.card-media {
  position: relative; aspect-ratio: 16 / 10; background: #fff; overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.card-media img, .card-media video { width: 100%; height: 100%; object-fit: contain; }
.card-media.cover img, .card-media.cover video { object-fit: cover; }
.card-media.dark { background: #0b0f14; }
.card-media.placeholder {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-2));
  color: var(--accent);
}
.card-media.placeholder .icon { width: 56px; height: 56px; opacity: .8; }
.badge {
  position: absolute; top: 10px; left: 10px; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; background: var(--surface); color: var(--accent);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.badge.gold { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 18px 18px 16px; }
.card-meta { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.card h2 { font-size: 18px; }
.card p { color: var(--muted); font-size: 15px; margin: 10px 0 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.tags li {
  font-size: 12.5px; font-weight: 500; color: var(--text);
  background: var(--surface-2); border-radius: 6px; padding: 3px 8px;
}
.card-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 16px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; }
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 20px; padding-bottom: 20px; }

@media (prefers-reduced-motion: reduce) {
  .card, .btn { transition: none; }
  .card:hover { transform: none; }
}
