/* ==========================================================================
   Science in the Box: gemeinsames Stylesheet
   Gestaltung nach der Skizze des Stempelhefts (Leporello) der Grafikerin.
   Tokens aus dem Web-Styleguide v0.1 (docs/styleguide.md, tokens.css).
   Keine externen Ressourcen, keine Rundungen, keine Schatten, keine Verläufe.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Schriften (selbst gehostet, SIL OFL 1.1, Lizenzen in /fonts/)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/instrument-sans-latin-wght-normal.woff2") format("woff2-variations"),
       url("/fonts/instrument-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/instrument-sans-latin-ext-wght-normal.woff2") format("woff2-variations"),
       url("/fonts/instrument-sans-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/dm-mono-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/dm-mono-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --------------------------------------------------------------------------
   Tokens (aus tokens.css, nur was die Seite braucht)
   -------------------------------------------------------------------------- */
:root {
  --color-paper: #FFFFFF;
  --color-ink: #000000;
  --color-ink-blue: #223382;

  /* Kachelflächen: 17 % der Grundtöne über Weiß */
  --color-rosa: #FFD4F8;
  --color-rose: #FBD4E9;
  --color-hellgruen: #DBEFDB;
  --color-mint: #B6E2DD;
  --color-hellblau: #D4EFFB;
  --color-lavendel: #D0CBE8;

  --color-text: var(--color-ink);
  --color-bg: var(--color-paper);
  --color-line: var(--color-ink);
  --color-grid: var(--color-ink);
  --color-link-hover: var(--color-ink-blue);
  --color-focus: var(--color-ink-blue);

  --font-head: "Instrument Sans", "ABC Whyte", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --fw-head: 600;

  --fs-display: clamp(3rem, 0.5rem + 11vw, 9rem);
  --fs-h2: clamp(1.375rem, 0.9rem + 2vw, 2.75rem);
  --fs-h3: clamp(1.25rem, 1.1rem + 0.5vw, 1.625rem);
  --fs-body: 1rem;
  --fs-text: 1.0625rem;
  --fs-small: 0.8125rem;

  --lh-display: 0.986;
  --lh-heading: 1.091;
  --lh-mono: 1.45;
  --lh-mono-tight: 1.2;
  --lh-text: 1.5;

  --ls-display-caps: 0.08em;
  --ls-display-box: 0.066em;
  --ls-caps: 0.04em;
  --ws-display: -0.08em;

  --measure-mono: 54ch;
  --measure-text: 68ch;

  --line-hair: 1px;
  --stamp-width: clamp(4.5rem, 3rem + 3vw, 6.5rem);

  --gutter: clamp(1rem, 4.5vw, 2.5rem);
  --tile-pad: clamp(1rem, 0.75rem + 1vw, 1.5rem);
  --tile-min-h: calc(var(--stamp-width) * 5 / 3 + 2 * var(--tile-pad));
  --section-gap: clamp(3rem, 2rem + 4vw, 6rem);
  --container-max: 90rem;
}

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

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: var(--fs-body);
  line-height: var(--lh-mono);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: var(--fw-head);
  line-height: var(--lh-heading);
  letter-spacing: 0;
  text-wrap: balance;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { color: var(--color-link-hover); }

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

::selection { background: var(--color-hellgruen); color: var(--color-ink); }

.skip {
  position: absolute;
  left: var(--gutter);
  top: 0.5rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--color-ink);
  color: var(--color-paper);
  font-size: var(--fs-small);
  transform: translateY(-200%);
}
.skip:focus { transform: none; color: var(--color-paper); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

/* Versal-Headline (gesperrt) */
.caps {
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
}

.h2 { font-size: var(--fs-h2); }

/* Mono klein */
.small {
  font-size: var(--fs-small);
  line-height: var(--lh-mono-tight);
}

/* Pfeil in DM Mono als einziges Zeichen */
.arrow { font-family: var(--font-mono); }

/* --------------------------------------------------------------------------
   Stempelraster 3 x 5 (dekorativ, immer aria-hidden)
   -------------------------------------------------------------------------- */
.stamps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(5, 1fr);
  aspect-ratio: 3 / 5;
  width: var(--stamp-width);
  flex: none;
  border-top: var(--line-hair) solid var(--color-grid);
  border-left: var(--line-hair) solid var(--color-grid);
}
.stamps i {
  border-right: var(--line-hair) solid var(--color-grid);
  border-bottom: var(--line-hair) solid var(--color-grid);
}
.stamps--accent { --color-grid: var(--color-ink-blue); }

/* --------------------------------------------------------------------------
   Kopf und Wortmarke
   -------------------------------------------------------------------------- */
.masthead {
  padding-top: clamp(1.25rem, 3vw, 2.5rem);
}

.sender {
  font-size: var(--fs-small);
  line-height: var(--lh-mono-tight);
  padding-bottom: clamp(1.5rem, 4vw, 3.5rem);
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--gutter);
}

.wordmark {
  font-family: var(--font-head);
  font-weight: var(--fw-head);
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: 0;
  margin: 0;
  /* optischer Einzug wie in der Skizze */
  margin-left: -0.04em;
}
.wordmark > span { display: block; white-space: nowrap; }
.wm-science {
  text-transform: uppercase;
  letter-spacing: var(--ls-display-caps);
}
.wm-line2 { word-spacing: var(--ws-display); }
.wm-box {
  text-transform: uppercase;
  letter-spacing: var(--ls-display-box);
}

/* Ornament neben der Wortmarke: so hoch wie die beiden Zeilen der Wortmarke */
.hero-stamps {
  --stamp-width: calc(var(--fs-display) * 2 * var(--lh-display) * 3 / 5);
  margin-top: 0.12em;
  font-size: var(--fs-display);
}

/* --------------------------------------------------------------------------
   Einführung und Fakten
   -------------------------------------------------------------------------- */
.intro {
  display: grid;
  gap: clamp(2rem, 4vw, 3rem) var(--gutter);
  padding-top: clamp(2rem, 5vw, 4rem);
}

.lead p { max-width: var(--measure-mono); }
.lead p + p { margin-top: 1lh; }

.facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1lh var(--gutter);
  align-content: start;
}

.soon {
  margin-top: 1lh;
  padding-top: 0.75rem;
  border-top: var(--line-hair) solid var(--color-line);
}

/* --------------------------------------------------------------------------
   Abschnitte
   -------------------------------------------------------------------------- */
.section {
  margin-top: var(--section-gap);
}

.section-head h2 + p,
.section-head p + p { margin-top: 0.9rem; }
.section-head p { max-width: var(--measure-mono); }

/* Wo ist die Kiste? Haarlinien wie auf der Rückseite der Skizze */
.where {
  display: grid;
  gap: 1.5rem var(--gutter);
  padding-top: 1.25rem;
  border-top: var(--line-hair) solid var(--color-line);
}

.days {
  border-top: var(--line-hair) solid var(--color-line);
  line-height: var(--lh-mono-tight);
}
.days li {
  display: grid;
  grid-template-columns: 9ch 1fr;
  gap: var(--gutter);
  padding-block: 0.85rem;
  border-bottom: var(--line-hair) solid var(--color-line);
}

/* --------------------------------------------------------------------------
   Kacheln
   -------------------------------------------------------------------------- */
.tiles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.tile {
  position: relative;
  display: flex;
  gap: var(--tile-pad);
  justify-content: space-between;
  align-items: stretch;
  min-height: var(--tile-min-h);
  padding: var(--tile-pad);
  background: var(--tile-bg, var(--color-hellgruen));
}
.tile-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}
.tile .stamps { align-self: center; }

/* Spiegelung: Raster links */
.tile--flip { flex-direction: row-reverse; }

.tile-name {
  font-family: var(--font-head);
  font-weight: var(--fw-head);
  font-size: var(--fs-h3);
  line-height: var(--lh-heading);
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
}

/* Farbzyklus Periode 6 (Styleguide 2.2) */
.cycle > :nth-child(6n+1) { --tile-bg: var(--color-rosa); }
.cycle > :nth-child(6n+2) { --tile-bg: var(--color-mint); }
.cycle > :nth-child(6n+3) { --tile-bg: var(--color-hellgruen); }
.cycle > :nth-child(6n+4) { --tile-bg: var(--color-hellblau); }
.cycle > :nth-child(6n+5) { --tile-bg: var(--color-rose); }
.cycle > :nth-child(6n+6) { --tile-bg: var(--color-lavendel); }

/* Mobil: jede zweite Kachel gespiegelt (Zickzack wie in der Skizze) */
.shops > :nth-child(2n) { flex-direction: row-reverse; }

/* Gutschein-Teaser */
.voucher .tile { min-height: 0; }
.voucher .tile--q { --tile-bg: var(--color-hellgruen); }
.voucher .tile--how { --tile-bg: var(--color-lavendel); }
.voucher .tile--q .tile-body { justify-content: flex-start; gap: 0.9em; }
.voucher h2 { font-size: var(--fs-h2); }
.voucher .decide {
  font-family: var(--font-head);
  font-weight: var(--fw-head);
  font-size: var(--fs-h2);
  line-height: var(--lh-heading);
}
.voucher h3 {
  font-size: var(--fs-h2);
  margin-bottom: 0.9rem;
}
.voucher .tile--how .tile-body { justify-content: flex-start; gap: 0; }
.voucher .tile--how p { max-width: var(--measure-mono); }
.voucher .tile--how p + p { margin-top: 1lh; }

/* Läden-Vorschau */
.shops-area {
  display: grid;
  gap: 1.5rem 0;
}
.shops-area .section-head { padding-right: var(--gutter); }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer {
  margin-top: var(--section-gap);
  padding-block: 1.25rem 2rem;
  border-top: var(--line-hair) solid var(--color-line);
  font-size: var(--fs-small);
  line-height: var(--lh-mono-tight);
}
.footer-grid {
  display: grid;
  gap: 1rem var(--gutter);
}
.footer nav ul { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.footer a { display: inline-block; padding-block: 0.35rem; }
.footer a[aria-current="page"] { text-decoration-thickness: 2px; }

/* --------------------------------------------------------------------------
   Unterseiten (Impressum, Datenschutz)
   -------------------------------------------------------------------------- */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--gutter);
  padding-top: clamp(1.25rem, 3vw, 2.5rem);
  padding-bottom: 1.25rem;
  border-bottom: var(--line-hair) solid var(--color-line);
}
.wordmark--small {
  font-size: clamp(1.5rem, 1rem + 2vw, 2.25rem);
  margin-left: 0;
}
.wordmark--small a { text-decoration: none; display: block; }
.wordmark--small a > span { display: block; white-space: nowrap; }
.wordmark--small a:hover { color: var(--color-link-hover); }
.page-head .stamps {
  --stamp-width: calc(clamp(1.5rem, 1rem + 2vw, 2.25rem) * 2 * var(--lh-display) * 3 / 5);
}

.legal {
  display: grid;
  gap: 2rem var(--gutter);
  padding-top: clamp(2rem, 5vw, 4rem);
}
.legal h1 { font-size: var(--fs-h2); }
.legal-body {
  font-family: var(--font-head);
  font-weight: 400;
  font-size: var(--fs-text);
  line-height: var(--lh-text);
  max-width: var(--measure-text);
}
.legal-body h2 {
  font-size: var(--fs-h3);
  margin-top: 2.25rem;
  margin-bottom: 0.6rem;
}
.legal-body h2:first-child { margin-top: 0; }
.legal-body p + p { margin-top: 0.85rem; }
.legal-body .note {
  margin-top: 2rem;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
}

/* --------------------------------------------------------------------------
   404
   -------------------------------------------------------------------------- */
.empty {
  display: grid;
  gap: 0;
  margin-top: clamp(2rem, 5vw, 4rem);
}
.empty-text {
  padding: var(--tile-pad) 0 var(--tile-pad);
}
.empty h1 {
  font-size: clamp(2.25rem, 1rem + 6vw, 5.5rem);
  line-height: var(--lh-display);
  margin-bottom: 1.25rem;
}
.empty-text p + p { margin-top: 1lh; }
.empty .tile {
  --tile-bg: var(--color-hellblau);
  justify-content: center;
  align-items: center;
  min-height: 16rem;
}
.empty .stamps { --stamp-width: clamp(7rem, 5rem + 8vw, 11rem); }

/* --------------------------------------------------------------------------
   Breakpoints: Tablet ab 40 rem (2 Spalten), Desktop ab 64 rem (4 Panels)
   -------------------------------------------------------------------------- */
@media (min-width: 40rem) {
  .facts { grid-template-columns: 1fr 1fr; }

  .shops { grid-template-columns: 1fr 1fr; }
  /* Tablet, 2 Spalten: jede zweite Reihe gespiegelt, damit das Zickzack erhalten bleibt [Web] */
  .shops > :nth-child(2n) { flex-direction: row; }
  .shops > :nth-child(4n+3),
  .shops > :nth-child(4n+4) { flex-direction: row-reverse; }

  .footer-grid { grid-template-columns: 1fr 1fr; }

  .empty { grid-template-columns: 1fr 1fr; }
  .empty-text { padding: var(--tile-pad) var(--gutter) var(--tile-pad) 0; align-self: center; }
}

@media (min-width: 64rem) {
  .tiles--2 { grid-template-columns: 1fr 1fr; }

  /* vier Panels wie das Leporello */
  .intro {
    grid-template-columns: repeat(4, 1fr);
  }
  .lead { grid-column: 1 / span 2; }
  .facts-block { grid-column: 3 / span 2; }

  .where {
    grid-template-columns: repeat(4, 1fr);
  }
  .where .section-head { grid-column: 1; }
  .days { grid-column: 2 / span 3; border-top: 0; }
  .days li:first-child { padding-top: 0.15rem; }
  .days li { grid-template-columns: repeat(3, 1fr); }
  .days li > :last-child { grid-column: 2 / span 2; }

  /* Ornament auf das Panelraster setzen (Beginn Panel 4) */
  .hero-top {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }
  .wordmark { grid-column: 1 / span 3; }
  .hero-stamps { grid-column: 4; }

  .shops-area {
    grid-template-columns: repeat(4, 1fr);
  }
  .shops-area .section-head { grid-column: 1; padding-top: var(--tile-pad); }
  .shops { grid-column: 2 / span 3; grid-template-columns: repeat(3, 1fr); }
  .shops > :nth-child(n) { flex-direction: row; }
  .shops > :nth-child(6n+4),
  .shops > :nth-child(6n+5),
  .shops > :nth-child(6n+6) { flex-direction: row-reverse; }

  .footer-grid { grid-template-columns: repeat(4, 1fr); }
  .footer-grid .footer-nav { grid-column: 4; }

  .legal { grid-template-columns: repeat(4, 1fr); }
  .legal h1 { grid-column: 1; }
  .legal-body { grid-column: 2 / span 3; }

  .empty { grid-template-columns: 2fr 1fr 1fr; }
  .empty .tile { grid-column: 3; }
  .empty-text { grid-column: 1 / span 2; }
}

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

@media print {
  .skip { display: none; }
  .tile { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
