/* ==========================================================================
   B&S Renovationen – Stylesheet
   ========================================================================== */

@layer reset, tokens, base, layout, components, utilities;

/* ---------- Fonts (lokal gehostet, keine Verbindung zu Google) ---------- */
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: italic;
  font-display: swap;
}

@view-transition { navigation: auto; }

/* ---------- Reset ---------- */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: none; text-size-adjust: none; }
  body { min-height: 100svh; }
  img, picture, svg, video { display: block; max-width: 100%; }
  img { height: auto; }
  input, button, textarea, select { font: inherit; color: inherit; }
  button { cursor: pointer; }
  p, h1, h2, h3, h4 { overflow-wrap: break-word; }
  ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
}

/* ---------- Design Tokens ---------- */
@layer tokens {
  :root {
    color-scheme: light;

    /* Farben – abgeleitet vom Logo (Anthrazit + Ziegelrot) und Holz */
    --paper: #f5f1ea;
    --paper-2: #ece5d9;
    --paper-3: #e1d7c7;
    --ink: #1c1917;
    --ink-2: #3a3430;
    --muted: #6b6159;
    --line: color-mix(in oklab, var(--ink) 14%, transparent);
    --line-strong: color-mix(in oklab, var(--ink) 28%, transparent);
    --brick: #8b3a31;
    --brick-dark: #6e2b24;
    --brick-soft: #c98a7b;
    --wood: #b0794c;
    --on-dark: #f3ede4;
    --on-dark-muted: #b6aca1;

    /* Typo */
    --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --step--1: clamp(0.84rem, 0.81rem + 0.12vw, 0.92rem);
    --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
    --step-1: clamp(1.15rem, 1.07rem + 0.38vw, 1.4rem);
    --step-2: clamp(1.4rem, 1.24rem + 0.75vw, 1.9rem);
    --step-3: clamp(1.8rem, 1.5rem + 1.4vw, 2.75rem);
    --step-4: clamp(2.3rem, 1.8rem + 2.4vw, 4rem);
    --step-5: clamp(2.7rem, 1.9rem + 3.9vw, 5.6rem);

    /* Abstände & Layout */
    --gutter: clamp(1.15rem, 0.7rem + 2.2vw, 2.5rem);
    --section: clamp(4.5rem, 3rem + 7vw, 9rem);
    --wrap: 80rem;
    --radius: 3px;
    --header-h: 5.25rem;

    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  }
}

/* ---------- Base ---------- */
@layer base {
  html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 1rem);
    hanging-punctuation: first last;
  }
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
  }

  body {
    font-family: var(--font);
    font-size: var(--step-0);
    line-height: 1.65;
    color: var(--ink-2);
    background: var(--paper);
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  h1, h2, h3, h4 {
    color: var(--ink);
    font-weight: 760;
    font-stretch: 82%;
    line-height: 1.04;
    letter-spacing: -0.018em;
    text-wrap: balance;
  }
  h1 { font-size: var(--step-5); font-weight: 800; letter-spacing: -0.028em; }
  h2 { font-size: var(--step-4); }
  h3 { font-size: var(--step-2); line-height: 1.12; }

  p, li { text-wrap: pretty; }
  strong { color: var(--ink); font-weight: 650; }

  a {
    color: inherit;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    transition: color 0.2s;
  }
  a:hover { color: var(--brick); }

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

  ::selection { background: var(--brick); color: var(--paper); }
}

/* ---------- Layout ---------- */
@layer layout {
  .wrap {
    width: min(100% - var(--gutter) * 2, var(--wrap));
    margin-inline: auto;
  }

  .section { padding-block: var(--section); }
  .section--tint { background: var(--paper-2); }
  .section--dark {
    background: var(--ink);
    color: var(--on-dark-muted);
    & :is(h2, h3, strong) { color: var(--on-dark); }
  }

  .section-head {
    display: grid;
    gap: 1.25rem 4rem;
    margin-bottom: clamp(2.5rem, 2rem + 3vw, 5rem);

    & > p { max-width: 38rem; font-size: var(--step-1); line-height: 1.55; }

    @media (width >= 60rem) {
      grid-template-columns: 1.1fr 1fr;
      align-items: end;
      & > p { justify-self: end; }
    }
  }
}

/* ---------- Components ---------- */
@layer components {

  /* Skip-Link */
  .skip-link {
    position: absolute;
    left: 1rem;
    top: 1rem;
    z-index: 100;
    background: var(--ink);
    color: var(--paper);
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    translate: 0 calc(-100% - 2rem);
    &:focus { translate: 0 0; }
  }

  /* Eyebrow / Kicker */
  .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: var(--step--1);
    font-weight: 600;
    font-stretch: 100%;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--brick);
    margin-bottom: 1.25rem;

    &::before {
      content: "";
      width: 1.9rem;
      height: 0.8rem;
      flex: none;
      background: currentColor;
      mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 38 16'%3E%3Cpath d='M0 15 L10 5 L19 13 L28 1 L38 15' fill='none' stroke='black' stroke-width='2.4' stroke-linejoin='miter'/%3E%3C/svg%3E") center / contain no-repeat;
    }

    .section--dark & { color: var(--brick-soft); }
  }

  /* Buttons */
  .btn {
    --btn-bg: var(--brick);
    --btn-fg: #fff;
    --btn-bd: var(--brick);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    min-height: 3.25rem;
    padding: 0.8rem 1.5rem;
    border: 1.5px solid var(--btn-bd);
    border-radius: var(--radius);
    background: var(--btn-bg);
    color: var(--btn-fg);
    font-weight: 620;
    font-size: var(--step-0);
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, translate 0.2s var(--ease-out);

    & svg { width: 1.1em; height: 1.1em; flex: none; }

    &:hover {
      --btn-bg: var(--brick-dark);
      --btn-bd: var(--brick-dark);
      color: var(--btn-fg);
    }
    &:active { translate: 0 1px; }
  }
  .btn--ghost {
    --btn-bg: transparent;
    --btn-fg: var(--ink);
    --btn-bd: var(--line-strong);
    &:hover { --btn-bg: var(--ink); --btn-fg: var(--paper); --btn-bd: var(--ink); }
  }
  .btn--light {
    --btn-bg: var(--paper);
    --btn-fg: var(--ink);
    --btn-bd: var(--paper);
    &:hover { --btn-bg: #fff; --btn-bd: #fff; --btn-fg: var(--ink); }
  }
  .btn--small { min-height: 2.6rem; padding: 0.5rem 1rem; font-size: var(--step--1); }

  .link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 620;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1.5px solid currentColor;
    padding-bottom: 0.15rem;
    & svg { width: 1em; transition: translate 0.25s var(--ease-out); }
    &:hover svg { translate: 0.25rem 0; }
  }

  /* ---------- Header ---------- */
  .site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in oklab, var(--paper) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(12px);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid transparent;
  }
  @supports (animation-timeline: scroll()) {
    .site-header {
      animation: header-line linear both;
      animation-timeline: scroll(root);
      animation-range: 0 120px;
    }
    @keyframes header-line {
      to { border-bottom-color: var(--line); }
    }
  }

  .site-header__inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-height: var(--header-h);
  }

  .brand {
    flex: none;
    margin-right: auto;
    & img { height: clamp(3.4rem, 2.9rem + 1.5vw, 4.1rem); width: auto; }
  }

  .nav {
    display: none;
    @media (width >= 64rem) { display: block; }

    & ul { display: flex; gap: clamp(1rem, 0.2rem + 1.6vw, 2.2rem); list-style: none; padding: 0; }
    & a {
      position: relative;
      font-size: 0.97rem;
      font-weight: 560;
      color: var(--ink);
      text-decoration: none;
      padding-block: 0.4rem;

      &::after {
        content: "";
        position: absolute;
        inset: auto 0 0;
        height: 1.5px;
        background: var(--brick);
        scale: 0 1;
        transform-origin: left;
        transition: scale 0.3s var(--ease-out);
      }
      &:hover::after, &[aria-current="true"]::after { scale: 1 1; }
    }
  }

  .header-call {
    display: none;
    @media (width >= 40rem) { display: inline-flex; }
  }

  .menu-toggle {
    display: grid;
    place-items: center;
    width: 2.9rem;
    height: 2.9rem;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius);
    background: transparent;
    color: var(--ink);
    & svg { width: 1.35rem; }
    @media (width >= 64rem) { display: none; }
  }

  /* Mobile Navigation (Popover API) */
  .mobile-nav {
    inset: 0;
    width: 100%;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border: 0;
    padding: 0;
    background: var(--ink);
    color: var(--on-dark);
    opacity: 0;
    translate: 0 -1rem;
    transition: opacity 0.3s, translate 0.35s var(--ease-out), overlay 0.35s allow-discrete, display 0.35s allow-discrete;

    &:popover-open { opacity: 1; translate: 0 0; }
    @starting-style {
      &:popover-open { opacity: 0; translate: 0 -1rem; }
    }

    &::backdrop { background: transparent; }

    & .mobile-nav__inner {
      display: flex;
      flex-direction: column;
      min-height: 100%;
      padding: 1.1rem var(--gutter) 2rem;
    }
    & .mobile-nav__top {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 2.5rem;
      font-size: var(--step--1);
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: var(--on-dark-muted);
    }
    & .mobile-nav__close {
      display: grid;
      place-items: center;
      width: 2.9rem;
      height: 2.9rem;
      border: 1.5px solid color-mix(in oklab, var(--on-dark) 30%, transparent);
      border-radius: var(--radius);
      background: transparent;
      color: var(--on-dark);
      & svg { width: 1.2rem; }
    }
    & ul { list-style: none; padding: 0; border-top: 1px solid color-mix(in oklab, var(--on-dark) 15%, transparent); }
    & li { border-bottom: 1px solid color-mix(in oklab, var(--on-dark) 15%, transparent); }
    & li a {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      padding-block: 1rem;
      font-size: var(--step-3);
      font-weight: 700;
      font-stretch: 82%;
      color: var(--on-dark);
      text-decoration: none;
      & span { font-size: var(--step--1); font-weight: 500; color: var(--on-dark-muted); font-stretch: 100%; }
    }
    & .mobile-nav__contact {
      margin-top: auto;
      padding-top: 2.5rem;
      display: grid;
      gap: 0.75rem;
      & a:not(.btn) { color: var(--on-dark-muted); }
    }
  }

  /* ---------- Hero ---------- */
  .hero {
    padding-top: clamp(1.5rem, 1rem + 3vw, 4rem);
    padding-bottom: var(--section);
  }
  .hero__grid {
    display: grid;
    gap: clamp(2rem, 1rem + 4vw, 4.5rem);
    align-items: center;

    @media (width >= 60rem) {
      grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
    }
  }
  .hero__text {
    & h1 { margin-bottom: 1.6rem; }
    & h1 em { font-style: normal; color: var(--brick); }
    & .lead {
      font-size: var(--step-1);
      line-height: 1.55;
      max-width: 34rem;
      margin-bottom: 2.25rem;
    }
  }
  .hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    @media (width < 30rem) { & .btn { flex: 1 1 100%; } }
  }
  .hero__media {
    position: relative;
    margin: 0;

    & img {
      width: 100%;
      aspect-ratio: 4 / 3.4;
      object-fit: cover;
      border-radius: var(--radius);
    }
    & figcaption {
      position: absolute;
      left: 0;
      bottom: 0;
      max-width: calc(100% - 2rem);
      padding: 0.85rem 1.15rem 0.85rem 0;
      background: var(--paper);
      border-top-right-radius: var(--radius);
      font-size: var(--step--1);
      line-height: 1.4;
      color: var(--muted);
      & strong { display: block; color: var(--ink); font-size: 0.98rem; }
    }

    @media (width >= 60rem) {
      & img { aspect-ratio: 4 / 4.3; }
    }
  }

  .facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
    margin-top: clamp(3rem, 2rem + 4vw, 5.5rem);
    border-top: 1px solid var(--line-strong);
    list-style: none;
    padding: 0;

    & li {
      padding: 1.4rem 1.5rem 0 0;
      display: grid;
      gap: 0.35rem;
      line-height: 1.5;
    }
    & strong {
      font-size: var(--step-1);
      font-stretch: 85%;
      font-weight: 700;
    }
    & span { color: var(--muted); font-size: 0.97rem; }
  }

  /* ---------- Über uns ---------- */
  .about {
    display: grid;
    gap: clamp(2.5rem, 1.5rem + 4vw, 6rem);
    @media (width >= 60rem) { grid-template-columns: 1.15fr 1fr; }
  }
  .about__text {
    & h2 { margin-bottom: 2rem; }
    & p + p { margin-top: 1.1rem; }
    & .lead { font-size: var(--step-1); color: var(--ink); line-height: 1.5; }
  }
  .about__aside {
    display: grid;
    gap: 1.25rem;
    align-content: start;
  }

  .owner {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.25rem;
    align-items: center;
    padding: 1.4rem;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);

    & .owner__mono {
      display: grid;
      place-items: center;
      width: 4rem;
      height: 4rem;
      background: var(--ink);
      color: var(--paper);
      font-weight: 750;
      font-stretch: 80%;
      font-size: 1.35rem;
      letter-spacing: 0.02em;
      border-radius: var(--radius);
    }
    & h3 { font-size: var(--step-1); margin-bottom: 0.15rem; }
    & p { font-size: 0.95rem; color: var(--muted); line-height: 1.45; }
  }

  .quote {
    margin: 0.75rem 0 0;
    padding: 1.6rem 0 0;
    border-top: 1px solid var(--line-strong);
    & p {
      font-size: var(--step-2);
      font-weight: 600;
      font-stretch: 85%;
      line-height: 1.25;
      color: var(--ink);
      letter-spacing: -0.01em;
    }
    & footer { margin-top: 0.85rem; font-size: var(--step--1); color: var(--muted); }
  }

  /* ---------- Schwerpunkte (Feature-Reihen) ---------- */
  .features { display: grid; gap: clamp(4rem, 3rem + 5vw, 8rem); }

  .feature {
    display: grid;
    gap: clamp(1.75rem, 1rem + 3vw, 5rem);
    align-items: center;

    @media (width >= 56rem) {
      grid-template-columns: 1fr 1fr;
      &:nth-child(even) .feature__media { order: 2; }
    }
  }
  .feature__media {
    position: relative;
    margin: 0;
    & img {
      width: 100%;
      aspect-ratio: 5 / 4;
      object-fit: cover;
      border-radius: var(--radius);
    }
    & figcaption {
      margin-top: 0.7rem;
      font-size: var(--step--1);
      color: var(--muted);
    }
  }
  .feature__body {
    & .feature__num {
      display: block;
      font-size: var(--step--1);
      font-weight: 600;
      letter-spacing: 0.14em;
      color: var(--brick);
      margin-bottom: 0.9rem;
    }
    & h3 { font-size: var(--step-3); margin-bottom: 1.25rem; }
    & p { max-width: 36rem; }
    & p + p { margin-top: 1rem; }
  }

  .checklist {
    list-style: none;
    padding: 0;
    margin-top: 1.75rem;
    display: grid;
    gap: 0;
    border-top: 1px solid var(--line);
    max-width: 36rem;

    & li {
      display: grid;
      grid-template-columns: 1.4rem 1fr;
      gap: 0.6rem;
      padding-block: 0.7rem;
      border-bottom: 1px solid var(--line);
      line-height: 1.45;
    }
    & li::before {
      content: "";
      width: 0.95rem;
      height: 0.6rem;
      margin-top: 0.42em;
      background: var(--brick);
      mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 19 12'%3E%3Cpath d='M1 11 L9.5 2.5 L18 11' fill='none' stroke='black' stroke-width='2.6'/%3E%3C/svg%3E") center / contain no-repeat;
    }
  }

  /* ---------- Leistungs-Index ---------- */
  .services-index {
    margin-top: clamp(4.5rem, 3rem + 6vw, 9rem);

    & > h3 {
      font-size: var(--step-3);
      margin-bottom: 2rem;
    }
  }
  .services {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
    @media (width >= 60rem) { grid-template-columns: repeat(3, 1fr); }
    list-style: none;
    padding: 0;
    border-top: 1px solid var(--line-strong);
    border-left: 1px solid var(--line);

    & li {
      padding: 1.75rem 1.6rem 2rem;
      border-right: 1px solid var(--line);
      border-bottom: 1px solid var(--line);
      transition: background-color 0.25s;
      &:hover { background: var(--paper); }
    }
    & .services__num {
      display: block;
      font-size: var(--step--1);
      font-weight: 600;
      color: var(--brick);
      letter-spacing: 0.1em;
      margin-bottom: 1.6rem;
    }
    & h4 {
      font-size: var(--step-1);
      font-stretch: 85%;
      line-height: 1.2;
      margin-bottom: 0.6rem;
    }
    & p { font-size: 0.98rem; line-height: 1.6; }
  }

  /* ---------- Projekte ---------- */
  .cases { display: grid; gap: clamp(3.5rem, 2.5rem + 4vw, 7rem); }

  .case {
    display: grid;
    gap: 1.75rem clamp(2rem, 1rem + 3vw, 4.5rem);
    padding-top: clamp(2rem, 1.5rem + 2vw, 3rem);
    border-top: 1px solid var(--line-strong);

    @media (width >= 60rem) {
      grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr);
    }
  }
  .case__info {
    & .case__meta {
      display: flex;
      flex-wrap: wrap;
      gap: 0.4rem 1rem;
      font-size: var(--step--1);
      font-weight: 600;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--brick);
      margin-bottom: 0.9rem;
    }
    & h3 { font-size: var(--step-3); margin-bottom: 1.1rem; }
    & p { max-width: 32rem; }
    & .tags {
      display: flex;
      flex-wrap: wrap;
      gap: 0.45rem;
      margin-top: 1.4rem;
      list-style: none;
      padding: 0;
      & li {
        padding: 0.3rem 0.7rem;
        border: 1px solid var(--line-strong);
        border-radius: var(--radius);
        font-size: 0.85rem;
        line-height: 1.3;
        color: var(--ink-2);
      }
    }
    @media (width >= 60rem) {
      position: sticky;
      top: calc(var(--header-h) + 2rem);
      align-self: start;
    }
  }

  /* Galerie: mobil horizontal wischbar, ab Tablet als Raster */
  .gallery {
    list-style: none;
    padding: 0;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: min(78%, 22rem);
    gap: 0.6rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    scroll-padding-inline: var(--gutter);

    &::-webkit-scrollbar { display: none; }

    & li { scroll-snap-align: start; }

    & a {
      position: relative;
      display: block;
      height: 100%;
      overflow: hidden;
      border-radius: var(--radius);
      background: var(--paper-3);
    }
    & img {
      width: 100%;
      height: 100%;
      aspect-ratio: 3 / 4;
      object-fit: cover;
      transition: scale 0.6s var(--ease-out), filter 0.3s;
    }
    & a:hover img { scale: 1.035; }

    & .gallery__more {
      position: absolute;
      inset: 0;
      display: none;
      place-items: center;
      background: color-mix(in oklab, var(--ink) 62%, transparent);
      color: var(--paper);
      font-size: var(--step-2);
      font-weight: 700;
      font-stretch: 85%;
      text-align: center;
      line-height: 1.1;
      & small { display: block; font-size: var(--step--1); font-weight: 500; font-stretch: 100%; margin-top: 0.3rem; }
    }

    @media (width >= 40rem) {
      grid-auto-flow: row;
      grid-auto-columns: auto;
      grid-template-columns: repeat(4, 1fr);
      grid-auto-rows: clamp(9rem, 6rem + 9vw, 15rem);
      overflow: visible;
      margin-inline: 0;
      padding-inline: 0;

      & img { aspect-ratio: auto; }
      & li:first-child { grid-column: span 2; grid-row: span 2; }
      & li:nth-child(n + 6) { display: none; }
      & .gallery__more { display: grid; }
    }
  }
  .gallery--single {
    @media (width >= 40rem) {
      grid-template-columns: 1fr;
      grid-auto-rows: auto;
      & li:first-child { grid-column: auto; grid-row: auto; }
      & img { aspect-ratio: 16 / 10; }
    }
    @media (width < 40rem) {
      grid-auto-columns: 100%;
      & img { aspect-ratio: 4 / 3; }
    }
  }

  .case__open {
    margin-top: 1.25rem;
    background: none;
    border: 0;
    border-bottom: 1.5px solid currentColor;
    border-radius: 0;
    padding: 0 0 0.15rem;
    font-size: var(--step-0);
  }

  .swipe-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.8rem;
    font-size: var(--step--1);
    color: var(--muted);
    & svg { width: 1.1rem; }
    @media (width >= 40rem) { display: none; }
  }

  /* ---------- Fotoalbum (dialog mit Blätter-Effekt) ---------- */
  .album {
    --paper-album: #f3ecdf;
    --leather: #3a2a20;

    width: 100%;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    color: var(--on-dark);
    background:
      radial-gradient(ellipse 70% 60% at 50% 45%, #3a3029 0%, #1d1815 55%, #110e0c 100%);
    opacity: 0;
    transition: opacity 0.35s, overlay 0.35s allow-discrete, display 0.35s allow-discrete;

    &[open] {
      opacity: 1;
      display: grid;
      grid-template-rows: auto 1fr auto;
    }
    @starting-style { &[open] { opacity: 0; } }
    &::backdrop { background: #110e0c; }
  }

  .album__bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem var(--gutter);
    font-size: var(--step--1);
  }
  .album__title { font-weight: 650; color: var(--on-dark); }
  .album__count { margin-right: auto; color: var(--on-dark-muted); font-variant-numeric: tabular-nums; }

  .album__btn {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    flex: none;
    border: 1px solid color-mix(in oklab, var(--on-dark) 25%, transparent);
    border-radius: 50%;
    background: color-mix(in oklab, #000 25%, transparent);
    color: var(--on-dark);
    transition: background-color 0.2s, opacity 0.2s;
    &:hover { background: color-mix(in oklab, var(--on-dark) 14%, transparent); }
    &:disabled { opacity: 0.25; cursor: default; }
    & svg { width: 1.2rem; }
  }

  .album__stage {
    display: grid;
    grid-template-columns: auto auto auto;
    align-items: center;
    justify-content: center;
    gap: clamp(1rem, 2vw, 2.5rem);
    min-height: 0;

    @media (width < 48rem) {
      grid-template-columns: auto auto;
      grid-template-rows: auto auto;
      gap: 1.25rem 3rem;
      align-content: center;
      & .book { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
      & .album__nav { grid-row: 2; }
      & .album__nav--prev { justify-self: end; }
      & .album__nav--next { justify-self: start; }
    }
  }

  .album__hint {
    padding: 0.75rem var(--gutter) max(1.1rem, env(safe-area-inset-bottom));
    text-align: center;
    font-size: var(--step--1);
    color: var(--on-dark-muted);

    & .album__hint--touch { display: none; }
    @media (pointer: coarse) {
      & .album__hint--mouse { display: none; }
      & .album__hint--touch { display: inline; }
    }
  }

  /* Buch */
  .book {
    --ph: min(calc(100dvh - 10.5rem), calc((100vw - 11rem) / 1.5), 52rem);
    --p: 0;
    --cast: 0;
    position: relative;
    width: calc(var(--ph) * 1.5);
    height: var(--ph);
    perspective: calc(var(--ph) * 4.6);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
    animation: book-in 0.6s var(--ease-out) both;

    &:active { cursor: grabbing; }

    /* Einband */
    &::before {
      content: "";
      position: absolute;
      inset: -1.4% -1.6%;
      z-index: -1;
      border-radius: 6px;
      background:
        linear-gradient(90deg, transparent 49.2%, #0006 50%, transparent 50.8%),
        radial-gradient(ellipse at 30% 20%, #ffffff12, transparent 60%),
        var(--leather);
      box-shadow:
        0 2px 0 #ffffff10 inset,
        0 30px 60px -20px #000c,
        0 12px 24px -8px #0009;
    }

    &[data-mode="single"] {
      --ph: min(calc(100dvh - 13rem), calc((100vw - 2.5rem) / 0.75));
      width: calc(var(--ph) * 0.75);
      &::before {
        inset: -2% -2.6% -2% -3.4%;
        background: radial-gradient(ellipse at 30% 20%, #ffffff12, transparent 60%), var(--leather);
      }
      & .book__page--left { display: none; }
      & .book__page--right { left: 0; width: 100%; }
    }
  }
  @keyframes book-in {
    from { opacity: 0; scale: 0.94; translate: 0 1.5rem; }
  }

  .book__page {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;

    &::after {
      content: "";
      position: absolute;
      inset: 0;
      pointer-events: none;
      z-index: 2;
    }
  }
  .book__page--left {
    left: 0;
    box-shadow: -1px 1px 0 #e4dacb, -2px 2px 0 #d6cab8, -3px 3px 0 #e4dacb, -4px 4px 0 #cfc2ae;
    &::after { background: linear-gradient(to left, rgb(0 0 0 / calc(var(--cast) * 0.38)), transparent 55%); }
  }
  .book__page--right {
    left: 50%;
    box-shadow: 1px 1px 0 #e4dacb, 2px 2px 0 #d6cab8, 3px 3px 0 #e4dacb, 4px 4px 0 #cfc2ae;
    &::after { background: linear-gradient(to right, rgb(0 0 0 / calc(var(--cast) * 0.38)), transparent 55%); }
  }

  /* Umblätterndes Blatt */
  .leaf {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 50%;
    z-index: 5;
    transform-origin: left center;
    transform-style: preserve-3d;
    transform: rotateY(calc(var(--p) * -180deg));
    pointer-events: none;

    .book[data-mode="single"] & {
      left: 0;
      width: 100%;
      opacity: calc(1.5 - var(--p) * 1.3);
    }
  }
  .leaf__face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;

    &::after {
      content: "";
      position: absolute;
      inset: 0;
      z-index: 3;
      pointer-events: none;
    }
  }
  .leaf__front::after {
    background: linear-gradient(to right,
      rgb(0 0 0 / calc(var(--p) * 0.3)) 0%,
      rgb(0 0 0 / calc(var(--p) * 0.08)) 35%,
      rgb(255 255 255 / calc(var(--p) * 0.14)) 80%,
      rgb(0 0 0 / calc(var(--p) * 0.22)) 100%);
  }
  .leaf__back {
    transform: rotateY(180deg);
    &::after {
      background: linear-gradient(to left,
        rgb(0 0 0 / calc((1 - var(--p)) * 0.3)) 0%,
        rgb(0 0 0 / calc((1 - var(--p)) * 0.08)) 35%,
        rgb(255 255 255 / calc((1 - var(--p)) * 0.14)) 80%,
        rgb(0 0 0 / calc((1 - var(--p)) * 0.22)) 100%);
    }
  }

  /* Albumseiten */
  .pg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    container-type: size;
    color: #3a332d;
    background-color: var(--paper-album);
    background-image:
      radial-gradient(#0000000a 0.5px, transparent 0.6px),
      linear-gradient(160deg, #ffffff55, transparent 40%, #00000008);
    background-size: 5px 5px, 100% 100%;
  }
  .pg--left {
    border-radius: 3px 0 0 3px;
    &::before {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(to left, #0000002e, #00000010 3%, transparent 9%);
      pointer-events: none;
      z-index: 2;
    }
  }
  .pg--right {
    border-radius: 0 3px 3px 0;
    &::before {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(to right, #0000002e, #00000010 3%, transparent 9%);
      pointer-events: none;
      z-index: 2;
    }
  }
  .book[data-mode="single"] .pg--right { border-radius: 3px; }
  .pg--paperback { background-color: #ebe3d4; }

  .pg__photo {
    position: absolute;
    inset: 9% 10% 19%;
    display: grid;
    place-items: center;
    container-type: size;
  }
  .print {
    position: relative;
    margin: 0;
    width: min(100cqw, 100cqh * var(--r));
    aspect-ratio: var(--r);
    padding: 3.2cqmin;
    background: #fdfcf8;
    rotate: var(--tilt, 0deg);
    box-shadow:
      0 1px 2px #0000002a,
      0 6px 14px -6px #00000059,
      0 18px 30px -18px #00000040;

    & img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      background: var(--paper-3);
      pointer-events: none;
      -webkit-user-drag: none;
    }

    /* Klebestreifen */
    &::before, &::after {
      content: "";
      position: absolute;
      width: 22%;
      height: 6cqmin;
      max-height: 2.1rem;
      background: #efe2c3b8;
      box-shadow: 0 1px 2px #00000014;
      backdrop-filter: blur(0.5px);
    }
    &::before { top: -2.2cqmin; left: -5%; rotate: -38deg; }
    &::after { bottom: -2.2cqmin; right: -5%; rotate: -38deg; }
  }

  .pg__caption {
    position: absolute;
    inset: auto 10% 8.5%;
    display: grid;
    gap: 0.2em;
    text-align: center;
    font-size: clamp(0.72rem, 3.1cqh, 1.15rem);
    line-height: 1.25;
    & em { font-style: italic; font-weight: 500; color: #2c2622; }
    & span { font-size: 0.8em; letter-spacing: 0.12em; text-transform: uppercase; color: #8a7d70; }
  }
  .pg__num {
    position: absolute;
    bottom: 3.5%;
    font-size: clamp(0.65rem, 2.2cqh, 0.85rem);
    color: #9a8d7f;
    font-variant-numeric: tabular-nums;
    .pg--left & { left: 7%; }
    .pg--right & { right: 7%; }
  }

  .pg--title, .pg--end {
    display: flex;
    flex-direction: column;
    padding: 12% 12% 10%;
  }
  .pg--title {
    & .pg__kicker {
      font-size: clamp(0.62rem, 2.3cqh, 0.85rem);
      font-weight: 600;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      color: var(--brick);
      margin-bottom: 4cqh;
    }
    & h3 {
      font-size: clamp(1.3rem, 7.2cqh, 3rem);
      line-height: 1.02;
      color: var(--ink);
      margin-bottom: 3.5cqh;
    }
    & .pg__meta {
      font-size: clamp(0.7rem, 2.6cqh, 1rem);
      font-weight: 600;
      color: var(--brick);
      margin-bottom: 3cqh;
    }
    & .pg__text {
      font-size: clamp(0.72rem, 2.75cqh, 1.05rem);
      line-height: 1.55;
      color: #4b433c;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 9;
      overflow: hidden;
    }
    & .pg__foot {
      margin-top: auto;
      display: flex;
      justify-content: space-between;
      align-items: end;
      gap: 1rem;
      padding-top: 3cqh;
      border-top: 1px solid #0000001f;
      font-size: clamp(0.66rem, 2.3cqh, 0.9rem);
      color: #8a7d70;
      & img { height: clamp(1.8rem, 9cqh, 3.6rem); width: auto; opacity: 0.85; }
    }
  }
  .pg--end {
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 3cqh;
    & img { height: clamp(2.2rem, 12cqh, 4.5rem); width: auto; opacity: 0.85; margin-bottom: 2cqh; }
    & p { font-size: clamp(0.8rem, 3.2cqh, 1.2rem); color: #4b433c; max-width: 22ch; }
    & strong { display: block; font-size: 1.2em; font-stretch: 85%; color: var(--ink); margin-bottom: 0.3em; }
    & .btn { font-size: clamp(0.78rem, 2.8cqh, 1rem); min-height: 0; padding: 0.7em 1.2em; }
  }

  html:has(.album[open]),
  html:has(.mobile-nav:popover-open) { overflow: hidden; }

  /* ---------- Ablauf ---------- */
  .steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
    gap: 0;
    list-style: none;
    padding: 0;
    counter-reset: step;

    & li {
      counter-increment: step;
      position: relative;
      padding: 1.75rem 1.5rem 1.75rem 0;
      border-top: 1px solid color-mix(in oklab, var(--on-dark) 22%, transparent);
    }
    & li::before {
      content: counter(step, decimal-leading-zero);
      display: block;
      margin-bottom: 2.2rem;
      font-size: var(--step-3);
      font-weight: 300;
      font-stretch: 80%;
      line-height: 1;
      color: var(--brick-soft);
    }
    & h3 { font-size: var(--step-1); font-stretch: 85%; margin-bottom: 0.6rem; }
    & p { font-size: 0.97rem; line-height: 1.6; }
  }

  /* ---------- Werte ---------- */
  .values {
    display: grid;
    gap: clamp(2rem, 1rem + 3vw, 4rem);
    @media (width >= 60rem) { grid-template-columns: 1fr 1.3fr; }

    & h2 { margin-bottom: 1.5rem; }
    & .values__list {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
      gap: 2.25rem 2.5rem;
      list-style: none;
      padding: 0;
    }
    & .values__list h3 {
      font-size: var(--step-1);
      font-stretch: 85%;
      padding-top: 1rem;
      border-top: 2px solid var(--ink);
      margin-bottom: 0.55rem;
    }
    & .values__list p { font-size: 0.98rem; }
  }

  .banner {
    position: relative;
    margin: 0;
    & img {
      width: 100%;
      height: clamp(16rem, 10rem + 25vw, 34rem);
      object-fit: cover;
      object-position: center 60%;
    }
  }

  /* ---------- FAQ ---------- */
  .faq {
    display: grid;
    gap: clamp(2rem, 1rem + 3vw, 5rem);
    @media (width >= 60rem) { grid-template-columns: 0.8fr 1.4fr; }
    & h2 { margin-bottom: 1.25rem; }
  }
  .faq__list { border-top: 1px solid var(--line-strong); }
  .faq__item {
    border-bottom: 1px solid var(--line-strong);
    interpolate-size: allow-keywords;

    & summary {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 1.5rem;
      padding-block: 1.35rem;
      list-style: none;
      cursor: pointer;
      font-size: var(--step-1);
      font-weight: 650;
      font-stretch: 88%;
      line-height: 1.3;
      color: var(--ink);
      &::-webkit-details-marker { display: none; }
      &:hover { color: var(--brick); }
    }
    & summary::after {
      content: "";
      flex: none;
      width: 0.9rem;
      height: 0.9rem;
      background:
        linear-gradient(currentColor, currentColor) center / 100% 1.5px no-repeat,
        linear-gradient(currentColor, currentColor) center / 1.5px 100% no-repeat;
      transition: rotate 0.3s var(--ease-out);
    }
    &[open] summary::after { rotate: 45deg; }

    &::details-content {
      block-size: 0;
      overflow: clip;
      transition: block-size 0.35s var(--ease-out), content-visibility 0.35s allow-discrete;
    }
    &[open]::details-content { block-size: auto; }

    & .faq__answer { padding-bottom: 1.5rem; max-width: 42rem; }
  }

  /* ---------- Kontakt ---------- */
  .contact {
    display: grid;
    gap: clamp(2.5rem, 1.5rem + 4vw, 6rem);
    @media (width >= 60rem) { grid-template-columns: 1fr 1.15fr; }
  }
  .contact__info {
    & h2 { margin-bottom: 1.5rem; }
    & > p { font-size: var(--step-1); line-height: 1.55; max-width: 32rem; }
  }
  .contact__channels {
    display: grid;
    gap: 0;
    margin-top: 2.5rem;
    list-style: none;
    padding: 0;
    border-top: 1px solid color-mix(in oklab, var(--on-dark) 22%, transparent);

    & li { border-bottom: 1px solid color-mix(in oklab, var(--on-dark) 22%, transparent); }
    & a {
      display: grid;
      gap: 0.2rem;
      padding-block: 1.25rem;
      text-decoration: none;
      color: var(--on-dark);
      & span { font-size: var(--step--1); letter-spacing: 0.12em; text-transform: uppercase; color: var(--on-dark-muted); }
      & strong { font-size: var(--step-2); font-weight: 700; font-stretch: 82%; color: var(--on-dark); transition: color 0.2s; overflow-wrap: anywhere; }
      &:hover strong { color: var(--brick-soft); }
    }
  }
  .contact__owners {
    margin-top: 1.75rem;
    font-size: 0.97rem;
  }

  .form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    gap: 1.1rem 1rem;
    padding: clamp(1.4rem, 1rem + 2vw, 2.5rem);
    background: var(--paper);
    color: var(--ink-2);
    border-radius: var(--radius);
    align-self: start;

    & h3 { grid-column: 1 / -1; font-size: var(--step-2); margin-bottom: 0.25rem; }
    & .field--full, & .form__consent, & .form__submit, & .form__status { grid-column: 1 / -1; }

    & label, & legend {
      display: block;
      margin-bottom: 0.4rem;
      font-size: 0.9rem;
      font-weight: 600;
      color: var(--ink);
    }
    & label .opt { font-weight: 400; color: var(--muted); }

    & :is(input, select, textarea) {
      width: 100%;
      min-height: 3.1rem;
      padding: 0.7rem 0.9rem;
      border: 1.5px solid var(--line-strong);
      border-radius: var(--radius);
      background: #fff;
      font-size: 1rem;
      color: var(--ink);
      transition: border-color 0.2s, box-shadow 0.2s;

      &:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in oklab, var(--brick) 22%, transparent); }
      &:user-invalid { border-color: var(--brick); }
    }
    & select {
      appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%231c1917' stroke-width='1.6'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 0.9rem center;
      background-size: 0.75rem;
      padding-right: 2.4rem;
    }
    & textarea { min-height: 9rem; resize: vertical; field-sizing: content; max-height: 24rem; }

    & .form__consent {
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 0.75rem;
      align-items: start;
      font-size: 0.9rem;
      line-height: 1.5;
      & input { width: 1.2rem; min-height: 1.2rem; height: 1.2rem; margin-top: 0.15rem; accent-color: var(--brick); }
      & label { font-weight: 400; color: var(--ink-2); margin: 0; font-size: inherit; }
    }
    & .form__submit { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 0.4rem; }
    & .form__submit p { font-size: 0.85rem; color: var(--muted); }
    & .form__status {
      display: none;
      padding: 0.9rem 1rem;
      border-radius: var(--radius);
      font-size: 0.95rem;
      &.is-ok { display: block; background: #e6efe3; color: #23461f; }
      &.is-error { display: block; background: #f6e3df; color: var(--brick-dark); }
    }
    & .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
    & button[disabled] { opacity: 0.6; cursor: progress; }
  }

  /* ---------- Footer ---------- */
  .site-footer {
    background: #141110;
    color: var(--on-dark-muted);
    padding-block: clamp(3.5rem, 2.5rem + 4vw, 6rem) 2rem;
    font-size: 0.97rem;

    & a { color: var(--on-dark); text-decoration: none; }
    & a:hover { color: var(--brick-soft); }
  }
  .footer__grid {
    display: grid;
    gap: 2.5rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
    @media (width >= 60rem) { grid-template-columns: 1.6fr 1fr 1fr 1fr; }

    & h4 {
      font-size: var(--step--1);
      font-weight: 600;
      font-stretch: 100%;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: var(--on-dark-muted);
      margin-bottom: 1rem;
    }
    & ul { list-style: none; padding: 0; display: grid; gap: 0.5rem; }
  }
  .footer__brand {
    & .footer__logo {
      display: inline-block;
      padding: 0.6rem 0.8rem;
      background: var(--paper);
      border-radius: var(--radius);
      margin-bottom: 1.25rem;
      & img { height: 3rem; width: auto; }
    }
    & p { max-width: 24rem; }
  }
  .footer__bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    margin-top: clamp(3rem, 2rem + 3vw, 5rem);
    padding-top: 1.5rem;
    border-top: 1px solid color-mix(in oklab, var(--on-dark) 14%, transparent);
    font-size: 0.88rem;
    & ul { display: flex; gap: 1.5rem; list-style: none; padding: 0; }
  }

  /* Mobile Anruf-Leiste */
  .callbar {
    position: fixed;
    inset: auto 0.75rem max(0.75rem, env(safe-area-inset-bottom)) 0.75rem;
    z-index: 40;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--ink);
    border-radius: calc(var(--radius) + 3px);
    box-shadow: 0 10px 30px -10px #0008;
    translate: 0 150%;
    transition: translate 0.4s var(--ease-out);

    & .btn { min-height: 2.9rem; font-size: 0.95rem; padding-inline: 0.75rem; }
    &.is-visible { translate: 0 0; }
    @media (width >= 40rem) { display: none; }
  }

  /* ---------- Unterseiten (Impressum, Datenschutz, 404) ---------- */
  .page {
    padding-block: clamp(3rem, 2rem + 5vw, 7rem) var(--section);

    & .page__inner { max-width: 46rem; }
    & h1 { font-size: var(--step-4); margin-bottom: 2rem; }
    & h2 { font-size: var(--step-2); margin: 2.75rem 0 0.85rem; }
    & p, & ul { margin-bottom: 1rem; }
    & ul { padding-left: 1.2rem; }
    & address { font-style: normal; margin-bottom: 1rem; }
    & .placeholder { background: #fff2c4; padding: 0 0.25rem; border-radius: 2px; }
  }
}

/* ---------- Utilities & Motion ---------- */
@layer utilities {
  .visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
  }

  @media (prefers-reduced-motion: no-preference) {
    @supports (animation-timeline: view()) {
      .reveal {
        animation: reveal linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 70%;
      }
      @keyframes reveal {
        from { opacity: 0; translate: 0 2.5rem; }
        to { opacity: 1; translate: 0 0; }
      }
    }

    .hero__text > * { animation: rise 0.9s var(--ease-out) both; }
    .hero__text > :nth-child(2) { animation-delay: 0.08s; }
    .hero__text > :nth-child(3) { animation-delay: 0.16s; }
    .hero__text > :nth-child(4) { animation-delay: 0.24s; }
    .hero__media { animation: rise 1.1s 0.1s var(--ease-out) both; }
    @keyframes rise {
      from { opacity: 0; translate: 0 1.5rem; }
    }
  }
}
