/* AnyVan Storage Discount Calculator */

:root {
  --navy: #0f2240;
  --primary: #41a5dd;
  --primary-dark: #106799;
  --accent: #ffc907;
  --surface: #f7f9fb;
  --card: #ffffff;
  --text: #16202e;
  --muted: #5c6b7f;
  --line: #e2e8f0;
  --good: #1da851;
  --good-bg: #e9f8ef;
  --bad: #dc2626;
  --bad-bg: #fdecec;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 34, 64, .08), 0 8px 24px rgba(15, 34, 64, .06);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--surface);
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; margin: 0; }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--navy);
  border-bottom: 3px solid var(--primary);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 72px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.av-logo { height: 22px; width: auto; color: #fff; flex: none; }

.header-divider {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, .22);
  flex: none;
}

.header-title {
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

.header-title span {
  display: block;
  font-size: .75rem;
  font-weight: 400;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--primary);
}

.header-actions { margin-left: auto; display: flex; gap: 8px; }

.ghost-btn {
  appearance: none;
  background: transparent;
  color: rgba(255, 255, 255, .82);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 6px;
  padding: .5rem 1rem;
  font: inherit;
  font-size: .875rem;
  font-weight: 700;
  min-height: 40px;
  cursor: pointer;
  transition: all .2s;
}

.ghost-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .5); }

/* ---------- layout ---------- */

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
  align-items: start;
}

/* Grid children default to min-width:auto, which lets the wide comparison
   table push the whole page past the viewport instead of letting
   .table-scroll scroll it. */
.grid > * { min-width: 0; }

@media (min-width: 1024px) {
  .grid { grid-template-columns: 400px 1fr; }
  .col-results { position: sticky; top: 104px; }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

.card + .card { margin-top: 24px; }

.card-title {
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

/* ---------- form ---------- */

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

.field label {
  display: block;
  font-size: .875rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.field .hint {
  display: block;
  font-size: .8125rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.45;
}

.input-wrap { position: relative; display: block; }

.input-wrap .prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 700;
  pointer-events: none;
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: .7rem 1rem .7rem 2rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: border-color .2s, box-shadow .2s;
}

.field.no-prefix input { padding-left: 1rem; }

.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(65, 165, 221, .22);
}

.field input::placeholder { font-weight: 400; color: #9aa8b8; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
/* The grid gap already separates these, so drop the fields' own margin. */
.row-2 .field { margin-bottom: 0; }

/* ---------- ceiling ---------- */

.ceiling {
  background: linear-gradient(135deg, var(--navy) 0%, var(--primary-dark) 100%);
  border: 0;
  color: #fff;
}

.ceiling .card-title { color: rgba(255, 255, 255, .7); margin-bottom: 8px; }

.ceiling-value {
  font-size: clamp(2.25rem, 6vw, 3rem);
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1.05;
  color: var(--accent);
}

.ceiling-note { font-size: .9375rem; font-weight: 700; color: rgba(255, 255, 255, .75); margin-top: 4px; }
.ceiling-note.ok { color: #9be3b8; }
.ceiling-note.bad { color: #ffb3b3; }

/* ---------- verdict ---------- */

.verdict {
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--line);
  background: #fff;
  transition: background .2s, border-color .2s;
}

.verdict-label {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 900;
  letter-spacing: -.02em;
}

.verdict-sub { font-size: .9375rem; color: var(--muted); font-weight: 700; }

.verdict.idle .verdict-label { color: var(--muted); }

.verdict.pass { background: var(--good-bg); border-color: #b7e6c9; }
.verdict.pass .verdict-label { color: #12703a; }
.verdict.pass .verdict-sub { color: #1b7a45; }

.verdict.fail { background: var(--bad-bg); border-color: #f5c2c2; }
.verdict.fail .verdict-label { color: #a81919; }
.verdict.fail .verdict-sub { color: #b83232; }

.reasons { margin: 12px 0 0; padding-left: 20px; font-size: .9375rem; color: #a81919; font-weight: 700; }
.reasons:empty { display: none; }
.reasons li { margin-top: 6px; }

/* ---------- comparison table ---------- */

.table-scroll { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }

table.compare {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

table.compare th, table.compare td {
  padding: 14px 12px;
  text-align: right;
  border-bottom: 1px solid var(--line);
}

table.compare thead th {
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
}

table.compare th.scenario, table.compare td.scenario { text-align: left; font-weight: 900; }

table.compare td { font-weight: 700; }

table.compare td .sub {
  display: block;
  font-size: .75rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.3;
}

table.compare tr.avs td { background: rgba(65, 165, 221, .06); }

table.compare td.total { color: var(--navy); font-weight: 900; font-size: 1.0625rem; }
table.compare tr.avs td.total { color: var(--primary-dark); }

.table-legend { font-size: .8125rem; color: var(--muted); margin: 12px 0 0; }

/* ---------- tiles ---------- */

.tiles { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 24px; }

@media (min-width: 640px) { .tiles { grid-template-columns: repeat(2, 1fr); } }

.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  transition: transform .2s, box-shadow .2s;
}

.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.tile-label {
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.tile-value {
  font-size: clamp(1.5rem, 3.5vw, 1.875rem);
  font-weight: 900;
  letter-spacing: -.025em;
  line-height: 1.15;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
}

.tile-value.good { color: var(--good); }
.tile-value.bad { color: var(--bad); }

.tile-sub { font-size: .8125rem; color: var(--muted); margin-top: 4px; line-height: 1.4; }

.gauge {
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
}

.gauge-fill {
  height: 100%;
  width: 0;
  background: var(--good);
  border-radius: 999px;
  transition: width .25s ease, background .25s ease;
}

.gauge-fill.near { background: var(--accent); }
.gauge-fill.over { background: var(--bad); }

/* ---------- actions ---------- */

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

.btn {
  appearance: none;
  font: inherit;
  font-weight: 700;
  min-height: 48px;
  padding: .85rem 2rem;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .2s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

@media (max-width: 639px) { .btn { width: 100%; } }

/* ---------- footer ---------- */

.site-footer {
  max-width: 78ch;
  margin: 0 auto;
  padding: 0 24px 48px;
  font-size: .8125rem;
  color: var(--muted);
}

.site-footer p { margin: 0 0 8px; }

/* On phones the logo, title and button only fit on one row once the logo
   and type step down; nowrap keeps the title to its two intended lines
   instead of breaking mid-phrase. */
@media (max-width: 639px) {
  .header-inner { padding: 0 16px; gap: 10px; }
  .av-logo { height: 18px; }
  .header-divider { height: 24px; }
  .header-title { font-size: .8125rem; white-space: nowrap; }
  .header-title span { font-size: .625rem; letter-spacing: .1em; }
  .header-actions .ghost-btn { min-height: 44px; padding: .5rem .9rem; font-size: .8125rem; }
}

/* Narrower than an iPhone SE: let the title wrap and the bar grow rather
   than clipping the button off the edge. */
@media (max-width: 359px) {
  .header-inner { height: auto; min-height: 72px; padding: 10px 12px; gap: 8px; }
  .header-title { white-space: normal; }
}

@media (max-width: 480px) {
  .wrap { padding: 24px 16px 48px; }
  .card { padding: 20px; }
  .row-2 { grid-template-columns: 1fr; }
  .verdict { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
