/* ==========================================================================
   rm-digitalisierung.de — Design: "Warmes Papier"
   Leinen/Terrakotta statt digitaler Nacht — ein Mensch macht das, kein
   Bot und keine Agentur. Handwerkliche Kanten statt Glow und Verlauf.
   ========================================================================== */

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "Work Sans";
  src: url("../fonts/work-sans.woff2") format("woff2");
  font-weight: 400 600;
  font-display: swap;
}

@property --grain-shift {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

:root {
  color-scheme: light dark;

  /* Anker-Farben */
  --c-paper: #f6f1e7;
  --c-paper-deep: #efe6d5;
  --c-ink: #241f1a;
  --c-espresso: #211a15;
  --c-espresso-surface: #2c231c;
  --c-rust: #c1552c;
  --c-rust-deep: #a5431f;
  --c-moss: #5c6b41;

  /* Abgeleitete Töne per color-mix() statt hart kodierter Zwischenfarben */
  --bg: light-dark(var(--c-paper), var(--c-espresso));
  --bg-surface: light-dark(var(--c-paper-deep), var(--c-espresso-surface));
  --text: light-dark(var(--c-ink), #efe7db);
  --text-dim: light-dark(color-mix(in oklch, var(--c-ink) 66%, transparent), color-mix(in oklch, #efe7db 66%, transparent));
  --border: light-dark(color-mix(in oklch, var(--c-ink) 78%, transparent), color-mix(in oklch, #efe7db 30%, transparent));
  --accent: light-dark(var(--c-rust), color-mix(in oklch, var(--c-rust) 80%, white 20%));
  --accent-deep: light-dark(var(--c-rust-deep), var(--c-rust));
  --accent-ink: #fff7ee;
  --moss: light-dark(var(--c-moss), color-mix(in oklch, var(--c-moss) 75%, white 25%));

  --radius: 3px;
  --max-width: 1160px;
  --font-display: "Fraunces", ui-serif, Georgia, serif;
  --font-body: "Work Sans", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}

@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;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: clamp(1rem, 0.94rem + 0.3vw, 1.1rem);
  position: relative;
}

/* Dezentes Grain-Overlay über der gesamten Seite — bricht die
   "zu perfekte Figma-Export"-Optik, die KI-Designs oft haben. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3, .brand {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.eyebrow {
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
}

a { color: var(--accent); }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-inline: 1.5rem;
  container-type: inline-size;
}

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

header.site {
  position: sticky;
  top: 0;
  background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
  view-transition-name: site-header;
}

header.site .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 0.9rem;
}

.brand {
  font-size: 1.2rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.brand::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  background: var(--accent);
  transform: rotate(45deg);
}

nav.site {
  display: flex;
  gap: 1.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.skip-link {
  position: absolute;
  left: 1rem; top: -3rem;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 600;
  text-decoration: none;
  z-index: 1000;
  transition: top 0.2s ease;
}

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

@media (max-width: 560px) {
  header.site .container { flex-wrap: wrap; row-gap: 0.5rem; }
  nav.site { gap: 1rem 1.1rem; font-size: 0.85rem; width: 100%; justify-content: flex-start; }
}

nav.site a {
  color: var(--text-dim);
  text-decoration: none;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.92rem;
  position: relative;
}

nav.site a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: -0.3rem;
  height: 2px;
  background: var(--accent);
  transition: right 0.25s ease;
}

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

/* ---------- Hero (Split-Screen mit Portraitfläche) ---------- */

.hero { position: relative; overflow: clip; }

.hero .container {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  align-items: center;
  gap: clamp(2rem, 5vw, 3.5rem);
  padding-block: clamp(3.5rem, 8vw, 6rem);
}

@container (max-width: 720px) {
  .hero .container { grid-template-columns: 1fr; }
}

.hero h1 {
  font-size: clamp(2.1rem, 1.5rem + 3vw, 3.5rem);
  line-height: 1.1;
  margin: 0.7rem 0 1.2rem;
}

.hero p.lead {
  color: var(--text-dim);
  font-size: 1.15rem;
  max-width: 46ch;
  margin: 0 0 2rem;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 1rem; }

/* Sticker-Buttons: harte Kante, Versatz-Schatten statt Glow/Pill */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-body);
  font-weight: 600;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius);
  text-decoration: none;
  border: 2px solid var(--text);
  box-shadow: 4px 4px 0 0 var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 0 var(--text);
}

.btn:active {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 0 var(--text);
}

.btn.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--text);
  box-shadow: 4px 4px 0 0 color-mix(in oklch, var(--text) 35%, transparent);
}

.btn.secondary:hover {
  box-shadow: 6px 6px 0 0 color-mix(in oklch, var(--text) 35%, transparent);
}

/* Portraitfläche: schräg gerahmtes Foto (oder Platzhalter bis eins da ist) */
.hero-portrait {
  position: relative;
  aspect-ratio: 4 / 5;
  width: min(100%, 340px);
  margin-inline: auto;
  rotate: -2.5deg;
  background: var(--bg-surface);
  border: 2px solid var(--text);
  box-shadow: 8px 8px 0 0 var(--accent);
  padding: 0.6rem 0.6rem 2.4rem;
}

.hero-portrait img,
.hero-portrait .portrait-fallback {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--c-rust);
  background-image: linear-gradient(160deg, var(--c-rust) 0%, var(--c-espresso) 100%);
}

.hero-portrait figcaption {
  position: absolute;
  bottom: 0.6rem;
  left: 0.6rem;
  right: 0.6rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--text-dim);
  text-align: center;
}

/* ---------- Gerissene Papierkante als Sektionstrenner ---------- */

.torn-divider {
  display: block;
  width: 100%;
  height: clamp(18px, 3vw, 30px);
  color: var(--bg);
}

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

section:not(.hero) {
  padding-block: clamp(3rem, 6vw, 5rem);
}

.section-head { max-width: 60ch; margin-bottom: 2.5rem; }

section h2 {
  font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.3rem);
  margin: 0.4rem 0 0.6rem;
}

.section-lead { color: var(--text-dim); margin: 0; }

/* ---------- Leistungen: Bento-Grid ---------- */

.bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(180px, auto);
  gap: 1.1rem;
}

.bento .tile:nth-child(1) { grid-column: span 4; }
.bento .tile:nth-child(2) { grid-column: span 2; }
.bento .tile:nth-child(3) { grid-column: span 2; }

@container (max-width: 720px) {
  .bento { grid-template-columns: 1fr; }
  .bento .tile:nth-child(1),
  .bento .tile:nth-child(2),
  .bento .tile:nth-child(3) { grid-column: span 1; }
}

.tile {
  background: var(--bg-surface);
  border: 2px solid var(--text);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 2vw, 2.25rem);
  position: relative;
  box-shadow: 5px 5px 0 0 color-mix(in oklch, var(--text) 30%, transparent);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tile:has(:hover) {
  transform: translate(-3px, -3px);
  box-shadow: 8px 8px 0 0 color-mix(in oklch, var(--accent) 60%, var(--text) 20%);
}

.tile .eyebrow { display: block; margin-bottom: 0.6rem; }

.tile h3 {
  font-size: 1.35rem;
  margin: 0 0 0.7rem;
}

.tile p { color: var(--text-dim); margin: 0; }

.tile.tile-primary h3 { font-size: 1.7rem; }
.tile.tile-primary p { max-width: 46ch; }

/* ---------- Ablauf: verbundene Zeitleiste ---------- */

.timeline {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  gap: 0;
  counter-reset: step;
}

.timeline li {
  counter-increment: step;
  position: relative;
  padding: 0 0 2.2rem 3.2rem;
  border-left: 2px solid var(--border);
}

.timeline li:last-child { border-color: transparent; padding-bottom: 0; }

.timeline li::before {
  content: counter(step);
  position: absolute;
  left: -1.15rem; top: 0;
  width: 2.3rem; height: 2.3rem;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
}

.timeline h3 {
  font-size: 1.15rem;
  margin: 0 0 0.35rem;
}

.timeline p { color: var(--text-dim); margin: 0; max-width: 56ch; }

/* ---------- Über mich ---------- */

.about .container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

@container (max-width: 720px) {
  .about .container { grid-template-columns: 1fr; }
}

.about p { color: var(--text-dim); }
.about p:first-of-type { color: var(--text); font-size: 1.15rem; }

/* ---------- Kontakt ---------- */

.contact-box {
  background: var(--bg-surface);
  border: 2px solid var(--text);
  border-radius: var(--radius);
  box-shadow: 6px 6px 0 0 color-mix(in oklch, var(--text) 30%, transparent);
  padding: clamp(1.75rem, 4vw, 2.75rem);
  max-width: 640px;
}

.form-row { margin-bottom: 1.1rem; display: flex; flex-direction: column; gap: 0.4rem; }

.form-row label {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-dim);
}

.form-row input,
.form-row textarea {
  font: inherit;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  resize: vertical;
}

.form-row input:user-invalid,
.form-row textarea:user-invalid { border-color: #b23b2e; }

.form-row input:focus-visible,
.form-row textarea:focus-visible,
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.form-row.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

button.btn { border: 2px solid var(--text); cursor: pointer; font-size: 1rem; }

.form-note { font-size: 0.85rem; color: var(--text-dim); margin-top: 1rem; }

.form-status {
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
}

.form-status.ok { background: color-mix(in oklch, var(--moss) 25%, var(--bg-surface)); }
.form-status.error { background: color-mix(in oklch, #b23b2e 22%, var(--bg-surface)); }

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

footer.site {
  border-top: 1px solid var(--border);
  padding-block: 1.5rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

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

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

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

.legal main {
  padding-block: 3rem;
  max-width: 720px;
  margin: 0 auto;
}

.legal h1 { font-size: clamp(1.7rem, 1.3rem + 1vw, 2.2rem); }
.legal h2 { font-size: 1.2rem; margin-top: 2rem; font-family: var(--font-display); }
.legal p, .legal li { color: var(--text-dim); }

/* ---------- Scroll-driven Reveals ---------- */

@supports (animation-timeline: view()) {
  .reveal {
    animation: fade-up linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 25%;
  }
}

@keyframes fade-up {
  from { opacity: 0; translate: 0 1.5rem; }
  to { opacity: 1; translate: 0 0; }
}

/* ---------- View Transitions zwischen Seiten ---------- */

@media not (prefers-reduced-motion: reduce) {
  ::view-transition-old(root) { animation-duration: 0.25s; }
  ::view-transition-new(root) { animation-duration: 0.35s; }
}
