@layer reset, basis, komponenten, effekte;

@property --fill { syntax: "<percentage>"; inherits: false; initial-value: 0%; }

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
  body { margin: 0; }
  img, picture { display: block; max-width: 100%; }
  button { font: inherit; color: inherit; }
}

@layer basis {
  :root {
    --gruen: #a7c585;
    --gruen-hell: #eef4e6;
    --kohle: #12100d;
    --tinte: #1a1a1a;
    --creme: #f4f1e6;
    --glut: #ff7a2f;
    --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
    --sans: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --nav-h: 64px;
  }
  body { font-family: var(--sans); color: var(--tinte); background: var(--creme); line-height: 1.6; }
  a { color: inherit; }
  h1, h2, h3 { font-family: var(--serif); line-height: 1.15; text-wrap: balance; }
  h2 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0 0 .4em; letter-spacing: -.01em; }
  p { text-wrap: pretty; }
  section { padding-block: clamp(64px, 10vw, 120px); }
  :focus-visible { outline: 3px solid var(--glut); outline-offset: 3px; }
  .wrap { width: min(1160px, 100% - 40px); margin-inline: auto; }
  .lead { max-width: 52ch; font-size: 1.15rem; }
}

@layer komponenten {
  /* Navigation: liegt über dem Hero, wird beim Scrollen grün */
  .nav { position: fixed; inset: 0 0 auto 0; z-index: 20; height: var(--nav-h); color: var(--creme); }
  .nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 100%; gap: 16px; }
  .nav .marke { font-family: var(--serif); font-weight: 700; font-size: 1.5rem; text-decoration: none; letter-spacing: -.01em; }
  .nav ul { display: flex; align-items: center; gap: 24px; list-style: none; margin: 0; padding: 0; font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; }
  .nav ul a { text-decoration: none; }
  .nav ul a:not(.nav-cta):hover { text-decoration: underline; text-underline-offset: 5px; }
  .nav-cta { border: 1px solid currentColor; padding: 8px 16px; border-radius: 99px; }
  .nav-cta:hover { background: var(--creme); color: var(--kohle); }
  .nav-fest { position: static; background: var(--gruen); color: var(--tinte); }

  .btn { display: inline-block; background: var(--gruen); color: var(--kohle); padding: 15px 30px; text-decoration: none; letter-spacing: .16em; text-transform: uppercase; font-size: .8rem; font-weight: 600; border-radius: 99px; transition: transform .25s, background .25s; }
  .btn:hover { background: var(--creme); transform: translateY(-2px); }

  /* Hero */
  .hero { position: relative; min-height: 100svh; background: var(--kohle); color: var(--creme); display: grid; align-items: center; padding-block: calc(var(--nav-h) + 24px) 56px; overflow: clip; }
  .hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 50% at 78% 60%, color-mix(in srgb, var(--glut) 22%, transparent), transparent 70%); pointer-events: none; }
  .hero-grid { position: relative; display: grid; gap: 40px; align-items: center; grid-template-columns: 1fr; }
  .hero-text { display: grid; justify-items: start; gap: 8px; }
  .hero-logo { width: min(380px, 70%); height: auto; margin-left: -4px; }
  .hero-claim { font-family: var(--serif); font-size: clamp(1.6rem, 3.4vw, 2.4rem); max-width: 18ch; margin: 8px 0 10px; line-height: 1.15; }
  .hero-sub { margin: 0 0 22px; max-width: 34ch; opacity: .8; }
  .region { margin: 28px 0 0; font-size: 1.05rem; }
  .btn-rand { background: transparent; color: var(--creme); border: 1px solid color-mix(in srgb, var(--creme) 55%, transparent); }
  .btn-rand:hover { background: var(--creme); color: var(--kohle); }
  .hero-bild { position: relative; justify-self: center; width: min(420px, 82vw); }
  .bogen { aspect-ratio: 9 / 14; border-radius: 999px 999px 28px 28px; overflow: hidden; background: #2a241d; }
  .bogen img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 62%; scale: 1.12; }
  .siegel { position: absolute; width: 116px; height: 116px; left: -10px; bottom: 28px; color: var(--creme); background: var(--kohle); border-radius: 50%; padding: 6px; }
  .siegel .ring { transform-box: view-box; transform-origin: center; }
  .siegel text { font: 600 13.5px var(--sans); letter-spacing: .18em; fill: currentColor; }
  .siegel .flamme { fill: var(--glut); }
  .runter { position: absolute; left: 50%; bottom: 20px; translate: -50% 0; width: 26px; height: 42px; border: 2px solid color-mix(in srgb, var(--creme) 60%, transparent); border-radius: 99px; display: none; }
  .runter span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--creme); }

  /* Statement */
  .statement { background: var(--gruen); color: var(--tinte); }
  .statement p { font-family: var(--serif); font-size: clamp(1.7rem, 4.4vw, 3.3rem); line-height: 1.25; margin: 0; max-width: 28ch; text-wrap: balance; }

  /* Galerie */
  .galerie-sektion { background: var(--kohle); color: var(--creme); }
  .galerie-sektion h2 { color: var(--gruen); }
  .galerie { columns: 2; column-gap: 14px; margin-top: 40px; }
  .foto { position: relative; margin: 0 0 14px; break-inside: avoid; border-radius: 18px; overflow: hidden; background: #2a241d; aspect-ratio: var(--r); transition: opacity .35s, filter .35s; }
  .foto-btn { all: unset; display: block; width: 100%; height: 100%; cursor: zoom-in; }
  .foto-btn:focus-visible { outline: 3px solid var(--glut); outline-offset: -3px; }
  .foto picture, .foto img { width: 100%; height: 100%; }
  .foto img { object-fit: cover; scale: 1.14; transition: scale .6s cubic-bezier(.2,.7,.2,1); }
  .foto figcaption { position: absolute; inset: auto 0 0 0; padding: 40px 16px 14px; font-size: .85rem; letter-spacing: .04em; background: linear-gradient(transparent, rgb(0 0 0 / .7)); translate: 0 100%; transition: translate .35s; pointer-events: none; }
  @media (hover: hover) {
    .foto:hover img { scale: 1.22; }
    .foto:hover figcaption, .foto:focus-within figcaption { translate: 0 0; }
    .galerie:has(.foto:hover) .foto:not(:hover) { opacity: .45; filter: saturate(.6); }
  }
  @media (hover: none) { .foto figcaption { translate: 0 0; } }

  /* Angebot */
  .angebot { background: var(--creme); }
  .karten { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-top: 36px; }
  .karte { background: var(--gruen-hell); padding: 32px 28px; border-radius: 20px; }
  .karte .nummer { font-family: var(--serif); color: var(--glut); font-size: .95rem; letter-spacing: .1em; }
  .karte h3 { margin: 6px 0 10px; font-size: 1.5rem; }
  .karte p { margin: 0; }

  .referenzen { background: var(--kohle); color: var(--creme); }
  .referenzen h2 { color: var(--gruen); }
  .ref-karten { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 36px; }
  .ref { padding: 34px 30px; border: 1px solid color-mix(in srgb, var(--creme) 22%, transparent); border-radius: 20px; display: grid; gap: 12px; align-content: start; }
  .ref-label { font-size: .78rem; letter-spacing: .24em; text-transform: uppercase; color: var(--glut); font-weight: 600; }
  .ref h3 { margin: 0; font-size: 1.7rem; }
  .ref p { margin: 0; opacity: .88; }
  .ref-datum { margin-top: 8px; font-size: .9rem; opacity: .6; }
  .ref-cta { margin: 32px 0 0; font-size: 1.1rem; }
  .ref-cta a { color: var(--gruen); text-underline-offset: 4px; }

  .ablauf { background: var(--gruen-hell); }
  .ablauf-grid { display: grid; gap: 40px; }
  .ablauf-kopf .btn-dunkel { background: var(--kohle); color: var(--creme); margin-top: 8px; }
  .ablauf-kopf .btn-dunkel:hover { background: var(--glut); color: var(--kohle); }
  .zeitstrahl { --punkt: 44px; list-style: none; margin: 0; padding: 0; position: relative; display: grid; gap: 20px; }
  .zeitstrahl::before, .zeitstrahl::after { content: ""; position: absolute; left: calc(var(--punkt) / 2 - 1px); top: calc(var(--punkt) / 2); bottom: calc(var(--punkt) / 2); width: 2px; }
  .zeitstrahl::before { background: rgb(0 0 0 / .14); }
  .zeitstrahl::after { background: var(--glut); transform-origin: top; }
  .zeitstrahl li { position: relative; margin-left: calc(var(--punkt) + 24px); padding: 24px 26px; background: var(--creme); border-radius: 18px; }
  .zeitstrahl h3 { margin: 0 0 6px; font-size: 1.35rem; }
  .zeitstrahl p { margin: 0; }
  .punkt { position: absolute; left: calc(-1 * (var(--punkt) + 24px)); top: 20px; width: var(--punkt); height: var(--punkt); border-radius: 50%; display: grid; place-items: center; font-family: var(--sans); font-variant-numeric: lining-nums; font-size: 1.15rem; font-weight: 700; background: var(--glut); color: var(--kohle); box-shadow: 0 0 0 6px var(--gruen-hell); }

  .band { background: var(--kohle); color: var(--creme); }
  .band h2 { color: var(--gruen); }
  .kontakt-zeile { display: flex; flex-wrap: wrap; gap: 32px; margin-top: 28px; align-items: center; }
  .kontakt-zeile address { font-style: normal; }

  footer { padding: 28px 0; font-size: .85rem; background: var(--gruen); color: var(--tinte); }
  footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
  footer nav { display: flex; gap: 20px; }

  .text-seite { padding: 56px 0 80px; max-width: 70ch; }
  .text-seite h1 { font-size: 2.2rem; }
  .text-seite h2 { font-size: 1.35rem; margin-top: 2em; }

  /* Funkenflug (funken.js) */
  .funken { position: fixed; inset: 0; width: 100vw; height: 100dvh; z-index: 5; pointer-events: none; opacity: 0; transition: opacity 1.2s ease; }
  .funken.an { opacity: 1; }

  /* Lightbox */
  #lightbox { border: 0; padding: 0; background: transparent; color: var(--creme); width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; }
  #lightbox::backdrop { background: rgb(8 7 5 / .94); backdrop-filter: blur(10px); }
  #lightbox[open] { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; }
  #lightbox form { display: contents; }
  #lightbox figure { margin: 0; display: grid; gap: 12px; justify-items: center; max-height: 100dvh; padding-block: 16px; }
  #lb-bild { max-width: 100%; max-height: calc(100dvh - 90px); width: auto; height: auto; border-radius: 14px; object-fit: contain; }
  #lb-text { font-size: .95rem; opacity: .8; }
  .lb-zu { position: fixed; top: 14px; right: 18px; z-index: 2; background: none; border: 0; font-size: 2.4rem; line-height: 1; cursor: pointer; padding: 6px 12px; }
  .lb-nav { background: none; border: 0; font-size: 3rem; cursor: pointer; padding: 16px 0; opacity: .75; }
  .lb-nav:hover { opacity: 1; }

  @media (min-width: 900px) {
    .ablauf-grid { grid-template-columns: 5fr 7fr; gap: 72px; align-items: start; }
    .ablauf-kopf { position: sticky; top: calc(var(--nav-h) + 40px); }
    .hero-grid { grid-template-columns: 1.1fr .9fr; gap: 64px; }
    .hero-bild { justify-self: end; width: min(460px, 100%); }
    .runter { display: block; }
    .galerie { columns: 3; column-gap: 18px; }
    .foto { margin-bottom: 18px; }
    .siegel { left: -64px; width: 150px; height: 150px; bottom: 36px; }
  }
  @media (max-width: 720px) {
    .nav ul li:not(:last-child) { display: none; }
    #lightbox[open] { grid-template-columns: 1fr; }
    .lb-nav { position: fixed; top: 50%; translate: 0 -50%; z-index: 2; background: rgb(0 0 0 / .4); border-radius: 50%; width: 44px; height: 44px; padding: 0; font-size: 2rem; line-height: 1; }
    .lb-prev { left: 8px; } .lb-next { right: 8px; }
  }
}

@layer effekte {
  @media (prefers-reduced-motion: no-preference) {
    /* Einstieg beim Laden */
    @keyframes hoch { from { opacity: 0; translate: 0 28px; } }
    @keyframes bogen-auf { from { clip-path: inset(14% 10% 0 10% round 999px 999px 28px 28px); opacity: 0; } to { clip-path: inset(0 round 999px 999px 28px 28px); } }
    .hero-logo, .hero-claim, .hero-text .btn { animation: hoch .9s cubic-bezier(.2,.7,.2,1) both; }
    .hero-claim { animation-delay: .15s; }
    .hero-text .btn { animation-delay: .3s; }
    .bogen { animation: bogen-auf 1.3s cubic-bezier(.2,.7,.2,1) both; }

    /* Scroll-getriebene Effekte (Chrome, Edge, Safari 26+); ohne Support bleibt alles statisch sichtbar */
    @supports (animation-timeline: view()) {
      @keyframes nav-farbe { to { background-color: var(--gruen); color: var(--tinte); box-shadow: 0 1px 0 rgb(0 0 0 / .12); } }
      .nav:not(.nav-fest) { animation: nav-farbe linear both; animation-timeline: scroll(root); animation-range: 40vh 70vh; }
      .nav:not(.nav-fest) .nav-cta:hover { background: var(--tinte); color: var(--creme); }

      @keyframes bogen-fahrt { to { translate: 0 9%; scale: 1.2; } }
      .bogen img { animation: bogen-fahrt linear both; animation-timeline: scroll(root); animation-range: 0 100svh; }
      @keyframes siegel-dreh { to { rotate: 540deg; } }
      .siegel .ring { animation: siegel-dreh linear both; animation-timeline: scroll(root); animation-range: 0 140svh; }

      @keyframes einblenden { from { opacity: 0; translate: 0 56px; } to { opacity: 1; translate: 0 0; } }
      .reveal { animation: einblenden linear both; animation-timeline: view(); animation-range: entry 0% entry 55%; }

      @keyframes fahrt { from { translate: 0 -7%; } to { translate: 0 7%; } }
      .foto img { animation: fahrt linear both; animation-timeline: view(); animation-range: cover; }

      @keyframes linie { from { transform: scaleY(0); } to { transform: scaleY(1); } }
      .zeitstrahl::after { animation: linie linear both; animation-timeline: view(); animation-range: entry 20% entry 100%; }
      @keyframes punkt-an { from { background: var(--gruen-hell); color: var(--tinte); box-shadow: 0 0 0 6px var(--gruen-hell), inset 0 0 0 2px rgb(0 0 0 / .25); } }
      .punkt { animation: punkt-an linear both; animation-timeline: view(); animation-range: entry 55% entry 100%; }
      .zeitstrahl li { animation: einblenden linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }

      @keyframes fuellen { from { --fill: -10%; } to { --fill: 105%; } }
      .statement p {
        background: linear-gradient(to bottom, var(--tinte) var(--fill), color-mix(in srgb, var(--tinte) 22%, transparent) calc(var(--fill) + 14%));
        -webkit-background-clip: text; background-clip: text; color: transparent;
        animation: fuellen linear both; animation-timeline: view(); animation-range: entry 35% cover 50%;
      }
      .foto:hover img { animation-play-state: running; }
    }

    /* View Transition für die Lightbox */
    ::view-transition-group(foto) { animation-duration: .45s; animation-timing-function: cubic-bezier(.2,.7,.2,1); }
    ::view-transition-old(foto), ::view-transition-new(foto) { height: 100%; object-fit: cover; }
  }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
}
