/* ============================================================
   TIRE WARRANTY CALCULATOR — style.css
   Mobile-first, modern, sleek
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ── DESIGN TOKENS ── */
:root {
  --navy:          #0f172a;
  --navy-mid:      #1e293b;
  --navy-light:    #334155;
  --blue:          #3b82f6;
  --blue-dark:     #2563eb;
  --blue-pale:     #eff6ff;
  --blue-border:   #bfdbfe;
  --green:         #16a34a;
  --green-pale:    #f0fdf4;
  --green-border:  #bbf7d0;
  --amber:         #d97706;
  --amber-pale:    #fffbeb;
  --amber-border:  #fde68a;
  --red:           #dc2626;
  --red-pale:      #fef2f2;
  --red-border:    #fecaca;
  --slate-50:      #f8fafc;
  --slate-100:     #f1f5f9;
  --slate-200:     #e2e8f0;
  --slate-300:     #cbd5e1;
  --slate-400:     #94a3b8;
  --slate-500:     #64748b;
  --slate-600:     #475569;
  --slate-700:     #334155;
  --slate-900:     #0f172a;

  --font:          'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-sm:     8px;
  --radius-md:     12px;
  --radius-lg:     18px;
  --shadow-sm:     0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
  --ease:          cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--slate-100);
  color: var(--slate-900);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
input, button, select, textarea { font-family: inherit; font-size: inherit; }
ol { padding-left: 1.4em; }
ol li { margin-bottom: 4px; }

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
  0%   { transform: scale(0.88); opacity: 0; }
  60%  { transform: scale(1.03); }
  100% { transform: scale(1);    opacity: 1; }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── LAYOUT ── */
.container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px;
}
.main {
  flex: 1;
  padding: 24px 0 64px;
}

/* ── HEADER ── */
.header {
  background: var(--navy);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06), 0 4px 20px rgba(0,0,0,0.3);
  /* Extend behind Safari's status bar when saved to home screen */
  padding-top: env(safe-area-inset-top);
}
.header__inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header__home {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--slate-400);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.1);
  transition: color 150ms, background 150ms, border-color 150ms;
  white-space: nowrap;
  flex-shrink: 0;
}

.header__home svg {
  width: 15px;
  height: 15px;
}

.header__home:hover {
  color: #fff;
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.18);
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo__icon {
  width: 36px;
  height: 36px;
  color: var(--blue);
  flex-shrink: 0;
  animation: spin 12s linear infinite;
}
.logo__text {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.15;
}
.logo__title {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}
.logo__sub {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--slate-400);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── LANDING PAGE ── */
.landing-body {
  background: var(--navy);
  min-height: 100vh;
  min-height: 100dvh; /* Safari: excludes browser chrome */
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.landing {
  width: 100%;
  padding: 40px 0 60px;
}

.landing__inner {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: fadeUp 0.5s var(--ease) both;
}

.landing__heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.landing__icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  color: var(--blue);
  filter: drop-shadow(0 2px 12px rgba(59,130,246,0.5));
}

.landing__icon svg { width: 100%; height: 100%; }

.landing__title {
  font-size: clamp(1.6rem, 6vw, 2rem);
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-align: left;
  margin-bottom: 0;
}

.landing__lead {
  font-size: 1rem;
  color: var(--slate-400);
  max-width: 340px;
  line-height: 1.65;
  margin-bottom: 32px;
}

.landing__cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-bottom: 32px;
}

.landing__card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: left;
}

.landing__card strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 3px;
}

.landing__card p {
  font-size: 0.82rem;
  color: var(--slate-400);
  line-height: 1.55;
  margin: 0;
}

.landing__card--highlight {
  background: rgba(217,119,6,0.1);
  border-color: rgba(217,119,6,0.25);
}

.landing__card--highlight strong { color: #fbbf24; }

.landing__card-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.btn-start {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 17px 32px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 24px rgba(59,130,246,0.4);
  transition: background 150ms, transform 150ms, box-shadow 150ms;
  margin-bottom: 20px;
}

.btn-start svg {
  width: 18px;
  height: 18px;
  transition: transform 200ms var(--ease);
}

.btn-start:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(59,130,246,0.45);
}

.btn-start:hover svg { transform: translateX(3px); }
.btn-start:active    { transform: none; }

.landing__note {
  font-size: 0.72rem;
  color: var(--slate-600);
  max-width: 300px;
  line-height: 1.5;
}

/* ── WELCOME SCREEN (old — keep for reference) ── */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 0 32px;
  animation: fadeUp 0.45s var(--ease) both;
}

.welcome__icon {
  width: 72px;
  height: 72px;
  color: var(--blue);
  margin-bottom: 20px;
  filter: drop-shadow(0 4px 16px rgba(59,130,246,0.3));
}

.welcome__icon svg {
  width: 100%;
  height: 100%;
}

.welcome__title {
  font-size: clamp(1.7rem, 6vw, 2.2rem);
  font-weight: 900;
  color: var(--slate-900);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.welcome__lead {
  font-size: 0.975rem;
  color: var(--slate-500);
  max-width: 360px;
  line-height: 1.6;
  margin-bottom: 28px;
}

.welcome__cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-bottom: 28px;
}

.welcome__card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.welcome__card strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--slate-800);
  margin-bottom: 3px;
}

.welcome__card p {
  font-size: 0.82rem;
  color: var(--slate-500);
  line-height: 1.55;
  margin: 0;
}

.welcome__card--highlight {
  background: var(--amber-pale);
  border-color: var(--amber-border);
}

.welcome__card--highlight strong {
  color: var(--amber);
}

.welcome__card-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}

.btn-start {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(15,23,42,0.3);
  transition: background 150ms, transform 150ms, box-shadow 150ms;
  width: 100%;
  justify-content: center;
  margin-bottom: 16px;
}

.btn-start svg {
  width: 18px;
  height: 18px;
  transition: transform 200ms var(--ease);
}

.btn-start:hover {
  background: var(--navy-light);
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(15,23,42,0.35);
}

.btn-start:hover svg {
  transform: translateX(3px);
}

.btn-start:active {
  transform: none;
}

.welcome__note {
  font-size: 0.72rem;
  color: var(--slate-400);
  max-width: 320px;
  line-height: 1.5;
}

/* ── CALCULATOR WRAPPER ── */
.calculator {
  animation: fadeUp 0.3s var(--ease) both;
}

/* ── TABS ── */
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 5px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 12px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--slate-500);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 180ms var(--ease);
  white-space: nowrap;
}
.tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.tab:hover:not(.tab--active) {
  background: var(--slate-100);
  color: var(--slate-700);
}
.tab--active {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 2px 8px rgba(15,23,42,0.25);
}

/* ── PANEL ── */
.panel {
  animation: fadeUp 0.35s var(--ease) both;
}
.panel--hidden { display: none; }

/* ── TREAD INFO BANNER ── */
.tread-info {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--blue-pale);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--slate-600);
  line-height: 1.5;
}
.tread-info svg {
  width: 18px;
  height: 18px;
  color: var(--blue);
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── FORM CARD ── */
.calc-form {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
}

/* ── FIELD GRID ── */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field--full { grid-column: 1 / -1; }

/* ── LABELS ── */
.label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--slate-600);
  letter-spacing: 0.01em;
}
.label__unit {
  font-weight: 500;
  font-size: 0.72rem;
  color: var(--slate-400);
  background: var(--slate-100);
  padding: 2px 7px;
  border-radius: 99px;
}

/* ── INPUTS ── */
.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  background: var(--slate-50);
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--slate-900);
  transition: border-color 150ms, box-shadow 150ms, background 150ms;
  -webkit-appearance: none;
  appearance: none;
}
.input::-webkit-outer-spin-button,
.input::-webkit-inner-spin-button { -webkit-appearance: none; }
.input[type=number] { -moz-appearance: textfield; }
.input::placeholder { color: var(--slate-300); }
.input:focus {
  outline: none;
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.input.is-error {
  border-color: var(--red);
  background: var(--red-pale);
  box-shadow: 0 0 0 3px rgba(220,38,38,0.1);
}

/* Prefix ($) */
.input-wrap--prefix {
  position: relative;
  display: flex;
  align-items: center;
}
.input-prefix {
  position: absolute;
  left: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--slate-400);
  pointer-events: none;
  z-index: 1;
}
.input--prefix { padding-left: 26px; }

/* Select wrapper */
.input-wrap--select {
  position: relative;
}
.input--select {
  cursor: pointer;
  padding-right: 36px;
}
.select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--slate-400);
  pointer-events: none;
}

/* ── FIELD ERROR ── */
.field__error {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--red);
  min-height: 16px;
  line-height: 1.3;
}

/* ── CHECKBOX (Road Hazard) ── */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--amber-pale);
  border: 1.5px solid var(--amber-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-bottom: 16px;
  transition: background 150ms, border-color 150ms;
}
.checkbox-row:hover {
  background: #fef3c7;
  border-color: #fcd34d;
}
.checkbox { display: none; }
.checkbox-box {
  width: 20px;
  height: 20px;
  border: 2px solid var(--slate-300);
  border-radius: 5px;
  background: #fff;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms;
  position: relative;
}
.checkbox:checked + .checkbox-box {
  background: var(--amber);
  border-color: var(--amber);
}
.checkbox:checked + .checkbox-box::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
}
.checkbox-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.875rem;
  color: var(--slate-700);
  line-height: 1.4;
}
.checkbox-label strong {
  font-size: 0.875rem;
  color: var(--amber);
}
.checkbox-label span {
  font-size: 0.78rem;
  color: var(--slate-500);
}

/* ── CALCULATE BUTTON ── */
.btn-calc {
  width: 100%;
  height: 52px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15,23,42,0.25);
  transition: background 150ms, transform 150ms, box-shadow 150ms;
}
.btn-calc:hover {
  background: var(--navy-light);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(15,23,42,0.3);
}
.btn-calc:active { transform: none; box-shadow: var(--shadow-sm); }
.btn-calc:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

/* ── RESULTS ── */
.results {
  animation: fadeUp 0.4s var(--ease) both;
}

/* Credit hero */
.results__credit {
  text-align: center;
  padding: 28px 20px;
  background: var(--green-pale);
  border: 1.5px solid var(--green-border);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
}
.results__credit.is-full {
  background: var(--amber-pale);
  border-color: var(--amber-border);
}
.results__credit-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 6px;
}
.results__credit.is-full .results__credit-label { color: var(--amber); }
.results__credit-amount {
  font-size: clamp(2.4rem, 8vw, 3.2rem);
  font-weight: 900;
  color: var(--green);
  letter-spacing: -0.04em;
  line-height: 1;
  animation: popIn 0.4s var(--ease) both;
}
.results__credit.is-full .results__credit-amount { color: var(--amber); }
.results__credit-sub {
  font-size: 0.82rem;
  margin-top: 8px;
  color: #15803d;
  font-weight: 500;
}
.results__credit.is-full .results__credit-sub { color: var(--amber); }

/* Progress bar */
.progress-block {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
}
.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--slate-500);
  margin-bottom: 8px;
}
.progress-labels strong { color: var(--slate-700); }
.progress-labels--sub { margin-top: 8px; margin-bottom: 0; font-size: 0.75rem; }
.progress-track {
  height: 12px;
  background: var(--slate-100);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  transition: width 0.9s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 99px;
  background: linear-gradient(90deg, #60a5fa, var(--blue-dark));


}
.progress-fill.is-warn  { background: linear-gradient(90deg, #fbbf24, var(--amber)); }
.progress-fill.is-full  { background: linear-gradient(90deg, #f87171, var(--red)); }

/* Breakdown table */
.breakdown {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 14px;
}
.breakdown__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--slate-100);
  gap: 12px;
}
.breakdown__row:last-child { border-bottom: none; }
.breakdown__row:nth-child(even) { background: var(--slate-50); }
.breakdown__row dt { color: var(--slate-500); font-weight: 500; }
.breakdown__row dd { font-weight: 700; color: var(--slate-800); font-variant-numeric: tabular-nums; text-align: right; }
.breakdown__row--highlight {
  background: var(--navy) !important;
}
.breakdown__row--highlight dt { color: rgba(255,255,255,0.65); font-weight: 600; }
.breakdown__row--highlight dd { color: #fff; font-size: 1rem; }

/* Callout (road hazard notice / expired notice) */
.callout {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 13px 15px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  line-height: 1.5;
  margin-bottom: 14px;
  font-weight: 500;
}
.callout--amber {
  background: var(--amber-pale);
  border: 1px solid var(--amber-border);
  color: #92400e;
}
.callout--red {
  background: var(--red-pale);
  border: 1px solid var(--red-border);
  color: #991b1b;
}
.callout__icon { font-size: 1rem; flex-shrink: 0; line-height: 1.4; }

/* Reset button */
.btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 20px;
  background: transparent;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--slate-600);
  cursor: pointer;
  transition: all 150ms;
  width: 100%;
  justify-content: center;
}
.btn-reset:hover {
  background: var(--slate-100);
  border-color: var(--slate-300);
  color: var(--slate-800);
}
.btn-reset:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

/* ── FORMULA BOX ── */
.formula-box {
  margin-top: 20px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.formula-box__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--slate-600);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 150ms;
}
.formula-box__summary::-webkit-details-marker { display: none; }
.formula-box__summary svg { width: 16px; height: 16px; color: var(--blue); flex-shrink: 0; }
.formula-box__summary:hover { background: var(--slate-50); }
.formula-box__body {
  padding: 4px 16px 18px;
  border-top: 1px solid var(--slate-100);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.formula-section h3 {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate-400);
  margin: 14px 0 8px;
}
.formula-section ol {
  font-size: 0.85rem;
  color: var(--slate-600);
  line-height: 1.6;
}

/* ── FOOTER ── */
.footer {
  background: var(--navy);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 16px 0;
  /* Push content above Safari's bottom toolbar */
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 0.75rem;
  color: var(--slate-500);
}

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  .field-grid { grid-template-columns: 1fr; }
  .field--full { grid-column: 1; }
  .logo__title { font-size: 0.9rem; }
  .calc-form { padding: 16px; }
}
