/* ── The hero, redesigned ───────────────────────────────────────────────
   Loaded last on the home page, so it wins over the older layers
   (style.css, sketch.css, clean.css, home.css) without touching them.
   Order: a "rolling window" badge, the big two-line promise, the sub line,
   two buttons (start / download), then the quieter ways in: the CLI line
   and the Chrome extension. A warm glow sits behind it (no grid). */

.hero {
  position: relative;
  isolation: isolate;
  padding-top: 132px;
}

/* The glow, fading out before it reaches the showcase. */
.hero::before {
  content: "";
  position: absolute;
  /* Taller than the hero's top and centred well inside its own box, so the
     light fades out on every side instead of being clipped at the page top. */
  inset: -320px 0 auto;
  height: 1300px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(249, 115, 22, 0.15), rgba(249, 115, 22, 0.06) 45%, transparent 100%)
    50% 50% / min(1400px, 110vw) 100% no-repeat;
}

/* ── Badge ── */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 26px;
  padding: 5px 14px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  font: 500 14px/1.2 var(--font-body);
  color: var(--ink-soft);
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.hero-badge:hover {
  border-color: rgba(234, 88, 12, 0.45);
  color: var(--ink);
}

.hero-badge-tag {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

html[data-theme="dark"] .hero-badge-tag {
  background: rgba(249, 115, 22, 0.16);
  color: #fdba74;
}

.hero-badge svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: translate 0.15s ease;
}

.hero-badge:hover svg {
  translate: 3px 0;
}

/* ── Title ── */
.hero h1.hero-title {
  display: grid;
  margin: 0 0 22px;
  font-size: clamp(40px, 8.4vw, 108px);
  line-height: 0.96;
  letter-spacing: -0.055em;
  text-transform: none;
}

.hero h1.hero-title .shine,
.hero h1.hero-title .thin {
  display: block;
  padding-bottom: 0.06em; /* keeps descenders inside the clipped gradient */
}

.hero h1.hero-title .thin {
  background-image: linear-gradient(100deg, #f97316 10%, #ea580c 45%, #c2410c 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.hero .hero-sub {
  margin-bottom: 34px;
}

/* ── The two buttons ── */
.hero .actions {
  gap: 12px;
}

.hero .actions .cta {
  display: inline-flex;
  align-items: center;
  min-height: 54px;
  padding: 0 28px;
  font-size: 16.5px;
  box-shadow: 0 1px 2px rgba(194, 65, 12, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 14px 30px -14px rgba(234, 88, 12, 0.7);
}

/* The download capsule is just its button now; the CLI line moved below. */
.hero .get-pill {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.hero .get-btn {
  min-height: 54px;
  background: var(--ink);
  color: var(--page);
  box-shadow: 0 14px 30px -16px rgba(24, 24, 27, 0.55);
}

html[data-theme="dark"] .hero .get-btn {
  background: #f4f4f5;
  color: #18181b;
  box-shadow: none;
}

.hero .get-os .get-os-cut {
  stroke: var(--accent);
}

.hero .get-dl:hover,
.hero .get-more:hover {
  background: rgba(127, 127, 127, 0.18);
}

/* ── The quieter ways in ── */
.hero-extras {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 22px;
  margin: 22px 0 0;
}

.hero .hero-cli {
  gap: 10px;
  padding: 4px 4px 4px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.hero .hero-cli code {
  color: var(--ink);
  font-size: 14px;
}

.hero-cli-prompt {
  font: 600 14px/1 var(--font-mono);
  color: var(--accent);
}

.hero .hero-cli .get-copy {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--ink-faint);
}

.hero .hero-cli .get-copy:hover {
  background: var(--paper-deep);
  color: var(--ink);
}

.hero .hero-cli .get-copy.is-done .get-done-icon {
  color: var(--leaf-lit);
}

.hero-ext {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 600 14.5px/1.2 var(--font-body);
  color: var(--ink);
  text-decoration: none;
}

.hero-ext small {
  font-weight: 500;
  color: var(--ink-faint);
}

.hero-ext:hover {
  color: var(--accent-deep);
}

.hero-ext svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
}

/* ── Phones ── */
@media (max-width: 560px) {
  .hero {
    padding-top: 108px;
  }

  .hero-badge {
    font-size: 13px;
  }

  .hero .actions {
    flex-direction: column;
    width: 100%;
  }

  .hero .actions .cta,
  .hero .get-pill {
    width: 100%;
    max-width: 340px;
    justify-content: center;
  }

  .hero .get-btn {
    border-radius: 999px;
  }

  .hero-extras {
    flex-direction: column;
  }
}

/* ── The Philippines (ph-map.js + builders.js) ──────────────────────────
   Under the headline, straight on the page (no card): the live figures on
   the left in Sora with rolling digits, Luzon, Visayas and Mindanao on the
   right in the flag's blue, gold and red. A new arrival draws a line from
   the map to "joined today". */
.hero .ph {
  position: relative;
  display: grid;
  grid-template-columns: auto auto;
  justify-content: center;
  align-items: center;
  gap: 16px 72px;
  width: min(100% - 32px, 760px);
  margin: 10px auto 34px;
  padding: 0;
  text-align: left;
}

.ph-luzon { --ph: #2563eb; }
.ph-visayas { --ph: #eab308; }
.ph-mindanao { --ph: #dc2626; }

html[data-theme="dark"] .ph-luzon { --ph: #60a5fa; }
html[data-theme="dark"] .ph-visayas { --ph: #facc15; }
html[data-theme="dark"] .ph-mindanao { --ph: #f87171; }

.ph-stats {
  display: grid;
  gap: 22px;
}

.ph-stat,
.ph-stat.builders-today {
  position: relative;
  display: block; /* clean.css lays .builders-today out as a row */
}

.ph-stat + .ph-stat {
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.ph-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font: 600 12px/1.2 var(--font-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.ph-label .builders-leaf {
  width: 22px;
  height: 22px;
  margin: -4px -2px -4px -4px;
}

.ph-label .builders-dot {
  margin: 0 3px 0 2px;
}

/* The figures: Sora, lighter than the headline, with even-width digits. */
.hero .ph-stat strong {
  display: inline-flex;
  font-family: "Sora", var(--font-display);
  font-size: clamp(30px, 3.6vw, 42px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* Both figures match: same ink, same size. The green dot beside "joined
   today" is what marks it live. */
.hero .ph-stat.builders-today strong {
  color: var(--ink);
}

/* ── Rolling digits (builders.js builds them) ── */
.odo {
  display: inline-flex;
}

.odo-col {
  display: inline-block;
  height: 1em;
  overflow: hidden;
  /* Soft top and bottom edges, so digits roll in rather than cut in. */
  -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
}

.odo-strip {
  display: flex;
  flex-direction: column;
  transition: transform 0.9s cubic-bezier(0.2, 0.9, 0.25, 1);
}

.is-first .odo-strip {
  transition-duration: 1.8s;
}

.odo-strip > span {
  display: block;
  height: 1em;
  text-align: center;
}

.odo-sep {
  display: inline-block;
}

.odo-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The line lands: the figure gives a small kick. */
.hero .ph-stat strong.is-hit {
  animation: ph-hit 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes ph-hit {
  35% { scale: 1.06; text-shadow: 0 0 24px color-mix(in srgb, var(--leaf-lit) 45%, transparent); }
}

/* "+1" rising and fading above "joined today". */
.ph-plus {
  position: absolute;
  right: 0;
  top: 22px;
  font: 600 16px/1 "Sora", var(--font-display);
  color: var(--leaf-lit);
  opacity: 0;
  pointer-events: none;
}

.ph-plus.is-on {
  animation: ph-plus 1.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes ph-plus {
  0% { opacity: 0; translate: 0 18px; }
  20% { opacity: 1; }
  100% { opacity: 0; translate: 0 -20px; }
}

.ph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  font: 500 13px/1 var(--font-body);
  color: var(--ink-soft);
}

.ph-legend li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.ph-legend li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ph);
}

/* ── The map ── */
.ph-map-wrap {
  position: relative;
}

/* A warm pool of light under the islands. */
.ph-map-wrap::before {
  content: "";
  position: absolute;
  inset: 6% -30% 0;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(249, 115, 22, 0.12), transparent);
  pointer-events: none;
}

.ph-map {
  display: block;
  height: 440px;
  width: auto;
  aspect-ratio: 408 / 686;
  overflow: visible;
}

.ph-map .ph-dot {
  fill: var(--ph);
}

.ph-map .ph-tint {
  fill: var(--ph);
  fill-opacity: 0.1;
  stroke: var(--ph);
  stroke-opacity: 0.4;
  stroke-width: 0.8;
  stroke-linejoin: round;
}

.ph-map .ph-dots {
  opacity: 0.85;
}

/* Each island group rises in, one after another, the first time it is seen. */
.ph-map .ph-region {
  opacity: 0;
  translate: 0 14px;
  filter: drop-shadow(0 8px 10px color-mix(in srgb, var(--ph) 22%, transparent));
  transition:
    opacity 0.8s ease calc(var(--i) * 0.18s),
    translate 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) calc(var(--i) * 0.18s),
    filter 0.3s ease;
}

.ph-map.is-in .ph-region {
  opacity: 1;
  translate: 0 0;
}

.ph-map .ph-region:hover {
  filter: brightness(1.12) saturate(1.2) drop-shadow(0 8px 14px color-mix(in srgb, var(--ph) 40%, transparent));
}

.ph-map .ph-region:hover .ph-name {
  fill: var(--ink);
}

.ph-map .ph-region.is-lit .ph-dots {
  animation: ph-lit 1.4s ease;
}

@keyframes ph-lit {
  30% { opacity: 1; filter: brightness(1.3); }
}

.ph-map .ph-name {
  font: 600 19px/1 var(--font-body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  fill: var(--ink-faint);
  transition: fill 0.2s ease;
}

.ph-map .ph-city {
  fill: var(--ph);
  stroke: var(--page);
  stroke-width: 1.6;
}

.ph-map .ph-ping {
  fill: none;
  stroke: var(--ph);
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  animation: ph-ping 1.8s cubic-bezier(0, 0, 0.2, 1) forwards;
}

.ph-map .ph-ping.is-join {
  stroke-width: 3;
  animation-name: ph-ping-big;
  animation-duration: 2.2s;
}

@keyframes ph-ping {
  from { opacity: 0.9; transform: scale(1); }
  to { opacity: 0; transform: scale(6); }
}

@keyframes ph-ping-big {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(12); }
}

/* ── The arrival line (ph-map.js draws it over the whole block) ── */
.ph-trail {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.ph-trail .ph-line {
  fill: none;
  stroke: var(--ph);
  stroke-width: 2;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--ph) 55%, transparent));
  transition: opacity 0.8s ease;
}

.ph-trail .ph-comet {
  fill: #fff;
  stroke: var(--ph);
  stroke-width: 3;
  filter: drop-shadow(0 0 8px var(--ph));
  transition: opacity 0.5s ease, r 0.5s ease;
}

.ph-trail .is-done {
  opacity: 0;
}

/* ── Phones: map on top, the two figures side by side under it ── */
@media (max-width: 640px) {
  .hero .ph {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 22px;
    text-align: center;
  }

  .ph-map-wrap {
    order: -1;
  }

  .ph-map {
    height: 320px;
  }

  .ph-stats {
    grid-template-columns: 1fr 1fr;
    gap: 18px 12px;
    width: 100%;
  }

  .ph-stat + .ph-stat {
    padding-top: 0;
    padding-left: 12px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .ph-label {
    justify-content: center;
    letter-spacing: 0.1em;
  }

  .hero .ph-stat strong {
    font-size: 30px;
  }

  .ph-plus {
    right: auto;
    left: 50%;
    top: 14px;
    margin-left: 34px; /* beside the figure; translate belongs to the rise */
  }

  .ph-legend {
    grid-column: 1 / -1;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .odo-strip {
    transition: none;
  }

  .ph-map .ph-region {
    opacity: 1;
    translate: none;
    transition: none;
  }

  .hero .ph-stat strong.is-hit,
  .ph-plus.is-on,
  .ph-map .ph-region.is-lit .ph-dots {
    animation: none;
  }
}

/* ── Hero layout: split under the headline ───────────────────────────────
   The figures, the pitch and the buttons sit left of the map, so the way in
   is on the first screen instead of under a tall map. Below 900px it stacks:
   map, figures, pitch, buttons. */
.ph-main {
  display: grid;
  gap: 28px;
  min-width: 0;
}

.hero .ph .hero-sub,
.hero .ph .hero-extras {
  margin: 0;
}

@media (min-width: 900px) {
  .hero .ph {
    grid-template-columns: minmax(0, 520px) auto;
    gap: 16px 72px;
    width: min(100% - 48px, 980px);
    margin: 18px auto 44px;
  }

  .ph-main {
    justify-items: start;
  }

  .ph-stats {
    grid-template-columns: auto auto;
    justify-content: start;
    gap: 14px 30px;
  }

  .ph-stat + .ph-stat {
    padding: 0 0 0 30px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .ph-legend {
    grid-column: 1 / -1;
  }

  .hero .ph .hero-sub {
    max-width: 44ch;
    text-align: left;
  }

  .hero .ph .actions,
  .hero .ph .hero-extras {
    justify-content: flex-start;
  }

  .ph-plus {
    top: 26px;
    right: 0;
  }

  .ph-map {
    height: 400px;
  }
}

@media (max-width: 899px) {
  .hero .ph {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 22px;
    text-align: center;
  }

  .ph-map-wrap {
    order: -1;
  }

  .ph-main {
    justify-items: center;
    gap: 22px;
    width: 100%;
  }

  .ph-stats {
    grid-template-columns: 1fr 1fr;
    gap: 18px 12px;
    width: 100%;
    max-width: 420px;
  }

  .ph-stat + .ph-stat {
    padding: 0 0 0 12px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .ph-label {
    justify-content: center;
  }

  .ph-legend {
    grid-column: 1 / -1;
    justify-content: center;
  }
}
