/* ============================================================
   estimate.html: cost estimator
   Builds on style.css tokens. The result is a paper "work ticket"
   (cream on navy) so it reads like the order Robert writes up,
   not a generic card.
   ============================================================ */

.est {
  padding: clamp(7.5rem, 14vh, 9.5rem) 0 clamp(4rem, 8vw, 6rem);
  background: linear-gradient(200deg, var(--navy-1) 0%, var(--navy-deep) 55%);
  min-height: 100vh;
}

.est__intro { max-width: 760px; }
.est h1 {
  font-size: clamp(2.3rem, 5.6vw, 4.2rem);
  font-weight: 800;
  text-transform: uppercase;
  line-height: 0.98;
  letter-spacing: -0.01em;
  margin-top: 0.6rem;
}
.est h1 em {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  color: var(--sky);
}
.est__sub { margin-top: 1.1rem; color: var(--cream-dim); max-width: 58ch; font-size: 1.02rem; }

/* ---- mode switch: an underline tab, not two pill buttons ---- */
.est__mode {
  display: flex;
  gap: 1.75rem;
  margin-top: 2.2rem;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.est__mode::-webkit-scrollbar { display: none; }
.est__mode button {
  padding: 0.85rem 0;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--slate);
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color .2s, border-color .2s;
}
.est__mode button[aria-selected="true"] { color: var(--cream); border-color: var(--sky); }
.est__mode button:hover { color: var(--cream); }

/* ---- layout ---- */
.est__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
  gap: clamp(2rem, 4vw, 4rem);
  align-items: start;
  margin-top: 2.5rem;
}
.est__form { min-width: 0; }
.est__form[hidden] { display: none; }

.est__set { border: 0; margin: 0 0 2.4rem; min-width: 0; }
.est__set legend {
  font-size: var(--text-h4);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin-bottom: 1.1rem;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
}
.est__n {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 400;
  font-size: 0.85em;
  color: var(--sky);
}
.est__hint { color: var(--slate); font-size: 0.9rem; margin: -0.4rem 0 1.1rem; }

.est__row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.est__field { display: flex; flex-direction: column; gap: 0.45rem; }
.est__field > span { font-size: 0.82rem; font-weight: 600; color: var(--cream-dim); letter-spacing: 0.02em; }
.est__field i { font-style: normal; color: var(--slate); font-weight: 400; }
.est input[type="text"], .est input[type="number"], .est select {
  width: 100%;
  background: rgba(8, 20, 32, 0.55);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--cream);
  font: inherit;
  font-size: 1rem;
  padding: 0.8rem 0.95rem;
  min-height: 48px;
  transition: border-color .2s;
}
.est input::placeholder { color: var(--slate); opacity: 0.8; }
.est input:focus, .est select:focus { outline: none; border-color: var(--sky); }
.est select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2393a2ab' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.8rem center; background-size: 16px; padding-right: 2.4rem; }
.est select option { background: var(--navy-deep); }

/* radio pills (stories, property type) */
.est__pills { display: inline-flex; gap: 0.5rem; flex-wrap: wrap; }
.est__pills label { position: relative; cursor: pointer; }
.est__pills input { position: absolute; opacity: 0; pointer-events: none; }
.est__pills span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 48px; min-height: 44px;
  padding: 0.5rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-weight: 700; font-size: 0.92rem;
  transition: border-color .2s, background .2s, color .2s;
}
.est__pills input:checked + span { border-color: var(--sky); background: rgba(53,194,242,0.1); color: var(--cream); }
.est__pills input:focus-visible + span { outline: 2px solid var(--sky); outline-offset: 2px; }

/* ---- service list: rows, not a card grid ---- */
.est__services { border-top: 1px solid var(--line); }
.svc { border-bottom: 1px solid var(--line); }
.svc__main {
  display: grid;
  grid-template-columns: 1.6rem 1fr auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.95rem 0.25rem;
  cursor: pointer;
}
.svc__main input { position: absolute; opacity: 0; pointer-events: none; }
.svc__box {
  width: 1.35rem; height: 1.35rem;
  border: 2px solid var(--navy-3);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--black); font-weight: 800; font-size: 0.8rem;
  transition: background .2s, border-color .2s;
}
.svc__main input:checked ~ .svc__box { background: var(--sky); border-color: var(--sky); }
.svc__main input:checked ~ .svc__box::after { content: '✓'; }
.svc__main input:focus-visible ~ .svc__box { outline: 2px solid var(--sky); outline-offset: 2px; }
.svc__name b { display: block; font-weight: 700; font-size: 1rem; }
.svc__name small { color: var(--slate); font-size: 0.84rem; }
.svc__from { font-family: var(--font-accent); font-style: italic; color: var(--cream-dim); font-size: 0.95rem; white-space: nowrap; }
.svc__opts {
  display: none;
  gap: 0.9rem 1.2rem;
  flex-wrap: wrap;
  padding: 0 0.25rem 1.1rem 2.75rem;
  align-items: flex-end;
}
.svc.is-on .svc__opts { display: flex; }
.svc__opts .est__field { min-width: 150px; flex: 0 1 190px; }
.svc__check { display: inline-flex; align-items: center; gap: 0.55rem; font-size: 0.9rem; color: var(--cream-dim); cursor: pointer; min-height: 44px; }
.svc__check input { width: 18px; height: 18px; accent-color: var(--sky); }

/* ---- business areas ---- */
.est__areas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.2rem; }
.est__areas .est__field small { color: var(--slate); font-size: 0.78rem; }

/* ---- the ticket ---- */
.ticket {
  position: sticky;
  top: 6.5rem;
  background: var(--cream);
  color: var(--navy-deep);
  border-radius: 6px;
  padding: 1.4rem 1.4rem 1.5rem;
  box-shadow: 0 30px 60px -30px rgba(0,0,0,0.6);
}
/* perforated top edge */
.ticket::before {
  content: '';
  position: absolute; left: 10px; right: 10px; top: -6px; height: 12px;
  background-image: radial-gradient(circle, var(--navy-deep) 5px, transparent 5.5px);
  background-size: 18px 12px;
  background-repeat: repeat-x;
}
.ticket__head {
  display: flex; justify-content: space-between;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--navy-3);
  padding-bottom: 0.9rem;
  border-bottom: 1.5px dashed rgba(13,30,48,0.25);
}
.ticket__body { padding: 0.6rem 0 0.4rem; font-variant-numeric: tabular-nums; }
.ticket__empty { color: #6a7780; font-size: 0.92rem; padding: 1.2rem 0; }
.tk-line { display: grid; grid-template-columns: 1fr auto; gap: 0.8rem; padding: 0.6rem 0; border-bottom: 1px solid rgba(13,30,48,0.1); }
.tk-line b { font-weight: 700; font-size: 0.94rem; }
.tk-line small { display: block; color: #5d6b74; font-size: 0.78rem; margin-top: 0.1rem; }
.tk-line .p { font-weight: 700; white-space: nowrap; text-align: right; font-size: 0.94rem; }
.tk-line .p s { color: #8a959c; font-weight: 400; }
.tk-tag {
  display: block; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  background: var(--amber); color: var(--black); padding: 0.15rem 0.45rem; border-radius: 3px; margin-bottom: 0.3rem;
  width: fit-content;
}
.tk-tag--muted { background: rgba(13,30,48,0.1); color: var(--navy-3); }
.tk-line .p .tk-tag { margin-left: auto; margin-bottom: 0; }
.tk-line .p small { font-weight: 400; }
.tk-note { font-size: 0.8rem; color: #4f5d66; margin-top: 0.7rem; line-height: 1.45; }
.tk-note b { color: var(--navy-deep); }
.tk-area { font-size: 0.78rem; font-weight: 700; margin-top: 0.4rem; color: #1f6f8f; }
.tk-area.is-warn { color: #b0461a; }
.tk-sug { margin-top: 0.8rem; padding: 0.7rem 0.8rem; background: rgba(53,194,242,0.14); border-radius: 4px; font-size: 0.84rem; }

.ticket__total {
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 0.2rem 1rem;
  border-top: 2px solid var(--navy-deep);
  padding-top: 0.9rem; margin-top: 0.4rem;
}
.ticket__total span { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.ticket__total b {
  font-family: var(--font-accent);
  font-size: clamp(1.9rem, 3vw, 2.3rem);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
  text-align: right;
}
.ticket__total small { grid-column: 1 / -1; text-align: right; color: #5d6b74; font-size: 0.78rem; min-height: 1em; }

.ticket__send { margin-top: 1.2rem; }
.ticket__name > span { color: var(--navy-3); }
.ticket .ticket__name input { background: #fff; color: var(--navy-deep); border-color: rgba(13,30,48,0.2); }
.ticket .ticket__name input::placeholder { color: #8a959c; }
.ticket .ticket__name input:focus { border-color: var(--navy-3); }
.ticket__warn { color: #b0461a; font-size: 0.82rem; margin-top: 0.4rem; }
.ticket__btn { width: 100%; justify-content: center; margin-top: 0.9rem; min-height: 50px; font-size: 0.95rem; animation: none; }
.ticket__btn.is-disabled { animation: none; }
.ticket__copy {
  width: 100%; margin-top: 0.6rem; min-height: 44px;
  border: 1.5px solid rgba(13,30,48,0.25); border-radius: 100px;
  font-weight: 700; font-size: 0.88rem; color: var(--navy-deep);
}
.ticket__copy:hover { border-color: var(--navy-deep); }
.ticket__fine { font-size: 0.74rem; color: #6a7780; margin-top: 0.7rem; text-align: center; }

/* ---- notes ---- */
.est__notes {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 3vw, 3rem);
  margin-top: clamp(3rem, 6vw, 5rem);
  padding-top: 2.2rem;
  border-top: 1px solid var(--line);
}
.est__notes h2 { font-size: 1.05rem; font-weight: 800; text-transform: uppercase; margin-bottom: 0.6rem; }
.est__notes p { color: var(--cream-dim); font-size: 0.93rem; line-height: 1.6; }
.est__notes b { color: var(--cream); }
.est__notes a { color: var(--sky); text-decoration: underline; text-underline-offset: 3px; }

/* ---- tablet ---- */
@media (max-width: 960px) {
  .est__grid { grid-template-columns: 1fr; }
  .ticket { position: relative; top: 0; max-width: 560px; }
  .est__notes { grid-template-columns: 1fr; }
}

/* ---- phone ---- */
@media (max-width: 560px) {
  .est__row { grid-template-columns: 1fr; }
  .est__areas { grid-template-columns: 1fr; }
  .svc__opts { padding-left: 0.25rem; }
  .svc__opts .est__field { flex: 1 1 100%; }
  .svc__from { font-size: 0.85rem; }
  .est__mode { gap: 1.2rem; }
  .est__mode button { font-size: 0.9rem; }
  .ticket { padding: 1.2rem 1.1rem 1.3rem; }
}

/* long totals (commercial annual budgets) step down instead of wrapping */
.ticket__total b.is-long { font-size: clamp(1.45rem, 2.3vw, 1.75rem); white-space: nowrap; }
.est__set > .est__field { margin-bottom: 1.1rem; }

/* phones/tablets: pinned running total, jumps to the ticket */
.est__bar { display: none; }
@media (max-width: 960px) {
  .est__bar:not([hidden]) {
    position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50;
    display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: center; column-gap: 1rem;
    background: var(--cream); color: var(--navy-deep);
    border-radius: 10px; padding: 0.7rem 1rem;
    box-shadow: 0 12px 30px -10px rgba(0,0,0,0.7);
    transition: transform .3s var(--ease), opacity .3s;
  }
  .est__bar span { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--navy-3); }
  .est__bar b { grid-row: 2; font-family: var(--font-accent); font-size: 1.35rem; font-weight: 600; line-height: 1.1; font-variant-numeric: lining-nums; }
  .est__bar em { grid-row: 1 / 3; grid-column: 2; font-style: normal; font-weight: 700; font-size: 0.85rem; background: var(--sky); color: var(--black); padding: 0.6rem 1rem; border-radius: 100px; min-height: 44px; display: inline-flex; align-items: center; }
  .ticket-in-view .est__bar { transform: translateY(140%); opacity: 0; pointer-events: none; }
  .est { padding-bottom: 7rem; }
}
