/* ==========================================================
   Schwarz Elektro Kassel — Stylesheet
   Design language: technical drawing / Schaltplan-Ästhetik
   ========================================================== */

/* Self-hosted fonts (no request to Google at page load —
   see Datenschutzerklärung for background) */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/space-grotesk-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/space-grotesk-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/space-grotesk-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/inter-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/inter-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/inter-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
}

:root {
  /* Colour tokens — light theme (default) */
  --surface: #F6F4EE;
  --surface-alt: #EDE9DE;
  --text: #1C1B18;
  --text-soft: #55524A;
  --accent: #A85A2A;
  --accent-soft: #C98A5C;
  --secondary: #2C4B49;
  --line: #D8D2C1;
  --line-strong: #B9B29E;

  /* The "night" contact block is always dark, in both themes —
     it's a deliberate inverted accent section, not a page surface. */
  --night: #1C1B18;
  --on-night: #F6F4EE;

  /* Type */
  --font-display: 'Space Grotesk', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  --radius: 3px;

  color-scheme: light;
}

[data-theme="dark"] {
  --surface: #17181B;
  --surface-alt: #212327;
  --text: #EDEAE2;
  --text-soft: #A6A297;
  --accent: #E0955F;
  --accent-soft: #EDB489;
  --secondary: #7FB2AC;
  --line: #2A2C27;
  --line-strong: #3D3F37;

  /* Slightly recessed relative to the (now dark) page background,
     with its own border for definition — see .contact-section */
  --night: #0C0D0E;
  --on-night: #F1EFE8;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

img { max-width: 100%; display: block; }

a {
  color: inherit;
  text-decoration: none;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 32px;
}

/* --- background texture: faint grid, like graph/schematic paper --- */
.grid-texture {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath d='M0 0.5H48M0.5 0V48' stroke='%23D8D2C1' stroke-width='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 48px 48px;
  opacity: 0.4;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 900px;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
  transform: translateZ(0);
}

[data-theme="dark"] .grid-texture {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath d='M0 0.5H48M0.5 0V48' stroke='%233A3D38' stroke-width='1'/%3E%3C/svg%3E");
  opacity: 0.6;
}

/* --- eyebrow / mono labels --- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.eyebrow::before {
  content: '';
  width: 18px;
  height: 1px;
  background: var(--accent);
  display: inline-block;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text);
}

/* ==================== HEADER ==================== */

header.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  transition: box-shadow 0.2s ease;
}

header.site-header.scrolled {
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.logo-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.logo-text-sub {
  display: block;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--text-soft);
  text-transform: uppercase;
  margin-top: 1px;
}

nav.main-nav {
  display: flex;
  align-items: center;
  gap: 36px;
}

nav.main-nav a.nav-link {
  font-size: 14.5px;
  color: var(--text-soft);
  position: relative;
  padding: 4px 0;
  transition: color 0.15s ease;
}

nav.main-nav a.nav-link:hover { color: var(--text); }

nav.main-nav a.nav-link::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}

nav.main-nav a.nav-link:hover::after { transform: scaleX(1); }

.header-cta {
  display: flex;
  align-items: center;
  gap: 22px;
}

.tel-link {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
  display: none;
}

/* --- Theme toggle: styled like a physical rocker light switch --- */
.theme-toggle {
  position: relative;
  width: 46px;
  height: 25px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--surface-alt);
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover { border-color: var(--accent); }

.theme-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(.65,0,.35,1), background-color 0.2s ease;
}

.theme-toggle[aria-checked="true"] .theme-toggle-thumb {
  transform: translateX(21px);
  background: var(--accent);
  border-color: var(--accent);
}

.theme-toggle-thumb svg {
  width: 12px;
  height: 12px;
  color: var(--text-soft);
  transition: opacity 0.15s ease;
}

.theme-toggle-thumb .icon-moon { position: absolute; opacity: 0; }
.theme-toggle[aria-checked="true"] .theme-toggle-thumb .icon-sun { opacity: 0; }
.theme-toggle[aria-checked="true"] .theme-toggle-thumb .icon-moon {
  opacity: 1;
  color: var(--night);
}

.btn {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 10px 18px;
  border: 1px solid var(--text);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.18s ease, color 0.18s ease, border-color .18s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--text);
  color: var(--surface);
}
.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-ghost:hover {
  background: var(--text);
  color: var(--surface);
}

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.menu-toggle span, .menu-toggle span::before, .menu-toggle span::after {
  content: '';
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--text);
  position: relative;
  transition: transform .2s ease, opacity .2s ease;
}
.menu-toggle span::before { position: absolute; top: -6px; }
.menu-toggle span::after { position: absolute; top: 6px; }

/* ==================== HERO ==================== */

.hero {
  position: relative;
  padding: 96px 0 80px;
  overflow: hidden;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero-copy h1 {
  font-size: clamp(2.4rem, 4.4vw, 3.6rem);
  line-height: 1.08;
  margin: 20px 0 24px;
}

.hero-copy h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero-copy p.lead {
  font-size: 17px;
  color: var(--text-soft);
  max-width: 46ch;
  margin-bottom: 34px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-diagram {
  position: relative;
}

.hero-diagram svg {
  width: 100%;
  height: auto;
  opacity: 0;
}

.hero-diagram svg.ready {
  opacity: 1;
  transition: opacity 0.25s ease;
}

.schematic-line {
  fill: none;
  stroke: var(--text);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.schematic-line.accent {
  stroke: var(--accent);
}

.schematic-line.petrol {
  stroke: var(--secondary);
}

.schematic-dash {
  stroke-dasharray: 4 4;
}

.schematic-node {
  fill: var(--surface);
  stroke: var(--text);
  stroke-width: 1.4;
}

.schematic-node.accent {
  stroke: var(--accent);
  fill: var(--accent);
}

.schematic-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  fill: var(--text-soft);
  letter-spacing: 0.04em;
}

/* Hidden by default (dasharray/offset larger than any real path in
   this diagram) so nothing flashes fully-drawn before JS measures
   the true length of each path and animates it in. */
.hero-diagram .draw {
  stroke-dasharray: 2000;
  stroke-dashoffset: 2000;
}

.fade-in-node {
  opacity: 0;
  animation: fadeInNode 0.5s ease forwards;
}
@keyframes fadeInNode {
  to { opacity: 1; }
}

/* Once the hero animation has finished, drop transition/animation
   properties entirely so browsers — Firefox in particular — can
   release the compositing layers instead of tracking them
   indefinitely during scroll. */
.hero-diagram.anim-done .fade-in-node {
  animation: none;
  opacity: 1;
}

/* ==================== STRIP / FACTS ==================== */

.facts-strip {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 22px 0;
}

.facts-strip .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 40px;
  justify-content: space-between;
}

.fact {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-soft);
  display: flex;
  align-items: baseline;
  gap: 8px;
  letter-spacing: 0.01em;
}

.fact strong {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--text);
  font-weight: 600;
}

/* ==================== SECTION GENERIC ==================== */

section {
  padding: 96px 0;
  position: relative;
}

.section-head {
  max-width: 640px;
  margin-bottom: 56px;
}

.section-head h2 {
  font-size: clamp(1.7rem, 2.6vw, 2.3rem);
  margin-top: 16px;
}

.section-head p {
  color: var(--text-soft);
  margin-top: 16px;
  font-size: 16px;
}

/* ==================== ABOUT ==================== */

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: start;
}

.about-copy p {
  color: var(--text-soft);
  margin-bottom: 18px;
  font-size: 16px;
}

.about-copy p.emphasis {
  color: var(--text);
  font-size: 18px;
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.4;
}

.timeline {
  border-left: 1px solid var(--line-strong);
  padding-left: 28px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.timeline-item {
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -33px;
  top: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--accent);
}

.timeline-year {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.timeline-item h4 {
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 600;
  margin: 4px 0 4px;
}

.timeline-item p {
  color: var(--text-soft);
  font-size: 14.5px;
  margin: 0;
}

/* ==================== SERVICES ==================== */

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.service-card {
  background: var(--surface);
  padding: 36px 30px;
  transition: background 0.2s ease;
}

.service-card:hover {
  background: var(--surface-alt);
}

.service-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 22px;
}

.service-icon svg {
  width: 100%;
  height: 100%;
}

.service-card h3 {
  font-size: 17px;
  margin-bottom: 10px;
}

.service-card p {
  color: var(--text-soft);
  font-size: 14.5px;
  margin: 0;
}

/* ==================== CONTACT ==================== */

.contact-section {
  background: var(--night);
  color: var(--on-night);
  border-top: 1px solid var(--line);
}

.contact-section .eyebrow { color: var(--accent-soft); }
.contact-section .eyebrow::before { background: var(--accent-soft); }

.contact-section h2 { color: var(--on-night); }

.contact-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 64px;
  align-items: start;
}

.contact-section p.lead {
  color: rgba(246, 244, 238, 0.68);
  font-size: 17px;
  max-width: 44ch;
  margin: 18px 0 32px;
}

.contact-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.contact-list li {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  border-bottom: 1px solid rgba(246,244,238,0.14);
  padding-bottom: 18px;
}

.contact-list .ico {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--accent-soft);
}

.contact-list .label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(246,244,238,0.5);
  display: block;
  margin-bottom: 4px;
}

.contact-list .value {
  font-size: 16.5px;
}

.contact-list a.value:hover { color: var(--accent-soft); }

.contact-card {
  background: rgba(246, 244, 238, 0.04);
  border: 1px solid rgba(246, 244, 238, 0.16);
  border-radius: var(--radius);
  padding: 34px;
}

.contact-card h3 {
  color: var(--on-night);
  font-size: 18px;
  margin-bottom: 14px;
}

.contact-card p {
  color: rgba(246, 244, 238, 0.62);
  font-size: 14.5px;
  margin-bottom: 24px;
}

.contact-card .btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-night);
  width: 100%;
  justify-content: center;
}
.contact-card .btn-primary:hover {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
}

.map-note {
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(246,246,238,0.45);
  margin-top: 16px;
}

/* ---- Anfahrt / Map widget ---- */

.route-block {
  margin-top: 64px;
  padding-top: 48px;
  border-top: 1px solid rgba(246, 244, 238, 0.14);
}

.route-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.route-head h3 {
  color: var(--on-night);
  font-size: 19px;
}

.route-head p {
  color: rgba(246, 244, 238, 0.55);
  font-size: 14px;
  margin: 6px 0 0;
}

.route-btn {
  background: transparent;
  border-color: rgba(246, 244, 238, 0.3);
  color: var(--on-night);
}
.route-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.map-widget {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 6;
  min-height: 260px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(246, 244, 238, 0.16);
  background: rgba(246, 244, 238, 0.03);
}

.map-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  cursor: pointer;
  background:
    linear-gradient(rgba(246,244,238,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(246,244,238,0.05) 1px, transparent 1px);
  background-size: 36px 36px;
  transition: background-color 0.2s ease;
}
.map-placeholder:hover { background-color: rgba(246,244,238,0.02); }

.map-placeholder svg {
  width: 34px;
  height: 34px;
  color: var(--accent-soft);
}

.map-placeholder .load-label {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.03em;
  color: var(--on-night);
}

.map-placeholder .load-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(246, 244, 238, 0.4);
  max-width: 320px;
  text-align: center;
  line-height: 1.5;
}

.map-widget iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  filter: grayscale(0.15) contrast(1.02);
}

/* ==================== FOOTER ==================== */

footer.site-footer {
  padding: 32px 0;
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-inner, .footer-inner a {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-soft);
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a:hover { color: var(--accent); }

/* ==================== IMPRESSUM PAGE ==================== */

.legal-page {
  padding: 72px 0 100px;
}

.legal-page .wrap {
  max-width: 760px;
}

.legal-page h1 {
  font-size: 2.1rem;
  margin: 18px 0 40px;
}

.legal-page h2 {
  font-size: 1.15rem;
  margin: 40px 0 14px;
}

.legal-page p, .legal-page li {
  color: var(--text-soft);
  font-size: 15px;
  margin-bottom: 12px;
}

.legal-page a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.legal-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 24px;
  font-size: 15px;
}

.legal-table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  color: var(--text-soft);
}
.legal-table td:first-child {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  width: 180px;
}

/* ==================== RESPONSIVE ==================== */

@media (min-width: 1101px) {
  .tel-link { display: inline-flex; align-items: center; gap: 8px; }
}

@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-diagram { order: -1; max-width: 420px; margin: 0 auto; }
  .about-grid { grid-template-columns: 1fr; gap: 44px; }
  .contact-grid { grid-template-columns: 1fr; }
  .services-grid { grid-template-columns: repeat(2, 1fr); }
}

/* The full desktop header (logo + 4 nav links + phone number + theme
   switch + CTA button) needs roughly 1050px of unbroken width to lay
   out in one row without wrapping or overflowing — that's wider than
   every tablet, including iPads in landscape. So the hamburger-nav
   mode has to kick in well above the usual "phone" breakpoint. */
@media (max-width: 1100px) {
  nav.main-nav, .header-cta .btn-ghost, .tel-link { display: none; }
  .menu-toggle { display: flex; }

  nav.main-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 20px;
    gap: 18px;
  }

  /* Theme toggle is relocated here by JS on small screens, instead of
     crowding .header-cta next to the CTA button and menu icon. */
  .header-cta > .theme-toggle { display: none; }

  nav.main-nav .nav-theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    margin-top: 2px;
    border-top: 1px solid var(--line);
  }

  .nav-theme-label {
    font-size: 14.5px;
    color: var(--text-soft);
  }
}

@media (max-width: 720px) {
  .wrap { padding-left: 20px; padding-right: 20px; }
  section { padding: 64px 0; }
  .hero { padding: 56px 0 56px; }
  .services-grid { grid-template-columns: 1fr; }
  .facts-strip .wrap { gap: 14px 28px; }
}

/* Below this, logo + CTA + menu icon (the only header-cta content left
   once the full nav is hidden) no longer fit at full size either. */
@media (max-width: 480px) {
  .logo { gap: 8px; font-size: 16px; }
  .logo-mark { width: 26px; height: 26px; }
  .logo-text-sub { font-size: 9.5px; letter-spacing: 0.03em; }
  .header-cta { gap: 8px; }
  .header-cta .btn-primary { padding: 8px 12px; font-size: 12px; }
  .menu-toggle { width: 36px; height: 36px; }
}

.nav-theme-row { display: none; }
