/* ============================================================
   Hans Föllmer — Personal Homepage
   Strictly aligned with HU Berlin Corporate Design (live tokens
   extracted from hu-berlin.de). Mobile-first, no third-party
   requests, no JavaScript.
   ============================================================ */

/* ---------- HU Berlin design tokens ---------- */
:root {
  /* Primary brand */
  --hu-primary:        #00376c;   /* HU-Blau */
  --hu-primary-2:      #004c90;
  --hu-primary-3:      #5b89b0;
  --hu-primary-4:      #d7dde1;

  /* Black scale (live values) */
  --hu-black-1:        #0a0a19;
  --hu-black-2:        #59595f;
  --hu-black-3:        #95959e;
  --hu-black-4:        #cfcfd1;
  --hu-black-5:        #ebebeb;

  /* Backgrounds */
  --hu-bg-1:           #fafaf5;   /* default body background */
  --hu-bg-2:           #f0f0eb;
  --hu-bg-3:           #e6e6e1;

  /* Accent (HU-Rot, used sparingly) */
  --hu-accent:         #e30031;
  --hu-danger:         #b00259;   /* live --danger */

  /* Semantic — light theme */
  --color-bg:          var(--hu-bg-1);
  --color-surface:     #ffffff;
  --color-text:        #000000;
  --color-heading:     #000000;
  --color-muted:       var(--hu-black-2);
  --color-rule:        var(--hu-black-4);
  --color-link:        var(--hu-primary);
  --color-link-hov:    var(--hu-primary-2);
  --color-accent:      var(--hu-primary);

  /* Type — match HU site stack with system fallback (no external request) */
  --font-body:    "ff-scala", "FF Scala", system-ui, -apple-system,
                  BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
                  "Noto Sans", "Liberation Sans", Arial, sans-serif;
  --font-display: "hub-ddin", "DIN Next", "DIN Pro",
                  "Helvetica Neue", "Helvetica", "Arial Narrow", system-ui,
                  sans-serif;

  /* Scale & rhythm */
  --fs-base:    1.0625rem;
  --fs-small:   0.9rem;
  --fs-h1:      clamp(2.25rem, 4vw + 1rem, 3rem);
  --fs-h2:      clamp(1.5rem, 2vw + 0.8rem, 1.875rem);
  --fs-h3:      1.125rem;
  --lh-base:    1.6;
  --lh-tight:   1.15;

  /* Layout */
  --measure:    72ch;
  --gutter:     clamp(1rem, 2vw + 0.5rem, 2rem);
  --radius:     2px;          /* HU uses very subtle/no rounding */

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg:        #0a0a19;     /* HU-Schwarz-1 */
    --color-surface:   #14141d;
    --color-text:      var(--hu-bg-1);
    --color-heading:   var(--hu-bg-1);
    --color-muted:     var(--hu-black-3);
    --color-rule:      var(--hu-black-2);
    --color-link:      var(--hu-primary-3);
    --color-link-hov:  var(--hu-primary-4);
    --color-accent:    var(--hu-primary-3);
  }
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; tab-size: 4; }

body {
  margin: 0;
  font: var(--fs-base) / var(--lh-base) var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--color-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 120ms ease;
}
a:hover, a:focus-visible { color: var(--color-link-hov); }

:focus-visible {
  outline: 2px solid var(--hu-primary);
  outline-offset: 3px;
}

/* WCAG 2.3.3: Honor user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* Visually-hidden utility (for table captions etc.) */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: 0; top: -3rem;
  padding: 0.6rem 1rem;
  background: var(--hu-primary);
  color: #fff;
  text-decoration: none;
  z-index: 100;
  transition: top 150ms ease;
}
.skip-link:focus { top: 0; color: #fff; }

/* ---------- Layout shell ---------- */
.container {
  width: min(100% - 2 * var(--gutter), 64rem);
  margin-inline: auto;
}

/* ---------- Header — HU style: blue accent rule, clear typography ---------- */
.site-header {
  background: var(--color-surface);
  border-bottom: 4px solid var(--hu-primary);
  padding-block: 1.25rem;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  flex-direction: column;
  font-style: normal;
  color: var(--color-muted);
  font-size: var(--fs-small);
  line-height: 1.35;
  text-decoration: none;
}
.brand strong {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 600;
  color: var(--hu-primary);
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  text-transform: none;
}
.brand:hover strong { color: var(--hu-primary-2); }

.nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.nav a {
  text-decoration: none;
  font-weight: 500;
  padding: 0.6rem 0.25rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  color: var(--color-text);
  font-family: var(--font-display);
  letter-spacing: 0.01em;
}
.nav a:hover, .nav a:focus-visible { color: var(--hu-primary); }
.nav a[aria-current="page"] {
  border-bottom-color: var(--hu-primary);
  color: var(--hu-primary);
}

main { padding-block: clamp(2rem, 5vw, 4rem); }

.site-footer {
  margin-top: 4rem;
  padding-block: 1.5rem;
  border-top: 1px solid var(--color-rule);
  font-size: var(--fs-small);
  color: var(--color-muted);
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
}
.site-footer a { color: inherit; }

/* ---------- Typography ---------- */
h1, h2, h3 {
  font-family: var(--font-display);
  line-height: var(--lh-tight);
  margin: 0 0 0.5em;
  color: var(--color-heading);
  letter-spacing: -0.005em;
}
h1 { font-size: var(--fs-h1); font-weight: 700; }
h2 {
  font-size: var(--fs-h2);
  font-weight: 600;
  margin-top: 2.25em;
  padding-bottom: 0.3em;
  border-bottom: 2px solid var(--hu-primary);
}
h3 { font-size: var(--fs-h3); font-weight: 600; margin-top: 1.5em; }

.lead {
  font-size: 1.15rem;
  color: var(--color-muted);
  margin-block: 0 1.5rem;
  max-width: var(--measure);
}

p { margin: 0 0 1em; max-width: var(--measure); }
ul, ol { padding-left: 1.25em; }
li { margin-bottom: 0.35em; }

hr { border: 0; border-top: 1px solid var(--color-rule); margin: 2.5em 0; }

/* ---------- Home — hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  align-items: center;
  padding-block: 1rem 2rem;
}

@media (min-width: 38rem) {
  .hero {
    grid-template-columns: auto 1fr;
    gap: 2.5rem;
  }
}

.hero__photo {
  width: 11rem;
  height: 13.75rem;          /* 4:5 aspect, fixed pixel size */
  object-fit: cover;
  border: 1px solid var(--color-rule);
  flex-shrink: 0;
  justify-self: start;
}

.hero__intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero__intro h1 { margin: 0 0 0.5rem; }
.hero__role {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.15rem;
  color: var(--color-muted);
  line-height: 1.45;
  max-width: 30rem;
}

.contact-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem 2rem;
  margin-top: 2rem;
  padding: 1.75rem 2rem;
  background: var(--color-surface);
  border-left: 4px solid var(--hu-primary);
}

@media (min-width: 38rem) {
  .contact-card { grid-template-columns: 1fr 1fr; }
}

.contact-card__email { grid-column: 1 / -1; }

.contact-card h2 {
  margin: 0 0 0.4em;
  border: 0;
  padding: 0;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hu-primary);
}
.contact-card address {
  font-style: normal;
  line-height: 1.5;
}

/* ---------- CV tables ---------- */
.cv-table {
  width: 100%;
  border-collapse: collapse;
  margin-block: 1rem 1.5rem;
}
.cv-table th, .cv-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.7em 1em 0.7em 0;
  border-bottom: 1px solid var(--color-rule);
}
.cv-table th {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--hu-primary);
  white-space: nowrap;
  width: 11rem;
}
.cv-table tr:last-child td,
.cv-table tr:last-child th { border-bottom: 0; }

.award-list { padding-left: 1.25em; }
.award-list li { margin-bottom: 0.5em; }

/* ---------- Publications ---------- */
.book-section { margin-bottom: 2.5rem; }
.book-section h2 { margin-top: 0; }

.editions {
  display: grid;
  gap: 1.25rem;
  margin-top: 1rem;
}

.edition {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  padding: 1.25rem;
  background: var(--color-surface);
  border-left: 4px solid var(--color-rule);
}
@media (min-width: 36rem) {
  .edition { grid-template-columns: 9rem 1fr; }
}

.edition.featured { border-left-color: var(--hu-primary); }

.edition__cover {
  width: 100%;
  max-width: 9rem;
  aspect-ratio: 2 / 3;
  object-fit: contain;
  background: var(--hu-bg-2);
  padding: 0.25rem;
}
@media (prefers-color-scheme: dark) {
  .edition__cover { background: var(--color-bg); }
}

.edition__body h3 {
  margin: 0 0 0.4em;
  font-size: 1.1rem;
  font-family: var(--font-display);
}
.edition__body p { margin-bottom: 0.5em; }
.edition__meta {
  color: var(--color-muted);
  font-size: var(--fs-small);
  margin-bottom: 0.5em;
}
.edition.featured h3 { color: var(--hu-primary); }

/* Publication entries */
.pub-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}
.pub-list > li {
  border-left: 2px solid var(--color-rule);
  padding: 0.25em 0 0.5em 1em;
}
.pub-list > li:hover { border-left-color: var(--hu-primary); }

.pub-title { font-weight: 500; }
.pub-venue {
  color: var(--color-muted);
  font-style: italic;
  display: block;
  margin-top: 0.15em;
}
.pub-list p { margin: 0.3em 0 0; }
.pub-links { font-size: var(--fs-small); }
.pub-links a {
  display: inline-flex;
  align-items: center;
  padding: 0.4em 0.8em;
  min-height: 32px;
  background: var(--hu-bg-3);
  color: var(--hu-primary);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 500;
  margin-right: 0.3em;
  border-radius: 1px;
}
.pub-links a:hover {
  background: var(--hu-primary);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .pub-links a { background: #1a2331; color: var(--hu-primary-3); }
  .pub-links a:hover { background: var(--hu-primary-3); color: var(--color-bg); }
}

/* ---------- Print ---------- */
@media print {
  :root {
    --color-bg: #fff;
    --color-surface: #fff;
    --color-text: #000;
    --color-muted: #555;
    --color-rule: #999;
    --color-link: #000;
  }
  .site-header, .site-footer, .skip-link, .nav { display: none; }
  main { padding-block: 0; }
  a { color: #000 !important; text-decoration: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #555; }
  .pub-list > li { border-left: 0; padding-left: 0; }
  h2 { break-after: avoid; }
  .edition { break-inside: avoid; border: 0; padding: 0; }
}
