/* Palette lifted from ddir.com: off-white paper, near-black text, and the
   house red-orange. --accent starts on that red-orange and is overwritten
   per-location by ui.js, so the needle and labels pick up the colourway of
   whichever restaurant illustration is on screen. */

:root {
  --paper: #f6f6f6;
  --card: #ffffff;
  --ink: #0e0e0e;
  --ink-soft: #272727;
  --muted: #6d6d6d;
  --rule: #dcdcdc;

  --accent: #ff671d;
  /* Tint of --accent, set alongside it. Kept separate because colour-mix()
     is still too new to rely on for something this load-bearing. */
  --accent-wash: rgba(255, 103, 29, .1);
}

* { box-sizing: border-box; }

/* `display: flex` on .compass would otherwise beat the UA stylesheet's
   [hidden] rule and render both screens at once. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  /* Chasing a needle means walking around; lock out the pull-to-refresh and
     rubber-banding that otherwise fire on every glance down at the phone. */
  overscroll-behavior: none;
  touch-action: manipulation;
}

.app {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: max(1.5rem, env(safe-area-inset-top)) 1.5rem max(1.5rem, env(safe-area-inset-bottom));
}

/* ---------- gate ---------- */

.gate { text-align: center; max-width: 22rem; }

.gate__eyebrow {
  margin: 0 0 1rem;
  font-size: .72rem;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.gate__title { margin: 0; }

/* Their own wordmark, with "Compass" set beneath it in the heavy caps the
   location graphics use for place names. */
.gate__logo {
  display: block;
  width: min(72vw, 17rem);
  height: auto;
  margin: 0 auto;
}

.gate__block {
  display: block;
  margin-top: .9rem;
  font-size: clamp(1.7rem, 9vw, 2.4rem);
  line-height: 1;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
}

.gate__blurb {
  margin: 1.5rem 0 2.25rem;
  color: var(--muted);
  line-height: 1.6;
  font-size: 1rem;
}

.gate__button {
  appearance: none;
  border: 0;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .01em;
  padding: 1.05rem 1.9rem;
  border-radius: 999px;
  box-shadow: 0 .5rem 1.5rem rgba(240, 82, 61, .28);
  transition: transform .12s ease, filter .12s ease;
}
.gate__button:hover { filter: brightness(1.07); }
.gate__button:active { transform: scale(.97); }

.gate__fine {
  margin: 1.5rem 0 0;
  font-size: .78rem;
  color: #9a9a9a;
  line-height: 1.5;
}

/* ---------- compass ---------- */

.compass {
  width: 100%;
  max-width: 24rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.dial { width: min(70vw, 17.5rem); aspect-ratio: 1; }
.dial__svg { width: 100%; height: 100%; overflow: visible; }

.dial__face { fill: var(--card); stroke: var(--rule); stroke-width: 1.5; }
.dial__ring { fill: none; stroke: var(--rule); stroke-width: 1; }

.tick { stroke: #c9c9c9; stroke-width: 2; stroke-linecap: round; }
.tick--major { stroke: #8f8f8f; stroke-width: 3; }

.dial__cardinal {
  fill: var(--muted);
  font-size: 17px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
}
.dial__cardinal--n { fill: var(--ink); }

.needle__body { fill: var(--accent); }
.needle__hub { fill: var(--card); stroke: var(--accent); stroke-width: 3; }
.needle__pin { fill: var(--accent); }

/* The needle is driven by JS every frame; the transition only smooths the
   gap between frames, and must stay short or it fights the easing.
   transform-origin lives here rather than inline because the arrival spin
   runs without JS ever setting a transform -- inline, it was defaulting to
   the needle's own bounding box and throwing it off the dial. */
#needle, #rose {
  transition: transform .08s linear;
  transform-origin: 150px 150px;
}

/* Arrival: stop pretending to navigate. */
.compass--arrived #needle {
  animation: spin 1.4s cubic-bezier(.4, 0, .3, 1) infinite;
  transition: none;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.compass--searching .dial { opacity: .45; }

/* ---------- artwork ---------- */

.art {
  margin: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  background: var(--accent-wash);
  border-radius: 1rem;
  padding: 1rem 1.25rem;
}

.art__img {
  display: block;
  width: 100%;
  max-width: 17rem;
  height: auto;
  /* The illustrations are transparent line art at a fixed 750x493-ish ratio;
     reserving the box stops the readout jumping as each one decodes. */
  aspect-ratio: 750 / 493;
  object-fit: contain;
}

/* ---------- readout ---------- */

.readout { text-align: center; }

.readout__label {
  margin: 0 0 .5rem;
  font-size: .7rem;
  letter-spacing: .26em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
}

/* Normally hidden: the illustration already says the name in larger type
   than this could. ui.js reveals it when there is no artwork to lean on. */
.readout__name {
  margin: 0 0 .25rem;
  font-size: clamp(1.7rem, 7vw, 2.2rem);
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.readout__distance {
  margin: .2rem 0 0;
  font-size: 2.6rem;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  color: var(--ink);
}

.readout__unit {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--muted);
  margin-left: .35rem;
}

.readout__meta {
  margin: .5rem 0 0;
  color: var(--muted);
  font-size: .85rem;
  font-variant-numeric: tabular-nums;
}

/* Container for the stacked per-subsystem notes. */
.notes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  width: 100%;
}

.note {
  margin: 0;
  max-width: 21rem;
  text-align: center;
  font-size: .82rem;
  line-height: 1.55;
  color: var(--ink-soft);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: .8rem;
  padding: .85rem 1rem;
}
.note--alert {
  color: #8c2718;
  background: rgba(240, 82, 61, .08);
  border-color: rgba(240, 82, 61, .35);
}
.note__action {
  display: block;
  margin: .7rem auto 0;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  padding: .5rem 1.2rem;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  #needle, #rose { transition: none; }
  .compass--arrived #needle { animation: none; }
}
