/* Weiss/Schneider – Moto-Cross Sidecar Team
   Dunkles Farbschema (wie die bisherige Seite), Markenfarbe Blau #00387a.
   Keine externen Ressourcen, keine Inline-Styles (CSP). */

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

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
  ul[class], ol[class] { list-style: none; padding: 0; }
  img, svg, video, iframe { display: block; max-width: 100%; }
  img, video { height: auto; }
  button { font: inherit; color: inherit; }
}

@layer base {
  :root {
    color-scheme: dark;
    --bg: #131313;
    --surface: #1b1b1b;
    --surface-2: #242424;
    --line: #2f3238;
    --text: #f1f2f4;
    --muted: #aab0ba;
    --brand: #00387a;
    --brand-strong: oklch(0.42 0.14 258);
    --brand-light: oklch(0.72 0.13 255);
    --accent: #e84949;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 18px 40px -18px rgb(0 0 0 / .75);
    --header-h: 76px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --step--1: clamp(.84rem, .8rem + .15vw, .92rem);
    --step-0: clamp(1rem, .96rem + .2vw, 1.09rem);
    --step-1: clamp(1.15rem, 1.06rem + .45vw, 1.38rem);
    --step-2: clamp(1.4rem, 1.2rem + .9vw, 1.9rem);
    --step-3: clamp(1.8rem, 1.45rem + 1.7vw, 2.8rem);
    --step-4: clamp(2.3rem, 1.6rem + 3.3vw, 4.3rem);
  }

  html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

  body {
    background: var(--bg);
    color: var(--text);
    font: 400 var(--step-0)/1.6 var(--font);
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
  }

  h1, h2, h3 {
    line-height: 1.08;
    font-weight: 800;
    text-wrap: balance;
  }
  h1, h2 { font-style: italic; text-transform: uppercase; letter-spacing: -.01em; }
  h3 { font-size: var(--step-1); }
  p, li, dd { text-wrap: pretty; }

  a { color: var(--brand-light); text-underline-offset: .18em; text-decoration-thickness: 1px; }
  a:hover { color: #fff; }
  :focus-visible { outline: 3px solid var(--brand-light); outline-offset: 3px; border-radius: 4px; }
  ::selection { background: var(--brand); color: #fff; }
  strong { font-weight: 700; color: #fff; }
}

@layer layout {
  .container { width: min(100% - 32px, 1200px); margin-inline: auto; }
  .container-narrow { width: min(100% - 32px, 820px); margin-inline: auto; }

  .section { padding: clamp(56px, 7vw, 80px) 0; }
  .section-alt { background: var(--surface); }
  .section + .section:not(.section-alt):not(.section-brand) { border-top: 1px solid var(--line); }
  .section-alt + .section-alt { padding-top: 0; }

  .section-head { margin-bottom: clamp(28px, 4vw, 44px); max-width: 52rem; }
  .section-head h2 { font-size: var(--step-3); }
  .section-head p { color: var(--muted); font-size: var(--step-1); margin-top: .6rem; }
  .eyebrow {
    display: inline-block;
    font-size: var(--step--1);
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--brand-light);
    margin-bottom: .5rem;
  }

  .grid { display: grid; gap: clamp(16px, 2.5vw, 28px); grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--min, 260px)), 1fr)); }
  .split { display: grid; gap: clamp(28px, 5vw, 64px); grid-template-columns: minmax(0, 1fr); align-items: start; }
  @media (min-width: 900px) {
    .split { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); }
    .split-rev { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
  }
}

@layer components {
  /* Skip-Link */
  .skip-link {
    position: absolute; left: 12px; top: -60px; z-index: 100;
    background: #fff; color: #000; padding: .6rem 1rem; border-radius: var(--radius-sm); font-weight: 700;
    &:focus { top: 12px; }
  }

  /* Header */
  .site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgb(19 19 19 / .92);
    backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid var(--line);
    & .container { display: flex; align-items: center; gap: 20px; min-height: var(--header-h); }
  }
  .logo { display: block; flex: none; line-height: 0; }
  .logo img { height: 46px; width: auto; }
  @media (max-width: 420px) { .logo img { height: 38px; } }

  .nav { margin-left: auto; }
  .nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
  .nav a {
    display: block; padding: .5rem .7rem; border-radius: 999px;
    color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem; white-space: nowrap;
    &:hover { background: var(--surface-2); }
    &[aria-current="true"], &[aria-current="page"] { background: var(--brand); color: #fff; }
  }
  .nav-toggle { display: none; }

  @media (max-width: 1080px) {
    .nav-toggle {
      display: inline-flex; align-items: center; gap: .5rem; margin-left: auto;
      background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
      padding: .55rem .95rem; font-weight: 700; cursor: pointer;
      & svg { width: 20px; height: 20px; }
    }
    .nav {
      position: absolute; inset: 100% 0 auto 0;
      background: var(--bg); border-bottom: 1px solid var(--line);
      display: none; max-height: calc(100dvh - var(--header-h)); overflow-y: auto;
    }
    .site-header:has(.nav-toggle[aria-expanded="true"]) .nav { display: block; }
    .nav ul { flex-direction: column; padding: 10px 16px 18px; gap: 4px; }
    .nav a { padding: .8rem 1rem; border-radius: var(--radius-sm); font-size: 1.05rem; }
  }
  /* Ohne JS: Menü immer anzeigen */
  .no-js .nav-toggle { display: none; }
  .no-js .nav { position: static; display: block; }

  /* Buttons */
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .85rem 1.35rem; border-radius: 999px;
    background: var(--brand); color: #fff; border: 2px solid var(--brand);
    font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer;
    transition: background-color .2s, border-color .2s, transform .2s;
    &:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; transform: translateY(-1px); }
    & svg { width: 18px; height: 18px; flex: none; }
  }
  .btn-ghost { background: transparent; border-color: rgb(255 255 255 / .35); color: #fff;
    &:hover { background: rgb(255 255 255 / .08); border-color: #fff; } }
  .btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

  .icon { width: 1.1em; height: 1.1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

  /* Bildnachweis */
  .credit {
    position: absolute; right: 10px; bottom: 10px;
    background: rgb(0 0 0 / .45); border-radius: 6px; padding: 4px 6px; line-height: 0;
    & img { width: 84px; height: auto; }
  }
  .credit-text {
    position: absolute; right: 8px; bottom: 8px;
    background: rgb(0 0 0 / .6); color: #fff; font-size: .75rem; padding: 2px 8px; border-radius: 4px;
  }

  /* Karten */
  .card {
    background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
    padding: clamp(20px, 2.5vw, 28px);
  }
  .card h3 { margin-bottom: .5rem; }

  /* Foto mit Rahmen */
  .photo {
    position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
    & > img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
    & figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 14px 10px;
      background: linear-gradient(transparent, rgb(0 0 0 / .75)); font-size: var(--step--1); color: #e7e9ee; }
  }

  /* Video: erst nach Klick laden */
  .video { display: grid; gap: .6rem; align-content: start; }
  .video-frame {
    position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden;
    background: radial-gradient(circle at 30% 20%, #1d3a66, #0b0f17 70%);
    box-shadow: var(--shadow);
    & iframe, & video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
    & img { width: 100%; height: 100%; object-fit: cover; }
  }
  .video-play {
    position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; cursor: pointer;
    background: transparent; display: grid; place-items: center;
    & img { position: absolute; inset: 0; opacity: .85; transition: opacity .2s; }
    & .placeholder-title { position: absolute; inset: auto 16px 16px; font-weight: 800; font-style: italic; text-transform: uppercase; text-align: left; font-size: var(--step-1); line-height: 1.1; }
    &:hover img, &:focus-visible img { opacity: 1; }
  }
  .play-icon {
    position: relative; width: 72px; height: 72px; border-radius: 50%;
    background: var(--brand); display: grid; place-items: center; box-shadow: 0 8px 26px rgb(0 0 0 / .5);
    transition: transform .2s;
    & svg { width: 30px; height: 30px; fill: #fff; margin-left: 4px; }
  }
  .video-play:hover .play-icon { transform: scale(1.08); }
  .video figcaption { font-weight: 700; line-height: 1.3; }
  .video figcaption small { display: block; font-weight: 400; color: var(--muted); font-size: var(--step--1); margin-top: .25rem; }

  /* Artikel (News/Presse) */
  .article-body {
    & > * + * { margin-top: .9rem; }
    & h3 { margin-top: 1.4rem; font-size: var(--step-0); }
    & img { border-radius: var(--radius-sm); margin-block: .4rem; max-height: 70vh; width: auto; }
    & ul { padding-left: 1.2rem; }
    & a { overflow-wrap: anywhere; }
    & video { width: 100%; border-radius: var(--radius-sm); background: #000; }
    & .video { margin-block: 1rem; max-width: 720px; }
  }
  .file-link {
    display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .75rem .35rem .55rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--text);
    font-size: var(--step--1); font-weight: 600; max-width: 100%;
    & .icon { color: var(--accent); }
    & span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    &:hover { border-color: var(--brand-light); color: #fff; }
  }
  .missing { color: var(--muted); font-style: italic; font-size: var(--step--1); }

  /* Footer */
  .site-footer {
    border-top: 1px solid var(--line); padding: 28px 0 36px; color: var(--muted); font-size: var(--step--1);
    & .container { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; justify-content: space-between; }
    & nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
    & a { color: var(--muted); text-decoration: none; &:hover { color: #fff; text-decoration: underline; } }
  }

  /* Einblenden (nur mit JS, kurz) */
  .js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .45s ease, transform .45s ease; }
  .js .reveal.is-visible { opacity: 1; transform: none; }
  @media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; transition: none; } }
}

@layer pages {
  /* Hero */
  .hero {
    position: relative; padding: clamp(40px, 6vw, 80px) 0 clamp(56px, 7vw, 88px);
    background:
      radial-gradient(1100px 520px at 85% 0%, rgb(0 56 122 / .45), transparent 70%),
      var(--bg);
    overflow: hidden;
  }
  .hero-grid { display: grid; gap: clamp(32px, 5vw, 56px); grid-template-columns: minmax(0, 1fr); align-items: center; }
  @media (min-width: 980px) { .hero-grid { grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); } }
  .hero h1 { font-size: var(--step-4); }
  .hero h1 .hl { color: var(--brand-light); display: block; }
  .hero .lead { font-size: var(--step-1); color: #d5d9e0; margin: 1.2rem 0 1.8rem; max-width: 36rem; }
  .hero-media { position: relative; padding-bottom: clamp(48px, 9vw, 110px); }
  @media (max-width: 979px) { .hero-media { padding-bottom: 17vw; } .hero-side { width: 30%; left: 0; } }
  .hero-main { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
    & > img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; object-position: 60% 40%; } }
  .hero-side {
    position: absolute; left: -12px; bottom: 0; width: 35%;
    border-radius: var(--radius-sm); overflow: hidden; border: 4px solid var(--bg); box-shadow: var(--shadow);
    & img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; object-position: 50% 30%; }
  }
  .hero-badge {
    position: absolute; top: 14px; left: 14px;
    background: var(--brand); color: #fff; font-weight: 800; font-style: italic; letter-spacing: .02em;
    padding: .45rem .9rem; border-radius: 999px; white-space: nowrap; box-shadow: var(--shadow);
  }

  /* Abschied */
  .letter {
    font-size: var(--step-1); line-height: 1.65;
    & p + p { margin-top: 1rem; }
    & .greeting { font-weight: 700; color: #fff; }
    & .signature { font-style: italic; color: #fff; }
  }
  .letter-date { color: var(--muted); font-size: var(--step--1); margin-bottom: 1rem; }
  .sticky-media { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 16px; }

  /* Erfolge */
  .stats { --min: 210px; }
  .stat {
    background: linear-gradient(160deg, var(--brand), #00234d); border-radius: var(--radius); padding: 24px 22px;
    display: grid; gap: .35rem; align-content: start; box-shadow: var(--shadow);
    & .num { font-size: clamp(2.4rem, 2rem + 2vw, 3.4rem); font-weight: 900; font-style: italic; line-height: 1; white-space: nowrap; flex: none; }
    & .label { font-weight: 700; color: #fff; }
    & .sub { color: #c8d4e8; font-size: var(--step--1); }
  }
  .path {
    display: grid; gap: 0; margin-top: clamp(32px, 4vw, 48px); counter-reset: step;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
    & li {
      position: relative; padding: 18px 16px 18px 0; border-top: 3px solid var(--line);
      &::before { content: ""; position: absolute; top: -9px; left: 0; width: 15px; height: 15px; border-radius: 50%; background: var(--brand-light); }
      &:last-child { border-top-color: var(--brand-light); }
      & strong { display: block; }
      & span { color: var(--muted); font-size: var(--step--1); }
    }
  }

  /* Team */
  .people { --min: 230px; }
  .person {
    & .role { color: var(--brand-light); font-weight: 700; font-size: var(--step--1); text-transform: uppercase; letter-spacing: .1em; }
    & h3 { font-size: var(--step-2); font-style: italic; text-transform: uppercase; margin: .2rem 0 .8rem; }
    & dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .3rem .9rem; font-size: var(--step--1); }
    & dt { color: var(--muted); }
    & dd { color: var(--text); }
  }
  .equipment { --min: 280px; margin-top: clamp(28px, 4vw, 44px); }
  .equip { padding: 0; overflow: hidden;
    & img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
    & .equip-body { padding: 20px 22px 24px; }
    & ul { padding-left: 1.1rem; color: var(--muted); }
  }

  /* Galerie */
  .gallery { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
  .gallery a { position: relative; display: block; border-radius: var(--radius-sm); overflow: hidden;
    & > img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; transition: transform .35s ease; }
    &:hover > img { transform: scale(1.03); } }
  .album-card {
    display: grid; grid-template-columns: minmax(0, 1fr); text-decoration: none; color: var(--text);
    background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
    margin-top: 24px;
    & img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
    & .album-body { padding: 22px; align-self: center; }
    & h3 { font-size: var(--step-2); font-style: italic; text-transform: uppercase; }
    & p { color: var(--muted); margin: .3rem 0 .9rem; }
    &:hover { border-color: var(--brand-light); color: var(--text); }
  }
  @container (min-width: 640px) { .album-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); } }
  .album-wrap { container-type: inline-size; }
  .photo-credit { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: var(--step--1); margin-top: 16px;
    & img { width: 110px; height: auto; } }

  /* Liste (News/Presse-Vorschau) */
  .post-list { display: grid; gap: 14px; }
  .post {
    display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 18px; align-items: baseline;
    padding: 16px 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
    text-decoration: none; color: var(--text);
    & time { color: var(--brand-light); font-weight: 700; font-size: var(--step--1); white-space: nowrap; }
    & span { font-weight: 700; }
    &:hover { border-color: var(--brand-light); color: #fff; }
  }
  @media (max-width: 520px) { .post { grid-template-columns: minmax(0, 1fr); } }
  .year-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px;
    & a { display: inline-block; padding: .4rem .85rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2);
      color: var(--text); text-decoration: none; font-weight: 700; font-size: var(--step--1); }
    & a:hover, & a[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: #fff; }
    & small { color: var(--muted); font-weight: 400; margin-left: .25rem; }
    & a[aria-current="page"] small { color: #d6e2f5; } }

  /* Sponsoren */
  .sponsors { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); }
  @media (max-width: 480px) { .sponsors { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
  .sponsor {
    display: grid; place-items: center; background: #fff; border-radius: var(--radius-sm); padding: 8px; aspect-ratio: 16 / 10;
    transition: transform .2s, box-shadow .2s;
    & img { width: 100%; height: 100%; object-fit: contain; }
  }
  a.sponsor:hover { transform: translateY(-2px); box-shadow: 0 0 0 3px var(--brand-light); }

  .donors { columns: 4 200px; column-gap: 28px; margin-top: 18px; padding: 0;
    & li { break-inside: avoid; padding: .25rem 0; border-bottom: 1px dashed var(--line); }
    & small { color: var(--muted); } }

  /* Links */
  .linklist { --min: 280px; }
  .linkitem { display: block; text-decoration: none; color: var(--text);
    & strong { display: flex; align-items: center; gap: .4rem; color: var(--brand-light); }
    & span { color: var(--muted); font-size: var(--step--1); }
    &:hover strong { color: #fff; } }

  /* Kontakt */
  .contact-card {
    & h3 { font-size: var(--step-2); font-style: italic; text-transform: uppercase; }
    & p { color: var(--muted); margin: .3rem 0 1rem; }
    & .mail { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; overflow-wrap: anywhere; }
  }
  .section-brand { background: linear-gradient(135deg, var(--brand), #001f45); }
  .section-brand .eyebrow { color: #cfe0ff; }
  .section-brand .section-head p { color: #d5e1f5; }

  /* Unterseiten */
  .page-hero { padding: clamp(40px, 6vw, 72px) 0 clamp(24px, 4vw, 40px);
    background: radial-gradient(900px 400px at 80% 0%, rgb(0 56 122 / .4), transparent 70%);
    & h1 { font-size: var(--step-4); }
    & p { color: var(--muted); font-size: var(--step-1); margin-top: .7rem; max-width: 44rem; } }
  .back { display: flex; width: fit-content; gap: .35rem; align-items: center; text-decoration: none; font-weight: 700; margin-bottom: 1.2rem; }
  .archive-article {
    padding: clamp(24px, 3vw, 32px) 0; border-top: 1px solid var(--line);
    & header { margin-bottom: 1rem; }
    & time { color: var(--brand-light); font-weight: 700; font-size: var(--step--1); }
    & h2 { font-size: var(--step-2); margin-top: .25rem; }
    &:target { scroll-margin-top: calc(var(--header-h) + 16px); }
    &:target h2 { color: var(--brand-light); }
  }
  .year-nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 28px 0 8px; border-top: 1px solid var(--line); }
  .archive-index { display: grid; gap: clamp(28px, 4vw, 40px); }
  .archive-index h2 { font-size: var(--step-2); display: flex; align-items: baseline; gap: .6rem; }
  @media (max-width: 520px) { .archive-index li a { grid-template-columns: minmax(0, 1fr); gap: 0; } }
  .archive-index h2 small { font-size: var(--step--1); color: var(--muted); font-style: normal; text-transform: none; font-weight: 400; }
  .archive-index ul { list-style: none; padding: 0; margin-top: .7rem; display: grid; gap: 2px; }
  .archive-index li a { display: grid; grid-template-columns: 11.5rem minmax(0, 1fr); gap: 4px 16px; align-items: baseline; padding: .45rem .6rem; border-radius: 6px; text-decoration: none; color: var(--text);
    & time { color: var(--muted); font-size: var(--step--1); white-space: nowrap; }
    &:hover { background: var(--surface-2); color: #fff; } }

  /* Rechtliches */
  .legal {
    & h2 { font-size: var(--step-2); margin: 2.2rem 0 .7rem; }
    & h3 { margin: 1.4rem 0 .4rem; font-size: var(--step-0); }
    & p, & ul { color: #d6d9df; }
    & p + p, & ul + p, & p + ul { margin-top: .7rem; }
    & ul { padding-left: 1.2rem; }
    & address { font-style: normal; }
    & .stand { color: var(--muted); margin-top: 2.4rem; font-size: var(--step--1); }
  }

  /* 404 */
  .notfound { min-height: 62vh; display: grid; align-items: center; }
  .notfound .code {
    font-size: clamp(5rem, 18vw, 10rem); font-weight: 900; font-style: italic; line-height: 1; letter-spacing: -.04em;
    background: linear-gradient(100deg, var(--brand-light), #fff); -webkit-background-clip: text; background-clip: text; color: transparent;
  }
  .notfound h1 { font-size: var(--step-3); margin-block: .5rem 1rem; }
  .notfound p { color: var(--muted); font-size: var(--step-1); max-width: 38rem; margin-bottom: 1.6rem; }
}

@layer utilities {
  .visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .mt { margin-top: clamp(20px, 3vw, 32px); }
  .muted { color: var(--muted); }
  .nowrap { white-space: nowrap; }
}
