/*
 * Components. Colors and sizes come from tokens.css only.
 */

/* Buttons. A flat call to action is <a role="button" class="button">. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--button-height);
  min-width: var(--tap-min);
  padding: 0 var(--space-6);
  border: 1px solid transparent;
  border-radius: var(--radius-input);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: 700;
  font-synthesis: none;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, transform 120ms ease;
}

.button:active {
  background: var(--accent-pressed);
  transform: translateY(1px);
}

.button-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.button-secondary:active {
  background: var(--surface);
}

/* .button-block: opt-in full-width button on phones (hero and wizard action bars). */
@media (max-width: 599px) {
  .button-block {
    display: flex;
    width: 100%;
  }
}

/* Icons: <svg class="icon"><use href="#icon-..."/></svg>, symbols in app/views/shared/_icons.html.erb. */
.icon {
  flex: none;
  width: var(--space-6);
  height: var(--space-6);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The sprite holds symbols only. The hidden attribute does not hide an SVG element, so it takes no box here. */
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Skip link: the first focusable element, off screen until it has focus. */
.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 10;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
  padding: 0 var(--space-4);
  border-radius: var(--radius-input);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-200%);
}

/* Shown in flow, so it pushes the header down instead of covering the brand link. */
.skip-link:focus {
  position: static;
  align-self: flex-start;
  margin: var(--space-2);
  transform: none;
}

/* Public layout: header, hero, map, how it works, footer. */
body.public {
  display: flex;
  flex-direction: column;
}

body.public > main {
  flex: 1 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  background: var(--bg);
  color: var(--text);
  padding: var(--space-4);
  padding-top: max(var(--space-4), env(safe-area-inset-top));
  padding-left: max(var(--space-4), env(safe-area-inset-left));
  padding-right: max(var(--space-4), env(safe-area-inset-right));
}

/* The logo artwork was drawn on a light ground, so it sits on a plate of that
   same color (--logo-plate) in the dark header. The link is the whole plate:
   --logo-height tall plus --space-1 above and below (the brand row). */
.brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-input);
  background: var(--logo-plate);
  text-decoration: none;
}

.brand-logo {
  display: block;
  height: var(--logo-height);
  width: auto;
}

.hero {
  background: var(--bg);
  color: var(--text);
  padding: var(--space-8) var(--space-4) var(--space-12);
  padding-left: max(var(--space-4), env(safe-area-inset-left));
  padding-right: max(var(--space-4), env(safe-area-inset-right));
}

.hero-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  gap: var(--space-8);
}

.hero-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.hero-subhead {
  margin-top: var(--space-3);
  max-width: 34rem;
  color: var(--text-muted);
  font-size: var(--text-lg);
  text-wrap: pretty;
}

/* Action slots (hero and header): empty until step 2 adds Log in, and then take no space. */
.hero-actions,
.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.hero-actions {
  margin-top: var(--space-6);
}

.hero-actions:empty,
.header-actions:empty {
  display: none;
}

.us-map {
  display: block;
  width: 100%;
  height: auto;
}

.us-map-land {
  fill: var(--surface);
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linejoin: round;
}

.us-map-route {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 2 16;
  animation: route-drift 8s linear infinite;
}

/* The dots drift from Los Angeles toward New York: 8 dash periods (2 + 16) per loop, so it never jumps.
   base.css stops it under prefers-reduced-motion. */
@keyframes route-drift {
  to { stroke-dashoffset: -144; }
}

.us-map-pin circle { fill: var(--accent); }
.us-map-pin .us-map-pin-core { fill: var(--bg); }

/* How it works: three numbered steps under the hero. */
.how {
  border-top: 1px solid var(--border);
  padding: var(--space-12) var(--space-4);
  padding-left: max(var(--space-4), env(safe-area-inset-left));
  padding-right: max(var(--space-4), env(safe-area-inset-right));
}

.how-inner {
  max-width: 1120px;
  margin: 0 auto;
}

.section-label {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.how-steps {
  display: grid;
  gap: var(--space-4);
  margin: var(--space-4) 0 0;
  padding: 0;
  list-style: none;
}

.how-step {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.how-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--space-8);
  height: var(--space-8);
  border: 2px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1;
}

.how-step-icon {
  width: var(--space-8);
  height: var(--space-8);
  color: var(--accent);
}

.how-step-title,
.how-step-text {
  flex-basis: 100%;
}

.how-step-title {
  margin-top: var(--space-2);
}

.how-step-text {
  color: var(--text-muted);
}

.site-footer {
  padding: var(--space-6) var(--space-4);
  padding-bottom: max(var(--space-6), env(safe-area-inset-bottom));
  color: var(--text-muted);
  font-size: var(--text-sm);
  text-align: center;
}

@media (min-width: 900px) {
  .site-header {
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }

  /* The hero fills the first screen under the header (its brand row, --logo-height plus --space-1 above
     and below, plus --space-4 above and below), content centered, so the fold is clean and the strip starts below it. */
  .hero {
    display: grid;
    align-items: center;
    min-height: calc(100vh - (var(--logo-height) + 2 * var(--space-1) + 2 * var(--space-4)));
    min-height: calc(100dvh - (var(--logo-height) + 2 * var(--space-1) + 2 * var(--space-4)));
    padding: var(--space-12) var(--space-8);
  }

  .hero-inner {
    width: 100%;
    grid-template-columns: 5fr 6fr;
    align-items: center;
  }

  .hero-title {
    font-size: calc(var(--text-2xl) * 1.5);
  }

  .how {
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }

  .how-steps {
    grid-template-columns: repeat(3, 1fr);
  }
}
