/* Leihwelt — clean light/dark portfolio */
:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 10px;
  --max: 1120px;
  --pad: 1.25rem;
  --gap: 1.25rem;
  --ease: 160ms ease;
}

/* Light */
html[data-theme="light"],
html[data-theme="system"] {
  color-scheme: light;
  --bg: #f7f7f5;
  --bg-elev: #ffffff;
  --text: #1a1a1a;
  --muted: #5c5c5c;
  --border: #e4e4e0;
  --accent: #1f6feb;
  --accent-soft: #e8f0fe;
  --badge: #0f766e;
  --badge-bg: #ccfbf1;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.04);
}

/* Dark via system */
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    color-scheme: dark;
    --bg: #0f1115;
    --bg-elev: #171a21;
    --text: #e8eaed;
    --muted: #9aa0a6;
    --border: #2a2f3a;
    --accent: #8ab4f8;
    --accent-soft: #1a2332;
    --badge: #5eead4;
    --badge-bg: #134e4a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115;
  --bg-elev: #171a21;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --border: #2a2f3a;
  --accent: #8ab4f8;
  --accent-soft: #1a2332;
  --badge: #5eead4;
  --badge-bg: #134e4a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover { text-decoration: none; }
h1, h2, h3 { line-height: 1.25; font-weight: 650; letter-spacing: -0.02em; }
.wrap { width: min(100% - 2 * var(--pad), var(--max)); margin-inline: auto; }
.main { flex: 1; padding-block: 1.5rem 3rem; }
.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--bg-elev); color: var(--text); padding: .5rem 1rem; z-index: 100;
}
.skip-link:focus { left: var(--pad); top: .5rem; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; gap: 1rem;
  min-height: 3.5rem;
}
.brand {
  font-weight: 700; letter-spacing: -0.03em; color: var(--text); text-decoration: none;
  font-size: 1.1rem;
}
.brand:hover { color: var(--accent); }
.nav { display: flex; gap: 1rem; margin-left: .5rem; }
.nav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); }
.theme-toggle {
  margin-left: auto;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 999px;
  width: 2.25rem; height: 2.25rem;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background var(--ease), border-color var(--ease);
}
.theme-toggle:hover { border-color: var(--muted); }
.theme-icon { font-size: .95rem; line-height: 1; }
html[data-theme="dark"] .theme-icon-sun,
html[data-theme="system"] .theme-icon-sun { display: none; }
html[data-theme="light"] .theme-icon-moon { display: none; }
@media (prefers-color-scheme: light) {
  html[data-theme="system"] .theme-icon-sun { display: none; }
  html[data-theme="system"] .theme-icon-moon { display: inline; }
}
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] .theme-icon-moon { display: none; }
  html[data-theme="system"] .theme-icon-sun { display: inline; }
}
html[data-theme="light"] .theme-icon-sun { display: none; }
html[data-theme="light"] .theme-icon-moon { display: inline; }
html[data-theme="dark"] .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: inline; }

/* Hero */
.hero { padding-block: 1.5rem 2rem; }
.hero-title { font-size: clamp(1.75rem, 4vw, 2.35rem); margin: 0 0 .35rem; }
.hero-lead { color: var(--muted); margin: 0 0 1rem; font-size: 1.05rem; }
.hero-bio { max-width: 46rem; margin: 0 0 1.25rem; }
.hero-links { display: flex; flex-wrap: wrap; gap: .65rem 1.1rem; margin: 0; }
.hero-links a { font-size: .95rem; }

.section-head { margin-bottom: 1.25rem; }
.section-head h2 { margin: 0 0 .25rem; font-size: 1.35rem; }
.section-sub { margin: 0; color: var(--muted); font-size: .95rem; }
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin: 0 0 .35rem; }

/* Grid — 3–4 cols desktop */
.project-grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: 1fr;
}
@media (min-width: 560px) {
  .project-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 860px) {
  .project-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1100px) {
  .project-grid { grid-template-columns: repeat(4, 1fr); }
}

.project-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: border-color var(--ease), transform var(--ease);
}
.project-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.project-card.is-hidden { display: none; }
.card-media { display: block; background: var(--border); aspect-ratio: 16 / 10; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: .9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.card-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.card-years { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.badge {
  font-size: .7rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em;
  color: var(--badge); background: var(--badge-bg); padding: .15rem .45rem; border-radius: 999px;
}
.card-title { margin: 0; font-size: 1.05rem; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:hover { color: var(--accent); }
.card-summary { margin: 0; color: var(--muted); font-size: .9rem; flex: 1; }
.tech-list {
  list-style: none; margin: .35rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: .35rem;
}
.tech-list li {
  font-size: .72rem; font-family: var(--mono);
  color: var(--muted); background: var(--accent-soft);
  border: 1px solid var(--border); border-radius: 6px; padding: .15rem .4rem;
}

.load-more-wrap { display: flex; justify-content: center; margin-top: 1.75rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text);
  border-radius: 8px; padding: .55rem 1rem; font: inherit; font-size: .95rem;
  cursor: pointer; text-decoration: none; transition: background var(--ease), border-color var(--ease);
}
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
html[data-theme="dark"] .btn-primary,
html[data-theme="system"] .btn-primary { color: #0f1115; }
@media (prefers-color-scheme: light) {
  html[data-theme="system"] .btn-primary { color: #fff; }
}
.load-more { min-width: 10rem; }

/* Detail */
.crumb { display: flex; gap: .5rem; align-items: center; color: var(--muted); font-size: .9rem; margin-bottom: 1rem; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.detail-header { margin-bottom: 1.25rem; max-width: 42rem; }
.detail-header h1 { margin: .35rem 0 .5rem; font-size: clamp(1.6rem, 3.5vw, 2.1rem); }
.detail-summary { margin: 0 0 .75rem; color: var(--muted); font-size: 1.05rem; }
.detail-meta { display: flex; gap: .5rem; align-items: center; }
.detail-links { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 0; }
.detail-cover {
  margin: 0 0 1.75rem; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); max-width: 48rem; box-shadow: var(--shadow);
}
.detail-body { max-width: 42rem; }
.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol { margin: 0 0 1rem; padding-left: 1.25rem; }
.prose h2 { margin: 1.75rem 0 .75rem; font-size: 1.25rem; }
.prose h3 { margin: 1.35rem 0 .5rem; font-size: 1.1rem; }
.prose a { word-break: break-word; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 1.25rem 1.75rem;
  margin-top: auto;
}
.footer-inner {
  display: flex; flex-wrap: wrap; gap: .75rem 1.5rem;
  justify-content: space-between; align-items: center;
}
.footer-copy, .footer-links { margin: 0; font-size: .9rem; color: var(--muted); }
.footer-links { display: flex; gap: 1rem; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
