/* ---------- Tokens ---------- */

:root {
  color-scheme: light dark;

  --bg: #fbfaf8;
  --text: #1b1b19;
  --muted: #66635d;
  --border: #e5e2db;
  --accent: #1f6f54;
  --tag-bg: #f1efea;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --page-width: 52rem;
  --label-col: 10rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121311;
    --text: #ecebe6;
    --muted: #9d9b94;
    --border: #2b2c29;
    --accent: #7dd3ae;
    --tag-bg: #1f201e;
  }
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

a {
  color: inherit;
}

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

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

.nowrap {
  white-space: nowrap;
}

/* ---------- Language switch ----------
   Every translated element carries its own lang attribute;
   only the ones matching <html lang> are shown. */

:root[lang="de"] [lang="en"],
:root[lang="en"] [lang="de"] {
  display: none;
}

.no-js .lang-switch {
  display: none;
}

/* ---------- Layout ---------- */

.page {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 1;
  padding: 0.5rem 1rem;
  background: var(--text);
  color: var(--bg);
  border-radius: 0.375rem;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

/* ---------- Header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0;
}

.site-nav {
  min-width: 0;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  color: var(--muted);
  font-size: 0.9375rem;
  text-decoration: none;
  transition: color 0.15s;
}

.site-nav a:hover {
  color: var(--text);
}

.lang-switch {
  display: inline-flex;
  flex: none;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.lang-switch button {
  padding: 0.4rem 0.75rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  line-height: 1.4;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}

.lang-switch button:hover {
  color: var(--text);
}

.lang-switch button[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
}

/* Narrow phones: tighten the header so the navigation stays on one line. */
@media (max-width: 26rem) {
  .site-header {
    gap: 0.75rem;
  }

  .site-nav ul {
    column-gap: 0.75rem;
  }

  .site-nav a {
    font-size: 0.875rem;
  }

  .lang-switch button {
    padding: 0.4rem 0.6rem;
  }
}

/* ---------- Hero ---------- */

.hero {
  padding: clamp(3rem, 10vw, 6.5rem) 0 clamp(3rem, 8vw, 5rem);
}

.hero h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(2.75rem, 9vw, 4.5rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.hero p {
  max-width: 38rem;
  margin: 0 0 1rem;
  color: var(--muted);
}

.hero .lead {
  color: var(--text);
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s;
}

.link-pill:hover {
  border-color: var(--text);
}

.link-pill svg {
  flex: none;
  width: 1.1rem;
  height: 1.1rem;
}

/* ---------- Sections ---------- */

.section {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: 1rem;
}

.section h2 {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (min-width: 46rem) {
  .section {
    display: grid;
    grid-template-columns: var(--label-col) minmax(0, 1fr);
    column-gap: 2rem;
    padding: 4rem 0;
  }

  .section h2 {
    margin: 0;
    padding-top: 0.3rem;
  }
}

.arrow {
  display: inline-block;
  margin-left: 0.3rem;
  color: var(--muted);
  transition: transform 0.15s, color 0.15s;
}

a:hover .arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

/* ---------- Projects ---------- */

.projects {
  display: grid;
  gap: 2.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project h3 {
  margin: 0 0 0.4rem;
  font-size: 1.1875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.project h3 a {
  text-decoration: none;
  transition: color 0.15s;
}

.project h3 a:hover {
  color: var(--accent);
}

.project p {
  max-width: 38rem;
  margin: 0 0 0.85rem;
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 0.2rem 0.55rem;
  border-radius: 0.375rem;
  background: var(--tag-bg);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.tags--lg li {
  padding: 0.3rem 0.7rem;
  color: var(--text);
  font-size: 0.8125rem;
}

/* ---------- Skills ---------- */

.skills {
  display: grid;
  gap: 1.75rem;
  margin: 0;
}

.skills dt {
  margin-bottom: 0.6rem;
  font-weight: 600;
}

.skills dd {
  margin: 0;
}

/* ---------- Contact ---------- */

.contact p {
  max-width: 34rem;
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.contact .email {
  color: var(--text);
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
  overflow-wrap: anywhere;
  transition: color 0.15s, text-decoration-color 0.15s;
}

.contact .email:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact-links a {
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
}

.contact-links a:hover {
  color: var(--accent);
}

/* ---------- Legal pages ---------- */

.legal {
  max-width: 40rem;
  padding: clamp(2rem, 8vw, 4rem) 0 clamp(3rem, 8vw, 5rem);
}

.legal h1 {
  margin: 0 0 2rem;
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.legal h2 {
  margin: 2.5rem 0 0.6rem;
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.legal p,
.legal ul,
.legal address {
  margin: 0 0 1rem;
  color: var(--muted);
}

.legal address {
  font-style: normal;
}

.legal ul {
  padding-left: 1.25rem;
}

.legal a {
  color: var(--text);
  text-decoration-color: var(--border);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
  transition: color 0.15s, text-decoration-color 0.15s;
}

.legal a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.legal .legal-date {
  margin-top: 2.5rem;
  font-size: 0.875rem;
}

/* Unfilled placeholder: meant to be impossible to overlook before publishing. */
.todo {
  padding: 0.05em 0.35em;
  border-radius: 0.25rem;
  background: #ffd84d;
  color: #1b1b19;
}

/* ---------- CV ---------- */

.cv-head {
  padding: clamp(2rem, 8vw, 4rem) 0 clamp(2.5rem, 7vw, 4rem);
}

.cv-head h1 {
  margin: 0;
  font-size: clamp(2.5rem, 8vw, 3.75rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.cv-kicker {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.65;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cv-role {
  margin: 0.5rem 0 0;
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.cv-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 1.5rem 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.9375rem;
  list-style: none;
}

.cv-contact a {
  text-decoration-color: var(--border);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
  transition: color 0.15s, text-decoration-color 0.15s;
}

.cv-contact a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.cv-download {
  margin: 2rem 0 0;
}

.cv-entries {
  display: grid;
  gap: 2.25rem;
}

.cv-entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 1.5rem;
}

.cv-entry h3 {
  margin: 0;
  font-size: 1.1875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.cv-date {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  white-space: nowrap;
}

.cv-org {
  margin: 0.15rem 0 0.6rem;
  font-weight: 500;
}

.cv-entry ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.cv-entry li + li {
  margin-top: 0.2rem;
}

.cv-entry cite {
  font-style: italic;
}

/* ---------- Footer ---------- */

.site-footer {
  display: flex;
  align-items: baseline;
  justify-content: center;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}

.footer-links {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Separator dots; the empty alternative text keeps screen readers from announcing them. */
.footer-links li::before {
  margin: 0 0.6rem;
  content: "·";
  content: "·" / "";
}

/* Too narrow for one line: copyright above, links below, both centred. */
@media (max-width: 40rem) {
  .site-footer {
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
  }

  .footer-links li:first-child::before {
    content: none;
  }

  /* Only the arrow stays visible; the label remains for screen readers. */
  .footer-top {
    display: inline-block;
  }

  .footer-top-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

.site-footer a[aria-current="page"] {
  color: var(--text);
}

.site-footer a {
  text-decoration: none;
  transition: color 0.15s;
}

.site-footer a:hover {
  color: var(--text);
}

/* ---------- Print ----------
   Used to produce the CV PDFs in downloads/. The font stack sticks to
   metric-compatible fonts so the page breaks the same way on every system. */

@page {
  size: A4;
  margin: 15mm 18mm;
}

@media print {
  :root {
    color-scheme: light;
    --bg: #ffffff;
    --text: #111111;
    --muted: #444444;
    --border: #cfcfcf;
    --accent: #1f6f54;
    --font-sans: Arial, Helvetica, "Liberation Sans", sans-serif;
  }

  body {
    font-size: 9.5pt;
    line-height: 1.4;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  .skip-link,
  .site-header,
  .site-footer,
  .cv-download {
    display: none;
  }

  a {
    text-decoration: none;
  }

  .cv-head {
    padding: 0 0 5mm;
  }

  .cv-head h1 {
    font-size: 24pt;
    letter-spacing: -0.02em;
  }

  .cv-kicker {
    margin-bottom: 1.5mm;
    font-family: var(--font-sans);
    font-size: 8pt;
  }

  .cv-role {
    margin-top: 1mm;
    font-size: 12pt;
  }

  .cv-contact {
    gap: 0 5mm;
    margin-top: 3mm;
    font-size: 9pt;
  }

  .section {
    display: grid;
    grid-template-columns: 32mm minmax(0, 1fr);
    column-gap: 6mm;
    padding: 4.5mm 0;
  }

  .section h2 {
    margin: 0;
    padding-top: 0.6mm;
    font-family: var(--font-sans);
    font-size: 8pt;
    font-weight: 700;
    line-height: 1.4;
  }

  .cv-entries {
    gap: 3.5mm;
  }

  .cv-entry,
  .skills > div {
    break-inside: avoid;
  }

  .cv-entry h3 {
    font-size: 10.5pt;
    letter-spacing: 0;
  }

  .cv-date {
    font-family: var(--font-sans);
    font-size: 9pt;
  }

  .cv-org {
    margin: 0 0 0.8mm;
  }

  .cv-entry ul {
    padding-left: 4mm;
  }

  .cv-entry li + li {
    margin-top: 0;
  }

  .skills {
    gap: 1.5mm;
  }

  .skills > div {
    display: grid;
    grid-template-columns: 44mm minmax(0, 1fr);
    column-gap: 4mm;
  }

  .skills dt {
    margin: 0;
  }

  /* Tags become a plain comma-separated line. */
  .tags {
    display: block;
  }

  .tags li,
  .tags--lg li {
    display: inline;
    padding: 0;
    background: none;
    color: var(--muted);
    font-family: var(--font-sans);
    font-size: inherit;
  }

  .tags li:not(:last-child)::after {
    content: ", ";
  }

  /* :last-child cannot tell the languages apart, so end each language's run explicitly. */
  .tags li[lang="de"]:has(+ li[lang="en"])::after {
    content: none;
  }
}
