/* ==========================================================================
   Kabel Brand: style.css
   One stylesheet for every page. Plain CSS, no build step.

   1. Fonts
   2. Colours and design tokens      <- change the look here
   3. Page layout

   LIGHT / DARK: follows the visitor's system setting automatically.
   Each colour is written once as light-dark(LIGHT, DARK).

   SIDE OF THE BUSINESS: set in the HTML as  <html data-side="electrical">  or
   "earthworks". It switches the accent colour (blue / green) and the background
   pattern (circuit traces / contour lines).
   ========================================================================== */

/* ---------- 1. Fonts (self-hosted, latin subset incl. Ä Ö Ü ß) ---------- */
@font-face { font-family: "Rubik"; src: url(fonts/rubik.woff2) format("woff2"); font-weight: 500 800; font-display: swap; }
@font-face { font-family: "Work Sans"; src: url(fonts/work-sans.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }

/* ---------- 2. Colours and tokens ---------- */
:root {
  color-scheme: light dark;

  --f-head: "Rubik", system-ui, sans-serif;
  --f-body: "Work Sans", system-ui, sans-serif;

  /*                 light      dark   */
  --bg:       light-dark(#f4f3ee, #151816);   /* page paper */
  --surface:  light-dark(#ffffff, #1e221e);   /* cards, header */
  --ink:      light-dark(#1b1f1a, #eeede6);   /* text */
  --muted:    light-dark(#52584e, #aeb2a6);   /* secondary text */
  --line:     light-dark(#d6d4c9, #343a33);   /* hairlines */

  --radius: 12px;
  --shadow-color: light-dark(rgba(27, 31, 26, .06), transparent);
  --shadow: 0 1px 2px var(--shadow-color);

  /* Background pattern (parallax layer): how fast it drifts, and how strong it is */
  --pat-speed: -.18;
  --pat-color: light-dark(color-mix(in srgb, var(--accent-text) 34%, transparent), color-mix(in srgb, var(--accent-text) 30%, transparent));
}

/* Section accents. MOCK values, not confirmed. Blue and green differ in lightness, so the
   two sides also work for red-green colour blindness. */
html[data-side="electrical"] {
  --accent:      light-dark(#2457d6, #3159e0);
  --on-accent:   #ffffff;
  --accent-text: light-dark(#1c46ad, #8fb0ff);   /* accent as text colour on paper / surface */
  --pat: url(img/pattern-circuit.svg);
  --pat-size: 480px;
}
html[data-side="earthworks"] {
  --accent:      #86c232;
  --on-accent:   #16200a;
  --accent-text: light-dark(#3d6a0e, #a9dd62);
  --pat: url(img/pattern-contour.svg);
  --pat-size: 512px;
}
:root {
  --tint:  color-mix(in srgb, var(--accent) 12%, var(--surface));              /* soft accent fill */
  --stage: light-dark(color-mix(in srgb, var(--accent) 14%, #fff), color-mix(in srgb, var(--accent) 34%, #b2b6aa)); /* circle behind the mascot */
}

/* Preview bar can force a scheme: #scheme=light or #scheme=dark */
html[data-scheme="light"] { color-scheme: light; }
html[data-scheme="dark"]  { color-scheme: dark; }

/* ---------- 3. Page layout ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { background: var(--bg); color: var(--ink); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font: 400 1.0625rem/1.6 var(--f-body); isolation: isolate; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
img { max-width: 100%; height: auto; }
a { color: var(--accent-text); }
[id] { scroll-margin-top: 7rem; }
:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 3px; }

h1, h2, h3 { font-family: var(--f-head); font-weight: 700; line-height: 1.12; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: clamp(2.3rem, 5.4vw, 3.8rem); }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.25rem); }
h3 { font-size: 1.25rem; }
p { text-wrap: pretty; }

.wrap { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.eyebrow { font: 600 .8rem/1 var(--f-head); letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 1rem; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 40ch; text-wrap: balance; }
.skip { position: absolute; left: -999px; top: .5rem; background: var(--surface); padding: .6rem 1rem; z-index: 50; }
.skip:focus { left: .5rem; }

/* Background pattern: fixed layer behind everything. script.js writes --scroll, so the
   pattern drifts slower than the page (parallax). Without JavaScript it simply stands still.
   The pattern is strongest in the side margins and fades out behind the text column. */
.bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--pat-color);
  --fade: linear-gradient(90deg, #000 calc(50% - 680px), rgba(0, 0, 0, .16) calc(50% - 560px), rgba(0, 0, 0, .16) calc(50% + 560px), #000 calc(50% + 680px));
  -webkit-mask-image: var(--pat), var(--fade); mask-image: var(--pat), var(--fade);
  -webkit-mask-size: var(--pat-size) var(--pat-size), 100% 100%; mask-size: var(--pat-size) var(--pat-size), 100% 100%;
  -webkit-mask-position: 0 calc(var(--scroll, 0) * var(--pat-speed) * 1px), 0 0; mask-position: 0 calc(var(--scroll, 0) * var(--pat-speed) * 1px), 0 0;
  -webkit-mask-composite: source-in; mask-composite: intersect;
}
@media (max-width: 1100px) { .bg { --pat-color: light-dark(color-mix(in srgb, var(--accent-text) 16%, transparent), color-mix(in srgb, var(--accent-text) 14%, transparent)); --fade: linear-gradient(#000, #000); } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: 600 1rem/1 var(--f-head); text-decoration: none; cursor: pointer;
  padding: .95rem 1.5rem; border-radius: 999px; border: 2px solid var(--accent);
  background: var(--accent); color: var(--on-accent); transition: transform .15s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-small { padding: .7rem 1.2rem; font-size: .95rem; }

/* Header: brand, big pill switch, contact button */
.site { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar { width: min(1120px, 100% - 2.5rem); margin-inline: auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding-block: .5rem; }
.brand { display: inline-flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--ink); justify-self: start; }
.brand img { flex: none; box-sizing: content-box; width: 64px; height: 64px; padding: 4px; border-radius: 50%; background: var(--stage); image-rendering: crisp-edges; image-rendering: pixelated; }
.wordmark { font: 700 1.5rem/1 var(--f-head); letter-spacing: -.01em; }
.bar .btn { justify-self: end; }

.pill { display: grid; grid-template-columns: 1fr 1fr; width: min(440px, 100%); padding: 5px; border-radius: 999px; background: var(--surface); border: 2px solid var(--line); box-shadow: var(--shadow); }
.pill a { text-align: center; padding: .9rem 1rem; border-radius: 999px; text-decoration: none; font: 600 1.1rem/1 var(--f-head); color: var(--ink); }
.pill a[aria-current="page"] { background: var(--accent); color: var(--on-accent); view-transition-name: pill-thumb; }   /* the current link is the highlighted slider */
.pill a:not([aria-current]):hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }

/* The highlighted link slides to the other side when changing pages (Chromium; other browsers just switch) */
@view-transition { navigation: auto; }
::view-transition-group(pill-thumb) { animation-duration: .35s; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .15s; }

/* Hero */
.hero { padding-block: clamp(2.5rem, 6vw, 5rem); }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: center; }
.hero h1 { margin-bottom: 1.2rem; }
.hero .lead { margin-bottom: 2rem; }
.actions { display: flex; flex-wrap: wrap; gap: .8rem; }

/* Circle behind the mascot, with a second thin ring around it (like a drawing dimension) */
.stage { width: min(340px, 100%); aspect-ratio: 1; margin-inline: auto; border-radius: 50%; background: var(--stage); border: 2px solid var(--line); outline: 1px solid var(--line); outline-offset: 14px; display: grid; place-items: center; }
/* Pixel art: scale only by whole numbers (the GIF is 32 px x 8 = 256) and never smooth it */
.mascot { width: 256px; height: 256px; image-rendering: crisp-edges; image-rendering: pixelated; }

/* Facts strip */
.facts { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.facts li { padding: 1.4rem 1.6rem; border-left: 1px solid var(--line); }
.facts li:first-child { border-left: 0; }
.facts strong { display: block; font: 700 1.7rem/1.1 var(--f-head); color: var(--accent-text); margin-bottom: .3rem; }
.facts span { color: var(--muted); font-size: .98rem; }

/* Sections */
/* On-site photo (slot "wide"): the frame is added here, not baked into the file.
   The <img> always carries width and height, so the page never jumps when it loads. */
.site-photo { margin: 0; }
.site-photo img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.site-photo figcaption { padding: 1.1rem 1.4rem 0; }
.site-photo figcaption .eyebrow { margin-bottom: .45rem; }
.site-photo figcaption p:last-child { color: var(--muted); max-width: 72ch; }

.section { padding-block: clamp(2.25rem, 5vw, 4rem); }
.section-head { max-width: 40rem; margin-bottom: 2.2rem; }

/* Need + fill cards.
   The "need" is a small tag with a ring in front (a solder pad, like in the background
   pattern). Title and text sit on shared rows so all cards line up. */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); column-gap: 1.2rem; }
.card { grid-row: span 3; display: grid; grid-template-rows: subgrid; row-gap: .7rem; align-content: start; margin-bottom: 1.2rem; padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.need { display: flex; gap: .55rem; align-items: baseline; justify-self: start; align-self: start; max-width: 100%; padding: .4rem .8rem .4rem .7rem; border-radius: 8px; background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent-text); font: 500 .92rem/1.35 var(--f-head); }
.need::before { content: ""; flex: none; width: .55rem; height: .55rem; border: 2px solid currentColor; border-radius: 50%; transform: translateY(-.05rem); }
.card p:last-child { color: var(--muted); }
.card-link { text-decoration: none; color: var(--ink); background: var(--tint); border-color: var(--accent); transition: transform .15s ease; }
.card-link h3::after { content: " →"; color: var(--accent-text); }
.card-link:hover { transform: translateY(-2px); }

/* Good to know: tinted panel with an icon, no side stripe */
.note { display: grid; grid-template-columns: auto 1fr; column-gap: 1.2rem; padding: 1.6rem 1.8rem; background: var(--tint); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: var(--radius); }
.note::before { content: "i"; grid-row: 1 / span 2; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--accent); color: var(--on-accent); font: 700 1.2rem/1 var(--f-head); }
.note h2 { font-size: 1.35rem; margin-bottom: .3rem; }
.note > * { grid-column: 2; }

/* Steps: three numbered nodes joined by a trace */
.steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.6rem; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding-top: 3.7rem; }
.steps li::before { content: counter(step); position: absolute; top: 0; left: 0; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--accent); color: var(--on-accent); font: 700 1.05rem/1 var(--f-head); }
.steps li:not(:last-child)::after { content: ""; position: absolute; top: calc(1.3rem - 1px); left: 3.3rem; right: -1rem; height: 2px; background: var(--line); }
.steps h3 { margin-bottom: .4rem; }
.steps p { color: var(--muted); }

/* FAQ (details/summary: works without JavaScript) */
.split { display: grid; grid-template-columns: 1fr 1.7fr; gap: 3rem; align-items: start; }
.split .section-head { margin-bottom: 0; position: sticky; top: 8rem; }
.faq { min-width: 0; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; padding: 1.1rem 0; font: 600 1.1rem/1.3 var(--f-head); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.5rem; line-height: 1; color: var(--accent-text); }
.faq details[open] summary::after {  content: "-"; }
.faq details p { padding: 0 0 1.2rem; color: var(--muted); max-width: 40rem; }

/* Contact block */
.contact { display: grid; grid-template-columns: 1.1fr .9fr; gap: 2rem; padding: clamp(1.8rem, 4vw, 3rem); border-radius: var(--radius); background: var(--accent); color: var(--on-accent); }
.contact h2 { margin-bottom: .8rem; }
.contact dl { display: grid; grid-template-columns: auto 1fr; gap: .7rem 1.2rem; align-content: center; }
.contact dt { font: 600 .8rem/1.9 var(--f-head); letter-spacing: .12em; text-transform: uppercase; }
.contact dd { font-weight: 500; }
.contact a { color: inherit; }

/* Placeholders: [text in brackets] that must be replaced with real data */
.ph { outline: 1.5px dashed currentColor; outline-offset: 2px; border-radius: 3px; }

/* Footer */
.footer { margin-top: 2rem; border-top: 1px solid var(--line); padding-block: 3rem 2rem; color: var(--muted); font-size: .95rem; }
.footer .wrap { display: flex; flex-direction: column; align-items: center; gap: 2.5rem; }
.footer-row { width: 100%; display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; }

/* Footer logo: transparent background, no box/plate. */
.footer img { display: block; width: min(560px, 100%); height: auto; margin-inline: auto; }
.footer nav { display: flex; flex-wrap: wrap; gap: .1rem 1.5rem; }
.footer a { color: var(--ink); display: inline-block; padding: .45rem 0; }
.prose { max-width: 42rem; }
.prose h2 { margin: 2rem 0 .6rem; font-size: 1.4rem; }
.prose dl { display: grid; grid-template-columns: 13rem 1fr; gap: .5rem 1.5rem; }
.prose dt { font-weight: 600; }
.prose p + p { margin-top: .8rem; }
.prose ul { padding-left: 1.3rem; margin-block: .6rem; }
.prose li + li { margin-top: .4rem; }
.prose .note { margin: 1.4rem 0; }
.prose .lines { line-height: 2; }
.prose h2 + p, .prose h2 + ul { margin-top: 0; }

@media (max-width: 960px) {
  .site { position: static; }
  .bar { grid-template-columns: 1fr auto; grid-template-areas: "brand btn" "pill pill"; }
  .brand { grid-area: brand; } .bar .btn { grid-area: btn; } .pill { grid-area: pill; width: 100%; }
  .hero-grid, .contact, .split { grid-template-columns: 1fr; gap: 1.5rem; }
  .split .section-head { position: static; }
  .stage { width: min(300px, 100%); }
  .mascot { width: 192px; height: 192px; }  /* 32 x 6 */
  .facts { grid-template-columns: 1fr; }
  .facts li { border-left: 0; border-top: 1px solid var(--line); }
  .facts li:first-child { border-top: 0; }
  .steps { grid-template-columns: 1fr; gap: 0; }
  .steps li { padding: 0 0 1.8rem 3.6rem; }
  .steps li:last-child { padding-bottom: 0; }
  .steps li:not(:last-child)::after { top: 3rem; bottom: .4rem; left: calc(1.3rem - 1px); right: auto; width: 2px; height: auto; }
  .prose dl { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .card-link { transition: none; }
  ::view-transition-group(pill-thumb), ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

