/* ==========================================================================
   Estimate page (price calculator). Loaded after style.css.
   ========================================================================== */

.estimate__lede {
  max-width: 44ch;
  margin: clamp(20px, 3vw, 32px) 0 0;
  font-size: clamp(1.1rem, 1.7vw, 1.45rem);
  line-height: 1.4;
  color: var(--bone-dim);
}

/* ---------- Setup: title + currency ---------- */

.est-setup {
  display: grid;
  gap: 20px clamp(20px, 4vw, 56px);
  margin-top: clamp(32px, 5vw, 64px);
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
@media (min-width: 700px) { .est-setup { grid-template-columns: minmax(0, 1fr) 220px; } }

.est-field { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.est-field .req { color: var(--ember); }

.est-input,
.est-select {
  width: 100%;
  padding: 14px 16px;
  font: inherit;
  font-size: 1rem;
  color: var(--bone);
  background: rgba(239, 232, 220, 0.04);
  border: 1px solid var(--line);
  border-radius: 0;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}
.est-input::placeholder { color: rgba(239, 232, 220, 0.38); }
.est-input:hover, .est-select:hover { border-color: rgba(239, 232, 220, 0.34); }
.est-input:focus-visible, .est-select:focus-visible { outline: none; border-color: var(--ember); background: rgba(239, 232, 220, 0.07); }
.est-input.is-invalid { border-color: #e2705a; }
.est-select { appearance: none; cursor: pointer; padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ember) 50%), linear-gradient(135deg, var(--ember) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.est-select option { background: var(--ink-2); color: var(--bone); }
.est-error { margin: 0; font-size: 0.85rem; color: #e2705a; }

/* ---------- Layout ---------- */

.est-layout {
  display: grid;
  gap: clamp(36px, 5vw, 72px);
  margin-top: clamp(32px, 5vw, 64px);
}
@media (min-width: 960px) {
  .est-layout { grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); align-items: start; }
  .est-side {
    position: sticky;
    top: calc(var(--nav-h) + 20px);
    max-height: calc(100vh - var(--nav-h) - 40px);
    max-height: calc(100svh - var(--nav-h) - 40px);
    display: flex;
    flex-direction: column;
  }
}

.est-section { border-top: 1px solid var(--line); padding-top: 22px; }
.est-section + .est-section { margin-top: clamp(36px, 5vw, 60px); }

.est-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 0 0 22px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bone-dim);
}
.est-head b { color: var(--ember); font-weight: 800; }
.est-badge {
  margin-left: auto;
  padding: 2px 10px;
  border: 1px solid var(--ember);
  color: var(--ember);
  font-variant-numeric: tabular-nums;
}

/* ---------- Length: timecode + slider ---------- */

.est-time {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.est-time__code {
  font-size: clamp(3.4rem, 9vw, 6.4rem);
  font-weight: 900;
  font-stretch: 70%;
  line-height: 0.9;
  letter-spacing: -0.01em;
  color: var(--ember);
  font-variant-numeric: tabular-nums;
}
.est-time small { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.18em; color: var(--bone-dim); }

.est-range { padding: 8px 0; }
.est-range input[type=range] {
  -webkit-appearance: none; appearance: none;
  display: block;
  width: 100%;
  height: 4px;
  margin: 10px 0;
  background: linear-gradient(90deg, var(--ember) var(--fill, 0%), rgba(239, 232, 220, 0.16) var(--fill, 0%));
  outline: none;
  cursor: pointer;
}
.est-range input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--ember);
  border: 4px solid var(--ink);
  box-shadow: 0 0 0 2px var(--ember);
}
.est-range input[type=range]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ember);
  border: 4px solid var(--ink);
  box-shadow: 0 0 0 2px var(--ember);
}
.est-range input[type=range]:focus-visible { outline: 2px solid var(--ember); outline-offset: 10px; }
.est-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--bone-dim);
  font-variant-numeric: tabular-nums;
}

.est-step { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.est-step__label { font-size: 0.95rem; color: var(--bone-dim); }
.est-step__label b { color: var(--bone); font-weight: 700; }

.est-btn-sq {
  flex: none;
  width: 40px; height: 40px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line);
  font-size: 1.2rem;
  line-height: 1;
  transition: border-color 0.25s ease, color 0.25s ease;
}
.est-btn-sq:hover { border-color: var(--ember); color: var(--ember); }
.est-btn-sq:focus-visible { outline-offset: 2px; }
.est-btn-sq--sm { width: 30px; height: 30px; font-size: 1rem; }

/* ---------- Add-on rows ---------- */

.est-list { margin-top: 22px; }
.est-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.est-row:last-child { border-bottom: 1px solid var(--line); }
.est-row__info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.est-row__name { font-size: 1.05rem; font-weight: 700; }
.est-row__desc { font-size: 0.88rem; line-height: 1.45; color: var(--bone-dim); max-width: 52ch; }
.est-row__right { display: flex; align-items: center; gap: 16px; flex: none; }
.est-price {
  min-width: 64px;
  text-align: right;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--bone-dim);
  font-variant-numeric: tabular-nums;
}

.est-switch {
  position: relative;
  flex: none;
  width: 48px; height: 26px;
  border: 1px solid rgba(239, 232, 220, 0.34);
  border-radius: 999px;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}
.est-switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--bone-dim);
  transition: transform 0.3s var(--ease), background-color 0.25s ease;
}
.est-switch[aria-checked="true"] { background: var(--ember); border-color: var(--ember); }
.est-switch[aria-checked="true"]::after { transform: translateX(22px); background: var(--ink); }
.est-switch:focus-visible { outline-offset: 4px; }

.est-qty { display: flex; align-items: center; gap: 10px; }
.est-qty span { min-width: 22px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.est-footage { padding: 18px 0; border-top: 1px solid var(--line); }
.est-footage__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 8px; }

/* ---------- Buttons ---------- */

.est-cta {
  display: block;
  width: 100%;
  margin-top: 26px;
  padding: 18px 20px;
  border: 1px solid var(--ember);
  color: var(--ember);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.est-cta:hover, .est-cta.is-done { background: var(--ember); color: var(--ink); }
.est-cta--solid { background: var(--ember); color: var(--ink); }
.est-cta--solid:hover { background: var(--bone); border-color: var(--bone); }
.est-cta--quiet { border-color: var(--line); color: var(--bone); margin-top: 10px; }
.est-cta--quiet:hover { background: transparent; color: var(--ember); border-color: var(--ember); }
.est-cta[disabled] { opacity: 0.6; cursor: progress; }

/* ---------- Assets in this project ---------- */

.est-empty { margin: 0; padding: 4px 0 6px; font-size: 0.95rem; color: var(--bone-dim); }
.est-asset__qty { color: var(--ember); font-weight: 800; }
.est-asset__price { min-width: 72px; text-align: right; font-weight: 800; color: var(--ember); font-variant-numeric: tabular-nums; }
.est-remove {
  width: 30px; height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--bone-dim);
  font-size: 0.8rem;
  transition: border-color 0.25s ease, color 0.25s ease;
}
.est-remove:hover { border-color: #e2705a; color: #e2705a; }
.est-asset { flex-wrap: wrap; }
.est-asset .est-row__right { flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }

/* ---------- Breakdown ---------- */

.est-side__inner { border-top: 1px solid var(--ember); padding-top: 22px; display: flex; flex-direction: column; min-height: 0; }
.est-ledger {
  min-height: 0; overflow-y: auto; padding-right: 10px; margin-right: -10px;
  scrollbar-width: thin; scrollbar-color: rgba(242, 180, 81, 0.5) transparent;
}
.est-ledger::-webkit-scrollbar { width: 4px; }
.est-ledger::-webkit-scrollbar-thumb { background: rgba(242, 180, 81, 0.5); }
.est-group {
  padding: 16px 0 4px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ember);
}
.est-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  font-size: 0.92rem;
  color: var(--bone-dim);
  border-bottom: 1px solid rgba(239, 232, 220, 0.09);
  font-variant-numeric: tabular-nums;
}
.est-line span:last-child { color: var(--bone); white-space: nowrap; }
.est-sub {
  display: flex;
  justify-content: space-between;
  padding: 10px 0 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--bone);
  font-variant-numeric: tabular-nums;
}
.est-total { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.est-total__label { display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--bone-dim); }
.est-total__value {
  display: block;
  margin-top: 6px;
  font-size: clamp(3rem, 6vw, 4.6rem);
  font-weight: 900;
  font-stretch: 70%;
  line-height: 0.95;
  color: var(--ember);
  font-variant-numeric: tabular-nums;
}
.est-fine { margin: 14px 0 0; font-size: 0.78rem; line-height: 1.55; color: var(--bone-dim); }
.est-actions { margin-top: 6px; }

/* ---------- Mobile: running total bar ---------- */

.est-bar { display: none; }
@media (max-width: 959px) {
  .est-bar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 40;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom, 0px));
    background: rgba(13, 11, 9, 0.92);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    transform: translateY(0);
    transition: transform 0.4s var(--ease);
  }
  .est-bar.is-hidden { transform: translateY(110%); pointer-events: none; }
  .est-bar__label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--bone-dim); }
  .est-bar__value { font-size: 1.9rem; font-weight: 900; font-stretch: 70%; line-height: 1; color: var(--ember); font-variant-numeric: tabular-nums; }
  .est-bar__link { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; }
  .est-bar__link span { color: var(--ember); }
}
@media (max-width: 599px) {
  .est-row { align-items: flex-start; }
  .est-row__right { flex-direction: column-reverse; align-items: flex-end; gap: 10px; }
  .est-footage__head { flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .est-bar, .est-switch, .est-switch::after { transition: none; }
}
