:root {
  color-scheme: light dark;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #334155;
  --line: #d3dce8;
  --focus: #0b5fff;
  --link: #0f3fb8;
  --accent: #1d4ed8;
  --tag-bg: color-mix(in srgb, var(--accent) 10%, var(--surface));
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.07), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-hover: 0 8px 28px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.07);
  --radius: 1rem;
  --max-width: 72rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #121c2f;
    --text: #e5ecf8;
    --muted: #b5c1d7;
    --line: #2d3b54;
    --focus: #78a6ff;
    --link: #a7c2ff;
    --accent: #60a5fa;
    --tag-bg: color-mix(in srgb, var(--accent) 12%, var(--surface));
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.65;
  background: radial-gradient(circle at top right, rgba(60, 130, 245, 0.1), transparent 36%), var(--bg);
  color: var(--text);
}

.shell {
  width: min(calc(100% - 2rem), var(--max-width));
  margin-inline: auto;
}

/* ── Skip link ── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--focus);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus-visible {
  left: 1rem;
  top: 1rem;
  z-index: 100;
}

/* ── Header ── */
.site-header {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  min-height: 4.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.brand {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--text);
}

.main-nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.main-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.45rem 0.65rem;
  border-radius: 0.5rem;
  transition: background 0.15s, color 0.15s;
}
.main-nav a:hover { color: var(--text); background: color-mix(in srgb, var(--surface) 75%, transparent); }

/* ── Language switcher ── */
.lang-switcher {
  display: flex;
  gap: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  padding: 0.2rem;
}

.lang-btn {
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.25rem 0.55rem;
  border-radius: 0.4rem;
  transition: background 0.12s, color 0.12s;
  letter-spacing: 0.03em;
}
.lang-btn:hover { color: var(--text); background: color-mix(in srgb, var(--surface) 75%, transparent); }
.lang-btn[aria-current="true"] {
  background: var(--accent);
  color: #fff;
}

/* ── Hero ── */
.hero { padding: clamp(2.5rem, 7vw, 5rem) 0 2.5rem; }
.eyebrow { margin: 0; font-weight: 700; color: var(--muted); letter-spacing: 0.1em; font-size: 0.72rem; text-transform: uppercase; }
h1 { margin: 0.5rem 0 0.9rem; font-size: clamp(2rem, 6vw, 3.5rem); line-height: 1.1; letter-spacing: -0.03em; }
.hero-text { max-width: 72ch; margin: 0; color: var(--muted); font-size: 1.05rem; }
.hero-text a { color: var(--link); }

/* ── Section ── */
.section { padding: 2rem 0 4rem; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.75rem;
}
.section-head h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  line-height: 1.2;
}
.muted { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* ── Project list (resume-style) ── */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.project-entry {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.75rem;
  transition: box-shadow 0.18s;
}
.project-entry:hover {
  box-shadow: var(--shadow-hover);
}

.entry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.entry-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.entry-name {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.entry-subtitle {
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

.lang-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.lang-badge.no-lang {
  background: var(--tag-bg);
  border-color: transparent;
}

.lang-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  background: var(--lang-color, var(--muted));
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.entry-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.entry-links a {
  color: var(--link);
  font-weight: 700;
  font-size: 0.88rem;
  text-underline-offset: 0.2em;
  white-space: nowrap;
}

.entry-summary {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 0.97rem;
  max-width: 80ch;
}

/* ── Entry detail list ── */
.entry-details {
  margin: 0 0 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.detail-row {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 0.5rem 1rem;
  align-items: baseline;
}

.detail-row dt {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  padding-top: 0.1rem;
}

.detail-row dd {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text);
}

.detail-row dd ul {
  margin: 0.25rem 0 0;
  padding-left: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-row dd li {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Tag / tech stack inline list ── */
ul.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

ul.tag-list li {
  background: var(--tag-bg);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 0.15rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

/* ── Topic pills ── */
.topics {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}

.topics li {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ── Notes section ── */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
}

.notes-grid a {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
  text-decoration: none;
  display: block;
  transition: box-shadow 0.18s;
}
.notes-grid a:hover { box-shadow: var(--shadow-hover); }

.notes-grid h3 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
}

.notes-grid p {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.25rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer p { margin: 0.3rem 0; }
.site-footer a { color: var(--link); }

/* ── Focus states ── */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 0.4rem;
}

/* ── Responsive ── */
@media (max-width: 42rem) {
  .shell { width: min(calc(100% - 1.25rem), var(--max-width)); }
  .header-inner { min-height: 3.7rem; flex-wrap: wrap; gap: 0.5rem; }
  .header-right { gap: 0.35rem; }
  .main-nav a { font-size: 0.85rem; padding: 0.4rem 0.5rem; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .project-entry { padding: 1.1rem 1rem; }
  .detail-row { grid-template-columns: 1fr; gap: 0.2rem; }
  .detail-row dt { padding-top: 0; }
  .entry-head { flex-direction: column; gap: 0.6rem; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
