/* ============================================================
   NOMAD — overland freight & last-mile delivery
   Cinematic dusty-desert scroll experience
   ============================================================ */

:root {
  /* warm desert palette */
  --sky-top: #ede2ca;
  --sky-mid: #ecd5a8;
  --sky-haze: #e9c894;
  --sun: #fdeecb;

  --sand-1: #e7d3ad;
  --sand-2: #d8bd8c;
  --sand-3: #c7a877;
  --sand-4: #ad8a5c;

  --road: #2b2118;
  --road-line: #c9a86a;

  --ink: #241a10;
  --ink-soft: #4a3a26;
  --paper: #f6edda;
  --muted: #8a755a;

  --accent: #c8783c;       /* burnt terracotta */
  --accent-deep: #9c4a22;  /* deep rust */
  --accent-ink: #2a1608;

  --panel: rgba(28, 20, 12, 0.62);
  --panel-line: rgba(246, 237, 218, 0.16);

  --font-display: "Archivo", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  font-family: var(--font-display);
  color: var(--paper);
  background: var(--sky-top);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: #fff; }

/* ============================================================
   FIXED WORLD (background that the truck drives through)
   ============================================================ */
#world {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(
    180deg,
    var(--sky-top) 0%,
    var(--sky-mid) 46%,
    var(--sky-haze) 70%,
    #e3bd86 84%,
    #d8ad73 100%
  );
  transition: background 1.2s var(--ease);
}

.layer {
  position: absolute;
  left: -10%;
  width: 120%;
  background-repeat: repeat-x;
  will-change: background-position, transform;
}

/* sun glow */
#sun {
  position: absolute;
  width: 46vmax;
  height: 46vmax;
  border-radius: 50%;
  left: 60%;
  top: 2%;
  transform: translate(-50%, -20%);
  background: radial-gradient(
    circle at center,
    rgba(255, 250, 235, 0.95) 0%,
    rgba(253, 232, 190, 0.55) 22%,
    rgba(250, 214, 150, 0.18) 46%,
    rgba(250, 214, 150, 0) 66%
  );
  mix-blend-mode: screen;
  will-change: transform;
  pointer-events: none;
}

#layer-mtn   { bottom: 30vh; height: 42vh; opacity: 0.85; }
#layer-dune3 { bottom: 26vh; height: 40vh; }
#layer-dune2 { bottom: 20vh; height: 40vh; }
#layer-dune1 { bottom: 14vh; height: 42vh; }

/* atmospheric haze band over the horizon */
#haze {
  position: absolute;
  left: 0; right: 0;
  bottom: 18vh;
  height: 34vh;
  background: linear-gradient(180deg, rgba(236,213,168,0) 0%, rgba(236,206,150,0.55) 60%, rgba(231,200,148,0.85) 100%);
  pointer-events: none;
}

/* ---- the road ---- */
#road {
  position: absolute;
  left: 0; right: 0;
  bottom: 0;
  height: 22vh;
  background:
    linear-gradient(180deg, #6b5238 0%, #3c2d1e 14%, var(--road) 30%, #1d160e 100%);
  box-shadow: inset 0 14px 30px rgba(0,0,0,0.35);
}
#road::before { /* top sandy shoulder */
  content: "";
  position: absolute;
  left: 0; right: 0; top: -3.4vh;
  height: 4vh;
  background: linear-gradient(180deg, rgba(173,138,92,0) 0%, #ad8a5c 55%, #8d6c44 100%);
}
#road-dashes {
  position: absolute;
  left: -10%; width: 120%;
  bottom: 7.5vh;
  height: 0.9vh;
  background-repeat: repeat-x;
  background-size: 180px 100%;
  background-image: linear-gradient(90deg, var(--road-line) 0 56%, transparent 56% 100%);
  opacity: 0.55;
  filter: blur(0.3px);
  will-change: background-position;
}
#road-grain {
  position: absolute; inset: 0;
  background-repeat: repeat-x;
  opacity: 0.5;
  will-change: background-position;
}

/* ---- truck ---- */
#truck-stage {
  position: absolute;
  left: 50%;
  bottom: 9vh;
  width: min(46vw, 640px);
  transform: translateX(-50%);
  will-change: transform;
  z-index: 3;
}
#truck-stage svg { width: 100%; height: auto; display: block; overflow: visible; }
.wheel { transform-box: fill-box; transform-origin: center; }

#dust {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 34vh;
  z-index: 2;
  pointer-events: none;
}

/* ============================================================
   CINEMATIC OVERLAYS
   ============================================================ */
#grain {
  position: fixed; inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-repeat: repeat;
  background-size: 180px 180px;
}
#vignette {
  position: fixed; inset: 0;
  z-index: 59;
  pointer-events: none;
  background: radial-gradient(125% 105% at 50% 38%, transparent 52%, rgba(40,24,8,0.16) 78%, rgba(28,16,4,0.42) 100%);
}

/* ============================================================
   HUD
   ============================================================ */
#hud {
  position: fixed; inset: 0;
  z-index: 50;
  pointer-events: none;
  font-family: var(--font-mono);
  color: var(--ink);
}
.hud-c { position: absolute; font-size: 11px; line-height: 1.5; letter-spacing: 0.06em; }
.hud-tl { top: 22px; left: 24px; }
.hud-tr { top: 22px; right: 24px; text-align: right; }
.hud-bl { bottom: 20px; left: 24px; color: #f1e4cb; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.hud-br { bottom: 20px; right: 24px; text-align: right; color: #f1e4cb; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.hud-dim { opacity: 0.55; }
.hud-mark {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.18em;
  display: flex; align-items: center; gap: 8px;
}
.hud-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(200,120,60,0.22); animation: pulse 2.4s var(--ease) infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

#scrollbar-track {
  position: fixed;
  right: 24px; top: 50%;
  transform: translateY(-50%);
  width: 2px; height: 120px;
  background: rgba(36,26,16,0.18);
  z-index: 50; pointer-events: none;
}
#scrollbar-fill { position: absolute; top: 0; left: -1px; width: 4px; background: var(--accent); height: 0%; }

.hud-hidden #hud, .hud-hidden #scrollbar-track { display: none; }

/* ============================================================
   CONTENT
   ============================================================ */
#scroll-root { position: relative; z-index: 10; }

.section {
  position: relative;
  min-height: 100vh;
  display: flex;
  padding: 13vh 7vw 26vh;
}
.section[data-align="center"] { align-items: center; justify-content: center; text-align: center; }
.section[data-align="top"] { align-items: flex-start; }

/* reveal — driven by JS rAF tween (robust against frozen CSS timelines) */
.rise { opacity: 0; will-change: opacity, transform; }

.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent-deep);
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 26px;
}
.kicker::before { content: ""; width: 38px; height: 1px; background: var(--accent-deep); opacity: 0.6; }

.display {
  font-weight: 900;
  line-height: 0.86;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-transform: uppercase;
}
.lead { color: var(--ink-soft); }

/* ---------- HERO ---------- */
#hero { flex-direction: column; justify-content: space-between; }
.hero-top { max-width: 64rem; }
#hero h1 { font-size: clamp(58px, 12.5vw, 188px); }
#hero h1 .rust { color: var(--accent-deep); -webkit-text-stroke: 0; }
.hero-sub {
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.4vw, 16px);
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  max-width: 34rem;
  margin-top: 28px;
}
.scrollcue {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--ink); display: flex; align-items: center; gap: 12px;
}
.scrollcue .bar { position: relative; width: 1px; height: 46px; background: rgba(36,26,16,0.25); overflow: hidden; }
.scrollcue .bar::after { content: ""; position: absolute; left: -1px; width: 3px; height: 16px; background: var(--accent); animation: cue 2.2s var(--ease) infinite; }
@keyframes cue { 0% { top: -16px; } 100% { top: 46px; } }

/* ---------- MANIFESTO ---------- */
#manifesto .quote {
  font-weight: 800;
  font-size: clamp(30px, 5.4vw, 78px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--ink);
  max-width: 22ch;
  margin: 0 auto;
}
#manifesto .quote em { font-style: normal; color: var(--accent-deep); }
#manifesto .foot { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.18em; color: var(--ink-soft); margin-top: 40px; text-transform: uppercase; }

/* ---------- panel (dark dusty card) ---------- */
.panelwrap { width: 100%; max-width: 1180px; margin: 0 auto; }
.eyebrow-row { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 18px; margin-bottom: 46px; }
.eyebrow-row h2 { font-weight: 900; font-size: clamp(30px, 4.4vw, 60px); color: var(--ink); text-transform: uppercase; letter-spacing: -0.01em; line-height: 0.92; }
.eyebrow-note { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; color: var(--ink-soft); max-width: 30ch; }

/* services grid */
.services { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.svc {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 4px;
  padding: 26px 22px 30px;
  min-height: 320px;
  display: flex; flex-direction: column;
  backdrop-filter: blur(7px) saturate(1.05);
  -webkit-backdrop-filter: blur(7px) saturate(1.05);
  transition: transform 0.5s var(--ease), border-color 0.5s var(--ease), background 0.5s var(--ease);
}
.svc:hover { transform: translateY(-8px); border-color: rgba(200,120,60,0.6); background: rgba(34,22,12,0.74); }
.svc .num { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em; color: var(--accent); }
.svc h3 { font-weight: 800; font-size: 25px; margin-top: auto; line-height: 1.02; text-transform: uppercase; }
.svc p { color: rgba(246,237,218,0.72); font-size: 14.5px; line-height: 1.5; margin-top: 12px; }
.svc .meta { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; color: rgba(246,237,218,0.45); margin-top: 18px; }
.svc .ico { width: 34px; height: 34px; border: 1.5px solid var(--accent); border-radius: 50%; display: grid; place-items: center; color: var(--accent); font-size: 15px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { padding: 30px 8px; border-top: 1.5px solid rgba(36,26,16,0.28); }
.stat .v { font-weight: 900; font-size: clamp(40px, 6vw, 82px); color: var(--ink); line-height: 0.9; letter-spacing: -0.02em; }
.stat .v .u { color: var(--accent-deep); }
.stat .l { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; color: var(--ink-soft); text-transform: uppercase; margin-top: 14px; }

/* ---------- TRACKING ---------- */
.track-card {
  width: 100%; max-width: 880px; margin: 0 auto;
  background: rgba(24,16,9,0.74);
  border: 1px solid var(--panel-line);
  border-radius: 6px;
  padding: 40px;
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  box-shadow: 0 30px 80px rgba(20,10,2,0.4);
}
.track-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.track-head .t { font-weight: 900; font-size: clamp(26px, 3.4vw, 40px); text-transform: uppercase; letter-spacing: -0.01em; }
.track-head .st { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; color: rgba(246,237,218,0.5); }
.track-form { display: flex; gap: 10px; }
.track-form input {
  flex: 1;
  background: rgba(246,237,218,0.06);
  border: 1px solid rgba(246,237,218,0.2);
  border-radius: 4px;
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 16px;
  letter-spacing: 0.16em;
  padding: 16px 18px;
  text-transform: uppercase;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.track-form input::placeholder { color: rgba(246,237,218,0.34); letter-spacing: 0.16em; }
.track-form input:focus { outline: none; border-color: var(--accent); background: rgba(246,237,218,0.1); }
.btn {
  font-family: var(--font-mono);
  font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 700;
  background: var(--accent); color: #fff;
  border: none; border-radius: 4px;
  padding: 0 30px;
  cursor: pointer;
  transition: background 0.3s var(--ease), transform 0.2s var(--ease);
}
.btn:hover { background: var(--accent-deep); }
.btn:active { transform: translateY(1px); }
.track-hint { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; color: rgba(246,237,218,0.4); margin-top: 12px; }
.track-hint b { color: var(--accent); cursor: pointer; }

/* result */
.track-result { overflow: hidden; max-height: 0; opacity: 0; }
.track-result.open { max-height: 2000px; opacity: 1; margin-top: 30px; }
.track-route { display: flex; align-items: center; justify-content: space-between; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; color: rgba(246,237,218,0.62); }
.track-route .city { color: var(--paper); font-size: 14px; }
.track-progress { position: relative; height: 4px; background: rgba(246,237,218,0.14); border-radius: 4px; margin: 18px 0 6px; }
.track-progress .fill { position: absolute; left: 0; top: 0; height: 100%; width: 0; background: var(--accent); border-radius: 4px; }
.track-progress .ptruck { position: absolute; top: -9px; left: 0; transform: translateX(-50%); font-size: 14px; }
.track-meta { display: flex; gap: 30px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; color: rgba(246,237,218,0.55); margin-top: 8px; }
.track-meta b { color: var(--accent); }
.timeline { margin-top: 28px; display: grid; gap: 0; }
.tl-step { display: grid; grid-template-columns: 26px 1fr auto; gap: 16px; align-items: start; padding: 12px 0; position: relative; opacity: 0.4; }
.tl-step.done, .tl-step.active { opacity: 1; }
.tl-step .node { width: 13px; height: 13px; border-radius: 50%; border: 2px solid rgba(246,237,218,0.4); margin: 3px auto 0; position: relative; z-index: 2; background: #1a120a; }
.tl-step.done .node { background: var(--accent); border-color: var(--accent); }
.tl-step.active .node { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(200,120,60,0.22); }
.tl-step::before { content: ""; position: absolute; left: 12px; top: 18px; bottom: -6px; width: 2px; background: rgba(246,237,218,0.16); }
.tl-step:last-child::before { display: none; }
.tl-step.done::before { background: var(--accent); }
.tl-step .lab { font-weight: 700; font-size: 15px; text-transform: uppercase; letter-spacing: 0.02em; }
.tl-step .sub { font-size: 13px; color: rgba(246,237,218,0.6); margin-top: 3px; }
.tl-step .time { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; color: rgba(246,237,218,0.5); white-space: nowrap; }

/* ---------- FOOTER ---------- */
#footer { flex-direction: column; justify-content: center; align-items: center; text-align: center; }
#footer .cta { font-weight: 900; font-size: clamp(46px, 10vw, 150px); color: var(--ink); text-transform: uppercase; line-height: 0.86; letter-spacing: -0.02em; }
#footer .cta .rust { color: var(--accent-deep); }
.foot-actions { margin-top: 40px; display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid rgba(36,26,16,0.4); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.foot-grid { margin-top: 12vh; display: flex; gap: 50px; flex-wrap: wrap; justify-content: center; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; color: var(--ink-soft); }
.foot-grid .col { text-align: left; }
.foot-grid .col .h { color: var(--accent-deep); letter-spacing: 0.18em; margin-bottom: 10px; }
.foot-grid .col a { color: var(--ink-soft); text-decoration: none; display: block; line-height: 1.9; transition: color 0.2s; }
.foot-grid .col a:hover { color: var(--accent); }
.copyline { margin-top: 9vh; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; color: var(--muted); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .services { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 6px 18px; }
  #truck-stage { width: 78vw; bottom: 8vh; }
  .section { padding: 12vh 6vw 28vh; }
}
@media (max-width: 560px) {
  .services { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .track-card { padding: 26px 20px; }
  .track-form { flex-direction: column; }
  .btn { padding: 16px 30px; }
  .hud-tr, .hud-bl { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .rise { opacity: 1 !important; transform: none !important; }
  .wheel { animation: none !important; }
}

/* ============================================================
   TIME-OF-DAY MOODS (Tweaks)
   ============================================================ */
body[data-tod="arany"] #world {
  background: linear-gradient(180deg, #f1dbb1 0%, #efcb8a 46%, #e7b06c 70%, #db914e 84%, #cd773a 100%);
}
body[data-tod="arany"] #haze {
  background: linear-gradient(180deg, rgba(239,203,138,0) 0%, rgba(228,160,90,0.55) 60%, rgba(219,140,72,0.88) 100%);
}
body[data-tod="parázs"] #world {
  background: linear-gradient(180deg, #ecca9c 0%, #e2a96f 44%, #cf7c47 68%, #a85431 86%, #7c3a23 100%);
}
body[data-tod="parázs"] #haze {
  background: linear-gradient(180deg, rgba(226,169,111,0) 0%, rgba(200,110,66,0.6) 58%, rgba(150,70,44,0.9) 100%);
}
body[data-tod="parázs"] #sun { opacity: 0.82; }
body[data-tod="parázs"] #road { filter: brightness(0.88); }

/* tweaks panel must never be hidden by the grain/vignette overlays */
#tweaks-root { position: relative; z-index: 70; }
