/*
 * Theme für speed.rbn.gr, im Stil von robingroppe.de. Der Dienst steht für sich, deshalb gibt es
 * kein Menü der Webseite. Die Fußzeile verlinkt nur Status, Impressum und Datenschutz.
 *
 * Die Farben sind eine Kopie der Werte aus public/cms/config.php. Ändern sie sich dort,
 * müssen sie auch hier angepasst werden. Die Tachos lesen --accent und --muted aus dieser Datei.
 */

@font-face {
  font-family: Lexend;
  src: url("fonts/lexend-700-900.woff2") format("woff2");
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-500.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* Farben und Schriften: erst die für beide Modi, dann hell, dann zwei Wege zu dunkel */

:root {
  color-scheme: light dark;
  --accent: #e46b25;
  --band: #262422;
  --band-line: #454139;
  --band-ink: #f7f4ee;
  --band-muted: #b9b2a7;
  --radius: 4px;
  --radius-tile: 10px;
  --width: 72rem;
  --gutter: clamp(1rem, 4vw, 3rem);
  --sans: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Roboto, Arial, sans-serif;
  --display: Lexend, "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;

  --paper: #f7f4ee;
  --ink: #1d1b18;
  --muted: #6a645b;
  --line: #d9d3c8;
  --link: #b3470c;
  --code-bg: #ece7dd;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1a1816;
    --ink: #f0ebe2;
    --muted: #b9b2a7;
    --line: #38342f;
    --link: #f08a4b;
    --code-bg: #2b2926;
  }
}
:root[data-theme="dark"] {
  --paper: #1a1816;
  --ink: #f0ebe2;
  --muted: #b9b2a7;
  --line: #38342f;
  --link: #f08a4b;
  --code-bg: #2b2926;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

@media (prefers-reduced-motion: no-preference) {
  .theme-fade, .theme-fade *, .theme-fade *::before, .theme-fade *::after {
    transition: background-color .3s ease, color .3s ease, border-color .3s ease;
  }
}

/* Grundlagen */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

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

.skip {
  position: absolute; left: -999px; top: .5rem;
  background: var(--paper); color: var(--ink); padding: .5rem 1rem; z-index: 2;
}
.skip:focus { left: .5rem; }

/* Dunkles Band: Kopfzeile und Titel */

.band { background: var(--band); color: var(--band-ink); }
.band a { color: inherit; }

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .25rem 2rem;
  padding-block: 1.1rem;
}

.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  font: 500 1rem var(--mono);
  text-decoration: none;
}
.brand::before { content: ""; width: .7rem; height: .7rem; background: var(--accent); }
.brand b { font-weight: inherit; }
.brand span { color: var(--band-muted); }

.brand b::after { content: "_"; content: "_" / ""; }
@media (prefers-reduced-motion: no-preference) {
  .brand b::after { animation: cursor-blink 1s step-end infinite; }
}
@keyframes cursor-blink {
  50% { opacity: 0; }
}

.theme-toggle {
  min-width: 5.5em;
  padding: .2rem .55rem;
  font: .8125rem var(--mono);
  background: transparent; color: var(--band-muted);
  border: 1px solid var(--band-line); border-radius: var(--radius);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--band-ink); border-color: var(--band-muted); }
.theme-toggle[hidden] { display: none; }

/* Ohne Menü wäre die Kopfzeile flacher, am Desktop bleibt sie so hoch wie auf der Webseite. */
@media (min-width: 52rem) {
  .topbar { min-height: 4.76rem; }
}

.pagehead { padding-block: clamp(2.5rem, 7vw, 5rem) clamp(2rem, 5vw, 3.5rem); }

/* Dachzeile über dem Titel */
.eyebrow {
  display: flex; align-items: center; gap: .6rem;
  margin: 0 0 1rem;
  font: 700 .8125rem/1.3 var(--display);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before { content: ""; flex: none; width: 1.75rem; height: 2px; background: currentColor; }

h1 {
  margin: 0;
  font: 900 clamp(2.25rem, 7vw, 4.75rem)/1.06 var(--display);
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
}
h1 em { font-style: normal; color: var(--accent); }

/* Messung */

#testWrapper {
  flex: 1;
  padding-block: clamp(2rem, 5vw, 3.5rem);
  text-align: center;
}

#startStopBtn {
  display: inline-block;
  min-width: 11rem;
  padding: .7rem 1.5rem;
  font: 700 1.0625rem/1.3 var(--display);
  color: #1d1b18;
  background: var(--accent);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
}
#startStopBtn:hover { filter: brightness(1.08); }
#startStopBtn::before { content: "Test starten"; }
#startStopBtn.running { color: var(--link); background: transparent; }
#startStopBtn.running::before { content: "Abbrechen"; }

#test { margin-top: clamp(1.5rem, 4vw, 2.5rem); }

.testGroup {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 44rem;
  margin: 0 auto 1rem;
}

.testArea, .testArea2 {
  position: relative;
  background: var(--code-bg);
  border-radius: var(--radius-tile);
  text-align: center;
}
.testArea2 { padding: 1rem .75rem; }
.testArea { aspect-ratio: 16 / 12.5; container-type: inline-size; }

/* Auf schmalen Bildschirmen stehen die Tachos untereinander, sonst überdeckt der Bogen die Beschriftung */
@media (max-width: 34rem) {
  .testGroup:has(.testArea) { grid-template-columns: minmax(0, 1fr); }
}

.testName {
  font: 700 .8125rem/1.3 var(--display);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--link);
}
.testArea .testName { position: absolute; top: 1rem; left: 0; width: 100%; z-index: 2; }

.meterText { font: 500 1.75rem/1.3 var(--mono); }
.testArea2 .meterText { display: inline-block; margin-top: .25rem; color: var(--ink); }
.testArea2 .unit { display: inline-block; margin-left: .25rem; }
.meterText:empty::before { content: "0.00"; color: var(--muted); }

.testArea .meterText {
  position: absolute; left: 0; bottom: 34%; width: 100%; z-index: 2;
  font-size: clamp(1.25rem, 9cqw, 2.5rem);
}
.testArea .unit { position: absolute; left: 0; bottom: 22%; width: 100%; z-index: 2; }

.unit { color: var(--muted); font-size: .875rem; }

.testArea canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }

#ipArea { margin: 1.25rem 0 0; color: var(--muted); font: 500 .9375rem var(--mono); overflow-wrap: anywhere; }

/* Ergebnis teilen */

#shareArea { max-width: 44rem; margin: 2rem auto 0; text-align: left; }
#shareArea h3 { margin: 0 0 .5rem; font: 800 1.5rem/1.25 var(--display); letter-spacing: -.01em; }
#shareArea p { margin: 0 0 .75rem; color: var(--muted); }
#shareArea input {
  display: block; width: 100%; margin-bottom: .75rem; padding: .5rem .7rem;
  font: .875rem var(--mono);
  color: var(--ink); background: var(--code-bg);
  border: 1px solid var(--line); border-radius: var(--radius);
}
#shareArea img { display: block; max-width: 100%; height: auto; margin-inline: auto; border-radius: var(--radius); }

/* Hinweise zum Datenschutz */

a.privacy { display: inline-block; margin-top: 1.5rem; color: var(--muted); font-size: .875rem; }
a.privacy:hover { color: var(--link); }

#privacyPolicy {
  position: fixed;
  inset: 2rem;
  max-width: 44rem;
  margin-inline: auto;
  overflow-y: auto;
  padding: 1.5rem;
  z-index: 10;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-tile);
  box-shadow: 0 1rem 4rem rgb(0 0 0 / .45);
}
#privacyPolicy h2 { margin: 0 0 .75rem; font: 800 1.5rem/1.25 var(--display); }
#privacyPolicy h4 { margin: 1.25rem 0 .25rem; font: 700 1.0625rem/1.3 var(--display); }
#privacyPolicy p, #privacyPolicy ul { margin-block: 0 .75rem; }

@media (max-width: 30rem) {
  #privacyPolicy { inset: 1rem; padding: 1rem; }
}

/* Fußzeile */

.foot { border-top: 1px solid var(--line); padding-block: 1.5rem; color: var(--muted); font-size: .9375rem; }
.foot .wrap { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem 2rem; }
.foot ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0 1.25rem; margin: 0; padding: 0; }
.foot a { color: inherit; }
.foot a:hover { color: var(--link); }
