/* ============================================
   TOKENS
   ============================================ */
:root {
  --bg:            #0E1117;
  --surface:       #171B24;
  --surface-2:     #1F2430;
  --border:        #2A2F3C;

  --text:          #EDEFF4;
  --text-muted:    #8890A0;
  --text-faint:    #565D6E;

  --loss:          #FF4757;
  --loss-dim:      #4A2229;
  --gain:          #2ED9A0;
  --gain-dim:      #1B3B34;
  --amber:         #FFB020;
  --violet:        #8C7CF0;

  --zalo:          #0068FF;
  --telegram:      #29A9EA;

  --font-display:  'Space Grotesk', sans-serif;
  --font-body:     'Inter', sans-serif;
  --font-mono:     'JetBrains Mono', monospace;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --max-w: 560px;
}

/* ============================================
   RESET / BASE
   ============================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

a { color: inherit; text-decoration: none; }

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 max(20px, env(safe-area-inset-left)) 0 max(20px, env(safe-area-inset-right));
}

.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main { position: relative; z-index: 2; }

.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(22px, 6vw, 26px);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.section-sub {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 24px;
}

/* ============================================
   BUTTONS — min 44px tap target throughout
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  min-height: 50px;
  padding: 14px 26px;
  border-radius: 100px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  cursor: pointer;
  border: none;
  -webkit-tap-highlight-color: transparent;
}

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

.btn-primary {
  background: var(--text);
  color: var(--bg);
}
.btn-primary:hover { box-shadow: 0 0 0 1px var(--text), 0 8px 24px -8px rgba(237,239,244,0.35); }
.btn-primary svg { transition: transform 0.15s ease; flex-shrink: 0; }
.btn-primary:hover svg { transform: translateX(2px); }

.btn-block { width: 100%; }

.btn-zalo {
  background: var(--zalo);
  color: #fff;
  flex: 1;
}
.btn-telegram {
  background: var(--telegram);
  color: #0E1117;
  flex: 1;
}
.btn-zalo:hover, .btn-telegram:hover { filter: brightness(1.08); }

/* ============================================
   HERO
   ============================================ */
.hero {
  padding: clamp(48px, 12vw, 72px) 0 36px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--gain);
  background: var(--gain-dim);
  border: 1px solid rgba(46,217,160,0.25);
  padding: 7px 14px 7px 10px;
  border-radius: 100px;
  margin-bottom: 24px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gain);
  box-shadow: 0 0 8px var(--gain);
  flex-shrink: 0;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(32px, 9vw, 50px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.strike {
  color: var(--loss);
  position: relative;
  white-space: nowrap;
}

.hero-sub {
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 46ch;
  margin-bottom: 28px;
}

.hero-meta {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-faint);
}

/* ============================================
   TRUST STRIP
   ============================================ */
.trust-strip {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 28px 0;
  background: var(--surface);
}

.trust-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.trust-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.trust-num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
}

.trust-label {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ============================================
   COMPARISON TABLE (now sits between trust strip and calculator)
   ============================================ */
.compare {
  padding: 48px 0 52px;
}

.compare-table {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.compare-row {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr 1.1fr;
  min-width: 300px;
  border-bottom: 1px solid var(--border);
}
.compare-row:last-child { border-bottom: none; }

.compare-row > div {
  padding: 12px 8px;
  font-size: 12px;
  line-height: 1.4;
}

.compare-head {
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-faint);
}

.compare-head .col-meta,
.compare-head .col-yt {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.compare-head span {
  font-size: 9.5px;
  color: var(--text-faint);
  text-transform: none;
  font-family: var(--font-body);
}

.row-label {
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
}

.compare-row:not(.compare-head) > div:nth-child(2) {
  color: var(--text-faint);
}

.compare-row .col-yt {
  color: var(--gain);
  font-weight: 500;
  background: rgba(46,217,160,0.05);
}

/* ============================================
   CALCULATOR → CTA — ONE CONTINUOUS SECTION
   ============================================ */
.calc-flow {
  padding: 8px 0 56px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.calc-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  margin-top: 20px;
}

.calc-input-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
  gap: 12px;
}

.calc-label {
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.calc-budget-display {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 19px;
  color: var(--text);
  white-space: nowrap;
}

/* Slider — thumb sized for thumbs, not cursors */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--gain) 0%, var(--gain) var(--fill, 50%), var(--surface) var(--fill, 50%), var(--surface) 100%);
  outline: none;
  cursor: pointer;
  margin: 8px 0;
  touch-action: pan-x;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--text);
  border: 5px solid var(--bg);
  box-shadow: 0 0 0 1px var(--border), 0 4px 10px rgba(0,0,0,0.4);
  cursor: grab;
}
.slider::-webkit-slider-thumb:active { cursor: grabbing; }

.slider::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--text);
  border: 5px solid var(--bg);
  box-shadow: 0 0 0 1px var(--border), 0 4px 10px rgba(0,0,0,0.4);
  cursor: grab;
}
.slider::-moz-range-progress {
  background: var(--gain);
  height: 6px;
  border-radius: 100px;
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 6px;
}

.calc-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.calc-output {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calc-output-block {
  flex: 1;
  min-width: 0;
  border-radius: var(--radius-md);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calc-output-block.loss {
  background: var(--loss-dim);
  border: 1px solid rgba(255,71,87,0.25);
}
.calc-output-block.gain {
  background: var(--gain-dim);
  border: 1px solid rgba(46,217,160,0.25);
}

.calc-output-label {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.calc-output-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(19px, 5.5vw, 24px);
  transition: transform 0.15s ease;
}
.loss .calc-output-value { color: var(--loss); }
.gain .calc-output-value { color: var(--gain); }

.calc-output-value.pulse { transform: scale(1.08); }

.calc-arrow {
  font-family: var(--font-mono);
  color: var(--text-faint);
  font-size: 16px;
  flex-shrink: 0;
}

.calc-footnote {
  font-size: 11.5px;
  color: var(--text-faint);
  line-height: 1.5;
  margin-top: 18px;
}

/* Trigger — replaces the old inline-expanding details; stays inside the
   calc-card, fixed height, never pushes the card taller. */
.methodology-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.methodology-trigger svg { color: var(--text-faint); flex-shrink: 0; }

/* Modal overlay — methodology lives here, completely out of the normal
   page flow, so the calculator card above stays a fixed, short height. */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--max-w);
  max-height: 80vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 8px 20px max(20px, env(safe-area-inset-bottom));
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 100px;
  margin: 8px auto 14px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

@media (min-width: 720px) {
  .modal-overlay { align-items: center; }
  .modal-sheet {
    max-width: 480px;
    border-radius: 20px;
    border-bottom: 1px solid var(--border);
    max-height: 85vh;
  }
  .modal-handle { display: none; }
}

.methodology-disclaimer {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.4;
  margin: 10px 0 14px;
  padding: 8px 10px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Stacked bar — composition of the total waste estimate */
.waste-stack-wrap {
  margin-bottom: 14px;
}

.waste-stack {
  display: flex;
  width: 100%;
  height: 14px;
  border-radius: 100px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
}

.stack-seg {
  height: 100%;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
}
.seg-base    { background: var(--text-faint); }
.seg-network { background: var(--loss); }
.seg-fraud   { background: var(--amber); }
.seg-region  { background: var(--violet); }

.stack-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 8px;
}

.stack-total-label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.stack-total-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 17px;
  color: var(--loss);
}

/* Per-factor rows */
.factor-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.factor-row {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.factor-list .factor-row:first-child { padding-top: 0; border-top: none; }

.factor-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.factor-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-base    { background: var(--text-faint); }
.dot-network { background: var(--loss); }
.dot-fraud   { background: var(--amber); }
.dot-region  { background: var(--violet); }

.factor-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}

.factor-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  flex-shrink: 0;
}

.factor-bar-track {
  width: 100%;
  height: 4px;
  border-radius: 100px;
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 6px;
}

.factor-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.fill-base    { background: var(--text-faint); }
.fill-network { background: var(--loss); }
.fill-fraud   { background: var(--amber); }
.fill-region  { background: var(--violet); }

.factor-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.42;
  margin-bottom: 8px;
}

.factor-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--text-faint);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px 9px 3px 7px;
}
.factor-source svg { flex-shrink: 0; opacity: 0.7; }

/* Connector — the visual seam between the number and the fix */
.connector {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 4px;
}

.connector-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border) 40%, var(--border) 60%, transparent);
}

.connector-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* CTA block — continues directly from the calculator, same surface, no seam */
.cta-block {
  text-align: center;
}

.cta-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(24px, 6.5vw, 30px);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}

.cta-loss {
  color: var(--loss);
  font-family: var(--font-mono);
}

.cta-sub {
  color: var(--text-muted);
  font-size: 14.5px;
  max-width: 38ch;
  margin: 0 auto 26px;
}

.cta-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
}

.cta-guarantee {
  font-size: 12px;
  color: var(--text-faint);
  max-width: 38ch;
  margin: 0 auto;
  line-height: 1.5;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0 max(32px, env(safe-area-inset-bottom));
}

.footer .wrap {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-faint);
}

/* ============================================
   RESPONSIVE — very small phones (SE, etc.)
   ============================================ */
@media (max-width: 360px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .calc-output { flex-direction: column; }
  .calc-arrow { transform: rotate(90deg); }
  .cta-buttons { flex-direction: column; }
  .compare-row { min-width: 0; grid-template-columns: 0.85fr 1fr 1fr; }
  .compare-row > div { padding: 10px 6px; font-size: 11px; }
}

/* ============================================
   DESKTOP — center card, don't stretch full-bleed
   ============================================ */
@media (min-width: 720px) {
  .trust-grid { flex-direction: row; }
  .trust-item { flex: 1; }
  .cta-buttons { max-width: 420px; margin-left: auto; margin-right: auto; }
}

/* Focus visibility for keyboard users */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--gain);
  outline-offset: 3px;
}
