/* ---------------------------------------------------------------------------
   dobuch.de — one stylesheet for the landing page, the CV and the odd pages.
   No framework, no build step beyond asset fingerprinting, one small script.

   Two palettes, one per theme — see the token block below. Light is
   colorhunt.co/palette/8b9a6ef7f2ebeae2d6eeeeee (olive on warm cream), dark
   keeps the sage set it started with.
--------------------------------------------------------------------------- */

@font-face {
  font-family: "Rubik";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/rubik-latin.99ec7ccb.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- tokens ------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  /* Light palette: colorhunt.co/palette/8b9a6ef7f2ebeae2d6eeeeee
       #8B9A6E olive   #F7F2EB cream   #EAE2D6 sand   #EEEEEE paper

     Sand is the ground and cream the raised surface — the palette's own two
     warm tones, in the order that makes cards read as lifted. That is a 1.15:1
     value step, so a card no longer depends on hue alone to separate from the
     page. #EEEEEE is deliberately unused: a flat grey with no hue at all, sat
     next to a distinctly warm cream, put a temperature seam down the page.

     Chips, the icon tiles and the hero wash are tinted toward the olive rather
     than the sand, which is what gives the accent any presence — it is the
     only chromatic colour here, and confined to a button it read as garnish.

     Ink is derived: none of the four swatches can carry body text. */
  --accent: #8b9a6e;
  --accent-hover: #7b8a5f;
  --on-accent: #1e2216;

  --bg: #eae2d6;
  --bg-veil: rgba(234, 226, 214, 0.82);
  --surface: #f7f2eb;
  --surface-hover: #f1ece0;
  --wash: #dfe6cd;

  --chip-bg: #e5ead6;
  --chip-border: #cfd9ba;

  --text: #23241f;
  --text-muted: #494a3f;
  --text-faint: #5f6154;

  --brand: #55613c;
  --brand-strong: #414c2d;

  --border: #d8cfbe;
  --border-strong: #c4b9a3;
  --rail: #cdd4bb;
  --ring: rgba(139, 154, 110, 0.4);

  --shadow-sm: 0 1px 2px rgba(45, 42, 30, 0.07);
  --shadow-md: 0 10px 30px -12px rgba(45, 42, 30, 0.28);

  --measure: 60ch;
  --gutter: clamp(1.25rem, 5vw, 2rem);
  --wrap: 62rem;
  --radius: 14px;
  --radius-sm: 10px;

  --i-sun: none;
  --i-moon: block;
}

/* The dark palette, twice on purpose: once for the OS preference, once for an
   explicit choice from the header toggle. A media query and a selector cannot
   be combined into one rule, and duplicating the tokens beats a build step.

   Its accents sit on the same olive hue as light (~78 deg). They used to be
   sage at 99-115 deg, which meant the brand colour changed hue when you
   flipped the theme. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --accent: #9aa877;
    --accent-hover: #b3c093;
    --on-accent: #14170f;

    --bg: #14170f;
    --bg-veil: rgba(20, 23, 15, 0.82);
    --surface: #1e2318;
    --surface-hover: #262d1e;
    --wash: #232d1a;

    --chip-bg: #242c1b;
    --chip-border: #3a442c;

    --text: #f1f1ea;
    --text-muted: #c9cdb9;
    --text-faint: #949886;

    --brand: #b9c795;
    --brand-strong: #d3dcb8;

    --border: #30371f;
    --border-strong: #414a2d;
    --rail: #3a4429;
    --ring: rgba(154, 168, 119, 0.3);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 30px -12px rgba(0, 0, 0, 0.6);

    --i-sun: block;
    --i-moon: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --accent: #9aa877;
  --accent-hover: #b3c093;
  --on-accent: #14170f;

  --bg: #14170f;
  --bg-veil: rgba(20, 23, 15, 0.82);
  --surface: #1e2318;
  --surface-hover: #262d1e;
  --wash: #232d1a;

  --chip-bg: #242c1b;
  --chip-border: #3a442c;

  --text: #f1f1ea;
  --text-muted: #c9cdb9;
  --text-faint: #949886;

  --brand: #b9c795;
  --brand-strong: #d3dcb8;

  --border: #30371f;
  --border-strong: #414a2d;
  --rail: #3a4429;
  --ring: rgba(154, 168, 119, 0.3);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px -12px rgba(0, 0, 0, 0.6);

  --i-sun: block;
  --i-moon: none;
}

:root[data-theme="light"] {
  color-scheme: light;
}

/* --- base --------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 0;
  font-weight: 600;
}

p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
}

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--brand-strong);
}

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

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

::selection {
  background: var(--ring);
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--text);
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  z-index: 100;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
}

/* --- header ------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-veil);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
}

.site-header > .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
  flex-wrap: wrap;
}

.wordmark {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.wordmark .dot {
  color: var(--accent);
}

.header-right {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 3vw, 1.5rem);
  flex-wrap: wrap;
}

.theme-toggle {
  width: 2.125rem;
  height: 2.125rem;
  flex: none;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--brand);
}

.theme-toggle svg {
  width: 1.0625rem;
  height: 1.0625rem;
}

.theme-toggle .i-sun {
  display: var(--i-sun);
}

.theme-toggle .i-moon {
  display: var(--i-moon);
}

.site-nav {
  display: flex;
  gap: clamp(0.75rem, 3vw, 1.75rem);
  font-size: 0.9375rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.site-nav a:hover,
.site-nav a[aria-current] {
  color: var(--brand);
}

/* --- sections ----------------------------------------------------------- */

section {
  padding-block: clamp(3.5rem, 9vw, 5.5rem);
}

section + section {
  border-top: 1px solid var(--border);
}

.section-title {
  font-size: clamp(1.5rem, 3.5vw, 1.875rem);
  margin-bottom: 0.5rem;
}

.section-lead {
  color: var(--text-faint);
  max-width: var(--measure);
  margin-bottom: 2.5rem;
}

/* --- hero --------------------------------------------------------------- */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  text-align: center;
  padding-block: clamp(3.5rem, 11vw, 6.5rem);
}

.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -60% -20% auto -20%;
  height: 150%;
  background: radial-gradient(50% 50% at 50% 50%, var(--wash), transparent 70%);
  pointer-events: none;
}

.hero-portrait {
  width: clamp(6rem, 17vw, 8.5rem);
  height: clamp(6rem, 17vw, 8.5rem);
  margin: 0 auto 2rem;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  background: var(--surface-hover);
  box-shadow: 0 0 0 6px var(--ring), var(--shadow-md);
}

.hero h1 {
  font-size: clamp(2.25rem, 8vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
  background: linear-gradient(100deg, var(--text) 30%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

@supports not ((background-clip: text) or (-webkit-background-clip: text)) {
  .hero h1 {
    color: var(--text);
    -webkit-text-fill-color: currentColor;
  }
}

.hero .role {
  font-size: clamp(1.0625rem, 2.5vw, 1.1875rem);
  color: var(--brand);
  font-weight: 500;
  margin-bottom: 1rem;
}

.hero .tagline {
  color: var(--text-muted);
  max-width: 44ch;
  margin-inline: auto;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 2.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, border-color 0.15s ease,
    transform 0.15s ease;
}

.btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
}

.btn svg {
  width: 1.0625rem;
  height: 1.0625rem;
  flex: none;
}

/* --- prose and tags ----------------------------------------------------- */

.prose {
  max-width: var(--measure);
  color: var(--text-muted);
  display: grid;
  gap: 1.125rem;
}

.prose strong {
  color: var(--text);
  font-weight: 500;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  list-style: none;
}

.tags li {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-muted);
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  padding: 0.1875rem 0.6875rem;
}

.prose + .tags {
  margin-top: 2rem;
}

.skill-groups {
  display: grid;
  gap: 1.75rem 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
}

.skill-group h3,
.subhead {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--text-faint);
  margin-bottom: 0.75rem;
}

/* --- cards -------------------------------------------------------------- */

.cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    transform 0.15s ease;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: inherit;
}

.card .icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  display: grid;
  place-items: center;
  margin-bottom: 0.25rem;
}

.card .icon svg {
  width: 1.125rem;
  height: 1.125rem;
  color: var(--brand);
}

.card h3 {
  font-size: 1.0625rem;
  color: var(--text);
}

.card h3 .sub {
  color: var(--text-faint);
  font-weight: 400;
}

.card p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.card .go {
  margin-top: auto;
  padding-top: 0.875rem;
  font-size: 0.8125rem;
  color: var(--brand);
  font-weight: 500;
}

.card .go::after {
  content: " \2192";
}

/* --- contact ------------------------------------------------------------ */

.contact-list {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  list-style: none;
}

.contact-list li {
  display: flex;
}

.contact-list a {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9375rem;
  word-break: break-word;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.contact-list a:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.contact-list svg {
  width: 1.125rem;
  height: 1.125rem;
  color: var(--brand);
  flex: none;
}

/* --- footer ------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem;
  font-size: 0.875rem;
  color: var(--text-faint);
}

.site-footer > .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
}

.site-footer a {
  color: var(--text-faint);
  text-decoration: none;
}

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

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

.cv {
  padding-block: clamp(2.5rem, 7vw, 3.5rem);
}

.cv-head {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.75rem;
}

.cv-head h1 {
  font-size: clamp(1.875rem, 6vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.cv-head .role {
  color: var(--brand);
  font-weight: 500;
  margin-top: 0.125rem;
}

.cv-head .where {
  color: var(--text-faint);
  font-size: 0.9375rem;
  margin-bottom: 1.125rem;
}

.cv-portrait {
  width: clamp(7rem, 20vw, 9.5rem);
  height: clamp(7rem, 20vw, 9.5rem);
  object-fit: cover;
  object-position: center top;
  border-radius: var(--radius);
  background: var(--surface-hover);
  box-shadow: var(--shadow-md);
}

.cv-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
}

.cv-contact a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3125rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.cv-contact a:hover {
  border-color: var(--accent);
  color: var(--brand);
}

.cv-contact svg {
  width: 0.9375rem;
  height: 0.9375rem;
  color: var(--accent);
  flex: none;
}

.cv section {
  padding-block: 0;
  margin-bottom: 2.75rem;
  border-top: none;
}

.cv section:last-of-type {
  margin-bottom: 0;
}

.cv h2 {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--brand);
  padding-bottom: 0.625rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.cv-intro {
  color: var(--text-muted);
  max-width: 68ch;
}

/* Timeline: one rail down the left, a dot per entry. */
.timeline {
  list-style: none;
}

.tl-item {
  position: relative;
  padding-left: 1.75rem;
  padding-bottom: 1.75rem;
  border-left: 1px solid var(--rail);
  break-inside: avoid;
}

.tl-item:last-child {
  padding-bottom: 0;
  border-left-color: transparent;
}

.tl-item::before {
  content: "";
  position: absolute;
  left: -0.3125rem;
  top: 0.5rem;
  width: 0.5625rem;
  height: 0.5625rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
}

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

.tl-head h3 {
  font-size: 1.0625rem;
}

.tl-head h3 .sub {
  color: var(--text-muted);
  font-weight: 400;
}

.tl-when {
  font-size: 0.8125rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tl-org {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-bottom: 0.625rem;
}

.tl-item ul {
  list-style: none;
  display: grid;
  gap: 0.375rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.tl-item ul li {
  position: relative;
  padding-left: 0.9375rem;
}

.tl-item ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6875rem;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.tl-note {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.tl-note a {
  text-decoration-color: var(--accent);
}

/* --- legal / error pages ------------------------------------------------ */

.doc {
  max-width: var(--measure);
  color: var(--text-muted);
  padding-block: clamp(2.5rem, 7vw, 4rem);
}

.doc h1 {
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  color: var(--text);
  margin-bottom: 2rem;
}

.doc h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--text-faint);
  margin-top: 2.25rem;
  margin-bottom: 0.5rem;
}

.doc p {
  margin-bottom: 0.75rem;
}

.doc address {
  font-style: normal;
}

.notfound {
  min-height: 60vh;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 1rem;
  padding-block: 4rem;
}

.notfound .code {
  font-size: clamp(3rem, 14vw, 5rem);
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
}

.notfound p {
  color: var(--text-muted);
  max-width: 40ch;
  margin-inline: auto;
}

/* --- motion ------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- print (the CV is the page people print) ---------------------------- */

@page {
  /* Chrome defaults to a one inch margin, which costs a whole page. */
  margin: 14mm 15mm;
}

/* --- print (the CV is the page people print) ---------------------------- */

@media print {
  /* prefers-color-scheme still matches when printing from a dark desktop, so
     the palette is reset here rather than patched colour by colour. */
  :root,
  :root[data-theme] {
    --bg: #fff;
    --bg-veil: #fff;
    --surface: #fff;
    --surface-hover: #fff;
    --wash: transparent;
    --chip-bg: #fff;
    --chip-border: #bbb;
    --text: #000;
    --text-muted: #2b2b2b;
    --text-faint: #555;
    --brand: #000;
    --brand-strong: #000;
    --accent: #777;
    --accent-hover: #777;
    --on-accent: #fff;
    --border: #bbb;
    --border-strong: #bbb;
    --rail: #ccc;
    --ring: transparent;
    --shadow-sm: none;
    --shadow-md: none;
  }

  .site-header,
  .site-footer,
  .skip {
    display: none !important;
  }

  body {
    background: #fff;
    font-size: 10pt;
    line-height: 1.45;
  }

  .wrap {
    max-width: none;
    padding-inline: 0;
  }

  /* Screen rhythm is generous on purpose; paper is not. */
  .cv {
    padding-block: 0;
  }

  .cv-head {
    margin-bottom: 1.5rem;
  }

  .cv section {
    margin-bottom: 1.5rem;
  }

  .cv h2 {
    margin-bottom: 1rem;
    break-after: avoid;
  }

  .cv-portrait {
    width: 6.5rem;
    height: 6.5rem;
  }

  .tl-item {
    padding-bottom: 1rem;
  }

  .cards {
    gap: 0.75rem;
  }

  .card {
    padding: 1rem;
  }

  .skill-groups {
    gap: 1rem;
  }
}
