/* Colours from atlas/docs/brand/BRAND.md, as on hevelius.tech. Never pure white on dark. */
:root {
  color-scheme: light dark;
  --bg: #FFFFFF;
  --fg: #0B0D12;
  --brass: #9A7128;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0D12;
    --fg: #ECEDEF;
    --brass: #D1AB62;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/*
  Layout (Penpot "Atlas - TRO", page "Kerbside landing"): logo and tagline
  centred near the top, the scene at the bottom with the bay's base line
  --base above the bottom edge, and a dotted road line across the full width at
  that height. The page is a flow column, so the scene never overlaps the
  tagline: on a short window the page scrolls instead.
*/
:root {
  --base: 48px;
  --scene-w: min(clamp(374px, 58.3vw, 1120px), 105vh);
}

@supports (height: 1dvh) {
  :root { --scene-w: min(clamp(374px, 58.3vw, 1120px), 105dvh); }
}

header {
  padding: 18vh 1rem 0;
  text-align: center;
}

@supports (height: 1dvh) {
  header { padding-top: 18dvh; }
}

.home {
  display: inline-block;
  width: clamp(160px, 17vw, 240px);
  line-height: 0;
}

.home img {
  display: block;
  width: 100%;
  height: auto;
}

main {
  box-sizing: border-box;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  text-align: center;
}

h1 {
  box-sizing: border-box;
  max-width: 520px;
  margin: 24px auto 0;
  padding: 0 1rem;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.6;
}

.stage {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  margin-top: auto;
  padding-top: 2rem;
  padding-bottom: calc(var(--base) + env(safe-area-inset-bottom, 0px));
}

/* The road: a dotted line, full width, level with the bay's base. */
.stage::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--base) + env(safe-area-inset-bottom, 0px) - 1px);
  height: 2px;
  opacity: 0.35;
  background: radial-gradient(circle at 1px 1px, var(--fg) 0.9px, transparent 1.1px) 0 0 / 6px 2px repeat-x;
  pointer-events: none;
}

.stage picture {
  display: block;
  width: var(--scene-w);
  margin: 0 auto;
}

.scene {
  display: block;
  width: 100%;
  height: auto;
  -webkit-user-drag: none;
}

a {
  color: inherit;
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* One sentence per line when there is room; each wraps evenly on a narrow screen. */
h1 span {
  display: block;
  text-wrap: balance;
}

@media (max-width: 600px) {
  :root {
    --base: 36px;
    --scene-w: min(92vw, 105vh);
  }

  header { padding-top: 96px; }

  h1 { font-size: 17px; }
}

@supports (height: 1dvh) {
  @media (max-width: 600px) {
    :root { --scene-w: min(92vw, 105dvh); }
  }
}

/*
  Entrance (kerbside-entrance-start.js, kerbside-entrance.js). Without script,
  or with reduced motion, nothing below applies and scene.svg shows. If the
  script fails or is late, it removes `js-entrance`, which puts the page back
  to that state. While the dots play they are the scene, so the image stays hidden.
*/
.entrance-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* Drag to park (fine pointer only; the script sets these classes). */
.car-hot { cursor: grab; }
.car-drag, .car-drag * { cursor: grabbing; user-select: none; -webkit-user-select: none; }

@media (prefers-reduced-motion: no-preference) {
  .js-entrance .scene,
  .js-entrance .home,
  .js-entrance h1 span {
    opacity: 0;
  }

  .js-entrance.entrance-run .home {
    opacity: 1;
    animation: entrance-line 900ms cubic-bezier(0.23, 1, 0.32, 1) 600ms backwards;
  }

  .js-entrance.entrance-run h1 span {
    opacity: 1;
    animation: entrance-line 700ms cubic-bezier(0.23, 1, 0.32, 1) 2300ms backwards;
  }

  .js-entrance.entrance-run h1 span + span {
    animation-delay: 3000ms;
  }

  .entrance-paused .home,
  .entrance-paused h1 span {
    animation-play-state: paused;
  }
}

@keyframes entrance-line {
  from {
    opacity: 0;
    transform: translateY(0.5em);
  }
}

/* The paths the script samples its dots from: measured, never seen. */
.scene-src {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
