/* nilsreeh.de — under construction
   Dark, minimal, self-contained. System fonts only, no external requests. */

:root {
  --bg: #0b0d10;
  --bg-ground: #0e1114;
  --fg: #ecebe6;
  --muted: #8b929c;
  --line: #262c34;
  --amber: #f3b83c;
  --amber-dark: #d9982a;
  --steel: #3b424c;
  --steel-dark: #22262c;
  --glass: #12151a;
  --font: system-ui, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter: clamp(20px, 4vw, 48px);
  --scene-h: 230px;
}

@media (max-height: 760px) {
  :root { --scene-h: 190px; }
}

@media (max-width: 600px), (max-height: 560px) {
  :root { --scene-h: 150px; }
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding-bottom: var(--scene-h);
  font-family: var(--font);
  color: var(--fg);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }

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

/* ---------- header ---------- */

.top {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(18px, 3vw, 32px) var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--fg);
}

.brand__mark {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(243, 184, 60, 0.14);
}

.lang {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
}

.lang__btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 6px 4px;
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.lang__btn:hover { color: var(--fg); }

.lang__btn[aria-pressed="true"] {
  color: var(--amber);
  border-bottom-color: var(--amber);
}

.lang__sep { color: var(--line); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  z-index: 2;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 2rem var(--gutter);
}

.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 50%;
  width: min(80vw, 760px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(243, 184, 60, 0.09), rgba(243, 184, 60, 0) 62%);
  pointer-events: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(243, 184, 60, 0.45); }
  60% { box-shadow: 0 0 0 7px rgba(243, 184, 60, 0); }
}

.headline {
  margin: 0.7rem 0 1.15rem;
  font-size: clamp(2.7rem, 9vw, 6.4rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lede {
  max-width: 36ch;
  margin: 0 auto;
  font-size: clamp(1.02rem, 1.5vw, 1.22rem);
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
}

/* ---------- footer (legal notice link) ----------
   Pinned to the bottom-right corner, inside the dark ground strip below the scene's
   ground line. The strip is 36 of the 240 viewBox units, scaled by whichever axis
   limits the SVG ("meet"): the viewport width or the scene height. */

.foot {
  position: fixed;
  right: var(--gutter);
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  height: calc(36 * min(100vw / 800, var(--scene-h) / 240));
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1;
  letter-spacing: 0.06em;
}

.foot__link {
  position: relative;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

/* Invisible hit area (>= 44px tall inside the viewport) for touch; the visible text stays inside the strip. */
.foot__link::before {
  content: "";
  position: absolute;
  left: -12px;
  right: -12px;
  bottom: -6px;
  height: 48px;
}

.foot__link:hover { color: var(--fg); }

/* ---------- drifting code background ---------- */

.code-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  font-family: var(--mono);
  font-size: clamp(0.72rem, 1.1vw, 0.9rem);
  color: var(--fg);
}

.code-line {
  position: absolute;
  white-space: nowrap;
  opacity: var(--alpha, 0.07);
  animation: drift var(--dur, 60s) ease-in-out var(--delay, 0s) infinite alternate;
  will-change: transform;
}

@keyframes drift {
  from { transform: translate(0, 0); }
  to { transform: translate(var(--dx, 40px), var(--dy, -30px)); }
}

/* ---------- scene (construction site) ---------- */

.scene {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  height: var(--scene-h);
  overflow: hidden;
  pointer-events: none;
}

/* Fixed viewBox, bottom-centred; the ground line runs past the viewBox edges. */
.scene__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ground {
  stroke: var(--line);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.ground-cover { fill: var(--bg-ground); }

.shadow { fill: #000; opacity: 0.4; }

.amber { fill: var(--amber); }
.amber-dark { fill: var(--amber-dark); }
.steel { fill: var(--steel); }
.track { fill: var(--steel-dark); }
.joint { fill: #14171b; }

.belt {
  fill: none;
  stroke: #4b545f;
  stroke-width: 2;
  stroke-dasharray: 5 4;
}

.wheel circle,
.t-wheel circle { fill: #2e343c; stroke: #4b545f; stroke-width: 1.5; }
.wheel line,
.t-wheel line { stroke: #4b545f; stroke-width: 1.5; stroke-linecap: round; }

.glass { fill: var(--glass); }
.glass-line { stroke: #5b6470; stroke-width: 1.5; stroke-linecap: round; }

.cyl { stroke: #2b3139; stroke-width: 5; stroke-linecap: round; }
.rod { stroke: #8f98a3; stroke-width: 2; stroke-linecap: round; }

.teeth { fill: none; stroke: var(--steel); stroke-width: 1.5; stroke-linejoin: round; }

/* rubble pile */
.pile { fill: #232930; }
.pile-chunk { fill: #343b45; }
.pile-chunk--amber { fill: var(--amber-dark); opacity: 0.55; }

/* dump truck */
.bed-back { fill: #2a3038; }
.bed-front { fill: var(--steel); }

/* tower crane */
.lattice { fill: url(#lattice); }
.lattice-line { stroke: #3a424c; stroke-width: 1.2; }
.chord { stroke: #58616c; stroke-width: 2; stroke-linecap: round; }
.tie { stroke: #4b545f; stroke-width: 1; }
.counterweight { fill: #2a3038; stroke: #4b545f; stroke-width: 1; }
.cable { stroke: #9aa3ad; stroke-width: 1.2; }
.hook-path { fill: none; stroke: #9aa3ad; stroke-width: 2; stroke-linecap: round; }

/* website wireframe */
.frame { fill: rgba(255, 255, 255, 0.015); stroke: #363d47; stroke-width: 1.2; }
.frame-bar { fill: #1c2127; }
.frame-dot { fill: #4b545f; }
.frame-dot--amber { fill: var(--amber); }

.glyph {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  fill: var(--bg);
}

.cursor { fill: var(--bg); }

.block--amber { fill: var(--amber); }
.block--amber-dark { fill: var(--amber-dark); }
.block--amber-alt { fill: #b98420; }
.block--grey { fill: #4b545f; }
.block--grey-dark { fill: #3b424c; }

.block.is-dropped {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: settle 0.34s ease-out;
}

@keyframes settle {
  0% { transform: scale(1.05, 0.86); }
  60% { transform: scale(0.98, 1.04); }
  100% { transform: scale(1, 1); }
}

/* exhaust puffs: only visible while the engine works */
.puffs {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.is-driving .puffs,
.is-working .puffs { opacity: 1; }

.puff {
  fill: #7d8793;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: puff 1.5s ease-out infinite;
}

.puff:nth-child(2) { animation-delay: 0.5s; }
.puff:nth-child(3) { animation-delay: 1s; }

@keyframes puff {
  0% { opacity: 0; transform: translate(0, 0) scale(0.5); }
  15% { opacity: 0.55; }
  100% { opacity: 0; transform: translate(-16px, -26px) scale(2.2); }
}

/* dust when the bucket bites into the pile */
.dust circle {
  fill: #6b7480;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

.dust.is-active circle { animation: dust 0.7s ease-out forwards; }
.dust.is-active circle:nth-child(1) { --ddx: -10px; }
.dust.is-active circle:nth-child(2) { --ddx: 0px; animation-delay: 0.05s; }
.dust.is-active circle:nth-child(3) { --ddx: 10px; animation-delay: 0.1s; }

@keyframes dust {
  0% { opacity: 0.6; transform: translate(0, 0) scale(0.6); }
  100% { opacity: 0; transform: translate(var(--ddx, 0px), -16px) scale(1.8); }
}

/* ---------- legal page ----------
   Plain text document: no cards, no boxes, no background scene. */

body[data-page="legal"] { padding-bottom: 0; }

.legal {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: calc(60ch + 2 * var(--gutter));
  margin: 0;
  padding: clamp(0.5rem, 3vh, 2rem) var(--gutter) 4rem;
  align-self: start;
  font-size: 1rem;
  line-height: 1.6;
}

.legal h1 {
  margin: 0 0 2rem;
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.legal h2 {
  margin: 2rem 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
}

.legal p {
  margin: 0 0 1rem;
  text-wrap: pretty;
}

.legal a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-underline-offset: 0.18em;
}

.legal a:hover { text-decoration-color: var(--fg); }

.legal__back {
  margin-top: 3rem;
  font-size: 0.9rem;
}

.legal__back a { color: var(--muted); }
.legal__back a:hover { color: var(--fg); }

.foot--legal { display: none; }

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .code-line,
  .eyebrow__dot,
  .puff,
  .dust circle,
  .block.is-dropped {
    animation: none;
  }
  .puffs { opacity: 0 !important; }
  .lang__btn,
  .foot__link,
  .legal a,
  .puffs {
    transition: none;
  }
}
