/* How long courier colours take to glide on the main page (raise it to slow them down) */
:root { --glide: 1s; }

/* LANDING PAGE */
.nav-cta-ghost { display: none; }
.hero.landing { min-height: 92vh; }

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  animation: fadeUp 0.6s 0.3s ease both;
}

.btn {
  height: 48px;
  padding: 0 24px;
  border-radius: 12px;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.4s, border-color 0.2s, color 0.2s, filter 0.15s, transform 0.1s;
}

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

.btn-primary { background-color: var(--accent-color, var(--blue)); color: var(--on-accent, #fff); }
.btn-primary:hover { filter: brightness(0.9); }

.btn-ghost {
  background: var(--input-bg);
  color: var(--text2);
  border: 1px solid var(--border2);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text3); }

/* Headline name: the old and new name cross-fade in place (opacity only, light on phones) */
#heroAccent {
  display: inline-grid;
  justify-items: center;
  white-space: nowrap;
}
#heroAccent .word {
  grid-area: 1 / 1;
  white-space: nowrap;
  transition: opacity 0.9s ease-in-out;
}
#heroAccent .word.enter, #heroAccent .word.leave { opacity: 0; }

/* Colour changes use one shared timing, so everything moves together */
.hero.landing h1 .accent { transition: none; }
.hero.landing .hero-tag { transition: background-color var(--glide) ease-in-out, border-color var(--glide) ease-in-out, color var(--glide) ease-in-out; }
.hero.landing .hero-tag-dot { transition: background-color var(--glide) ease-in-out; }
.theme-toggle-thumb { transition: left 0.3s cubic-bezier(0.4,0,0.2,1), background-color var(--glide) ease-in-out; }
.btn-primary { transition: background-color var(--glide) ease-in-out, color var(--glide) ease-in-out, filter 0.15s, transform 0.1s; }

.nav-links { display: flex; align-items: center; gap: 4px; }
#heroAccent.swap { opacity: 0; }

.land-section {
  padding: 4.5rem 1.5rem;
  max-width: 920px;
  margin: 0 auto;
  scroll-margin-top: 64px;
}

.land-section h2 {
  font-family: var(--display);
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  text-align: center;
  margin-bottom: 0.75rem;
}

.land-lead {
  text-align: center;
  color: var(--text2);
  font-size: 15px;
  line-height: 1.6;
  max-width: 460px;
  margin: 0 auto 2.5rem;
}

/* COURIER LIST: dots share one vertical line */
.ledger {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.ledger-row {
  display: grid;
  grid-template-columns: 8px 1fr auto 14px;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  background: var(--recent-item-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}

.ledger-row:hover { border-color: var(--c); background: var(--bg3); }

.ledger-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

.ledger-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

.ledger-site {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ledger-row svg { stroke: var(--text3); transition: stroke 0.2s, transform 0.2s; }
.ledger-row:hover svg { stroke: var(--c); transform: translateX(2px); }

/* HOW IT WORKS */
.how {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--recent-item-bg);
  overflow: hidden;
}

.how-step { padding: 1.75rem 1.5rem; }
.how-step + .how-step { border-left: 1px solid var(--border); }

.how-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent-color, var(--blue));
  margin-bottom: 0.9rem;
  transition: color var(--glide) ease-in-out;
}

.how-title {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.how-desc { font-size: 13px; color: var(--text2); line-height: 1.6; }

/* closing call to action */
.land-cta {
  text-align: center;
  padding: 4rem 1.5rem 5rem;
}

.land-cta h2 {
  font-family: var(--display);
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}

.features { padding-top: 1rem; }

@media (max-width: 700px) {
  .ledger { grid-template-columns: 1fr; }
  .how { grid-template-columns: 1fr; }
  .how-step + .how-step { border-left: none; border-top: 1px solid var(--border); }
}

@media (prefers-reduced-motion: reduce) {
  #heroAccent .word, .glow-layer { transition: none; }
  .feat-card { opacity: 1 !important; transform: none !important; transition: none; }
}

/* Each sentence of this heading stays on one line */
.h2-line { display: block; width: max-content; max-width: none; margin: 0 auto; white-space: nowrap; }

/* tap behaviour on touch screens */
a, button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* MOBILE */
@media (max-width: 600px) {
  body::before { display: none; }

  /* same header as desktop: logo + name, page links, track button, theme toggle.
     Sizes are compact here and landing.js scales the row down further if a phone is narrower. */
  nav { padding-left: 0.5rem; padding-right: 0.5rem; }
  .nav-logo { gap: 6px; flex-shrink: 0; }
  .nav-logo-icon { width: 28px; height: 28px; }
  .nav-logo-icon svg { width: 18px; height: 18px; }
  .nav-logo-text { white-space: nowrap; }
  .nav-right { gap: 0; flex-shrink: 0; }
  .nav-links { gap: 0; }
  .nav-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; white-space: nowrap; }
  /* at the top the page links sit on the right; after scrolling they slide away and the button takes their place */
  .nav-right { flex: 0 0 auto; }
  .nav-links {
    flex: 0 0 auto; justify-content: flex-end; max-width: var(--links-w, 320px); overflow: hidden;
    transition: max-width 0.3s ease, opacity 0.25s ease, visibility 0s;
  }
  .nav-link { flex-shrink: 0; }
  html:not(.at-top) .nav-links {
    max-width: 0; opacity: 0; visibility: hidden; pointer-events: none;
    transition: max-width 0.3s ease, opacity 0.2s ease, visibility 0s linear 0.3s;
  }
  html:not(.ready) .nav-links { transition: none; }   /* no movement while the page is still loading */

  /* "Track a parcel": hidden at the top of the page (its space collapses), slides open after scrolling */
  .nav-cta {
    display: inline-flex; align-items: center; min-height: 40px; padding: 0 13px; margin-left: 4px;
    font-size: 14px; white-space: nowrap; max-width: var(--cta-w, 150px); overflow: hidden;
    transition: max-width 0.3s ease, padding 0.3s ease, margin 0.3s ease, opacity 0.25s ease, transform 0.25s ease,
                background-color var(--glide) ease-in-out, color var(--glide) ease-in-out, filter 0.15s;
  }
  html.at-top .nav-cta {
    max-width: 0; padding-left: 0; padding-right: 0; margin-left: 0;
    opacity: 0; transform: translateY(-4px); visibility: hidden; pointer-events: none;
    transition: max-width 0.3s ease, padding 0.3s ease, margin 0.3s ease, opacity 0.2s ease, transform 0.2s ease,
                visibility 0s linear 0.3s, background-color var(--glide) ease-in-out, color var(--glide) ease-in-out;
  }
  html:not(.ready) .nav-cta { transition: none; }   /* no movement while the page is still loading */

  /* invisible copy that tells the page how wide the real button will be (see landing.js) */
  .nav-cta-ghost {
    display: inline-flex; position: absolute; visibility: hidden; pointer-events: none;
    padding: 0 13px; margin-left: 4px; font-size: 14px; white-space: nowrap; font-weight: 500;
  }
  .theme-toggle { padding: 7px 0; margin-left: 5px; flex-shrink: 0; }   /* full size: 56 x 30 with a 44px touch area */
  .lang-btn { margin-left: 2px; }

  .hero.landing {
    min-height: auto;
    justify-content: flex-start;
    padding: calc(88px + env(safe-area-inset-top, 0px)) 1.25rem 3rem;
  }

  .hero-tag { margin-bottom: 1.5rem; }

  /* one line at every width, so the headline never jumps while the name changes */
  .hero.landing h1 {
    font-size: clamp(1.9rem, 9.5vw, 2.6rem);
    margin-bottom: 1.1rem;
  }

  .hero.landing .hero-sub { font-size: 0.95rem; min-height: 0; margin-bottom: 1.75rem; }

  .hero-actions { width: 100%; max-width: 360px; }
  .hero-actions .btn { flex: 1; padding: 0 12px; }

  .land-section { padding: 3rem 1.25rem; scroll-margin-top: 16px; }
  .land-lead { margin-bottom: 1.5rem; font-size: 14px; }

  /* courier list: two compact columns instead of ten tall rows */
  .ledger { grid-template-columns: 1fr 1fr; gap: 7px; }
  .ledger-row { grid-template-columns: 8px 1fr; gap: 12px; padding: 14px 14px; min-height: 48px; }
  .ledger-site, .ledger-row svg { display: none; }
  .ledger-name { font-size: 14px; white-space: normal; line-height: 1.25; }

  .how-step { padding: 1.25rem; }

  .features { padding: 1rem 1.25rem 2.5rem; }
  .features h2 { margin-bottom: 1.75rem; }
  .features h2.features-title { font-size: clamp(1.05rem, 6.6vw, 1.7rem); }
  .feat-card { padding: 1.25rem; }

  .land-cta { padding: 2.5rem 1.25rem 3.5rem; }
  .land-cta .btn { width: 100%; max-width: 360px; }

  footer { padding: 2rem 1.25rem calc(2rem + env(safe-area-inset-bottom, 0px)); }
  .footer-links { gap: 2px 14px; }
  .footer-links a { padding: 8px 2px; }
}

/* narrower phones: a little less padding so the text can stay large */
@media (max-width: 389px) {
  .nav-link { padding: 0 5px; }
}

/* very narrow phones (320px class): slightly tighter header and controls */
@media (max-width: 340px) {
  .nav-link { padding: 0 3px; font-size: 13px; }
  .nav-cta, .nav-cta-ghost { font-size: 13px; padding-left: 10px; padding-right: 10px; }
  .nav-logo-text { font-size: 14px; }
  .nav-logo { gap: 5px; }
  .nav-logo-icon { width: 26px; height: 26px; }
  .nav-logo-icon svg { width: 17px; height: 17px; }
  .lang-btn { width: 32px; height: 32px; }
  .lang-btn svg { width: 16px; height: 16px; }
  .lang-btn::after { inset: -6px; }
  .theme-toggle { zoom: 0.88; padding: 9px 0; }
}
