/* Budget guide page (estimate.html). Builds on style.css tokens. */

.est-page { cursor: auto; }
.est { padding-top: clamp(120px, 14vw, 170px); padding-bottom: clamp(60px, 8vw, 100px); }
.est .h2 { font-size: clamp(2.6rem, 7vw, 5.5rem); }

.est-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: clamp(20px, 3.5vw, 48px); align-items: start; }
@media (max-width: 960px) { .est-grid { grid-template-columns: 1fr; } }

/* ---------- question card ---------- */
.est-card {
  display: grid; gap: 22px;
  padding: clamp(20px, 3vw, 34px); border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  scroll-margin-top: 96px;
}
.est-top { display: grid; gap: 12px; }
.est-scene { color: var(--teal-ink); }

/* progress as a strip of film frames */
.est-strip {
  display: flex; gap: 4px; padding: 9px 8px; border-radius: 8px; background: #2a2825; overflow-x: auto; scrollbar-width: none;
  /* sprocket holes along both edges */
  background-image:
    radial-gradient(circle at 50% 50%, var(--surface) 1.6px, transparent 2px),
    radial-gradient(circle at 50% 50%, var(--surface) 1.6px, transparent 2px);
  background-size: 10px 5px, 10px 5px;
  background-position: 0 1px, 0 calc(100% - 1px);
  background-repeat: repeat-x;
  background-color: #2a2825;
}
.est-strip::-webkit-scrollbar { display: none; }
.est-frame {
  flex: 1 1 0; min-width: 26px; min-height: 36px; padding: 0 2px; border: 0; border-radius: 4px;
  background: #4a4640; color: #b9b2a6; font: 700 .75rem var(--font-body); letter-spacing: .04em; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-med) var(--ease-out);
}
.est-frame.done { background: #d8d1c4; color: var(--text); }
.est-frame[aria-current="step"] { background: var(--accent); color: var(--on-accent); transform: scaleY(1.12); }
.est-frame:disabled { cursor: default; opacity: .55; }
.est-frame:not(:disabled):not([aria-current]):hover { background: #6a655c; color: #fff; }
.est-frame.done:not([aria-current]):hover { background: #fff; color: var(--text); }

.est-body { display: grid; gap: 26px; min-height: 260px; align-content: start; }
.est-body > * { animation: estIn var(--t-med) var(--ease-out) both; }
@keyframes estIn { from { opacity: 0; transform: translateX(18px); } }
.est-q { margin: 0; padding: 0; border: 0; background: none; display: grid; gap: 14px; min-width: 0; }
.est-title, .est-subtitle { float: none; display: block; width: auto; margin: 0; padding: 0; }
.est-title { font: 800 clamp(1.6rem, 3.4vw, 2.4rem)/1.05 var(--font-display); font-stretch: 82%; text-transform: uppercase; }
.est-title em { font-weight: 400; font-stretch: 115%; }
.est-subtitle { font-weight: 700; font-size: 1.0625rem; }
.est-q legend small { font: 400 .9375rem var(--font-body); color: var(--muted); text-transform: none; }
html[lang^="zh"] .est-title { font-family: 'Noto Sans TC', sans-serif; font-weight: 900; line-height: 1.25; }
.est-hint { margin: 0; color: var(--muted); }

.est-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.est-opts.cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.est-opt { position: relative; cursor: pointer; display: grid; }
.est-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.est-opt > span {
  display: grid; align-content: center; gap: 2px; min-height: 56px; padding: 12px 16px 12px 44px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg); position: relative;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast) var(--ease-out);
}
.est-opts.cards .est-opt > span { min-height: 84px; }
.est-opt b { font-weight: 700; line-height: 1.3; }
.est-opt small { color: var(--muted); font-size: .8125rem; line-height: 1.35; }
/* the tick mark: a ring that fills like a reel hub */
.est-opt > span::before {
  content: ''; position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; margin-top: -10px;
  border-radius: 50%; border: 2px solid var(--line); background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.est-opt input[type="checkbox"] + span::before { border-radius: 6px; }
.est-opt:hover > span { border-color: var(--text); }
.est-opt input:checked + span { background: #fff4df; border-color: var(--accent); }
.est-opt input:checked + span::before { border-color: var(--text); background: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }
.est-opt input[type="checkbox"]:checked + span::before {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3L15 6.5' fill='none' stroke='%23141414' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
  box-shadow: none;
}
.est-opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.est-opt:active > span { transform: scale(.98); }

.est-nav { display: flex; justify-content: space-between; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.est-nav .est-next { margin-left: auto; }
.est-nav .btn:disabled { opacity: .45; cursor: not-allowed; }
.est-nav .btn svg { width: 18px; height: 18px; }

/* result summary inside the card */
.est-result { display: grid; gap: 14px; }
.est-summary { margin: 6px 0 0; display: grid; gap: 0; }
.est-summary div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.est-summary dt { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.est-summary dd { margin: 0; font-weight: 700; }
@media (max-width: 520px) { .est-summary div { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- meter ---------- */
.est-meter {
  position: sticky; top: 96px; display: grid; gap: 14px;
  padding: clamp(22px, 3vw, 30px); border-radius: var(--radius); background: var(--teal-deep); color: #fff;
}
.est-meter .label { color: #cfe7e4; }
.est-meter-head { display: flex; align-items: center; gap: 12px; }
.est-reel { width: 34px; height: 34px; color: var(--accent); opacity: .45; transition: opacity var(--t-med); }
.est-meter.on .est-reel { opacity: 1; animation: estSpin 3.2s linear infinite; }
@keyframes estSpin { to { rotate: 360deg; } }
.est-empty { margin: 0; color: #cfe7e4; font-size: 1.0625rem; }
.est-range {
  margin: 0; font: 800 clamp(1.9rem, 3.6vw, 2.9rem)/1.05 var(--font-display); font-stretch: 80%;
  font-variant-numeric: tabular-nums; color: var(--accent); overflow-wrap: anywhere;
}
.est-range:empty { display: none; }
html[lang^="zh"] .est-range { font-family: var(--font-display); }
.est-meta { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.est-meta li { padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.12); font-size: .875rem; }
.est-parts { display: grid; gap: 10px; }
.est-parts:empty { display: none; }
.est-part { display: grid; grid-template-columns: 9.5em 1fr 3em; align-items: center; gap: 10px; font-size: .875rem; }
.est-part-name { color: #cfe7e4; }
.est-part-track { height: 8px; border-radius: 4px; background: rgba(255,255,255,.14); overflow: hidden; }
.est-part-fill { display: block; height: 100%; width: var(--w, 0%); border-radius: 4px; background: var(--teal); transition: width var(--t-slow) var(--ease-out); }
.est-part-pct { text-align: right; font-variant-numeric: tabular-nums; }
.est-note { margin: 0; padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(255,255,255,.08); border-left: 3px solid var(--accent); font-size: .875rem; color: #e4f1ef; }
.est-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.est-actions .btn-ghost { background: transparent; border-color: rgba(255,255,255,.45); color: #fff; }
.est-actions .btn-ghost:hover { border-color: #fff; }
.est-toast { flex-basis: 100%; margin: 0; font-size: .875rem; min-height: 1.4em; }
.est-meter :focus-visible { outline-color: var(--accent); }
.est-plan-link { display: inline-flex; align-items: center; gap: 6px; color: #cfe7e4; font-size: .9375rem; text-underline-offset: 3px; min-height: 44px; }
.est-plan-link:hover { color: #fff; }
.est-plan-link svg { width: 16px; height: 16px; }
.est-card.is-result + .est-meter { box-shadow: 0 0 0 4px var(--accent); }
@media (max-width: 960px) { .est-meter { position: static; } }

/* ---------- phone: sticky running total ---------- */
.est-bar { display: none; }
@media (max-width: 960px) {
  .est-bar.meter-visible { opacity: 0; pointer-events: none; transform: translateY(12px); }
  .est-bar:not([hidden]) {
    transition: opacity var(--t-fast), transform var(--t-med) var(--ease-out);
    position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: var(--z-top);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 52px; padding: 8px 18px; border: 0; border-radius: 999px;
    background: var(--teal-deep); color: #fff; box-shadow: var(--shadow); cursor: pointer;
    animation: estIn var(--t-med) var(--ease-out) both;
  }
  .est-bar .label { color: #cfe7e4; }
  .est-bar b { color: var(--accent); font-family: var(--font-display); font-stretch: 85%; font-size: 1.125rem; font-variant-numeric: tabular-nums; }
  .est-page { padding-bottom: 80px; }
}

.est-foot { width: min(100% - 2 * var(--gutter), var(--max)); margin: 0 auto; padding: 24px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
.est-foot a { text-underline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .est-body > *, .est-bar:not([hidden]) { animation: none; }
  .est-meter.on .est-reel { animation: none; }
  .est-part-fill { transition: none; }
}
