/* ==========================================================================
   IBU — Section patterns added in Phase 2.1 polish
   --------------------------------------------------------------------------
   Image tape, image-inset (about), decorative SVG positioning, FAQ
   accordion (native <details>), Stelle list. Lives next to components.css;
   linked after it so cascade order is predictable.

   Background-rhythm: section-level bg colors come from existing
   `.section--subtle` (uses --color-bg-subtle = stone-50). The hero stays
   on --color-bg (paper). The cta-strip stays inverse. No new tokens.
   ========================================================================== */

@layer components {

  /* ====================================================================
     Decorative SVG layer — large, subtle, behind content
     --------------------------------------------------------------------
     Sections that host one MUST be position: relative + overflow: hidden.
     The .deco wrapper handles absolute positioning; SVG inside is scaled
     to a max-width (clamp) so it stays "big but tasteful" across screens.
     Hidden from AT and pointer events.
     ==================================================================== */

  .deco {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
    color: var(--color-rule-strong);
  }

  .deco svg {
    position: absolute;
    display: block;
    color: inherit;
    /* SVG strokes consume currentColor; opacity handled per-instance below */
  }

  /* All section content needs to sit above the deco layer. */
  .section { position: relative; }
  .section > * { position: relative; z-index: 1; }
  .section .deco { z-index: 0; }

  /* Variants — placement + opacity tuned per section */

  /* Hero dot field — full-bleed CSS-tiled dots with a soft radial mask
     so they fade away from the motto/lede area. Ships as plain divs
     (no SVG) so the pattern auto-scales with hero height. */
  .deco--hero-dots {
    background-image: radial-gradient(circle, var(--color-accent) 1.2px, transparent 1.6px);
    background-size: 28px 28px;
    background-position: 0 0;
    opacity: 0.16;
    -webkit-mask-image: radial-gradient(
      ellipse 55% 75% at 28% 55%,
      transparent 8%,
      rgba(0, 0, 0, 0.55) 55%,
      black 95%
    );
    mask-image: radial-gradient(
      ellipse 55% 75% at 28% 55%,
      transparent 8%,
      rgba(0, 0, 0, 0.55) 55%,
      black 95%
    );
  }

  /* Corner dimension line + DN 608 label — bottom-right of hero */
  .deco--hero-dim svg {
    inset-block-end: 4%;
    inset-inline-end: 3%;
    width: clamp(220px, 36vw, 520px);
    height: auto;
    opacity: 0.32;
    color: var(--color-accent);
  }

  @media (max-width: 720px) {
    .deco--hero-dim svg { display: none; }
  }

  .deco--leistungen-arc svg {
    inset-block-end: -25%;
    inset-inline-start: -8%;
    width: clamp(420px, 60vw, 880px);
    opacity: 0.07;
  }

  .deco--referenzen-pipes svg {
    inset-block-start: -12%;
    inset-inline-end: -10%;
    width: clamp(280px, 38vw, 560px);
    opacity: 0.06;
  }

  .deco--faq-bracket svg {
    inset-block-end: -16%;
    inset-inline-start: -6%;
    width: clamp(320px, 46vw, 720px);
    opacity: 0.055;
  }

  .deco--karriere-iso svg {
    inset-block-start: -14%;
    inset-inline-end: -10%;
    width: clamp(360px, 48vw, 640px);
    opacity: 0.07;
  }

  /* ====================================================================
     Hero deco — extra purple corner glow already exists via .hero::before;
     we only add the grid SVG here.
     ==================================================================== */

  .hero { /* stays as-is in components.css — selector here only to bump z-index for content over deco */
    z-index: 0;
  }
  .hero > .hero__inner { z-index: 1; }
  .hero > .deco { z-index: 0; }

  /* ====================================================================
     About teaser — 2-col variant (text + image)
     --------------------------------------------------------------------
     Image drops below text on mobile. On desktop the image becomes a
     real co-anchor (taller frame) rather than an inset accent.
     ==================================================================== */

  .about-teaser--with-image {
    grid-template-columns: 1fr;
  }

  @media (min-width: 880px) {
    .about-teaser--with-image {
      grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
      gap: clamp(var(--space-7), 5vw, var(--space-9));
      align-items: start;
    }
  }

  .about-teaser__text {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .about-teaser__text > .about-teaser__lede { margin-top: var(--space-2); }

  .about-teaser__image {
    margin-top: var(--space-5);
    overflow: hidden;
    border-radius: var(--radius-sm);
    background-color: var(--stone-150);
    aspect-ratio: 4 / 3;
    position: relative;
  }

  @media (min-width: 880px) {
    .about-teaser__image {
      margin-top: 0;
      aspect-ratio: 4 / 5;
    }
  }

  .about-teaser__image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.92) contrast(1.02);
  }

  /* Small mono label overlay — gives the photo an editorial caption feel */
  .about-teaser__image-label {
    position: absolute;
    inset-block-end: var(--space-3);
    inset-inline-start: var(--space-4);
    inset-inline-end: var(--space-4);
    color: var(--white);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-label);
    text-shadow: 0 1px 6px rgb(0 0 0 / 0.4);
  }

  /* ====================================================================
     FAQ — native <details>/<summary> accordion
     --------------------------------------------------------------------
     Multiple panels can stay open (intentionally — readers often want to
     compare answers). Animation is via grid-template-rows for the body so
     it interpolates cleanly without measuring height in JS.
     ==================================================================== */

  .faq {
    border-top: 1px solid var(--color-rule);
  }

  .faq__item {
    border-bottom: 1px solid var(--color-rule);
  }

  .faq__item summary {
    list-style: none;
    cursor: pointer;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    gap: var(--space-5);
    padding: var(--space-5) 0;
    font-size: var(--text-lg);
    font-weight: var(--font-medium);
    color: var(--color-text-strong);
    line-height: var(--leading-snug);
    letter-spacing: var(--tracking-tight);
    transition: color var(--duration-fast) var(--ease-standard);
  }

  @media (min-width: 720px) {
    .faq__item summary {
      font-size: var(--text-xl);
      padding: var(--space-6) 0;
    }
  }

  .faq__item summary::-webkit-details-marker { display: none; }
  .faq__item summary::marker { content: ""; }

  /* Custom +/− indicator — drawn as two crossed bars, rotates on open */
  .faq__indicator {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    position: relative;
    color: var(--color-text-muted);
    transition: color var(--duration-fast) var(--ease-standard);
    align-self: center;
  }
  .faq__indicator::before,
  .faq__indicator::after {
    content: "";
    position: absolute;
    background-color: currentColor;
    transition: transform var(--duration-normal) var(--ease-emphasized);
  }
  .faq__indicator::before {
    inset-block-start: 50%;
    inset-inline: 0;
    height: 1.5px;
    transform: translateY(-50%);
  }
  .faq__indicator::after {
    inset-inline-start: 50%;
    inset-block: 0;
    width: 1.5px;
    transform: translateX(-50%);
  }
  .faq__item[open] .faq__indicator::after { transform: translateX(-50%) scaleY(0); }
  .faq__item[open] .faq__indicator { color: var(--color-accent); }

  .faq__item summary:hover { color: var(--color-accent); }
  .faq__item summary:hover .faq__indicator { color: var(--color-accent); }

  .faq__body {
    padding-block: 0 var(--space-6);
    max-width: 64ch;
    color: var(--color-text);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
  }

  .faq__body p + p { margin-top: var(--space-3); }

  /* ====================================================================
     Stelle list — the open-positions section
     --------------------------------------------------------------------
     One stelle = one row. Hairline-rule rhythm; row is no longer a single
     anchor (two distinct CTAs per row: primary "Jetzt bewerben" mailto
     and secondary "Mehr ansehen" → /karriere/<slug>). Title is its own
     link to the detail page so the row still feels reactive.
     ==================================================================== */

  .stelle-list {
    border-top: 1px solid var(--color-rule);
  }

  .stelle-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-5);
    padding-block: var(--space-6);
    border-bottom: 1px solid var(--color-rule);
    color: inherit;
    position: relative;
  }

  @media (min-width: 720px) {
    .stelle-card {
      grid-template-columns: minmax(0, 1fr) auto;
      gap: var(--space-7);
      align-items: start;
    }
  }

  .stelle-card__main {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 0;
  }

  .stelle-card__type {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-text-subtle);
    text-transform: uppercase;
    letter-spacing: var(--tracking-label);
  }

  .stelle-card__type::before {
    content: "";
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background-color: var(--color-accent);
    margin-right: var(--space-2);
    vertical-align: middle;
  }

  .stelle-card__title {
    font-size: var(--text-xl);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    color: var(--color-text-strong);
    font-weight: var(--font-medium);
    margin: 0;
    text-wrap: balance;
  }
  .stelle-card__title a {
    color: inherit;
    text-decoration: none;
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0 1px;
    background-repeat: no-repeat;
    background-position: 0 100%;
    transition: background-size var(--duration-normal) var(--ease-emphasized);
  }
  .stelle-card__title a:hover { background-size: 100% 1px; }

  .stelle-card__teaser {
    font-size: var(--text-base);
    color: var(--color-text);
    line-height: var(--leading-normal);
    max-width: 56ch;
    margin: 0;
  }

  .stelle-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-5);
    margin-top: var(--space-1);
    font-size: var(--text-sm);
  }

  .stelle-card__meta-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-text-muted);
  }

  .stelle-card__meta-item .icon {
    color: var(--color-text-subtle);
    width: 0.95rem;
    height: 0.95rem;
  }

  .stelle-card__actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    align-items: stretch;
  }

  @media (min-width: 720px) {
    .stelle-card__actions {
      min-width: 13.5rem;
      align-items: stretch;
    }
  }

  .stelle-card__actions .btn {
    justify-content: center;
  }

  /* Initiativbewerbung pseudo-card — sibling of real stellen but no detail
     page, so only the primary mailto CTA renders. Visually muted so it
     doesn't fight the actual open positions. */
  .stelle-card--initiativ .stelle-card__type::before {
    background-color: var(--color-text-subtle);
  }

  /* Hero meta row on /karriere/<slug> — scope + location chips under the
     hero lede, before the CTA actions. Reuses .stelle-card__meta-item. */
  .stelle-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-5);
    margin-top: var(--space-4);
    font-size: var(--text-sm);
  }

  /* Re-applied "Jetzt bewerben" CTA below the markdown body. */
  .stelle-body-cta {
    margin-top: var(--space-7);
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-rule);
    max-width: 70ch;
  }

  /* Aside accent image for the karriere section — small, decorative, optional */
  .karriere-aside {
    margin-top: var(--space-7);
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
    align-items: center;
  }

  @media (min-width: 880px) {
    .karriere-aside {
      grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
      gap: var(--space-8);
    }
  }

  .karriere-aside__image {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background-color: var(--stone-150);
    position: relative;
  }
  .karriere-aside__image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.85) contrast(1.02);
  }

  .karriere-aside__copy h3 {
    font-size: var(--text-2xl);
    line-height: var(--leading-snug);
    letter-spacing: var(--tracking-tight);
    color: var(--color-text-strong);
    font-weight: var(--font-medium);
    margin: 0 0 var(--space-3);
    text-wrap: balance;
  }
  .karriere-aside__copy p {
    color: var(--color-text);
    line-height: var(--leading-normal);
    max-width: 52ch;
    margin: 0 0 var(--space-5);
  }

  /* ====================================================================
     Hero — full-bleed image variant
     --------------------------------------------------------------------
     Sits beneath the editorial hero. Min-height 100vh; image fills the
     section with a layered overlay so white type stays legible without
     a hard scrim. Inverts hero text colors; mutes the existing purple
     corner glow.
     ==================================================================== */

  .hero--full {
    min-height: 100vh;
    padding-block: 0;
    color: var(--white);
    display: grid;
    align-items: end;
  }

  /* Cap on short viewports so a phone in landscape doesn't get an
     awkwardly stretched portrait. */
  @media (max-height: 640px) and (orientation: landscape) {
    .hero--full { min-height: 560px; }
  }

  /* Kill the light-mode purple corner glow on the dark variant */
  .hero--full::before { display: none; }

  .hero--full__image {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: block;
  }
  .hero--full__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 45%;
    filter: saturate(0.75) contrast(1.05);
  }

  .hero--full__overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
      linear-gradient(180deg,
        rgb(20 20 26 / 0.55) 0%,
        rgb(20 20 26 / 0.30) 35%,
        rgb(20 20 26 / 0.30) 60%,
        rgb(20 20 26 / 0.78) 100%),
      linear-gradient(90deg,
        rgb(20 20 26 / 0.45) 0%,
        rgb(20 20 26 / 0.10) 55%,
        transparent 100%),
      radial-gradient(80% 60% at 12% 90%,
        color-mix(in oklab, var(--ibu-purple) 22%, transparent) 0%,
        transparent 70%);
    pointer-events: none;
  }

  .hero--full .hero__inner {
    z-index: 2;
    padding-block: clamp(var(--space-7), 9vw, var(--space-10)) clamp(var(--space-7), 6vw, var(--space-9));
  }

  .hero--full .hero__motto {
    color: var(--white);
    text-shadow: 0 1px 24px rgb(0 0 0 / 0.35);
  }
  .hero--full .hero__motto em {
    color: color-mix(in oklab, var(--ibu-purple) 50%, var(--white));
  }
  .hero--full .hero__lede {
    color: color-mix(in oklab, var(--white) 88%, transparent);
    text-shadow: 0 1px 12px rgb(0 0 0 / 0.4);
  }
  .hero--full .hero__eyebrow {
    color: color-mix(in oklab, var(--white) 78%, transparent);
  }
  .hero--full .hero__eyebrow::before {
    background-color: color-mix(in oklab, var(--white) 70%, transparent);
  }

  .hero--full .hero__meta {
    border-top-color: color-mix(in oklab, var(--white) 28%, transparent);
  }
  .hero--full .hero__meta-key {
    color: color-mix(in oklab, var(--white) 65%, transparent);
  }
  .hero--full .hero__meta-value,
  .hero--full .hero__meta-value--list {
    color: var(--white);
  }

  /* ====================================================================
     Reveal-on-scroll animation
     --------------------------------------------------------------------
     Module pattern: any element with [data-reveal] starts hidden + 12px
     down, transitions to visible when JS adds .is-revealed. Stagger is
     applied via --reveal-delay (set by reveal.js for [data-reveal-group]
     children, or per-element via inline style). Falls back to visible
     under prefers-reduced-motion or no-JS (handled by JS itself).
     ==================================================================== */

  [data-reveal] {
    opacity: 0;
    transform: translateY(12px);
    transition:
      opacity 620ms var(--ease-emphasized),
      transform 620ms var(--ease-emphasized);
    transition-delay: var(--reveal-delay, 0ms);
    will-change: opacity, transform;
  }
  [data-reveal].is-revealed {
    opacity: 1;
    transform: translateY(0);
  }

  /* No-JS fallback — reveal everything immediately */
  html.no-js [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  @media (prefers-reduced-motion: reduce) {
    [data-reveal] {
      opacity: 1;
      transform: none;
      transition: none;
    }
  }

  /* ====================================================================
     Leistung detail page — Phase 3
     --------------------------------------------------------------------
     /leistungen/<slug> hero, body column, related projekte (3-up),
     sibling Gewerke chips. Hero borrows .deco--hero-dots from the
     editorial home hero so subpages read as one family.
     ==================================================================== */

  .leistung-hero {
    position: relative;
    overflow: hidden;
    /* Top padding is intentionally lighter than bottom — the sticky header
       (~4.75rem) already cushions the top edge, so we don't need a deep
       hero space above the breadcrumb. */
    padding-block: clamp(var(--space-5), 5vw, var(--space-7)) clamp(var(--space-7), 7vw, var(--space-9));
    background-color: var(--color-bg);
  }

  /* Subpage hero already provides ample bottom padding — collapsing the
     adjacent section's top padding avoids a doubled gap on /karriere,
     /leistungen, /leistungen/<slug>, /firmenprofil, /kontakt. */
  .leistung-hero + .section { padding-block-start: 0; }

  /* Place hero content above the dot-lattice deco */
  .leistung-hero > * { position: relative; z-index: 1; }
  .leistung-hero > .deco { z-index: 0; }

  .leistung-hero__inner {
    width: min(100% - 2 * var(--gutter-page), var(--container-wide));
    margin-inline: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
  }

  .leistung-hero__breadcrumb {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-text-subtle);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    text-transform: none;
    letter-spacing: 0;
  }

  .leistung-hero__breadcrumb a {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-standard);
  }

  .leistung-hero__breadcrumb a:hover {
    color: var(--color-accent);
    text-decoration: none;
  }

  .leistung-hero__breadcrumb [aria-current="page"] {
    color: var(--color-text-strong);
  }

  .leistung-hero__head {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    margin-top: var(--space-3);
  }

  .leistung-hero__index {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--color-text-subtle);
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
    padding-block: var(--space-2);
    border-top: 1px solid var(--color-rule-strong);
    flex: 1;
  }

  .leistung-hero__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    color: var(--color-accent);
    background-color: color-mix(in oklab, var(--color-accent) 8%, transparent);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
  }
  .leistung-hero__icon .icon { width: 2rem; height: 2rem; }

  @media (min-width: 720px) {
    .leistung-hero__icon {
      width: 5rem;
      height: 5rem;
    }
    .leistung-hero__icon .icon { width: 2.5rem; height: 2.5rem; }
  }

  .leistung-hero__title {
    font-size: var(--text-4xl);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tighter);
    color: var(--color-text-strong);
    font-weight: var(--font-medium);
    margin: 0;
    text-wrap: balance;
  }

  .leistung-hero__lede {
    font-size: var(--text-lg);
    line-height: var(--leading-snug);
    color: var(--color-text);
    max-width: 56ch;
    margin: 0;
  }

  .leistung-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-3);
  }

  /* ====================================================================
     Projekt strip — 3-up modifier for the leistung detail page
     --------------------------------------------------------------------
     Default .projekt-strip is 4-up at >=1000px; 3-up looks balanced
     for the per-gewerk subset (3 most-recent projekte).
     ==================================================================== */

  @media (min-width: 1000px) {
    .projekt-strip--3 { grid-template-columns: repeat(3, 1fr); }
    .projekt-strip--3 .projekt-card:nth-child(2n) { border-left: 1px solid var(--color-rule); }
    .projekt-strip--3 .projekt-card + .projekt-card { border-left: 1px solid var(--color-rule); }
  }

  /* ====================================================================
     Sibling Gewerke — chip-style row at page bottom
     --------------------------------------------------------------------
     A compact link to each of the other 4 leistungen. Lighter visual
     weight than the home's gewerk grid; the visitor has already seen
     the full version on the home.
     ==================================================================== */

  .leistung-siblings {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px solid var(--color-rule);
  }

  @media (min-width: 600px) {
    .leistung-siblings { grid-template-columns: repeat(2, 1fr); }
  }
  @media (min-width: 880px) {
    .leistung-siblings { grid-template-columns: repeat(4, 1fr); }
  }

  .leistung-sibling {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-4);
    border-bottom: 1px solid var(--color-rule);
    text-decoration: none;
    color: inherit;
    transition: background-color var(--duration-normal) var(--ease-standard);
    position: relative;
  }

  @media (min-width: 600px) {
    .leistung-siblings li:nth-child(2n) .leistung-sibling { border-left: 1px solid var(--color-rule); }
  }
  @media (min-width: 880px) {
    .leistung-siblings li:nth-child(2n) .leistung-sibling { border-left: 0; }
    .leistung-siblings li + li .leistung-sibling { border-left: 1px solid var(--color-rule); }
  }

  .leistung-sibling:hover {
    background-color: var(--color-bg-subtle);
    color: inherit;
    text-decoration: none;
  }

  .leistung-sibling__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    color: var(--color-accent);
    flex-shrink: 0;
    transition: transform var(--duration-normal) var(--ease-emphasized);
  }
  .leistung-sibling__icon .icon { width: 1.4rem; height: 1.4rem; }

  .leistung-sibling__label {
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    color: var(--color-text-strong);
    letter-spacing: var(--tracking-tight);
    flex: 1;
    min-width: 0;
  }

  /* Optional second line under a sibling label — used for stelle siblings
     to show the employment type (Vollzeit / Werkstudent / etc.) under the
     job title. Quiet mono treatment to match the index stamps elsewhere. */
  .leistung-sibling__sub {
    display: block;
    margin-top: 0.25rem;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: var(--font-regular);
    color: var(--color-text-subtle);
    text-transform: uppercase;
    letter-spacing: var(--tracking-label);
  }

  .leistung-sibling__arrow {
    color: var(--color-text-subtle);
    width: 1rem;
    height: 1rem;
    transition: transform var(--duration-normal) var(--ease-emphasized),
                color var(--duration-fast) var(--ease-standard);
  }

  .leistung-sibling:hover .leistung-sibling__arrow {
    transform: translateX(3px);
    color: var(--color-accent);
  }

  /* ====================================================================
     Leistung overview — vertical list on /leistungen. Each row = a full-
     width link to the detail page. Hairline-ruled, sober, scannable.
     ==================================================================== */

  .leistung-overview {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--color-rule);
  }

  .leistung-overview li { margin: 0; }

  .leistung-overview-item {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    padding: var(--space-6) 0;
    border-bottom: 1px solid var(--color-rule);
    text-decoration: none;
    color: inherit;
    transition: background-color var(--duration-normal) var(--ease-standard);
    position: relative;
  }

  @media (min-width: 720px) {
    .leistung-overview-item {
      grid-template-columns: auto minmax(0, 1fr) auto;
      gap: var(--space-6);
      align-items: center;
      padding: var(--space-7) var(--space-4);
    }
  }

  .leistung-overview-item:hover {
    background-color: var(--color-bg-subtle);
    color: inherit;
    text-decoration: none;
  }

  .leistung-overview-item__head {
    display: flex;
    align-items: center;
    gap: var(--space-4);
  }

  @media (min-width: 720px) {
    .leistung-overview-item__head {
      flex-direction: column;
      gap: var(--space-2);
      min-width: 4.5rem;
    }
  }

  .leistung-overview-item__index {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-text-subtle);
    font-variant-numeric: tabular-nums;
  }

  .leistung-overview-item__icon {
    width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in oklab, var(--color-accent) 25%, transparent);
    border-radius: var(--radius-xs);
    color: var(--color-accent);
    flex-shrink: 0;
  }
  .leistung-overview-item__icon .icon { width: 1.5rem; height: 1.5rem; }

  .leistung-overview-item__body { min-width: 0; }

  .leistung-overview-item__title {
    margin: 0;
    font-size: var(--text-2xl);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tighter);
    font-weight: var(--font-medium);
    color: var(--color-text-strong);
  }

  .leistung-overview-item__teaser {
    margin: var(--space-2) 0 0;
    font-size: var(--text-base);
    color: var(--color-text-muted);
    line-height: var(--leading-snug);
    max-width: 60ch;
  }

  .leistung-overview-item__arrow {
    display: none;
    color: var(--color-accent);
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-label);
    transform: translateX(0);
    transition: transform var(--duration-normal) var(--ease-emphasized);
  }
  .leistung-overview-item__arrow .icon {
    width: 1rem;
    height: 1rem;
  }

  @media (min-width: 720px) {
    .leistung-overview-item__arrow { display: inline-flex; }
  }

  .leistung-overview-item:hover .leistung-overview-item__arrow {
    transform: translateX(4px);
  }

  /* ====================================================================
     Referenzen — Phase 4
     --------------------------------------------------------------------
     Filter bar (sticky under header), chip-based gewerk filter, decade-
     grouped card grid. Cards stay rendered server-side; client JS toggles
     the `hidden` attribute via [data-projekt-card] hooks.
     ==================================================================== */

  /* Visually hidden helper — keeps content available to AT but invisible. */
  .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  /* --- Filter bar --------------------------------------------------- */

  .referenzen-filter {
    position: sticky;
    top: var(--header-height, 4.75rem);
    z-index: 30;
    background-color: color-mix(in oklab, var(--color-bg) 92%, transparent);
    backdrop-filter: saturate(140%) blur(8px);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
    border-block: 1px solid var(--color-rule);
    padding-block: var(--space-4);
  }

  .referenzen-filter__inner {
    width: min(100% - 2 * var(--gutter-page), var(--container-wide));
    margin-inline: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  @media (min-width: 720px) {
    .referenzen-filter__inner {
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
      gap: var(--space-5);
    }
  }

  /* --- Chips -------------------------------------------------------- */

  .referenzen-filter__chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .referenzen-chip {
    display: inline-flex;
    align-items: baseline;
    gap: var(--space-2);
    padding: 0.45rem 0.85rem;
    background-color: var(--color-bg-inset);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    letter-spacing: var(--tracking-tight);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-standard),
                background-color var(--duration-fast) var(--ease-standard),
                border-color var(--duration-fast) var(--ease-standard);
    cursor: pointer;
    white-space: nowrap;
  }

  .referenzen-chip:hover {
    color: var(--color-text-strong);
    border-color: var(--color-border-strong);
    text-decoration: none;
  }

  .referenzen-chip.is-active {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-text-on-accent);
  }

  .referenzen-chip__count {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: var(--font-normal);
    color: var(--color-text-subtle);
    font-variant-numeric: tabular-nums;
    transition: color var(--duration-fast) var(--ease-standard);
  }

  .referenzen-chip.is-active .referenzen-chip__count {
    color: color-mix(in oklab, var(--color-text-on-accent) 75%, transparent);
  }

  .referenzen-filter__status {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
  }

  /* --- Decade group ------------------------------------------------- */

  .section--referenzen .section__inner {
    display: flex;
    flex-direction: column;
    gap: clamp(var(--space-7), 6vw, var(--space-9));
  }

  .referenzen-decade {
    display: block;
    padding-block-start: var(--space-3);
  }

  .referenzen-decade__head {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: baseline;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
  }

  .referenzen-decade__label {
    font-family: var(--font-mono);
    font-size: var(--text-base);
    line-height: 1;
    letter-spacing: 0;
    color: var(--color-text-strong);
    font-weight: var(--font-medium);
    font-variant-numeric: tabular-nums;
  }

  .referenzen-decade__count {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-text-subtle);
    font-variant-numeric: tabular-nums;
    text-transform: uppercase;
    letter-spacing: var(--tracking-label);
  }

  .referenzen-decade__rule {
    display: block;
    height: 1px;
    background-color: var(--color-rule);
    align-self: center;
  }

  /* --- Card grid ---------------------------------------------------- */

  .referenzen-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  @media (min-width: 600px) {
    .referenzen-grid { grid-template-columns: repeat(2, 1fr); }
  }

  @media (min-width: 1000px) {
    .referenzen-grid { grid-template-columns: repeat(3, 1fr); }
  }

  /* Bordered-card variant of .projekt-card for the referenzen grid.
     Overrides the home-strip's hairline-stripe pattern. */
  .projekt-card--referenz {
    padding: var(--space-5);
    border: 1px solid var(--color-rule);
    border-radius: var(--radius-sm);
    background-color: var(--color-bg);
    gap: var(--space-3);
    transition: border-color var(--duration-normal) var(--ease-standard),
                box-shadow var(--duration-normal) var(--ease-standard),
                background-color var(--duration-normal) var(--ease-standard);
  }

  /* Reset the hover bg/underline trick from .projekt-card so it doesn't
     fight the bordered look. */
  .projekt-card--referenz:hover {
    border-color: var(--color-rule-strong);
    box-shadow: 0 1px 0 0 var(--color-rule-strong) inset;
    background-color: var(--color-bg-inset);
  }
  .projekt-card--referenz::after { display: none; }

  .projekt-card--referenz .projekt-card__title {
    font-size: var(--text-lg);
    text-wrap: balance;
  }

  .projekt-card__image {
    margin: calc(var(--space-5) * -1) calc(var(--space-5) * -1) 0;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    background-color: var(--stone-100, var(--color-bg-subtle));
  }

  .projekt-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .projekt-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-2);
    color: var(--color-text-muted);
    font-size: var(--text-xs);
  }

  .projekt-card__sep { color: var(--color-text-subtle); }

  .projekt-card__ort {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    overflow-wrap: anywhere;
  }

  /* --- Empty state -------------------------------------------------- */

  .referenzen-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-3);
    padding-block: var(--space-9);
    color: var(--color-text-muted);
  }

  .referenzen-empty__icon {
    width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-rule);
    border-radius: var(--radius-full);
    color: var(--color-text-subtle);
    margin-bottom: var(--space-2);
  }
  .referenzen-empty__icon .icon { width: 1.25rem; height: 1.25rem; }

  .referenzen-empty__msg {
    margin: 0;
    font-size: var(--text-base);
    color: var(--color-text-muted);
    max-width: 36ch;
  }

}
