/* ==========================================================
   Holger Hellinger — CV
   Design tokens, light/dark theming, print styles
   ========================================================== */

:root {
  --font-sans: "Inter var", "Inter", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Inter var", "Inter", ui-sans-serif, system-ui, sans-serif;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 2rem;
  --space-8: 2.5rem;
  --space-9: 3rem;
  --space-10: 4rem;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* Type */
  --fs-xs: 0.78rem;
  --fs-sm: 0.88rem;
  --fs-base: 1rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.6rem;

  /* Light theme (default) */
  --bg: #faf9f6;
  --bg-elev: #ffffff;
  --bg-soft: #f3f1ec;
  --fg: #14181f;
  --fg-muted: #5a6373;
  --fg-subtle: #8a93a3;
  --border: #e6e3da;
  --border-strong: #d4d0c4;
  --accent: #2f6df6;
  --accent-soft: #e3edff;
  --accent-fg: #ffffff;
  --shadow-sm: 0 1px 2px rgba(20, 24, 31, 0.04), 0 1px 1px rgba(20, 24, 31, 0.03);
  --shadow-md: 0 8px 24px rgba(20, 24, 31, 0.06), 0 2px 6px rgba(20, 24, 31, 0.04);
  --shadow-lg: 0 24px 48px rgba(20, 24, 31, 0.08), 0 6px 12px rgba(20, 24, 31, 0.04);
  --ring: 0 0 0 3px rgba(47, 109, 246, 0.35);

  --max-width: 1180px;
}

/* Dark theme — applied via system preference unless user overrides */
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0b0d10;
    --bg-elev: #14181f;
    --bg-soft: #1b2029;
    --fg: #e8ecf3;
    --fg-muted: #a8b1c2;
    --fg-subtle: #76808f;
    --border: #232a35;
    --border-strong: #303949;
    --accent: #7aa2ff;
    --accent-soft: #1a2540;
    --accent-fg: #0b0d10;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.45), 0 6px 12px rgba(0, 0, 0, 0.3);
    --ring: 0 0 0 3px rgba(122, 162, 255, 0.45);
  }
}

/* Manual overrides via toggle */
:root[data-theme="dark"] {
  --bg: #0b0d10;
  --bg-elev: #14181f;
  --bg-soft: #1b2029;
  --fg: #e8ecf3;
  --fg-muted: #a8b1c2;
  --fg-subtle: #76808f;
  --border: #232a35;
  --border-strong: #303949;
  --accent: #7aa2ff;
  --accent-soft: #1a2540;
  --accent-fg: #0b0d10;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.45), 0 6px 12px rgba(0, 0, 0, 0.3);
  --ring: 0 0 0 3px rgba(122, 162, 255, 0.45);
}

:root[data-theme="light"] {
  --bg: #faf9f6;
  --bg-elev: #ffffff;
  --bg-soft: #f3f1ec;
  --fg: #14181f;
  --fg-muted: #5a6373;
  --fg-subtle: #8a93a3;
  --border: #e6e3da;
  --border-strong: #d4d0c4;
  --accent: #2f6df6;
  --accent-soft: #e3edff;
  --accent-fg: #ffffff;
}

/* ----- Reset & base ----- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--fg);
  background:
    radial-gradient(1200px 600px at 90% -10%, var(--accent-soft) 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--accent-soft) 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11", "kern";
  transition: background-color 0.3s ease, color 0.3s ease;
}
@supports (font-variation-settings: normal) {
  html { font-family: "Inter var", ui-sans-serif, system-ui, sans-serif; }
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.012em; line-height: 1.2; }

ul, ol { margin: 0; padding: 0; list-style: none; }

::selection { background: var(--accent); color: var(--accent-fg); }

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--accent-fg);
  padding: var(--space-3) var(--space-4); border-radius: 0 0 var(--radius-md) 0;
  font-weight: 600; z-index: 100;
}
.skip-link:focus { left: 0; }

/* ----- Topbar ----- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  border-bottom: 1px solid color-mix(in oklab, var(--border) 80%, transparent);
}
.topbar__inner {
  max-width: var(--max-width); margin: 0 auto;
  padding: var(--space-3) var(--space-6);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4);
}
.brand {
  display: inline-flex; align-items: center; gap: var(--space-3);
  color: var(--fg); font-weight: 600; letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand__monogram {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent) 60%, #b388ff));
  color: white; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.5px;
  box-shadow: var(--shadow-sm);
}
.brand__name { font-size: 0.95rem; }
.topbar__actions { display: inline-flex; align-items: center; gap: var(--space-2); }

/* Buttons */
.iconbtn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-pill);
  background: var(--bg-elev);
  color: var(--fg);
  border: 1px solid var(--border);
  font-family: inherit; font-size: 0.85rem; font-weight: 500;
  cursor: pointer;
  transition: transform .15s ease, background-color .2s ease, border-color .2s ease;
}
.iconbtn:hover { background: var(--bg-soft); border-color: var(--border-strong); }
.iconbtn:active { transform: translateY(1px); }
.iconbtn__label { display: inline; }

/* Theme toggle */
.theme-toggle {
  --w: 58px; --h: 30px;
  width: var(--w); height: var(--h);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  background: var(--bg-elev); padding: 0; cursor: pointer;
  position: relative;
  transition: background-color .2s ease, border-color .2s ease;
}
.theme-toggle:hover { border-color: var(--border-strong); }
.theme-toggle__track {
  position: absolute; inset: 3px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6px;
  color: var(--fg-muted);
}
.theme-toggle__sun, .theme-toggle__moon { width: 16px; height: 16px; }
.theme-toggle__thumb {
  position: absolute; top: 0; left: 0;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--shadow-sm);
  transition: transform .25s cubic-bezier(.2,.8,.2,1);
  transform: translateX(2px);
}
:root[data-theme="dark"] .theme-toggle__thumb { transform: translateX(28px); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .theme-toggle__thumb { transform: translateX(28px); }
}

/* Icons */
.ic { width: 20px; height: 20px; flex: none; }
.ic--sm { width: 16px; height: 16px; }
.ic--xs { width: 12px; height: 12px; opacity: .7; }

/* ----- Layout ----- */
.layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-7) var(--space-6) var(--space-9);
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: var(--space-7);
}
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; padding: var(--space-5) var(--space-4) var(--space-7); gap: var(--space-5); }
}

.sidebar { display: flex; flex-direction: column; gap: var(--space-5); align-self: start; position: sticky; top: 80px; }
@media (max-width: 880px) { .sidebar { position: static; } }
.content { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }

/* ----- Cards ----- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
  animation: fade-up .55s ease both;
}
.card:hover { box-shadow: var(--shadow-md); }
.card__title {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--fg-muted);
  margin-bottom: var(--space-4);
}
.card__title .ic { color: var(--accent); }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
  * { transition: none !important; }
}

/* ----- Hero ----- */
.hero { text-align: center; padding-top: var(--space-7); }
.hero__photo {
  position: relative;
  width: 168px; height: 168px;
  margin: 0 auto var(--space-5);
  border-radius: 50%;
}
.hero__photo img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg-elev);
  box-shadow: var(--shadow-md);
}
.hero__ring {
  position: absolute; inset: -8px;
  border-radius: 50%;
  background: conic-gradient(from 140deg,
    var(--accent),
    color-mix(in oklab, var(--accent) 50%, #b388ff),
    color-mix(in oklab, var(--accent) 30%, #ffffff),
    var(--accent));
  z-index: -1;
  filter: blur(2px);
  opacity: 0.55;
  animation: spin 14s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .hero__ring { animation: none; } }

.hero__name {
  font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.02em;
  margin-bottom: var(--space-1);
}
.hero__role {
  margin: 0; color: var(--accent); font-weight: 600; font-size: 0.95rem;
}
.hero__location {
  display: inline-flex; align-items: center; gap: 6px;
  margin: var(--space-3) 0 0; color: var(--fg-muted); font-size: 0.875rem;
}

/* ----- Contact / Links lists ----- */
.contact-list, .links-list { display: flex; flex-direction: column; gap: var(--space-2); }
.contact-list li, .links-list li {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  transition: background-color .2s ease;
}
.contact-list li:hover, .links-list li:hover { background: var(--bg-soft); }
.contact-list a, .links-list a {
  display: flex; align-items: center; gap: var(--space-3);
  color: var(--fg); width: 100%;
}
.contact-list a:hover, .links-list a:hover { color: var(--accent); text-decoration: none; }
.contact-list .ic, .links-list .ic { color: var(--fg-muted); }
.contact-list a:hover .ic, .links-list a:hover .ic { color: var(--accent); }

/* ----- Skills ----- */
.skills { display: flex; flex-direction: column; gap: var(--space-4); }
.skill-group__title {
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--fg-subtle); margin-bottom: var(--space-2);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.78rem; font-weight: 500;
  background: var(--bg-soft);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.chip:hover { background: var(--accent-soft); border-color: color-mix(in oklab, var(--accent) 30%, var(--border)); transform: translateY(-1px); }

/* ----- Sections ----- */
.section { padding: var(--space-7); }
.section__title {
  display: flex; align-items: center; gap: var(--space-3);
  font-size: var(--fs-lg);
  font-weight: 700;
  margin-bottom: var(--space-5);
  letter-spacing: -0.012em;
}
.section__title .ic { color: var(--accent); width: 22px; height: 22px; }

.lede {
  font-size: var(--fs-md);
  line-height: 1.65;
  color: var(--fg);
  margin: 0;
}
.prose p { margin: 0 0 var(--space-4); color: var(--fg); }
.prose p:last-child { margin-bottom: 0; }

/* ----- Timeline ----- */
.timeline { position: relative; display: flex; flex-direction: column; gap: var(--space-5); }
.timeline::before {
  content: ""; position: absolute;
  left: 110px; top: 6px; bottom: 6px;
  width: 2px; background: linear-gradient(to bottom, var(--accent), color-mix(in oklab, var(--accent) 30%, transparent));
  border-radius: 2px;
}
.timeline__item {
  display: grid; grid-template-columns: 110px 1fr; gap: var(--space-5);
  position: relative;
}
.timeline__item::before {
  content: ""; position: absolute;
  left: 105px; top: 8px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 18%, transparent);
}
.timeline__period {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--fg-muted);
  padding-top: 4px;
}
.timeline__body { padding-left: var(--space-5); }
.timeline__role { font-size: var(--fs-md); font-weight: 700; }
.timeline__org {
  margin: 2px 0 var(--space-3);
  color: var(--accent); font-weight: 500; font-size: 0.95rem;
}
.timeline__desc { margin: 0; color: var(--fg-muted); }

@media (max-width: 640px) {
  .timeline::before { left: 7px; }
  .timeline__item { grid-template-columns: 1fr; gap: var(--space-2); padding-left: 28px; }
  .timeline__item::before { left: 1px; top: 6px; }
  .timeline__body { padding-left: 0; }
}

/* ----- Education ----- */
.edu-list { display: flex; flex-direction: column; gap: var(--space-3); }
.edu {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
}
.edu:first-child { border-top: 0; padding-top: 0; }
.edu__year {
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em;
  color: var(--fg-muted); text-transform: uppercase;
}
.edu__body { display: flex; flex-direction: column; gap: 2px; }
.edu__degree { font-weight: 600; }
.edu__inst { color: var(--fg-muted); font-size: 0.92rem; }
@media (max-width: 540px) {
  .edu { grid-template-columns: 1fr; gap: var(--space-1); }
}

/* ----- Publications ----- */
.pubs { display: flex; flex-direction: column; gap: var(--space-4); }
.pub {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: var(--space-5);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--border);
}
.pub:first-child { border-top: 0; padding-top: 0; }
.pub__year {
  font-size: 0.82rem; font-weight: 700; letter-spacing: 0.04em;
  color: var(--fg-muted); text-transform: uppercase;
  padding-top: 3px;
}
.pub__title {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-md); font-weight: 600;
  color: var(--fg);
}
.pub__title:hover { color: var(--accent); text-decoration: none; }
.pub__title:hover .ic { color: var(--accent); opacity: 1; }
.pub__desc { margin: var(--space-2) 0 0; color: var(--fg-muted); font-size: 0.94rem; }
@media (max-width: 540px) {
  .pub { grid-template-columns: 1fr; gap: var(--space-1); }
}

/* ----- Footer ----- */
.footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-6);
  text-align: center;
  color: var(--fg-subtle);
  font-size: 0.85rem;
}

/* ==========================================================
   Print styles — A4/Letter, single column, no UI chrome
   ========================================================== */
@media print {
  :root, :root[data-theme="dark"], :root[data-theme="auto"] {
    --bg: #ffffff;
    --bg-elev: #ffffff;
    --bg-soft: #f5f5f5;
    --fg: #111111;
    --fg-muted: #444444;
    --fg-subtle: #666666;
    --border: #d0d0d0;
    --border-strong: #b0b0b0;
    --accent: #1d4ed8;
    --accent-soft: #eef2ff;
    --accent-fg: #ffffff;
    --shadow-sm: none; --shadow-md: none; --shadow-lg: none;
  }

  @page { size: A4; margin: 14mm 14mm 16mm; }

  html, body {
    background: #ffffff !important;
    color: #111111 !important;
    font-size: 10.5pt;
    line-height: 1.45;
  }

  /* Hide UI chrome */
  .topbar, .skip-link, .footer, .iconbtn, .theme-toggle { display: none !important; }
  .hero__ring { display: none !important; }

  /* Layout collapses to a single column */
  .layout {
    display: block !important;
    max-width: none;
    padding: 0;
    margin: 0;
  }
  .sidebar, .content {
    display: block !important;
    position: static !important;
  }
  .sidebar { margin-bottom: 6mm; }

  /* Remove card chrome for cleaner printing */
  .card {
    background: #ffffff !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin-bottom: 6mm;
    animation: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .section { padding: 0 !important; }
  .section__title {
    font-size: 13pt;
    margin-bottom: 4mm;
    padding-bottom: 1.5mm;
    border-bottom: 1px solid #cfcfcf;
    color: #111;
  }
  .section__title .ic { display: none; }
  .card__title { color: #555; margin-bottom: 3mm; }
  .card__title .ic { display: none; }

  /* Hero — compact, photo + name + key contacts on one band */
  .hero {
    text-align: left;
    padding: 0 !important;
    display: grid;
    grid-template-columns: 28mm 1fr;
    gap: 6mm;
    align-items: center;
    margin-bottom: 6mm !important;
    border-bottom: 1.5pt solid #1d4ed8;
    padding-bottom: 5mm !important;
  }
  .hero__photo { width: 28mm; height: 28mm; margin: 0; }
  .hero__photo img { border: 0; box-shadow: none; }
  .hero__name { font-size: 18pt; }
  .hero__role { font-size: 11pt; color: #1d4ed8; }
  .hero__location { font-size: 9.5pt; color: #444; }
  .hero__location .ic { display: none; }

  /* Contacts/Links — inline rows */
  .contact-list, .links-list {
    display: flex; flex-wrap: wrap;
    gap: 1mm 5mm;
    font-size: 9.5pt;
  }
  .contact-list li, .links-list li {
    padding: 0; background: transparent !important;
  }
  .contact-list a, .links-list a { color: #111 !important; }
  .links-list a::after { content: " (" attr(href) ")"; color: #666; font-size: 8.5pt; word-break: break-all; }
  .contact-list .ic, .links-list .ic { display: none; }

  /* Skills */
  .skills { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm 6mm; }
  .skill-group__title { font-size: 9pt; color: #666; margin-bottom: 1.5mm; }
  .chip {
    background: #fff !important; border: 1px solid #cfcfcf !important;
    color: #111 !important; padding: 1pt 6pt; font-size: 9pt; font-weight: 500;
  }

  /* Timeline */
  .timeline::before, .timeline__item::before { display: none; }
  .timeline__item {
    grid-template-columns: 28mm 1fr;
    gap: 4mm;
    padding-left: 0;
    break-inside: avoid; page-break-inside: avoid;
  }
  .timeline__period { font-size: 9pt; color: #666; }
  .timeline__role { font-size: 11pt; }
  .timeline__org { color: #1d4ed8; font-size: 10pt; margin: 0 0 1mm; }
  .timeline__desc { color: #222; font-size: 10pt; }
  .timeline__body { padding-left: 0; }

  /* Education */
  .edu { grid-template-columns: 28mm 1fr; gap: 4mm; padding: 1.5mm 0; }
  .edu__year { font-size: 9pt; color: #666; }
  .edu__degree { font-size: 10.5pt; }
  .edu__inst { font-size: 9.5pt; color: #444; }
  .edu, .pub { break-inside: avoid; page-break-inside: avoid; }

  /* Publications */
  .pub { grid-template-columns: 18mm 1fr; gap: 4mm; }
  .pub__title { font-size: 10.5pt; color: #111 !important; }
  .pub__title::after { content: " — " attr(href); color: #666; font-size: 8.5pt; font-weight: 400; word-break: break-all; }
  .pub__desc { font-size: 9.5pt; color: #333; }
  .pub__title .ic { display: none; }

  /* Generic anchors */
  a { color: #111 !important; text-decoration: none !important; }

  /* Page break hints */
  h2, h3 { break-after: avoid; page-break-after: avoid; }
  .section { break-inside: avoid-page; }
}
