/* Tüftelei: a bold blueprint. Deep blue paper, white ink, thick lines. */

:root {
  --c1: #0B2A8C;   /* paper */
  --c2: #fff;      /* ink */
  --bg: var(--c1);
  --ink: var(--c2);
  --grid: color-mix(in srgb, var(--c2) 10%, transparent);
  --grid-major: color-mix(in srgb, var(--c2) 22%, transparent);

  --line: 5px;
  --shadow: 10px 10px 0;
  --shadow-sm: 6px 6px 0;

  --display: "Archivo Black", "Arial Black", Impact, sans-serif;
  --body: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Space Mono", ui-monospace, Menlo, monospace;
}

/* Easter egg: the print. Same drawing, blue ink on white paper. */
html.inverted { --c1: #fff; --c2: #0B2A8C; }

/* Blocks that flip ink and paper locally, for punch. */
.tagline, .marquee, .contact, .btn--solid {
  --bg: var(--c2);
  --ink: var(--c1);
}

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

html { background: var(--bg); color: var(--ink); }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  font-family: var(--body);
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-major) 2px, transparent 2px),
    linear-gradient(90deg, var(--grid-major) 2px, transparent 2px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
}

h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.2rem, 7vw, 4.2rem);
  line-height: 1;
  margin: 0 0 0.35em;
  text-transform: uppercase;
}

kbd {
  font-family: var(--mono);
  font-size: 0.95em;
  padding: 0 0.35em;
  border: 2px dashed var(--ink);
}

:focus-visible { outline: 4px dashed var(--ink); outline-offset: 6px; }

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

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 100;
  padding: 0.5em 1em; background: var(--ink); color: var(--bg);
  font-weight: 700;
}
.skip:focus { top: 16px; }

/* Blueprint annotation: small mono caps. */
.note {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.8;
}

main {
  position: relative;
  transform-origin: 50% 0;
  transition: transform 0.7s cubic-bezier(0.3, 1.6, 0.5, 1);
}
main.is-tilted { transform: rotate(-4deg) translateY(30px); }

.wrap {
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: 16px;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding-block: clamp(64px, 10vw, 120px) clamp(64px, 9vw, 110px);
  text-align: center;
}
.hero > .note { margin-bottom: clamp(18px, 3vw, 30px); }

.hero h1 { margin: 0; position: relative; z-index: 1; }

.wordmark {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(12px, 1.8vw, 24px) clamp(12px, 2.2vw, 28px);
}
.syl { display: flex; gap: clamp(5px, 0.9vw, 12px); }

.tile {
  display: grid;
  place-items: center;
  width: 1em;
  height: 1.12em;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.6rem, 9vw, 6.5rem);
  line-height: 1;
  color: var(--ink);
  background: var(--bg);
  border: var(--line) solid var(--ink);
  box-shadow: var(--shadow) var(--ink);
  transform: translate(var(--ex, 0px), var(--ey, 0px)) rotate(var(--r, 0deg));
  transition: transform 0.6s cubic-bezier(0.3, 1.5, 0.5, 1);
  cursor: pointer;
  user-select: none;
}
.tile:hover { animation: wobble 0.55s ease-in-out; }

/* Exploded view: tiles drift apart, outlined like a parts diagram. */
.wordmark.is-exploded .tile {
  border-style: dashed;
  transform: translate(var(--ex, 0px), var(--ey, 0px)) rotate(calc(var(--r, 0deg) * 4));
}
.wordmark.is-exploded .tile:hover { animation: none; }

@keyframes wobble {
  0%, 100% { transform: rotate(var(--r, 0deg)); }
  25% { transform: rotate(calc(var(--r, 0deg) - 10deg)) translateY(-10px); }
  50% { transform: rotate(calc(var(--r, 0deg) + 8deg)) translateY(-4px); }
  75% { transform: rotate(calc(var(--r, 0deg) - 4deg)); }
}

/* Dimension line under the wordmark: |—— label ——| */
.dim {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 880px;
  margin: clamp(28px, 4vw, 40px) auto 0;
  font-family: var(--mono);
  font-size: clamp(0.7rem, 1.8vw, 0.9rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}
.dim::before, .dim::after {
  content: "";
  flex: 1;
  height: 16px;
  background:
    linear-gradient(var(--ink), var(--ink)) center / 100% 2px no-repeat;
  border-inline: 2px solid var(--ink);
}
.dim::before { border-right: 0; }
.dim::after { border-left: 0; }

.hero-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 18px 22px;
  margin-top: clamp(32px, 5vw, 52px);
  position: relative;
  z-index: 1;
}

.tagline {
  margin: 0;
  padding: 0.25em 0.6em;
  font-family: var(--display);
  font-size: clamp(1.4rem, 4.4vw, 2.6rem);
  text-transform: uppercase;
  background: var(--bg);
  color: var(--ink);
  transform: rotate(-2deg);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.2em 0.55em 0.2em 0.3em;
  font-family: var(--display);
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  line-height: 1.2;
  color: var(--ink);
  background: var(--bg);
  border: var(--line) solid var(--ink);
  box-shadow: var(--shadow-sm) var(--ink);
  transform: rotate(6deg);
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.badge:hover { transform: rotate(-4deg) scale(1.08); }
.badge:active { transform: rotate(6deg) scale(0.95); }
.badge svg { width: 1.2em; height: 1.2em; }

/* ---------- Stickers ---------- */

.stickers { position: absolute; inset: 0; z-index: 5; pointer-events: none; }

.sticker {
  position: absolute;
  display: grid;
  place-items: center;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
  user-select: none;
  color: var(--ink);
  background: var(--bg);
  border: var(--line) solid var(--ink);
  box-shadow: var(--shadow-sm) var(--ink);
  transform: translate(var(--x, 0px), var(--y, 0px)) rotate(var(--r, 0deg));
  transition: transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1), box-shadow 0.15s;
}
.sticker.is-dragging {
  cursor: grabbing;
  box-shadow: 16px 16px 0 var(--ink);
  transform: translate(var(--x, 0px), var(--y, 0px)) rotate(0deg) scale(1.12);
  transition: box-shadow 0.15s;
}

.sticker--cog { width: 92px; height: 92px; border: 0; box-shadow: none; background: none; }
.sticker--cog svg { width: 100%; height: 100%; animation: spin 14s linear infinite; }
.sticker--cog.is-dragging { box-shadow: none; }
.sticker--cog.is-turbo svg { animation-duration: 0.35s; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Link stickers (watch, car): drag them like the rest, click them to visit. The shadow follows the drawing's outline,
   and data-tag names the destination on hover or focus. */
.sticker--link {
  border: 0; box-shadow: none; background: none;
  text-decoration: none;
  filter: drop-shadow(6px 6px 0 var(--ink));
}
.sticker--link svg { width: 100%; height: 100%; overflow: visible; }
.sticker--link.is-dragging { box-shadow: none; filter: drop-shadow(14px 14px 0 var(--ink)); }
.sticker--link::after {
  content: attr(data-tag);
  position: absolute;
  top: calc(100% + 10px);
  padding: 3px 8px;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  color: var(--bg);
  background: var(--ink);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.sticker--link:hover::after,
.sticker--link:focus-visible::after { opacity: 1; }
.sticker--link.is-dragging::after { opacity: 0; }

/* The watch keeps the visitor's time. */
.sticker--watch { width: 84px; height: 136px; }
.hand { transform-origin: 42px 68px; }
.hand--h { transform: rotate(var(--hour, 300deg)); }
.hand--m { transform: rotate(var(--min, 60deg)); }
.hand--s { transform: rotate(var(--sec, 180deg)); }

/* The car's wheels spin while you hover it. */
.sticker--car { width: 150px; height: 74px; }
.wheel { transform-box: fill-box; transform-origin: center; }
.sticker--car:hover .wheel,
.sticker--car:focus-visible .wheel { animation: spin 0.6s linear infinite; }

.sticker--label {
  padding: 0.15em 0.5em;
  font-family: var(--display);
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  border-style: dashed;
}

.sticker--swiss { width: 64px; height: 64px; padding: 6px; }
.sticker--swiss svg { width: 100%; height: 100%; }

.sticker--screw { width: 62px; height: 62px; border-radius: 50%; }
.sticker--screw::before,
.sticker--screw::after {
  content: "";
  position: absolute;
  width: 60%; height: 8px;
  background: var(--ink);
}
.sticker--screw::after { transform: rotate(90deg); }

.sticker--round {
  width: 104px; height: 104px;
  border-radius: 50%;
  font-family: var(--display);
  font-size: 0.85rem;
  line-height: 1.1;
  text-transform: uppercase;
  text-align: center;
  outline: 2px solid var(--ink);
  outline-offset: -11px;
}

.sticker--stamp {
  padding: 0.3em 0.6em;
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-radius: 8px;
  outline: 2px solid var(--ink);
  outline-offset: -9px;
}

/* ---------- Dictionary card ---------- */

.dict {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(26px, 4vw, 48px);
  border: var(--line) solid var(--ink);
  box-shadow: var(--shadow) var(--ink);
  transform: rotate(1.2deg);
  background:
    repeating-linear-gradient(transparent 0 35px, var(--grid-major) 35px 37px),
    var(--bg);
}
.dict p { margin: 0; }
.dict .tab {
  position: absolute;
  top: calc(-1 * var(--line));
  left: 24px;
  transform: translateY(-100%);
  padding: 4px 12px;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--ink);
}
.dict-word {
  font-family: var(--display);
  font-size: clamp(2.2rem, 7vw, 4rem);
  line-height: 1.05;
}
.ipa { font-family: var(--mono); font-size: 0.36em; font-weight: 400; white-space: nowrap; }
.dict-pos {
  display: inline-block;
  margin-top: 14px !important;
  padding: 2px 12px;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 3px dashed var(--ink);
}
.dict-defs { margin: 18px 0; padding-left: 1.4em; font-size: clamp(1.15rem, 2.8vw, 1.5rem); font-weight: 700; }
.dict-defs li::marker { font-family: var(--display); }
.dict-ex { font-style: italic; border-left: 6px solid var(--ink); padding-left: 14px; }

/* ---------- Marquee ---------- */

/* The band is wider than the page so its tilted ends never show; clip it here. */
.band {
  overflow-x: clip;
  margin-block: clamp(64px, 10vw, 110px) clamp(48px, 8vw, 90px);
}

.marquee {
  width: 110vw;
  margin-left: -5vw;
  overflow: hidden;
  padding: 0.55em 0;
  font-family: var(--display);
  font-size: clamp(1.3rem, 3.6vw, 2.4rem);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink);
  background: var(--bg);
  transform: rotate(-2deg);
}
.marquee-track { display: flex; width: max-content; animation: scroll 40s linear infinite; }
.marquee-track p { margin: 0; }
@keyframes scroll { to { transform: translateX(-50%); } }

/* ---------- Buttons and toy box ---------- */

.btn {
  display: inline-block;
  padding: 0.7em 1.2em;
  font-family: var(--display);
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  line-height: 1.1;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--bg);
  text-decoration: none;
  border: var(--line) solid var(--ink);
  box-shadow: var(--shadow-sm) var(--ink);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); }
.btn:active { transform: translate(6px, 6px); box-shadow: 0 0 0 var(--ink); }
/* A solid button is white on the page, so its shadow takes the page's ink. */
.btn--solid { box-shadow: 6px 6px 0 var(--c2); }
.btn--solid:hover { box-shadow: 8px 8px 0 var(--c2); }
.btn--solid:active { box-shadow: none; }
#nope { min-width: 13ch; }
.btn--big { font-size: clamp(1.4rem, 5vw, 2.4rem); }
/* Say grüezi hops away from the mouse (see script.js), springily. */
.contact .btn { transition: transform 0.08s, box-shadow 0.08s, translate 0.35s cubic-bezier(0.3, 1.6, 0.5, 1); }

.toybox { text-align: center; }
.lede { max-width: 34ch; margin: 0 auto; font-size: clamp(1.1rem, 2.5vw, 1.3rem); }

.toys {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 28px;
  margin-top: 32px;
}

.hazard {
  padding: 12px;
  border: var(--line) solid var(--ink);
  background: repeating-linear-gradient(-45deg, var(--ink) 0 14px, var(--bg) 14px 28px);
}

/* ---------- Contact ---------- */

.contact {
  margin-top: clamp(72px, 10vw, 120px);
  padding: clamp(28px, 6vw, 64px) clamp(20px, 5vw, 56px);
  text-align: center;
  color: var(--ink);
  background: var(--bg);
  transform: rotate(-1deg);
}
.contact > p:not(.contact-mail, .note) { margin: 0 auto 28px; max-width: 40ch; }
.contact-mail { margin: 22px 0 0; font-family: var(--mono); font-weight: 700; word-break: break-all; }

/* ---------- Footer: a drawing's title block ---------- */

.titleblock {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  margin: clamp(64px, 9vw, 100px) 0 32px;
  border: var(--line) solid var(--ink);
}
.titleblock > div { padding: 10px 14px; border: 1.5px solid var(--ink); }
.titleblock dt {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.75;
}
.titleblock dd { margin: 2px 0 0; font-weight: 700; }
.tb-name dd { font-family: var(--display); font-size: 1.3rem; font-weight: 400; text-transform: uppercase; }
.tb-wide { grid-column: span 3; }
.tb-wide dd { font-size: 0.95rem; }

/* ---------- Collapse and rebuild ---------- */

/* While the page lies in pieces below the screen, nothing scrolls and nothing is clickable. */
html.is-collapsed { overflow: hidden; }
html.is-collapsed main { pointer-events: none; }

.rebuild {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 60;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  padding: 0;
  color: var(--ink);
  background: var(--bg);
  border: var(--line) solid var(--ink);
  box-shadow: var(--shadow-sm) var(--ink);
  cursor: pointer;
  transform: translateX(-50%);
  animation: drop-in 0.6s cubic-bezier(0.3, 1.6, 0.5, 1) 0.8s both;
}
.rebuild[hidden] { display: none; }
.rebuild svg { width: 30px; height: 30px; transition: transform 0.35s; }
.rebuild:hover svg, .rebuild:focus-visible svg { transform: rotate(-200deg); }
.rebuild:active { box-shadow: none; transform: translate(-50%, 4px); }
.rebuild::after {
  content: "Rebuild";
  position: absolute;
  top: calc(100% + 10px);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}
@keyframes drop-in { from { transform: translate(-50%, -140px); } }

/* ---------- Cow sighting ---------- */

.cowbox {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: clamp(16px, 3vw, 28px);
  color: var(--ink);
  background: var(--bg);
  border: var(--line) solid var(--ink);
  box-shadow: var(--shadow) var(--ink);
}
.cowbox::backdrop { background: color-mix(in srgb, #0B2A8C 80%, transparent); }
.cowbox[open] { animation: moo-in 0.4s cubic-bezier(0.3, 1.5, 0.5, 1); }
@keyframes moo-in { from { transform: translateY(40px) rotate(-3deg) scale(0.9); opacity: 0; } }
.cow-frame {
  aspect-ratio: 3 / 2;
  max-height: 60vh;
  border: 3px solid var(--ink);
  background: color-mix(in srgb, var(--ink) 12%, transparent);
}
.cow-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cow-place { margin: 14px 0 2px; font-family: var(--display); font-size: clamp(1.1rem, 3vw, 1.5rem); text-transform: uppercase; }
.cow-credit { margin: 0; font-family: var(--mono); font-size: 0.75rem; opacity: 0.85; }
.cow-credit a { color: inherit; }
.cow-actions { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 18px; }

/* ---------- Snow ---------- */

.flake {
  position: fixed;
  top: -14px;
  z-index: 40;
  border-radius: 50%;
  background: var(--c2);
  pointer-events: none;
}

/* ---------- Toast and confetti ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 50;
  width: max-content;
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: 0.7em 1.1em;
  font-weight: 700;
  text-align: center;
  color: var(--ink);
  background: var(--bg);
  border: var(--line) solid var(--ink);
  box-shadow: var(--shadow-sm) var(--ink);
  transform: translate(-50%, 140%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1), opacity 0.2s;
  pointer-events: none;
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }

.confetti {
  position: fixed;
  z-index: 40;
  border: 2px solid var(--ink);
  pointer-events: none;
}

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  :root { --line: 4px; --shadow: 7px 7px 0; --shadow-sm: 5px 5px 0; }
  .sticker { scale: 0.68; }
  /* Keep the tagline readable: tuck these two into the corners below it. */
  .sticker--round { right: 0 !important; bottom: 0 !important; }
  .sticker--screw { right: auto !important; left: 30% !important; bottom: 0 !important; }
  .sticker--stamp { top: auto !important; bottom: 26% !important; left: 0 !important; }
  .sticker--watch { right: 0 !important; top: 27% !important; }
  .sticker--watch::after { right: 0; } /* grow leftwards, so the tag stays on screen */
  .hero > .note { margin-bottom: 64px; } /* room for the car parked on the Ü */
  .dim { gap: 8px; font-size: 0.62rem; letter-spacing: 0.06em; }
  .titleblock { grid-template-columns: 1fr 1fr; }
  .tb-name, .tb-wide { grid-column: span 2; }
}

/* ---------- Calm mode ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
