/* Perfboard Lab website. Own code only: no framework, no web font, no script on the pages of stage 1.
   Colours follow the app (LabTheme accent, app icon background and fire gradient). */

:root {
  color-scheme: dark light;
  /* Dark is the default look, like every store image of the app. */
  --grund: #0a0b0d;
  --grund-hell: #212429;
  --flaeche: #17191d;
  --text: #f2f3f5;
  --text-leise: #b6b9c2;
  --akzent: #f09a4e;
  --linie: #33373e;
  --loch: rgb(255 255 255 / 0.07);
  --loch-rand: transparent;
  --led: #ffcc47;
  --led-schein: rgb(255 115 31 / 0.55);
  --feuer-a: #ff731f;
  --feuer-b: #ffcc47;
  --kupfer: rgb(240 154 78 / 0.17);
  --kupfer-hell: rgb(240 154 78 / 0.55);
  --strom: #ffd76a;
  --raster: 28px;
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --schrift-fest: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    /* Light: the bare board, pale laminate with copper pads. */
    --grund: #f4ead8;
    --grund-hell: #fbf5e9;
    --flaeche: #fffaf0;
    --text: #1d1206;
    --text-leise: #57452f;
    --akzent: #9e470a;
    --linie: #d9c7a6;
    --loch: #f4ead8;
    --loch-rand: rgb(184 86 15 / 0.3);
    --led: #ffb000;
    --led-schein: rgb(255 115 31 / 0.45);
    --feuer-a: #9e470a;
    --feuer-b: #9e470a;
    --kupfer: rgb(184 86 15 / 0.2);
    --kupfer-hell: rgb(184 86 15 / 0.6);
    --strom: #ff731f;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font: 1.0625rem/1.6 var(--schrift);
  /* The holes of the board on a 2.54 mm style grid, fading towards the edges. */
  background:
    radial-gradient(ellipse 75% 60% at 50% 38%, transparent 0, var(--grund) 100%),
    radial-gradient(circle at center, var(--loch) 0 2px, var(--loch-rand) 2.2px 4.6px, transparent 5px)
      center top / var(--raster) var(--raster),
    radial-gradient(ellipse 90% 70% at 42% 34%, var(--grund-hell) 0, var(--grund) 100%);
  background-color: var(--grund);
}

a { color: var(--akzent); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, :focus-visible {
  outline: 3px solid var(--akzent);
  outline-offset: 3px;
  border-radius: 4px;
}

footer {
  margin-top: auto;
  padding: 1.5rem 1.25rem 2rem;
  text-align: center;
}
footer nav { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 1.5rem; margin: 0 0.75rem; }
footer nav a { padding: 0.6rem 0.1rem; }
.klein { margin: 0.75rem auto 0; max-width: 46rem; font-size: 0.8125rem; line-height: 1.5; color: var(--text-leise); }

/* ── Board decoration: tracks behind the page, the circuit around the app icon ── */
/* Everything here is drawn by tools/bahnen.py and Seiten/teile/symbol-schaltung.svg. The tracks draw themselves in
   once; afterwards short bright dashes (the current) run along them and light the LEDs at their ends. Only the
   current and the LEDs keep moving; "Animation anhalten" and "reduce motion" stop them, the tracks stay. */

.hintergrund {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.hintergrund::after {
  /* Calms the tracks behind the text in the middle. */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 46% 52% at 50% 48%, var(--grund) 0, transparent 100%);
  opacity: 0.85;
}
.bahnen { position: absolute; inset: 0; width: 100%; height: 100%; }
.bahnen.hoch { display: none; }
@media (max-aspect-ratio: 4 / 5) {
  .bahnen.quer { display: none; }
  .bahnen.hoch { display: block; }
}
.kupfer path {
  fill: none;
  stroke: var(--kupfer);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  animation: zeichnen 1.4s cubic-bezier(0.6, 0, 0.2, 1) backwards;
}
.enden .pad { fill: var(--grund); stroke: var(--kupfer); stroke-width: 4; }
.enden .led-punkt { fill: var(--led); opacity: 0.3; }
.enden circle { animation: auftauchen 0.4s ease-out backwards; }
.strom path {
  fill: none;
  stroke: var(--strom);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 0.05 2;
  stroke-dashoffset: 0.05;
  animation: fliessen 3.6s linear infinite;
}
/* Six groups with their own rhythm; the dash and the LED at the end of a track share a group. */
.kupfer .t1 { animation-delay: 0.15s; }
.kupfer .t2 { animation-delay: 0.3s; }
.kupfer .t3 { animation-delay: 0.45s; }
.kupfer .t4 { animation-delay: 0.6s; }
.kupfer .t5 { animation-delay: 0.75s; }
.enden circle { animation-delay: 1.1s; }
.strom .t0 { animation-duration: 3.4s; animation-delay: 1.4s; }
.strom .t1 { animation-duration: 4.1s; animation-delay: 2.2s; }
.strom .t2 { animation-duration: 3.7s; animation-delay: 1.7s; }
.strom .t3 { animation-duration: 4.6s; animation-delay: 2.6s; }
.strom .t4 { animation-duration: 3.9s; animation-delay: 1.9s; }
.strom .t5 { animation-duration: 4.3s; animation-delay: 2.9s; }
.enden .led-punkt.t0 { animation: auftauchen 0.4s 1.1s ease-out backwards, leuchten 3.4s 1.4s linear infinite; }
.enden .led-punkt.t1 { animation: auftauchen 0.4s 1.1s ease-out backwards, leuchten 4.1s 2.2s linear infinite; }
.enden .led-punkt.t2 { animation: auftauchen 0.4s 1.1s ease-out backwards, leuchten 3.7s 1.7s linear infinite; }
.enden .led-punkt.t3 { animation: auftauchen 0.4s 1.1s ease-out backwards, leuchten 4.6s 2.6s linear infinite; }
.enden .led-punkt.t4 { animation: auftauchen 0.4s 1.1s ease-out backwards, leuchten 3.9s 1.9s linear infinite; }
.enden .led-punkt.t5 { animation: auftauchen 0.4s 1.1s ease-out backwards, leuchten 4.3s 2.9s linear infinite; }

@keyframes zeichnen { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes auftauchen { from { opacity: 0; } }
/* The dash runs from the edge to the end of its track in the first 55 % of a cycle, then the track rests. */
@keyframes fliessen {
  0% { stroke-dashoffset: 0.05; }
  55%, 100% { stroke-dashoffset: -1; }
}
@keyframes leuchten {
  0%, 52% { opacity: 0.3; }
  56% { opacity: 1; }
  80% { opacity: 0.85; }
  100% { opacity: 0.3; }
}

/* The circuit around the app icon: three times as wide as the icon, which sits in its middle. */
.symbol-platine {
  --symbol: clamp(104px, 22vw, 132px);
  position: relative;
  width: calc(var(--symbol) * 3.2);
  max-width: 100%;
  aspect-ratio: 640 / 200;
}
.symbol-schaltung { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.symbol-feld {
  position: absolute;
  left: 34.375%;
  top: 0;
  width: 31.25%;
  aspect-ratio: 1;
  animation: einschalten 0.5s 0.9s cubic-bezier(0.3, 1.4, 0.5, 1) backwards;
}
.symbol-feld .symbol { position: relative; display: block; width: 100%; height: auto; }
.symbol-feld::before {
  /* The glow behind the icon: lights up when the current arrives, then breathes with every pulse. */
  content: "";
  position: absolute;
  inset: -45%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--led-schein) 0, transparent 62%);
  animation: auftauchen 0.6s 0.9s ease-out backwards, atmen-schein 2.4s 1.5s ease-in-out infinite;
}
.symbol-feld::after {
  /* A ring that spreads out once when the power comes on. */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 22.5%;
  border: 2px solid var(--feuer-b);
  opacity: 0;
  animation: ring 1.1s 0.95s ease-out 1;
}
@keyframes einschalten {
  from { opacity: 0.35; transform: scale(0.9); }
}
@keyframes atmen-schein {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
@keyframes ring {
  0% { opacity: 0.9; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.6); }
}

.sp-kupfer path {
  fill: none;
  stroke: var(--kupfer-hell);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  animation: zeichnen 0.8s 0.1s cubic-bezier(0.6, 0, 0.2, 1) backwards;
}
.sp-kupfer .sp-b { animation-delay: 0.25s; }
.sp-kupfer .sp-c { animation-delay: 1.15s; }
.sp-pads circle { fill: var(--grund); stroke: var(--kupfer-hell); stroke-width: 6; animation: auftauchen 0.3s ease-out backwards; }
.sp-widerstand { animation: auftauchen 0.4s 1.3s ease-out backwards; }
.sp-widerstand path { stroke: #c9ccd2; stroke-width: 4; stroke-linecap: round; }
.sp-widerstand rect { fill: #e9d6a4; stroke: #b79a5a; stroke-width: 1.5; }
.sp-ring { stroke: #b0362a; stroke-width: 5; }
.sp-led { fill: var(--led); stroke: rgb(0 0 0 / 0.35); stroke-width: 2; animation: led-puls 2.4s 0.9s linear infinite; }
.sp-schein { animation: led-puls 2.4s 0.9s linear infinite; }
.sp-strom path {
  fill: none;
  stroke: var(--strom);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 0.12 2;
  stroke-dashoffset: 0.12;
  animation: in-den-eingang 2.4s 0.9s linear infinite;
}
.sp-strom .sp-c { stroke-dasharray: 0.1 2; animation-name: aus-dem-ausgang; }
@keyframes in-den-eingang {
  0% { stroke-dashoffset: 0.12; }
  42%, 100% { stroke-dashoffset: -1; }
}
@keyframes aus-dem-ausgang {
  0%, 45% { stroke-dashoffset: 0.1; }
  75%, 100% { stroke-dashoffset: -1; }
}
@keyframes led-puls {
  0%, 72% { opacity: 0.35; }
  77% { opacity: 1; }
  100% { opacity: 0.35; }
}

/* The error page: the board without power. */
.stromlos .strom, .stromlos .sp-strom, .stromlos .sp-schein, .stromlos .symbol-feld::before, .stromlos .symbol-feld::after { display: none; }
.stromlos .enden .led-punkt, .stromlos .sp-led { animation: none; opacity: 1; fill: var(--linie); }
.stromlos .symbol-feld { animation: none; opacity: 0.55; }

/* ── Welcome page ─────────────────────────────────────────── */

.empfang main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.25rem 1.5rem;
  text-align: center;
}

.symbol {
  width: clamp(104px, 22vw, 132px);
  height: auto;
  border-radius: 22.5%;
  box-shadow:
    0 0 0 1px var(--linie),
    0 18px 50px rgb(0 0 0 / 0.45),
    0 0 90px var(--led-schein);
}

h1 {
  margin: 1.6rem 0 0;
  font-size: clamp(2.4rem, 8vw, 4.25rem);
  line-height: 1.05;
  font-weight: 800;
  font-style: italic;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.empfang h1 {
  /* The wordmark's gradient; a plain colour stands in where clipping is unsupported and in light mode. A bright
     band sweeps across it once when the power comes on. */
  color: var(--feuer-b);
  background:
    linear-gradient(100deg, transparent 30%, rgb(255 248 225 / 0.95) 50%, transparent 70%) -150% 0 / 60% 100% no-repeat,
    linear-gradient(90deg, var(--feuer-a), var(--feuer-b));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  padding: 0 0.12em 0.08em;
  font-size: clamp(2.6rem, 9vw, 5.25rem);
  animation: glanz 1.4s 1.1s ease-in-out 1 backwards, aufsteigen 0.7s 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}
@keyframes glanz {
  from { background-position: -150% 0, 0 0; }
  to { background-position: 250% 0, 0 0; }
}
@keyframes aufsteigen {
  from { opacity: 0; transform: translateY(18px); }
}

@media (forced-colors: active) {
  /* The system's own colours: no clipped gradient, the text must stay visible. */
  .empfang h1 { background: none; -webkit-text-fill-color: currentColor; color: CanvasText; }
}

.sprachen {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.25rem;
  width: 100%;
  max-width: 54rem;
  margin-top: 2.5rem;
}
.sprachen section { position: relative; padding: 0 0.5rem; animation: aufsteigen 0.7s 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
.sprachen section + section { animation-delay: 0.85s; }
.sprachen p { margin: 0 auto 0.8rem; max-width: 24rem; text-wrap: pretty; }

/* Between the two languages runs a copper track with a solder pad at each end. */
.sprachen section + section::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -1.125rem;
  width: 6.5rem;
  height: 10px;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(circle at 5px 50%, var(--akzent) 0 2px, transparent 2.5px),
    radial-gradient(circle at 5px 50%, transparent 0 3px, var(--linie) 3.5px 5px, transparent 5.5px),
    radial-gradient(circle at calc(100% - 5px) 50%, var(--akzent) 0 2px, transparent 2.5px),
    radial-gradient(circle at calc(100% - 5px) 50%, transparent 0 3px, var(--linie) 3.5px 5px, transparent 5.5px),
    linear-gradient(var(--linie), var(--linie)) center / calc(100% - 20px) 2px no-repeat;
}

@media (min-width: 48rem) {
  .sprachen { grid-template-columns: 1fr 1fr; gap: 0; }
  .sprachen section { padding: 0.25rem 2.5rem; }
  .sprachen section + section::before {
    left: 0;
    top: 50%;
    width: 10px;
    height: 7.5rem;
    background:
      radial-gradient(circle at 50% 5px, var(--akzent) 0 2px, transparent 2.5px),
      radial-gradient(circle at 50% 5px, transparent 0 3px, var(--linie) 3.5px 5px, transparent 5.5px),
      radial-gradient(circle at 50% calc(100% - 5px), var(--akzent) 0 2px, transparent 2.5px),
      radial-gradient(circle at 50% calc(100% - 5px), transparent 0 3px, var(--linie) 3.5px 5px, transparent 5.5px),
      linear-gradient(var(--linie), var(--linie)) center / 2px calc(100% - 20px) no-repeat;
  }
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font: 600 0.8125rem/1.4 var(--schrift-fest);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-leise);
}

/* A status LED: amber and breathing while the site is being built. */
.led {
  flex: none;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff6d8 0, var(--led) 45%, var(--feuer-a) 100%);
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.25), 0 0 12px 3px var(--led-schein);
  animation: atmen 1.6s ease-in-out infinite;
}
.led.aus { background: var(--linie); box-shadow: 0 0 0 1px rgb(0 0 0 / 0.25); animation: none; }
@keyframes atmen {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.pfeil { display: inline-block; padding: 0.55rem 0.1rem; font-weight: 600; }
.pfeil::after { content: " →"; white-space: pre; display: inline-block; transition: transform 0.2s ease; }
.pfeil:hover::after { transform: translateX(4px); }

/* "Animation anhalten": a switch without script (WCAG 2.2.2). The checkbox stays reachable by keyboard; its label is
   the visible switch. When it is on, everything that keeps moving stops; the drawn state stays. */
.bewegung { margin: 1rem 0 0; }
.ruhe { position: absolute; width: 1px; height: 1px; opacity: 0; }
.bewegung label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0.35rem 0.95rem;
  border: 1px solid var(--linie);
  border-radius: 999px;
  color: var(--text-leise);
  font-size: 0.8125rem;
  cursor: pointer;
}
.bewegung label::before {
  /* Two bars (pause); a triangle (play) while the animation is stopped. */
  content: "";
  flex: none;
  width: 0.6rem;
  height: 0.7rem;
  background: linear-gradient(90deg, currentColor 0 34%, transparent 34% 66%, currentColor 66%);
}
.bewegung label:hover { color: var(--text); border-color: var(--text-leise); }
.ruhe:focus-visible + label { outline: 3px solid var(--akzent); outline-offset: 3px; }
.ruhe:checked + label { color: var(--text); border-color: var(--akzent); }
.ruhe:checked + label::before { background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }

body:has(.ruhe:checked) :is(.strom, .sp-strom) { display: none; }
body:has(.ruhe:checked) :is(.led, .led-punkt, .sp-led, .sp-schein) { animation: none; opacity: 1; }
body:has(.ruhe:checked) .symbol-feld::before { animation: none; }

@media (prefers-reduced-motion: reduce) {
  /* Nothing moves: the tracks are drawn, the LEDs are lit, there is no current running. */
  .kupfer path, .sp-kupfer path, .enden circle, .sp-pads circle, .sp-widerstand, .symbol-feld, .symbol-feld::before,
  .empfang h1, .sprachen section, .led, .sp-led, .sp-schein, .pfeil::after { animation: none; transition: none; }
  .enden .led-punkt, .sp-led, .sp-schein { opacity: 1; }
  .strom, .sp-strom, .symbol-feld::after, .bewegung { display: none; }
}

/* ── Text pages (legal notice, privacy) ───────────────────── */

.text header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  max-width: 50rem;
  margin: 0 auto;
  padding: 1.25rem;
}
.marke {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.25rem 0.25rem 0;
  color: var(--text);
  font-weight: 800;
  font-style: italic;
  font-size: 1.1875rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.marke img { border-radius: 22.5%; box-shadow: 0 0 0 1px var(--linie); }
.text header nav a { display: inline-block; padding: 0.6rem 0.25rem; }

.text main {
  width: calc(100% - 2rem);
  max-width: 47.5rem;
  margin: 0.5rem auto 2rem;
  padding: clamp(1.25rem, 5vw, 3rem);
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 1.25rem;
  overflow-wrap: break-word;
}
.text h1 { margin: 0; font-size: clamp(1.6rem, 7vw, 2.75rem); font-style: normal; letter-spacing: -0.025em; -webkit-hyphens: auto; hyphens: auto; }
.stand { margin: 0.6rem 0 1.75rem; font: 0.8125rem/1.4 var(--schrift-fest); letter-spacing: 0.04em; color: var(--text-leise); }
.text h2 { margin: 2.25rem 0 0.5rem; font-size: 1.25rem; line-height: 1.3; letter-spacing: -0.01em; }
.text p, .text ul, .text address { margin: 0 0 0.9rem; max-width: 68ch; }
.text ul { padding-left: 1.25rem; }
.text li { margin: 0.25rem 0; }
.text address { font-style: normal; }
.kurz {
  margin: 0 0 1.5rem;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--akzent);
  border-radius: 0 0.75rem 0.75rem 0;
  background: var(--grund);
}
.kurz p { margin: 0; }
.klein span { display: block; }
