/* ============================================================
   RIETHMÜLLERPLAN Gebäudetechnik GmbH — riethmuellerplan.de
   Token-System: 1 Neutral-Stamm + 1 Akzent (Marken-Orange)
   Primitive → semantische → Komponenten-Ebene
   ============================================================ */

:root {
  /* Primitive — aus dem Logo gemessen */
  --brand-orange: #FC9D02;          /* oklch(.763 .155 70)  Logo-Punktkreis */
  --brand-orange-deep: #D98400;     /* Hover/aktive Zustände, gleiche Helligkeitsachse */
  --brand-orange-soft: #FFF4E0;     /* Flächen-Tint, sehr hell */
  --gray-950: #161615;              /* Off-Black, nie #000 im Fließbild */
  --gray-700: #4A4A48;
  --gray-500: #6E6E6B;
  --gray-400: #9A9A9A;              /* Logo-Grau — nur für Deko/große Typo */
  --gray-200: #E4E4E1;
  --gray-100: #F1F1EE;
  --gray-050: #F7F7F5;
  --white: #FEFEFD;

  /* Semantisch */
  --bg: var(--white);
  --bg-raised: var(--gray-050);
  --ink: var(--gray-950);
  --ink-soft: var(--gray-700);
  --ink-mute: var(--gray-500);
  --line: var(--gray-200);
  --accent: var(--brand-orange);
  --accent-deep: var(--brand-orange-deep);
  --accent-soft: var(--brand-orange-soft);

  /* Typo */
  --font-sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "Cascadia Mono", ui-monospace, monospace;

  /* Rhythmus */
  --space-section: clamp(5.5rem, 11vw, 9rem);
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --maxw: 1240px;
  --radius: 2px;                    /* Kantensystem: scharf, ingenieurmäßig */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Fonts (lokal, DSGVO-konform) ---------- */
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

/* ---------- Reset / Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  overflow-x: clip;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul[class], ol[class] { padding: 0; list-style: none; }
button { font: inherit; }

::selection { background: var(--accent); color: var(--white); }

/* Skip-Link nach sr-only-Muster (kein Off-Screen-Positioning noetig) */
.skip-link {
  position: absolute; left: 0; top: 0; z-index: 100;
  width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
  background: var(--ink); color: var(--white); font-size: .9rem;
}
.skip-link:focus {
  width: auto; height: auto; clip-path: none; white-space: normal;
  padding: .6rem 1rem;
}

:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 3px;
}

.wrap {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Marken-Element: Punktkreis ---------- */
.dotring { display: inline-block; }
.dotring circle { fill: var(--accent); }

/* Header-Brand */
.brand {
  display: flex; align-items: center; gap: .65rem;
  text-decoration: none;
}
.brand .dotring { width: 30px; height: 30px; flex: none; }
.brand-text { line-height: 1.15; }
.brand-name {
  font-size: 1.14rem; font-weight: 600; letter-spacing: -0.015em;
  color: var(--ink); white-space: nowrap;
}
/* Logo-Grau #9A9A9A besteht auf Weiß kein WCAG AA, daher dunklere Web-Stufe */
.brand-name span { color: var(--gray-500); }
.brand-sub {
  font-size: .72rem; font-weight: 500; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-mute);
}

/* ---------- Header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--white) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.site-head.is-scrolled { border-bottom-color: var(--line); }
.site-head-in {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; height: 72px;
}
.site-nav { display: flex; align-items: center; gap: clamp(1.1rem, 2.4vw, 2.2rem); }
.site-nav a {
  text-decoration: none; font-size: .95rem; font-weight: 500;
  color: var(--ink-soft); position: relative; padding-block: .35rem;
}
.site-nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0;
  height: 2px; background: var(--accent);
  transition: right .35s var(--ease);
}
.site-nav a:hover { color: var(--ink); }
.site-nav a:hover::after { right: 0; }

.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .78rem 1.5rem; border-radius: var(--radius);
  text-decoration: none; font-weight: 600; font-size: .98rem;
  border: 1px solid transparent;
  transition: background .25s var(--ease), color .25s var(--ease),
              border-color .25s var(--ease), transform .15s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--white); }
.btn-primary:hover { background: #33332F; }
.btn-primary .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.btn-ghost { border-color: var(--gray-950); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--white); }
.btn-head { padding: .6rem 1.15rem; font-size: .9rem; }

.nav-toggle {
  display: none; background: none; border: 0; cursor: pointer;
  width: 44px; height: 44px; padding: 10px; margin-right: -10px;
}
.nav-toggle span {
  display: block; height: 2px; background: var(--ink); margin: 5px 0;
  transition: transform .3s var(--ease), opacity .2s;
}

/* ---------- Hero ---------- */
.hero { padding-block: clamp(2.5rem, 6vw, 5rem) 0; }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 10fr) minmax(0, 9fr);
  gap: clamp(2rem, 5vw, 4.5rem); align-items: center;
}
.hero h1 {
  font-size: clamp(2.4rem, 4.6vw, 3.7rem);
  line-height: 1.06; letter-spacing: -0.03em; font-weight: 700;
  max-width: 21ch;
}
/* Akzent im H1 als orange Unterstreichung: Markenfarbe ohne Kontrastverlust */
.hero h1 em {
  font-style: normal; color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: .07em;
  text-underline-offset: .09em;
}
.hero-sub {
  margin-top: 1.4rem; font-size: clamp(1.05rem, 1.5vw, 1.2rem);
  color: var(--ink-soft); max-width: 44ch;
}
.hero-cta { margin-top: 2.2rem; display: flex; flex-wrap: wrap; gap: .9rem; }
.hero-fact {
  margin-top: 3rem; padding-top: 1.4rem; border-top: 1px solid var(--line);
  display: flex; gap: clamp(1.5rem, 4vw, 3rem);
}
.hero-fact div { min-width: 0; }
.hero-fact .num {
  display: block; font-family: var(--font-mono); font-size: 1.5rem; font-weight: 500;
  color: var(--ink); letter-spacing: -0.02em; white-space: nowrap;
}
.hero-fact .lbl { display: block; font-size: .84rem; color: var(--ink-mute); line-height: 1.4; margin-top: .2rem; }

/* padding-top reserviert Raum für den Punktkreis: er überlappt die Bildkante,
   bleibt aber vollständig im Element (kein Clipping durch body overflow-x) */
.hero-media { position: relative; padding-top: 44px; }
.hero-media img {
  width: 100%; aspect-ratio: 4 / 3.4; object-fit: cover;
  border-radius: var(--radius);
}
.hero-media figcaption {
  margin-top: .7rem; font-family: var(--font-mono);
  font-size: .78rem; color: var(--ink-mute);
}
.hero-media .dotring {
  position: absolute; top: 0; right: 4px; width: 112px; height: 112px;
  pointer-events: none;
}

/* ---------- Sektionen ---------- */
.section { padding-block: var(--space-section); }
.section-tint { background: var(--bg-raised); }
.section-head { max-width: 62ch; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.section-head h2 {
  font-size: clamp(1.9rem, 3.4vw, 2.7rem);
  line-height: 1.12; letter-spacing: -0.025em; font-weight: 700;
}
.section-head p { margin-top: 1rem; color: var(--ink-soft); }

/* Gewerke-Matrix */
.trades {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}
.trade {
  padding: 1.9rem 1.6rem 2.1rem 0;
  border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: .55rem;
}
.trade:nth-child(3n+2) { padding-left: 1.6rem; }
.trade:nth-child(3n)   { padding-left: 1.6rem; }
.trade .kg {
  font-family: var(--font-mono); font-size: .8rem; color: var(--ink-mute);
  font-weight: 500;
}
.trade h3 { font-size: 1.22rem; font-weight: 600; letter-spacing: -0.015em; }
.trade p { font-size: .95rem; color: var(--ink-soft); line-height: 1.6; }
.trades-note {
  margin-top: 1.6rem; font-size: .95rem; color: var(--ink-mute); max-width: 70ch;
}

/* Leistungsphasen-Leiste */
.phases { position: relative; }
.phases-track {
  display: grid; grid-template-columns: repeat(9, 1fr);
  gap: 0; position: relative; margin-top: 3.2rem;
}
.phases-track::before {
  content: ""; position: absolute; top: 5px; left: calc(100% / 18);
  right: calc(100% / 18); height: 1px; background: var(--gray-400);
}
.phase { text-align: center; position: relative; padding-top: 1.6rem; }
.phase::before {
  content: ""; position: absolute; top: 0; left: 50%; translate: -50% 0;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent);
}
.phase .no {
  font-family: var(--font-mono); font-size: .8rem; color: var(--ink-mute);
  display: block;
}
.phase .name { font-size: .88rem; font-weight: 500; line-height: 1.35; display: block; margin-top: .15rem; }

/* ---------- Referenzen ---------- */
.refs-photo { margin-bottom: clamp(2.8rem, 6vw, 4.5rem); }
.refs-photo img {
  width: 100%; aspect-ratio: 21 / 9; object-fit: cover; object-position: center 62%;
  border-radius: var(--radius);
}
.refs-photo figcaption {
  margin-top: .7rem; font-family: var(--font-mono); font-size: .78rem; color: var(--ink-mute);
}

.refs-group { margin-top: 3.4rem; }
.refs-group:first-of-type { margin-top: 0; }
.refs-group-head {
  display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.5rem;
}
.refs-group-head h3 { font-size: 1.3rem; font-weight: 600; letter-spacing: -0.015em; }
.refs-group-head .count {
  font-family: var(--font-mono); font-size: .82rem; color: var(--ink-mute);
}

.project {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr) minmax(0, 2.6fr);
  gap: 1.2rem 2.2rem;
  padding-block: 1.35rem;
  align-items: baseline;
}
.project + .project { border-top: 1px solid var(--line); }
.project h4 { font-size: 1.08rem; font-weight: 600; letter-spacing: -0.012em; line-height: 1.4; }
.project .client { font-size: .9rem; color: var(--ink-mute); margin-top: .15rem; }
.project .task { font-size: .95rem; color: var(--ink-soft); line-height: 1.55; }
.project .meta { text-align: right; }
.project .sum {
  font-family: var(--font-mono); font-size: .95rem; font-weight: 500; white-space: nowrap;
}
.project .sum abbr { text-decoration: none; }
.project .year {
  font-family: var(--font-mono); font-size: .78rem; color: var(--ink-mute);
  display: block; margin-top: .2rem;
}
.refs-note { margin-top: 2.2rem; font-size: .9rem; color: var(--ink-mute); }

/* ---------- Bild-Break ---------- */
.break-media { position: relative; }
.break-media img {
  width: 100%; height: clamp(300px, 46vw, 460px); object-fit: cover;
}

/* ---------- Büro ---------- */
.office-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 5rem); align-items: start;
}
.office-text p + p { margin-top: 1.1rem; }
.office-text .lead { font-size: 1.18rem; line-height: 1.6; color: var(--ink); }
.office-text p { color: var(--ink-soft); }
.office-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid var(--line); }
.fact {
  padding: 1.6rem 1.2rem 1.8rem 0;
  border-bottom: 1px solid var(--line);
}
.fact:nth-child(2n) { padding-left: 1.6rem; }
.fact .num {
  font-family: var(--font-mono); font-size: clamp(1.9rem, 3vw, 2.5rem);
  font-weight: 500; letter-spacing: -0.03em; line-height: 1.1;
}
.fact .num sup { font-size: .55em; }
.fact .lbl { font-size: .88rem; color: var(--ink-mute); margin-top: .35rem; line-height: 1.45; }

/* ---------- Kontakt ---------- */
.contact { background: var(--gray-950); color: var(--gray-100); }
.contact .section-head h2 { color: var(--white); }
.contact .section-head p { color: var(--gray-400); }
.contact-grid {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 5rem);
}
.contact-main a.big {
  display: block; text-decoration: none; font-weight: 600;
  font-size: clamp(1.45rem, 3vw, 2.1rem); letter-spacing: -0.02em;
  color: var(--white); width: fit-content; max-width: 100%;
  transition: color .25s var(--ease);
  overflow-wrap: anywhere;
}
.contact-main a.big:hover { color: var(--accent); }
.contact-main a.big + a.big { margin-top: .8rem; }
.contact-note { margin-top: 1.9rem; font-size: .95rem; color: var(--gray-400); max-width: 46ch; }
.contact-aside address {
  font-style: normal; line-height: 1.75; color: var(--gray-100);
}
.contact-aside .h {
  font-family: var(--font-mono); font-size: .78rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--gray-400); margin-bottom: .6rem;
}
.contact-aside .block + .h { margin-top: 2rem; }
.contact-aside a { color: inherit; text-decoration-color: var(--gray-500); text-underline-offset: 3px; }
.contact-aside a:hover { color: var(--accent); }

/* ---------- Footer ---------- */
.site-foot { background: var(--gray-950); color: var(--gray-400); border-top: 1px solid #2A2A28; }
.site-foot-in {
  display: flex; flex-wrap: wrap; gap: 1rem 2.5rem;
  align-items: center; justify-content: space-between;
  padding-block: 1.7rem; font-size: .88rem;
}
.site-foot .brand-name { color: var(--gray-100); font-size: 1rem; }
.site-foot .brand-name span { color: var(--gray-400); }
.site-foot .dotring { width: 22px; height: 22px; }
.site-foot nav { display: flex; gap: 1.6rem; }
.site-foot a { color: var(--gray-400); text-decoration: none; }
.site-foot a:hover { color: var(--white); }

/* ---------- Unterseiten (Impressum / Datenschutz) ---------- */
.page-plain { padding-block: clamp(3rem, 7vw, 5rem) var(--space-section); }
.page-plain .wrap { max-width: 780px; }
.page-plain h1 { font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -0.025em; line-height: 1.1; }
.page-plain h2 { font-size: 1.25rem; margin-top: 2.6rem; letter-spacing: -0.01em; }
.page-plain p, .page-plain address, .page-plain li { color: var(--ink-soft); font-style: normal; }
.page-plain p, .page-plain address { margin-top: .9rem; }
.page-plain ul { margin-top: .9rem; padding-left: 1.2rem; }
.page-plain a { text-underline-offset: 3px; }
.page-plain .backlink {
  display: inline-block; margin-bottom: 2.2rem; text-decoration: none;
  font-size: .92rem; font-weight: 500; color: var(--ink-mute);
}
.page-plain .backlink:hover { color: var(--ink); }

/* ---------- Reveal-Animationen ---------- */
@media (prefers-reduced-motion: no-preference) {
  .rv {
    opacity: 0; transform: translateY(26px);
    transition: opacity .8s var(--ease), transform .8s var(--ease);
    transition-delay: var(--rv-delay, 0s);
  }
  .rv.is-in { opacity: 1; transform: none; }

  .hero-media img { clip-path: inset(0 0 0 0 round var(--radius)); }
  .rv-img { clip-path: inset(8% 6% 8% 6% round var(--radius)); opacity: 0; transform: scale(1.03);
    transition: clip-path 1s var(--ease), opacity .9s var(--ease), transform 1.2s var(--ease); }
  .rv-img.is-in { clip-path: inset(0 0 0 0 round var(--radius)); opacity: 1; transform: none; }

  .dotring.spin-in circle {
    opacity: 0; transform: scale(.2); transform-origin: center; transform-box: fill-box;
    animation: dot-in .5s var(--ease) forwards;
    animation-delay: calc(var(--i) * 55ms + .15s);
  }
  @keyframes dot-in { to { opacity: 1; transform: scale(1); } }
}

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .site-nav { display: none; }
  .site-head .btn-head { display: none; }
  .nav-toggle { display: block; }
  .site-head.nav-open .site-nav {
    display: flex; flex-direction: column; align-items: flex-start;
    position: absolute; top: 72px; left: 0; right: 0;
    background: var(--white); border-bottom: 1px solid var(--line);
    padding: 1.2rem var(--gutter) 1.6rem; gap: 1.1rem;
  }
  .site-head.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .site-head.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  .site-head.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .hero-grid { grid-template-columns: 1fr; }
  .hero h1 { max-width: 16ch; }
  .hero-media { padding-top: 32px; }
  .hero-media .dotring { width: 84px; height: 84px; }

  .trades { grid-template-columns: 1fr 1fr; }
  .trade { padding-left: 0 !important; padding-right: 1.4rem; }
  .trade:nth-child(2n) { padding-left: 1.4rem !important; padding-right: 0; }

  .phases-track { grid-template-columns: repeat(3, 1fr); gap: 1.6rem 0; }
  .phases-track::before { display: none; }

  .office-grid, .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  body { font-size: 1rem; }
  .project { grid-template-columns: 1fr; gap: .45rem; }
  .project .meta { text-align: left; display: flex; gap: 1rem; align-items: baseline; }
  .project .year { margin-top: 0; }
  .trades { grid-template-columns: 1fr; }
  .trade { padding-left: 0 !important; padding-right: 0; }
  .refs-photo img { aspect-ratio: 16 / 10; }
  .hero-fact { flex-wrap: wrap; gap: 1.2rem 2rem; }
  .phases-track { grid-template-columns: repeat(3, 1fr); }
  .office-facts { grid-template-columns: 1fr 1fr; }
}

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

@media print {
  .site-head, .site-foot, .hero-cta, .break-media { display: none; }
}
