/* ============================================================
   CityFrame — shared base for every page: the home page, the
   shared plan page (/j/:token), the link page (/s/:id) and the
   legal pages. home.css adds the home page sections on top.

   The tokens are the mobile app's own, so the site and the app
   look like one product. Sources (mobile_app/src/theme):
     ground #F5F6FC        palette.gray50 (screen background)
     ink    #0D111C        palette.gray900
     ink-2  #404A67        palette.gray600
     ink-3  #5D6785        palette.gray500 (AA on white, per onboardingTheme)
     line   #D2D9EE        palette.gray150
     accent #367BE2        palette.primary
     gold   #FFF5E8/#905C10 GoldenHourBand (gold50 / gold500)

   Contrast (WCAG 2.x, measured): ink/ground 17.5, ink-2/ground 8.1,
   ink-3/ground 5.2, accent-text/ground 4.9, gold-text/gold-bg 5.2,
   white/ink 18.9. accent #367BE2 is 3.8 on ground: icons and
   large text only, never body links. gold-icon is decorative.
   ============================================================ */

/* Inter, subset to Latin from the app's own font files (SIL OFL 1.1). */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/inter-400-3afab078.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/inter-500-b50112e2.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/inter-600-cdff2493.woff2") format("woff2");
}

/* Arial scaled to Inter's metrics, so the swap does not move the text. */
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Helvetica");
  size-adjust: 107.06%;
  ascent-override: 90.49%;
  descent-override: 22.56%;
  line-gap-override: 0%;
}

:root {
  --ground: #f5f6fc;
  --surface: #ffffff;
  --surface-2: #e8ecfb;
  --line: #d2d9ee;
  --ink: #0d111c;
  --ink-2: #404a67;
  --ink-3: #5d6785;
  --accent: #367be2;
  --accent-text: #1267d6;
  --accent-soft: #f3f5fe;
  --gold-bg: #fff5e8;
  --gold-line: #f8deb6;
  --gold-text: #905c10;
  --gold-icon: #db900b;
  --gold-fill: #b17900;
  --danger-bg: #fef0ee;
  --danger-text: #c4292f;

  --font: "Inter", "Inter Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;

  --r-tile: 14px;
  --r-card: 18px;
  --r-control: 16px;
  --shadow: 0 1px 2px rgba(13, 17, 28, 0.06), 0 10px 30px rgba(13, 17, 28, 0.07);
  --shadow-soft: 0 1px 2px rgba(13, 17, 28, 0.05), 0 4px 14px rgba(13, 17, 28, 0.05);

  --gutter: clamp(16px, 5vw, 56px);
  --maxw: 1200px;
  --section-y: clamp(72px, 10vw, 136px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  color-scheme: light;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 17px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}

@media (min-width: 900px) {
  body {
    font-size: 18px;
  }
}

a {
  color: var(--accent-text);
  text-underline-offset: 3px;
}

img,
svg {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

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

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
}

.skip-link:focus-visible {
  top: 16px;
}

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

h1,
h2,
h3 {
  font-family: var(--font);
  font-weight: 600;
  text-wrap: balance;
}

h2 {
  margin: 0;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

h3 {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

/* ---------- Brand ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
}

/* The app icon's folded map, drawn as a mask so it takes the text colour. */
.brand-mark {
  width: 24px;
  height: 22px;
  flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='190 235 660 595'%3E%3Cpath d='M205 350L368 252V705L205 795ZM410 252L630 378V815L410 695ZM672 252L835 350V705L672 800Z' stroke='%23000' stroke-width='24' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='190 235 660 595'%3E%3Cpath d='M205 350L368 252V705L205 795ZM410 252L630 378V815L410 695ZM672 252L835 350V705L672 800Z' stroke='%23000' stroke-width='24' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

/* ---------- Buttons: an ink pill, like the app's centre "+" ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 14px 24px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font: 600 17px/1.2 var(--font);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background-color 0.2s var(--ease);
}

.button:hover {
  background: #1b2236;
  transform: translateY(-1px);
}

.button:active {
  transform: scale(0.98);
}

.button.small {
  min-height: 44px;
  padding: 10px 18px;
  font-size: 15px;
}

/* ---------- Official store badges (unmodified artwork) ---------- */
.badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 10px;
  line-height: 0;
}

.badge img {
  display: block;
  width: auto;
  height: 48px;
}

/* Google's badge ships with clear space around it; this lines its
   visible edge up with Apple's without cropping the artwork. */
.badge.google img {
  height: 71px;
  margin: -11.5px -11.5px;
}

/* ============================================================
   LIGHT BAR — sunrise to sunset, golden windows, stop markers
   ============================================================ */
.lightbar {
  margin: 22px 0 0;
  font-variant-numeric: tabular-nums;
}

.lightbar .track {
  position: relative;
  height: 14px;
  margin: 40px 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
}

.lightbar .day,
.lightbar .gold {
  position: absolute;
  top: 0;
  bottom: 0;
}

.lightbar .day {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.lightbar .gold {
  background: var(--gold-fill);
}

/* Stop markers stand above the bar so they never hide the golden windows. */
.lightbar .tick {
  position: absolute;
  bottom: calc(100% + 8px);
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 26px;
  text-align: center;
  white-space: nowrap;
}

.lightbar .ends {
  position: relative;
  height: 22px;
  margin-top: 10px;
  color: var(--ink-3);
  font-size: 14px;
}

.lightbar .ends span {
  position: absolute;
  top: 0;
  white-space: nowrap;
}

/* ============================================================
   PLAN VIEW — shared by /j/:token and the home page demo
   ============================================================ */
.planview {
  overflow-wrap: anywhere;
}

.plan-page {
  background: var(--ground);
}

.plan-page main {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 20px 48px;
}

.plan-title {
  margin: 20px 0 6px;
  font-size: clamp(32px, 9vw, 44px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.planview .date {
  margin: 0;
  color: var(--ink-2);
  font-size: 18px;
  font-weight: 500;
}

.planview .muted,
.plan-page .muted {
  color: var(--ink-3);
}

.planview .owner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 0;
  color: var(--ink-2);
  font-size: 15px;
}

.planview .avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 600;
  object-fit: cover;
}

.planview .banner {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: var(--r-tile);
  background: var(--danger-bg);
  color: var(--danger-text);
  font-weight: 500;
}

/* The golden-hour band, as in the app (GoldenHourBand). */
.planview .light {
  display: grid;
  gap: 6px;
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--gold-line);
  border-radius: 12px;
  background: var(--gold-bg);
  font-size: 15px;
}

.planview .light div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 12px;
}

.planview .light dt {
  color: var(--gold-text);
  font-weight: 600;
}

.planview .light dd {
  margin: 0;
  color: var(--ink-2);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.planview .notes {
  margin: 20px 0 0;
  color: var(--ink-2);
  white-space: pre-line;
}

.planview .stops-head {
  margin: 28px 0 8px;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.planview .stops {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.planview .stop {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-tile);
  background: var(--surface);
}

.planview .num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 28px;
  text-align: center;
}

.planview .stop p {
  margin: 2px 0 0;
  font-size: 15px;
}

.planview .stop .stop-name {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

.planview .stop .note {
  margin-top: 6px;
  color: var(--ink-2);
  white-space: pre-line;
}

.planview .maps {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 15px;
  font-weight: 500;
}

.planview time {
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.planview .empty {
  color: var(--ink-3);
}

/* Only the button stays on screen; everything else sits below it. */
.plan-page .cta {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 24px -20px 0;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--ground) 72%, rgba(245, 246, 252, 0));
}

.plan-page .cta .button {
  width: 100%;
}

.planview .open,
.planview .hint,
.planview .linktext,
.planview .organiser,
.plan-page .open,
.plan-page .hint,
.plan-page .linktext,
.plan-page .organiser {
  margin: 8px 0 0;
  color: var(--ink-3);
  font-size: 15px;
  text-align: center;
}

.planview .open a,
.plan-page .open a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent-text);
  font-weight: 500;
}

.planview .linktext,
.plan-page .linktext {
  user-select: all;
  font-size: 14px;
}

.planview .stores,
.plan-page .stores {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 16px 0 0;
  font-size: 15px;
}

.planview .stores a,
.plan-page .stores a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 500;
}

.planview .organiser,
.plan-page .organiser {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.plan-page main.center {
  padding-top: 12vh;
  text-align: center;
}

.plan-page .center .plan-title {
  margin-top: 28px;
}

.plan-page .retry {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 8px;
  font-weight: 500;
}

/* ============================================================
   LINK PAGE — /s/:id
   ============================================================ */
.link-page {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 32px 20px;
  text-align: center;
}

.link-page h1 {
  margin: 0;
  font-size: clamp(30px, 8vw, 40px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.link-page p {
  max-width: 36ch;
  margin: 0;
  color: var(--ink-3);
}

.link-page .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.link-page .secondary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink-2);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
