/* ============================================================
   BUILD YOUR CREW: workforce estimator (talent page)
   Scoped to .est. Sits on a paper-2 band; readout panel in ink-2.
   ============================================================ */

.est { --est-gap: clamp(20px, 3vw, 40px); }
.est p { max-width: none; margin: 0; }
.est :focus-visible { outline-color: var(--accent); }
.est .est__panel :focus-visible { outline-color: var(--sealed); }

.est__sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- head ---------- */
.est__head {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(28px, 5vw, 80px); align-items: end;
  margin-bottom: clamp(36px, 6vh, 64px);
}
.est__label {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 18px !important;
}
.est__label::before { content: ""; width: 7px; height: 7px; background: var(--accent); }
.est__head .h2 { margin-bottom: 18px; }
.est__head .lede { max-width: 54ch; }

.est__scale { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.est__scale li {
  display: grid; grid-template-columns: 4.6rem minmax(0, 1fr); gap: 18px; align-items: baseline;
  padding: 14px 0; border-bottom: 1px solid var(--line);
  font-size: 14.5px; line-height: 1.45; color: var(--text-dim);
}
.est__scale-n {
  font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1;
  color: var(--text);
}

/* ---------- main grid ---------- */
.est__grid {
  display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: var(--est-gap); align-items: start;
}

/* ---------- controls ---------- */
.est__controls { background: var(--paper); border: 1px solid var(--line); border-radius: 3px; }
.est__row { padding: clamp(20px, 2.4vw, 28px); border-bottom: 1px solid var(--line); }
.est__row:last-child { border-bottom: 0; }
.est__k {
  display: block; font-family: var(--font-mono); font-size: 11px; font-weight: 400;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim);
  margin: 0 0 12px !important; line-height: 1.5;
}
.est__hint { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); margin-top: 10px !important; line-height: 1.6; }

/* crew size */
.est__size-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.est__size-top .est__k { margin-bottom: 4px !important; }
.est__size-field { display: inline-flex; align-items: baseline; gap: 10px; }
.est__size-input {
  width: 4.6ch; padding: 4px 10px; font: inherit; font-size: clamp(2rem, 3.2vw, 2.6rem); font-weight: 800;
  letter-spacing: -0.02em; line-height: 1.1; color: var(--text); text-align: right;
  background: var(--paper); border: 1px solid var(--line); border-radius: 2px;
  -moz-appearance: textfield; appearance: textfield;
}
.est__size-input::-webkit-outer-spin-button, .est__size-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.est__size-input:focus { border-color: var(--accent); outline: none; }
.est__size-unit { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); }

.est__slider-wrap { position: relative; margin-top: 18px; padding-bottom: 26px; }
.est__slider {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 44px; margin: 0;
  background: transparent; cursor: pointer; --p: 19%;
}
.est__slider::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--accent) 0 var(--p), var(--line) var(--p) 100%);
}
.est__slider::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
.est__slider::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
.est__slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px;
  background: var(--accent); border: 2px solid var(--paper); border-radius: 2px;
  box-shadow: 0 0 0 1px var(--accent); cursor: grab; transition: transform 0.15s var(--ease);
}
.est__slider::-moz-range-thumb {
  width: 22px; height: 22px; background: var(--accent); border: 2px solid var(--paper); border-radius: 2px;
  box-shadow: 0 0 0 1px var(--accent); cursor: grab;
}
.est__slider:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.1); }
.est__slider:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.est__ticks { position: absolute; left: 0; right: 0; bottom: 0; height: 22px; list-style: none; margin: 0; padding: 0; }
.est__ticks li {
  position: absolute; top: 0; left: calc(var(--x) * (100% - 22px) + 11px); transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; color: var(--text-dim);
  padding-top: 8px; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.est__ticks li::before { content: ""; position: absolute; top: 0; left: 50%; width: 1px; height: 5px; background: var(--line); }
.est__ticks li:first-child { transform: translateX(-11px); }
.est__ticks li:first-child::before { left: 11px; }
.est__ticks li:last-child { transform: translateX(calc(-100% + 11px)); }
.est__ticks li:last-child::before { left: auto; right: 11px; }
.est__ticks .is-core { color: var(--accent); font-weight: 700; }
.est__ticks .is-core::before { background: var(--accent); height: 7px; }

/* role family */
.est__roles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.est__role {
  position: relative; text-align: left; min-height: 72px; padding: 13px 34px 13px 15px;
  border: 1px solid var(--line); border-radius: 2px; background: var(--paper); color: var(--text);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.est__role:hover { border-color: var(--text-dim); }
.est__role-name { display: block; font-size: 15px; font-weight: 500; line-height: 1.3; }
.est__role-ex { display: block; margin-top: 3px; font-size: 12.5px; line-height: 1.4; color: var(--text-dim); }
.est__role::after {
  content: ""; position: absolute; top: 15px; right: 13px; width: 9px; height: 9px;
  border: 1px solid var(--line); border-radius: 1px; transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.est__role[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--paper)); }
.est__role[aria-checked="true"]::after { background: var(--accent); border-color: var(--accent); }

/* money + number fields */
.est__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: end; }
.est__money {
  display: flex; align-items: center; border: 1px solid var(--line); border-radius: 2px; background: var(--paper);
  transition: border-color 0.2s;
}
.est__money:focus-within { border-color: var(--accent); }
.est__money span { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); padding: 0 12px; white-space: nowrap; }
.est__money input, .est__field input {
  width: 100%; min-width: 0; padding: 13px 14px; font: inherit; font-size: 16px; font-weight: 500; color: var(--text);
  border: 1px solid var(--line); border-radius: 2px; background: var(--paper); font-variant-numeric: tabular-nums;
}
.est__money input { border: 0; padding-inline: 0; }
.est__money input:focus { outline: none; }
.est__field input:focus { outline: none; border-color: var(--accent); }

/* segmented shifts */
.est__seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 2px; }
.est__seg button {
  min-height: 48px; background: var(--paper); color: var(--text); border: 0; border-left: 1px solid var(--line);
  font-size: 15px; font-weight: 500; transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.est__seg button:first-child { border-left: 0; }
.est__seg button:hover { background: var(--paper-2); }
.est__seg button[aria-checked="true"] { background: var(--accent); color: #fff; }

/* overtime switch */
.est__switch {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 18px;
  padding: 0; border: 0; background: none; color: var(--text); text-align: left; min-height: 48px;
}
.est__switch-text strong { display: block; font-size: 15px; font-weight: 500; }
.est__switch-text span { display: block; font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.est__switch-track {
  flex: none; position: relative; width: 46px; height: 26px; border: 1px solid var(--line); border-radius: 2px;
  background: var(--paper-2); transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.est__switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 1px;
  background: var(--text-dim); transition: transform 0.25s var(--ease), background 0.2s var(--ease);
}
.est__switch[aria-checked="true"] .est__switch-track { background: var(--accent); border-color: var(--accent); }
.est__switch[aria-checked="true"] .est__switch-track::after { transform: translateX(20px); background: #fff; }

/* ---------- readout panel ---------- */
.est__out { position: sticky; top: 92px; }
.est__panel { background: var(--ink-2); color: var(--cover-text); border-radius: 3px; overflow: hidden; }
.est__bar {
  display: flex; justify-content: space-between; gap: 12px; padding: 13px clamp(20px, 2.4vw, 28px);
  border-bottom: 1px solid var(--line-ink);
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cover-dim);
}
.est__bar-live { display: inline-flex; align-items: center; gap: 9px; color: var(--cover-text); }
.est__bar-live::before { content: ""; width: 7px; height: 7px; background: var(--accent-bright); }
.est__block { padding: clamp(20px, 2.4vw, 28px); padding-bottom: 0; }
.est__panel .est__k { color: var(--cover-dim); font-size: 10.5px; letter-spacing: 0.14em; margin-bottom: 10px !important; }

.est__range { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.45em; row-gap: 2px; }
.est__num {
  font-size: clamp(1.45rem, 2.3vw, 1.9rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.05;
  color: #fff; white-space: nowrap;
}
.est__hi { display: inline-flex; align-items: baseline; gap: 0.45em; white-space: nowrap; }
.est__range--xl .est__num { font-size: clamp(1.9rem, 3vw, 2.6rem); }
.est__to { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cover-dim); }

.est__stats {
  display: grid; grid-template-columns: 1fr 1fr; margin: clamp(20px, 2.4vw, 26px) clamp(20px, 2.4vw, 28px) 0;
  border-top: 1px solid var(--line-ink); border-bottom: 1px solid var(--line-ink);
}
.est__stats > div { padding: 18px 0; }
.est__stats > div + div { padding-left: clamp(16px, 2vw, 24px); border-left: 1px solid var(--line-ink); }
.est__sub { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; color: var(--cover-dim); margin-top: 8px !important; line-height: 1.5; }

/* deployment waves */
.est__waves { padding: clamp(18px, 2.2vw, 24px) clamp(20px, 2.4vw, 28px) 0; }
.est__waves-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.est__unit { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; color: var(--cover-dim); margin-bottom: 10px !important; }
.est__unit.is-scaled { color: #fff; }
.est__cells {
  display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 4px;
  min-height: 22px; padding: 2px 0;
}
.est__cell { display: none; aspect-ratio: 1 / 1; border-radius: 1px; transition: background-color 0.4s var(--ease), box-shadow 0.4s var(--ease); }
.est__cell.is-on { display: block; }
.est__cell--w1, .est__sw--1 { background: var(--accent-bright); }
.est__cell--w2, .est__sw--2 { background: color-mix(in srgb, var(--accent-bright) 52%, var(--ink-2)); }
.est__cell--w3, .est__sw--3 { background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-bright) 75%, var(--ink-2)); }
.est__cell.is-pop { animation: est-pop 0.55s var(--ease) both; }
@keyframes est-pop { from { opacity: 0; transform: scale(0.25); } to { opacity: 1; transform: none; } }
.est--still .est__cell { animation: none !important; transition: none !important; }

.est__legend { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.est__legend li {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cover-dim);
}
.est__legend b { color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
.est__sw { display: inline-block; width: 10px; height: 10px; border-radius: 1px; }

.est__foot { padding: clamp(18px, 2.2vw, 24px) clamp(20px, 2.4vw, 28px); margin-top: clamp(18px, 2.2vw, 24px); border-top: 1px solid var(--line-ink); }
.est__note { font-size: 14px; line-height: 1.5; color: var(--cover-text); }
.est__note strong { color: #fff; font-weight: 500; }
.est__fine { font-size: 12.5px; line-height: 1.55; color: var(--cover-dim); margin-top: 8px !important; }

/* ---------- quote form ---------- */
.est__quote {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(24px, 4vw, 56px);
  margin-top: var(--est-gap); padding: clamp(24px, 3vw, 40px);
  background: var(--paper); border: 1px solid var(--line); border-radius: 3px;
}
.est__quote .h3 { margin-bottom: 12px; }
.est__quote-copy p { font-size: 15px; line-height: 1.55; color: var(--text-dim); }
.est__quote-copy .est__sending {
  margin-top: 18px !important; padding: 12px 14px; border: 1px solid var(--line); border-radius: 2px; background: var(--paper-2);
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.7; color: var(--text);
}
.est__sending span { display: block; }
.est__sending span:first-child { color: var(--text-dim); }
.est__form .field { margin-bottom: 16px; }
.est__form .field--row { gap: 16px; }
.est__form input[aria-invalid="true"] { border-color: var(--exposed); }
.est__form .btn { margin-top: 6px; }
.est__status { font-size: 14px; color: var(--text); }
.est__status:not(:empty) { margin-top: 12px !important; }
.est__status.is-error { color: var(--exposed); }
.est .est__status a { color: var(--exposed); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.est__done:focus { outline: none; }
.est__done:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .est__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .est__head, .est__grid, .est__quote { grid-template-columns: 1fr; }
  .est__out { position: static; }
}
@media (max-width: 520px) {
  .est__roles { grid-template-columns: 1fr; }
  .est__role { min-height: 60px; }
  .est__stats { grid-template-columns: 1fr; }
  .est__stats > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line-ink); }
  .est__cells { gap: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  .est__cell, .est__role, .est__seg button, .est__switch-track, .est__switch-track::after, .est__slider::-webkit-slider-thumb { transition: none; }
  .est__cell.is-pop { animation: none; }
}
