/* ==========================================================================
   arne-nordmann.de - design system
   Minimal, text-focused, privacy-first. System fonts only (no external loads).
   ========================================================================== */

:root {
  /* Type */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;

  /* Scale (fluid) */
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem);
  --step-2:  clamp(1.5rem, 1.3rem + 1vw, 2.1rem);
  --step-3:  clamp(2rem, 1.6rem + 2vw, 3.2rem);

  /* Spacing */
  --space-xs: 0.5rem;
  --space-s:  1rem;
  --space-m:  1.75rem;
  --space-l:  3rem;
  --space-xl: 5rem;

  --measure: 68ch;
  --radius: 10px;
  --border: 1px solid var(--line);
  --transition: 160ms ease;

  /* Light theme palette */
  --bg: #ffffff;
  --bg-soft: #f6f7f8;
  --fg: #18181b;
  --fg-muted: #52525b;
  --line: #e4e4e7;
  --accent: #0f766e;
  --accent-fg: #ffffff;
  --link: #0f766e;
  --link-hover: #115e59;

  /* Timeline category colors */
  --cat-education: #7c3aed;
  --cat-research: #0f766e;
  --cat-industry: #b45309;
  --cat-leadership: #be123c;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0f12;
    --bg-soft: #16191e;
    --fg: #e7e7ea;
    --fg-muted: #a1a1aa;
    --line: #2a2e35;
    --accent: #2dd4bf;
    --accent-fg: #0d0f12;
    --link: #2dd4bf;
    --link-hover: #5eead4;
    --cat-education: #a78bfa;
    --cat-research: #2dd4bf;
    --cat-industry: #fbbf24;
    --cat-leadership: #fb7185;
  }
}

/* Explicit dark theme (toggle) */
:root[data-theme="dark"] {
  --bg: #0d0f12;
  --bg-soft: #16191e;
  --fg: #e7e7ea;
  --fg-muted: #a1a1aa;
  --line: #2a2e35;
  --accent: #2dd4bf;
  --accent-fg: #0d0f12;
  --link: #2dd4bf;
  --link-hover: #5eead4;
  --cat-education: #a78bfa;
  --cat-research: #2dd4bf;
  --cat-industry: #fbbf24;
  --cat-leadership: #fb7185;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--transition), color var(--transition);
}

img, svg { max-width: 100%; height: auto; display: block; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--link-hover); }

h1, h2, h3 { line-height: 1.15; font-weight: 650; letter-spacing: -0.02em; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

/* ---------- Layout ---------- */
.wrap { width: min(100% - 2.5rem, 980px); margin-inline: auto; }
.section { padding-block: var(--space-xl); border-top: var(--border); }
.section:first-of-type { border-top: 0; }
.section__eyebrow {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}
.flow > * + * { margin-top: var(--space-s); }
.measure { max-width: var(--measure); }
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--accent-fg);
  padding: var(--space-xs) var(--space-s); z-index: 100; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: var(--border);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-s); padding-block: var(--space-s); }
.brand { font-weight: 700; letter-spacing: -0.02em; text-decoration: none; color: var(--fg); font-size: var(--step-0); }
.nav { display: flex; align-items: center; gap: var(--space-m); }
.nav__links { display: flex; align-items: center; gap: var(--space-s); }
.nav a { color: var(--fg-muted); text-decoration: none; font-size: var(--step--1); font-weight: 500; }
.nav a:hover { color: var(--fg); }
@media (max-width: 640px) { .nav__links { display: none; } }

.theme-toggle {
  border: var(--border); background: var(--bg-soft); color: var(--fg);
  width: 2.25rem; height: 2.25rem; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; font-size: 1rem; transition: background var(--transition);
}
.theme-toggle:hover { background: var(--line); }

/* ---------- Hero / Who I Am ---------- */
.hero { padding-block: var(--space-xl) var(--space-l); }
.hero h1 { margin-bottom: var(--space-s); }
.hero__role { font-size: var(--step-1); color: var(--fg-muted); font-weight: 500; }
.hero__intro { margin-top: var(--space-m); color: var(--fg); }
.hero__intro p + p { margin-top: var(--space-s); }

.hero__grid { display: grid; gap: var(--space-l); align-items: center; }
.hero__image {
  width: 100%; height: auto; max-width: 320px; margin-inline: auto;
  border: var(--border); border-radius: var(--radius); background: #fff;
}
@media (min-width: 720px) {
  .hero__grid { grid-template-columns: 3fr 2fr; }
  .hero__image { max-width: none; }
}

.values { display: grid; gap: var(--space-m); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: var(--space-l); }
.value { padding: var(--space-m); border: var(--border); border-radius: var(--radius); background: var(--bg-soft); }
.value h3 { font-size: var(--step-0); margin-bottom: var(--space-xs); }
.value p { color: var(--fg-muted); font-size: var(--step--1); }

/* ---------- Timeline ---------- */
.timeline__legend { display: flex; flex-wrap: wrap; gap: var(--space-s) var(--space-m); margin-block: var(--space-m) var(--space-l); }
.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; font-size: var(--step--1); color: var(--fg-muted); }
.legend-dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; flex: none; }

/* Two independently-packed columns either side of a centered spine, so a
   short card doesn't leave its opposite number stranded under a tall one -
   each column flows by its own content height instead of sharing a row. */
.timeline-grid {
  --tl-gutter: 3.5rem; --tl-node-r: 0.475rem;
  position: relative; display: grid;
  grid-template-columns: 1fr var(--tl-gutter) 1fr;
}
.timeline-grid::before {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  top: 0; bottom: 0; width: 2px; background: var(--line);
}

.timeline-col {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: var(--space-l);
}
.timeline-col--left { grid-column: 1; }
.timeline-col--right { grid-column: 3; padding-top: var(--space-l); }

.tl-item { position: relative; }

.tl-item__node {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: calc(var(--tl-node-r) * 2); height: calc(var(--tl-node-r) * 2); border-radius: 50%;
  background: var(--cat); border: 3px solid var(--bg); box-shadow: 0 0 0 2px var(--cat);
  transition: transform var(--transition);
}
.tl-item:hover .tl-item__node { transform: translateY(-50%) scale(1.3); }

/* Connector: a thin line from the card edge to its node on the spine,
   so the pairing reads at a glance instead of relying on proximity alone. */
.tl-item::after {
  content: ""; position: absolute; top: 50%; transform: translateY(-50%);
  height: 2px; background: var(--cat);
  width: calc(var(--tl-gutter) / 2 - var(--tl-node-r));
}
.timeline-col--left .tl-item__node { right: calc(-1 * (var(--tl-gutter) / 2 + var(--tl-node-r))); }
.timeline-col--left .tl-item::after { right: calc(-1 * (var(--tl-gutter) / 2 - var(--tl-node-r))); }
.timeline-col--right .tl-item__node { left: calc(-1 * (var(--tl-gutter) / 2 + var(--tl-node-r))); }
.timeline-col--right .tl-item::after { left: calc(-1 * (var(--tl-gutter) / 2 - var(--tl-node-r))); }

.tl-card {
  display: block; text-decoration: none; color: inherit;
  border: var(--border); border-radius: var(--radius);
  padding: var(--space-s) var(--space-m); background: var(--bg-soft);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.tl-card:hover, .tl-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--cat) 60%, transparent);
}
.tl-card__image {
  display: block; width: 100%; height: 200px; object-fit: cover;
  border-radius: calc(var(--radius) - 2px); margin-bottom: var(--space-s); background: #fff;
}
.tl-card__meta { display: flex; align-items: baseline; gap: var(--space-s); }
.tl-card__cat { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--cat); }
.tl-card__year { font-variant-numeric: tabular-nums; font-size: var(--step--1); color: var(--fg-muted); font-weight: 600; }
.tl-card__title { font-size: var(--step-1); margin-block: 0.15rem 0.3rem; color: var(--fg); }
.tl-card__summary { color: var(--fg-muted); font-size: var(--step--1); }
.tl-card__more { font-size: var(--step--1); color: var(--cat); font-weight: 600; margin-top: var(--space-xs); display: inline-block; }

/* Left column: card faces the spine on its right edge */
.timeline-col--left .tl-card { text-align: right; border-right: 3px solid var(--cat); }
.timeline-col--left .tl-card__meta { justify-content: flex-end; }

/* Right column: card faces the spine on its left edge */
.timeline-col--right .tl-card { text-align: left; border-left: 3px solid var(--cat); }
.timeline-col--right .tl-card__meta { justify-content: flex-start; }

/* Single-column on small screens: unwrap the two columns into one flex
   flow (spine left, all cards right), restoring chronological order via
   the --order custom property since DOM order is now left-items-then-
   right-items rather than strictly chronological. */
@media (max-width: 720px) {
  .timeline-grid { display: flex; flex-direction: column; }
  .timeline-grid::before { left: 0.5rem; transform: none; }
  .timeline-col { display: contents; }
  .timeline-col--right { padding-top: 0; }
  .tl-item { order: var(--order); display: block; padding-left: 2rem; padding-block: var(--space-s); }
  .tl-item__node { position: absolute; left: 0.5rem; right: auto; top: 1.9rem; transform: translateX(-50%); }
  .tl-item:hover .tl-item__node { transform: translateX(-50%) scale(1.3); }
  .timeline-col--left .tl-item::after, .timeline-col--right .tl-item::after {
    left: 0.5rem; right: auto; top: 1.9rem; transform: none; width: 1.5rem;
  }
  .timeline-col--left .tl-card, .timeline-col--right .tl-card {
    text-align: left; border-right: 0; border-left: 3px solid var(--cat);
  }
  .timeline-col--left .tl-card__meta, .timeline-col--right .tl-card__meta {
    justify-content: space-between;
  }
}

/* ---------- Links hub ---------- */
/* Deliberately small/compact: this is a linktree, not primary content. */
.linkhub { display: grid; gap: var(--space-xs); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: var(--space-m); }
.linkcard {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; min-width: 0;
  border: var(--border); border-radius: var(--radius); padding: var(--space-xs) var(--space-s);
  text-decoration: none; color: var(--fg); background: var(--bg); transition: border-color var(--transition), background var(--transition), transform var(--transition);
}
.linkcard:hover { border-color: var(--accent); background: var(--bg-soft); transform: translateY(-2px); }
.linkcard__label { font-weight: 600; font-size: var(--step--1); white-space: nowrap; }
.linkcard__handle {
  color: var(--fg-muted); font-size: 0.75rem; font-family: var(--font-mono);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.linkhub--secondary { margin-top: var(--space-m); }
.linkhub--secondary .linkcard { background: transparent; }

/* ---------- Footer ---------- */
.site-footer { border-top: var(--border); padding-block: var(--space-l); color: var(--fg-muted); font-size: var(--step--1); }
.site-footer a { color: var(--fg-muted); }
.site-footer__row { display: flex; flex-wrap: wrap; gap: var(--space-s) var(--space-m); justify-content: space-between; }

/* ---------- Breadcrumb nav ---------- */
.breadcrumb { margin-bottom: var(--space-m); }
.breadcrumb ol { display: flex; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; gap: 0.4rem; font-size: var(--step--1); }
.breadcrumb li { display: flex; align-items: center; gap: 0.4rem; color: var(--fg-muted); }
.breadcrumb li:not(:first-child)::before { content: "/"; color: var(--fg-muted); }
.breadcrumb a { color: var(--fg-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb [aria-current="page"] { color: var(--fg); }

/* ---------- Milestone detail page ---------- */
.detail-hero { padding-block: var(--space-l) var(--space-m); }
.detail-cat { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--cat); }
.detail-year { color: var(--fg-muted); font-variant-numeric: tabular-nums; margin-top: var(--space-xs); }
.detail-image {
  display: block; width: 100%; height: auto; margin-top: var(--space-m);
  border: var(--border); border-radius: var(--radius); background: #fff;
}
.detail-body { margin-block: var(--space-m); font-style: normal; }
.detail-body p + p { margin-top: var(--space-s); }
.facts { list-style: none; padding: 0; border: var(--border); border-radius: var(--radius); overflow: hidden; margin-block: var(--space-m); }
.facts li { display: flex; gap: var(--space-s); padding: var(--space-s) var(--space-m); border-top: var(--border); }
.facts li:first-child { border-top: 0; }
.facts__label { flex: none; width: 9rem; color: var(--fg-muted); font-size: var(--step--1); }
.facts__value { font-weight: 500; }
.detail-links { display: flex; flex-wrap: wrap; gap: var(--space-s); margin-top: var(--space-m); }
.btn {
  display: inline-block; text-decoration: none; padding: 0.55rem var(--space-m);
  border-radius: var(--radius); border: var(--border); background: var(--bg-soft); color: var(--fg);
  font-size: var(--step--1); font-weight: 600; transition: background var(--transition), border-color var(--transition);
}
.btn:hover { border-color: var(--accent); background: var(--bg); }
.btn--accent { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn--accent:hover { background: var(--link-hover); color: var(--accent-fg); }
button.btn { font-family: inherit; cursor: pointer; }
.detail-neighbors {
  display: flex; justify-content: space-between; gap: var(--space-s);
  margin-top: var(--space-l); padding-top: var(--space-m); border-top: var(--border);
}
.detail-neighbor { color: var(--fg-muted); text-decoration: none; font-size: var(--step--1); max-width: 45%; }
.detail-neighbor:hover { color: var(--accent); }
.detail-neighbor--next { text-align: right; margin-left: auto; }

/* ---------- Archive list ---------- */
.cv-list { list-style: none; padding: 0; margin-block: var(--space-m) var(--space-l); }
.cv-item { display: flex; gap: var(--space-s); padding: var(--space-xs) 0; border-top: var(--border); }
.cv-item:first-child { border-top: 0; }
.cv-item__year { flex: none; width: 8rem; color: var(--fg-muted); font-size: var(--step--1); font-variant-numeric: tabular-nums; }
.cv-item__link { color: var(--fg); text-decoration: none; }
a.cv-item__link:hover { color: var(--accent); }

/* ---------- Archive post page ---------- */
.archive-disclaimer {
  border: var(--border); border-radius: var(--radius); background: var(--bg-soft);
  padding: var(--space-s) var(--space-m); margin-block: var(--space-m); font-size: var(--step--1); color: var(--fg-muted);
}
.archive-figure { margin-block: var(--space-m); }
.archive-figure img { display: block; width: 100%; height: auto; border: var(--border); border-radius: var(--radius); background: #fff; }
.archive-figure figcaption { margin-top: var(--space-xs); font-size: var(--step--1); color: var(--fg-muted); }
.footnotes { margin-top: var(--space-l); padding-top: var(--space-m); border-top: var(--border); font-size: var(--step--1); color: var(--fg-muted); }
.footnotes li { margin-bottom: var(--space-xs); }
.comments { margin-top: var(--space-l); padding-top: var(--space-m); border-top: var(--border); }
.comments ol { list-style: none; padding: 0; margin: 0; }
.comments > ol > li { margin-top: var(--space-m); }
.comment__meta { font-size: var(--step--1); color: var(--fg-muted); }
.comment__meta a { color: var(--fg-muted); }
.comment__body p { margin-top: 0.35rem; }
.comment__replies { margin-top: var(--space-s); margin-left: var(--space-m); padding-left: var(--space-m); border-left: var(--border); }

/* ---------- CV page ---------- */
.cv-header { margin-bottom: var(--space-l); }
.cv-header h1 { margin-bottom: var(--space-xs); }
.cv-header__title { font-size: var(--step-1); color: var(--fg-muted); font-weight: 500; }
.cv-header__meta { color: var(--fg-muted); font-size: var(--step--1); margin-top: 0.2rem; }
.cv-header .print-btn { margin-top: var(--space-m); }

.cv-page { display: grid; gap: var(--space-xl); }
@media (min-width: 800px) {
  .cv-page { grid-template-columns: 15.5rem 1fr; align-items: start; }
}

.cv-sidebar h2 {
  font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--accent); font-weight: 700; margin-bottom: var(--space-s);
}
.cv-sidebar h2:not(:first-child) { margin-top: var(--space-l); }
.cv-skill { padding-block: var(--space-s); border-top: var(--border); }
.cv-skill:first-of-type { border-top: 0; padding-top: 0; }
.cv-skill__title { font-weight: 600; font-size: var(--step--1); }
.cv-skill__text { color: var(--fg-muted); font-size: var(--step--1); margin-top: 0.2rem; }
.cv-sidebar-links { display: flex; flex-direction: column; gap: 0.4rem; }
.cv-sidebar-link { color: var(--link); text-decoration: none; font-size: var(--step--1); }
.cv-sidebar-link:hover { color: var(--link-hover); }

.cv-main h2 {
  margin-top: var(--space-l); margin-bottom: var(--space-s);
  padding-top: var(--space-l); border-top: var(--border);
}
.cv-main h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.cv-entry + .cv-entry { margin-top: var(--space-m); padding-top: var(--space-m); border-top: var(--border); }
.cv-entry__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-s); }
.cv-entry__title { font-size: var(--step-0); }
.cv-entry__period {
  flex: none; color: var(--fg-muted); font-size: var(--step--1);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.cv-entry__org { color: var(--fg-muted); font-size: var(--step--1); margin-top: 0.15rem; font-weight: 500; }
.cv-entry__text { margin-top: var(--space-xs); color: var(--fg); }
.cv-entry__more { display: inline-block; margin-top: var(--space-xs); font-size: var(--step--1); color: var(--accent); font-weight: 600; text-decoration: none; }
.cv-entry__more:hover { color: var(--link-hover); }

/* ---------- Print ---------- */
@media print {
  .no-print, .site-header, .site-footer, .skip-link, .breadcrumb, .detail-neighbors, .theme-toggle { display: none !important; }
  body { color: #000; background: #fff; }
  .section { border-top: 0; padding-block: 0; }
  a { color: #000; text-decoration: none; }
  .cv-entry__more { display: none; }
  .cv-page { gap: var(--space-l); }
  @media (min-width: 800px) {
    .cv-page { grid-template-columns: 13rem 1fr; }
  }
  .cv-entry, .cv-skill { break-inside: avoid; }
  .cv-sidebar h2, .cv-main h2 { color: #000; }
}
