/* ============================================================
   Scheunencode – Designsystem v2
   Palette: Kalkputz / Eichenbalken / Ochsenblut / Stroh
   Fonts: bewusst nur Systemschriften (keine externen Requests,
   keine Google Fonts → schlanke Datenschutzerklärung)
   Dark Mode: „Scheune bei Nacht" via prefers-color-scheme
   ============================================================ */

:root {
  /* Flächen */
  --bg: #F4EEE2;             /* Kalkputz – Hintergrund */
  --bg-soft: #EAE1D0;        /* abgesetzte Flächen */
  --texture: rgba(42, 33, 24, 0.014);

  /* Struktur & Text */
  --structure: #2A2118;      /* Eichenbalken – Fachwerk, Headlines */
  --ink: #33291F;            /* Fließtext */
  --muted: #6E6250;          /* Nebentext (AA-konform) */
  --accent: #8C3B2E;         /* Ochsenblut – Links, Akzente */
  --straw: #C9A554;          /* Stroh – Markierungen */

  /* Karten */
  --card-bg: #FBF7EE;
  --card-border: #2A2118;
  --card-shadow: #E0D5BE;
  --gefach: rgba(42, 33, 24, 0.07);

  /* Dunkle Panels (Kontaktblock) */
  --panel-bg: #2A2118;
  --panel-text: #F4EEE2;
  --panel-link: #C9A554;
  --panel-link-hover: #FFFFFF;

  /* Chips */
  --tag-bg: #8C3B2E;
  --tag-text: #F4EEE2;
  --tag-wip-bg: #6E6250;
  --tag-wip-text: #F4EEE2;

  /* Hinweiskasten */
  --note-bg: #EAE1D0;
  --note-text: #5C5140;

  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas,
               "Liberation Mono", Menlo, monospace;
  --font-display: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;

  /* Illustrationen (Scheunen-Szene) */
  --illo-wall: #FBF7EE;
  --illo-beam: #2A2118;
  --illo-roof: #8C3B2E;
  --illo-hay: #C9A554;
  --illo-hay-deep: #A8853F;
  --illo-dark: #1D160F;
  --illo-glow: #F3E3B4;
  --illo-ground: #D9C58F;
  --illo-orb: #E9D9A8;

  --w: 42rem;                /* Textspaltenbreite */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #201A12;
    --bg-soft: #191309;
    --texture: rgba(244, 238, 226, 0.016);

    --structure: #E6DCC3;
    --ink: #E4DAC4;
    --muted: #B3A585;
    --accent: #D68F6F;
    --straw: #CFAB5E;

    --card-bg: #2A2318;
    --card-border: #8F7C52;
    --card-shadow: #120D06;
    --gefach: rgba(230, 220, 195, 0.08);

    --panel-bg: #120D06;
    --panel-text: #EFE6D0;
    --panel-link: #D9B876;
    --panel-link-hover: #FFFFFF;

    --tag-bg: #A34A38;
    --tag-text: #F7EFDC;
    --tag-wip-bg: #4A4032;
    --tag-wip-text: #E0D5BE;

    --note-bg: #241D12;
    --note-text: #C9BCA0;

    --illo-wall: #453B2B;
    --illo-beam: #140F08;
    --illo-roof: #5E2A20;
    --illo-hay: #C9A554;
    --illo-hay-deep: #8F7433;
    --illo-dark: #0D0904;
    --illo-glow: #FFD97A;
    --illo-ground: #3E3626;
    --illo-orb: #EFE6C8;

    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

body {
  margin: 0;
  background-color: var(--bg);
  /* feine Putz-Struktur: zwei kaum sichtbare Gewebe-Raster */
  background-image:
    repeating-linear-gradient(0deg, transparent 0 3px, var(--texture) 3px 4px),
    repeating-linear-gradient(90deg, transparent 0 3px, var(--texture) 3px 4px);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--straw);
  color: #2A2118;
}

/* --------- Fachwerk-Balkenband (Signatur-Element) --------- */
.fachwerk {
  display: block;
  width: 100%;
  height: auto;
  color: var(--structure);   /* SVGs zeichnen mit currentColor */
}
.fachwerk--slim { max-height: 34px; }

/* --------- Illustrations-Szene --------- */
.scene { margin: 0.5rem 0 0; }
.scene svg { display: block; width: 100%; height: auto; }
.i-wall  { fill: var(--illo-wall); }
.i-beam  { fill: var(--illo-beam); }
.i-beam-s { stroke: var(--illo-beam); }
.i-roof  { stroke: var(--illo-roof); }
.i-hay   { fill: var(--illo-hay); }
.i-hay-s { stroke: var(--illo-hay-deep); }
.i-dark  { fill: var(--illo-dark); }
.i-glow  { fill: var(--illo-glow); }
.i-ground { fill: var(--illo-ground); }
.i-orb   { fill: var(--illo-orb); }
.i-star  { fill: var(--illo-orb); opacity: 0; }
@media (prefers-color-scheme: dark) {
  .i-star { opacity: 0.9; }
}

/* Karten-Vignetten */
.card-art { float: right; width: 76px; height: 76px; margin: 0 0 0.5rem 0.9rem; }

/* --------- Grundgerüst --------- */
.shell {
  max-width: var(--w);
  margin: 0 auto;
  padding: 0 1.25rem;
}

header.site {
  padding-top: 3rem;
  padding-bottom: 1.25rem;
}

.topline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin: 0 0 0.85rem;
}
.topline .eyebrow { margin: 0; }
.lang {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.85rem;
}
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { color: var(--structure); text-decoration: underline; }

h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.1rem, 6.4vw, 3.15rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--structure);
  margin: 0 0 1.1rem;
  text-wrap: balance;
}
h1 em.hl {
  font-style: normal;
  text-decoration: underline;
  text-decoration-color: var(--straw);
  text-decoration-thickness: 0.14em;
  text-underline-offset: 0.12em;
  text-decoration-skip-ink: none;
}

h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--structure);
  margin: 2.5rem 0 0.75rem;
}

h3 {
  font-family: var(--font-body);
  font-weight: 650;
  font-size: 1.05rem;
  color: var(--structure);
  margin: 1.75rem 0 0.35rem;
}

p { margin: 0 0 1rem; }
.lede { font-size: 1.16rem; color: var(--ink); text-wrap: pretty; }
.muted { color: var(--muted); }
small, .small { font-size: 0.875rem; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-thickness 0.15s ease,
              text-underline-offset 0.15s ease;
}
a:hover {
  color: var(--structure);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--structure);
  outline-offset: 2px;
  border-radius: 2px;
}
.contact a:focus-visible { outline-color: var(--panel-link); }

/* --------- Abschnitte --------- */
.section { padding: 1.25rem 0 0.5rem; }

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 2.75rem 0 0.5rem;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  scroll-margin-top: 1rem;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 5px;
  background:
    linear-gradient(to bottom, var(--structure) 0 2px, transparent 2px 3px, var(--structure) 3px 5px);
  opacity: 0.85;
}

/* --------- App-/Projektkarten --------- */
.card {
  position: relative;
  border: 2px solid var(--card-border);
  background: var(--card-bg);
  padding: 1.15rem 1.25rem;
  margin: 0 0 1.15rem;
  box-shadow: 4px 4px 0 var(--card-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  overflow: hidden;
}
.card:hover {
  transform: translate(-3px, -3px);
  box-shadow: 8px 8px 0 var(--card-shadow);
}
.card h3 { margin-top: 0; }
.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tag-text);
  background: var(--tag-bg);
  padding: 0.15rem 0.5rem;
  display: inline-block;
  margin-left: 0.4rem;
  vertical-align: middle;
}
.tag--wip { background: var(--tag-wip-bg); color: var(--tag-wip-text); }
.app-head .tag { font-size: 0.95rem; vertical-align: 0.35em; }

/* --------- Kontaktblock --------- */
.contact {
  font-family: var(--font-mono);
  font-size: 1rem;
  background: var(--panel-bg);
  color: var(--panel-text);
  padding: 1.1rem 1.2rem;
  margin: 0.5rem 0 1rem;
  box-shadow: 4px 4px 0 var(--card-shadow);
}
.contact a { color: var(--panel-link); }
.contact a:hover { color: var(--panel-link-hover); }

/* --------- Rechtstexte --------- */
.legal h2 { font-size: 1.25rem; margin-top: 2.25rem; }
.legal p, .legal li { font-size: 0.98rem; }
.legal ul { padding-left: 1.2rem; }
.note {
  border-left: 4px solid var(--straw);
  background: var(--note-bg);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: var(--note-text);
  margin: 1.25rem 0;
}

/* --------- Footer --------- */
footer.site {
  margin-top: 3.5rem;
  padding: 1.5rem 0 2.5rem;
  border-top: 2px solid var(--structure);
}
footer.site .shell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  align-items: baseline;
}
footer.site nav a {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-right: 1.25rem;
}
.barn-unit {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.7;
}

/* --------- Karten als Links --------- */
a.card {
  display: block;
  color: inherit;
  text-decoration: none;
}
a.card:hover { color: inherit; }
a.card:focus-visible { outline: 3px solid var(--structure); outline-offset: 3px; }
.card-more {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  margin-top: 0.2rem;
  transition: transform 0.18s ease;
}
a.card:hover .card-more { transform: translateX(4px); }
.card-art { transition: transform 0.22s ease; }
a.card:hover .card-art { transform: rotate(-3deg) scale(1.05); }

/* --------- Buttons (mailto-CTAs) --------- */
.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  background: var(--accent);
  color: #F4EEE2;
  padding: 0.65rem 1rem;
  margin: 0.25rem 0.5rem 0.25rem 0;
  text-decoration: none;
  border: 2px solid var(--accent);
  box-shadow: 3px 3px 0 var(--card-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover {
  color: #FFFFFF;
  background: var(--structure);
  border-color: var(--structure);
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--card-shadow);
}
.btn--ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn--ghost:hover { background: var(--accent); color: #F4EEE2; }

/* --------- App-Seiten --------- */
.app-head { display: flex; align-items: center; gap: 1.25rem; margin: 0.25rem 0 0.75rem; }
.app-head .card-art { float: none; width: 96px; height: 96px; margin: 0; flex-shrink: 0; }
.app-head h1 { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 0.75rem 0 1rem; list-style: none; }
.chips li {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  border: 2px solid var(--structure);
  color: var(--structure);
  background: var(--card-bg);
  padding: 0.3rem 0.7rem;
  box-shadow: 2px 2px 0 var(--card-shadow);
}
.feature-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.feature-list li {
  padding: 0.35rem 0 0.35rem 1.7rem;
  position: relative;
}
.feature-list li::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 0.85em;
  width: 0.8rem;
  height: 0.32rem;
  background: var(--straw);
  transform: rotate(-45deg);
}

/* --------- Animationen (nur Bildschirm, nur ohne Reduced Motion) --------- */
@media screen and (prefers-reduced-motion: no-preference) {
  @keyframes rise {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @keyframes draw {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
  }
  @keyframes drift {
    from { transform: translateY(0); }
    to   { transform: translateY(9px); }
  }
  @keyframes sway {
    from { transform: rotate(-4deg); }
    to   { transform: rotate(4deg); }
  }
  @keyframes twinkle {
    0%, 100% { opacity: 0.9; }
    50%      { opacity: 0.25; }
  }
  @keyframes flicker {
    0%, 100% { opacity: 1; }
    47%      { opacity: 0.85; }
    52%      { opacity: 0.96; }
    70%      { opacity: 0.88; }
  }

  header.site .topline { animation: rise 0.5s ease-out both; }
  header.site h1       { animation: rise 0.55s ease-out 0.08s both; }
  header.site .lede    { animation: rise 0.6s ease-out 0.16s both; }
  .scene               { animation: rise 0.7s ease-out 0.22s both; }
  .section .card:nth-of-type(1) { animation: rise 0.5s ease-out 0.1s both; }
  .section .card:nth-of-type(2) { animation: rise 0.5s ease-out 0.2s both; }
  .section .card:nth-of-type(3) { animation: rise 0.5s ease-out 0.3s both; }
  .divider::before { transform-origin: left center;  animation: draw 0.8s ease-out 0.15s both; }
  .divider::after  { transform-origin: right center; animation: draw 0.8s ease-out 0.15s both; }

  .i-orb { animation: drift 11s ease-in-out infinite alternate; }
  .i-star { animation: twinkle 4s ease-in-out infinite; }
  .i-star:nth-of-type(2n) { animation-delay: 1.3s; }
  .i-star:nth-of-type(3n) { animation-delay: 2.4s; animation-duration: 5s; }
  .i-glow { animation: flicker 7s linear infinite; }
  .scene .i-hay-s path {
    transform-box: fill-box;
    transform-origin: 50% 100%;
    animation: sway 3.6s ease-in-out infinite alternate;
  }
  .scene .i-hay-s path:nth-of-type(2) { animation-delay: 0.9s; }
  .scene .i-hay-s path:nth-of-type(3) { animation-delay: 1.7s; }
}

/* --------- Mobil --------- */
@media (max-width: 480px) {
  body { font-size: 1rem; }
  header.site { padding-top: 2.25rem; }
  .card { box-shadow: 3px 3px 0 var(--card-shadow); }
  .card:hover { transform: none; box-shadow: 3px 3px 0 var(--card-shadow); }
}

/* --------- Druck --------- */
@media print {
  * { animation: none !important; transition: none !important; }
  body { background: #fff; color: #000; }
  .fachwerk { display: none; }
  a { color: #000; }
  .card, .contact { box-shadow: none; }
  .contact { background: #fff; color: #000; border: 2px solid #000; }
  .contact a { color: #000; }
}
