/* ============================================================================
   ShyftOff Cost Calculator — component styles (Shadow DOM isolated).
   Tokens resolve from the site's Webflow variables (rootCSS) with the original
   page palette as fallback, so the component adapts to the site automatically.
   NO external fonts: body text inherits the site font via --main--main-font;
   numeric accents use a system monospace stack (--calc-font-mono).
   ========================================================================== */
:host, .shyftoff-calc {
  --calc-ink: var(--neutral--neutral-dark, #1B0E33);
  --calc-ink-2: var(--neutral--neutral-700, #2C1A4D);
  --calc-purple: var(--brand--purple, #6E30C4);
  --calc-purple-soft: var(--brand--purple-100, #8B5CF6);
  --calc-coral: var(--brand--orange, #FF6A4D);
  --calc-pink: var(--brand--pink, #F0438C);
  --calc-star: #8F68D3;
  --calc-paper: transparent;
  --calc-card: var(--neutral--neutral-white, #FFFFFF);
  --calc-line: var(--brand--purple-300, #E7DBF7);
  --calc-muted: var(--neutral--neutral-500, #6B5A82);
  --calc-tint: var(--brand--purple-300, #F3ECFD);
  --calc-ink-on-dark: #EFE9F7;
  --calc-soft-on-dark: #cdbfe2;
  --calc-grad: linear-gradient(90deg, var(--calc-coral), var(--calc-pink), var(--calc-purple));
  --calc-radius: var(--border--radius-l, 16px);
  --calc-radius-m: var(--border--radius-m, 12px);
  --calc-shadow: 0 18px 50px -24px rgba(27, 14, 51, .45);
  --calc-font-body: var(--main--main-font, inherit);
  --calc-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

.shyftoff-calc, .shyftoff-calc * { box-sizing: border-box; }
.shyftoff-calc {
  font-family: var(--calc-font-body);
  color: var(--calc-ink);
  background: var(--calc-paper);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
/* Mirrors the site's .container class exactly (Container/Main Size 90rem,
   Container/Size Padding 1.5rem) so the calc aligns with every other section. */
.shyftoff-calc .wrap {
  width: 100%;
  max-width: var(--container--main-size, 90rem);
  margin: 0 auto;
  padding-left: var(--container--size-padding, 1.5rem);
  padding-right: var(--container--size-padding, 1.5rem);
}

/* ---------- section head ---------- */
.tool { padding: 0; }
.section-head { margin-bottom: 32px; }
.eyebrow {
  display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase;
  border: 1px solid var(--calc-line); border-radius: 999px; padding: 7px 14px;
  color: var(--calc-purple); background: var(--calc-card);
}
.section-head h2 { font-size: clamp(26px, 3.6vw, 38px); font-weight: 800; letter-spacing: -.02em; margin: 18px 0 8px; color: var(--calc-ink); }
.section-head p { color: var(--calc-muted); max-width: 62ch; margin: 0; font-size: 15.5px; }

.grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 28px; align-items: start; }
@media (max-width: 880px) { .grid { grid-template-columns: 1fr; } }

@media (min-width: 881px) {
  .grid.workspace { align-items: stretch; }
  .grid.workspace > .panel { display: flex; flex-direction: column; }
  .grid.workspace > .panel > .panel-pad { flex: 1; display: flex; flex-direction: column; }
  .grid.workspace > .panel #adv-open { margin-top: auto; }
  .grid.workspace > .results .stat-row { flex: 1 1 auto; }
  .grid.workspace > .results .stat-row > .stat { display: flex; flex-direction: column; justify-content: center; }
  .grid.workspace > .results .chips { flex: 1 1 auto; grid-auto-rows: 1fr; }
  .grid.workspace > .results .chip-stat { display: flex; flex-direction: column; justify-content: center; }
}

.panel { background: var(--calc-card); border: 1px solid var(--calc-line); border-radius: var(--calc-radius); box-shadow: var(--calc-shadow); }
.panel-pad { padding: 26px 26px 30px; }
.panel h3 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--calc-muted); font-weight: 700; margin: 0 0 4px; }
.panel .lede { font-size: 13px; color: var(--calc-muted); margin: 0 0 18px; }

.field { padding: 16px 0; border-top: 1px solid var(--calc-line); }
.field:first-of-type { border-top: none; padding-top: 6px; }
.field-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field label { font-weight: 600; font-size: 14.5px; color: var(--calc-ink); }
.field .hint { font-size: 12px; color: var(--calc-muted); margin-top: 3px; line-height: 1.4; }
.val {
  font-family: var(--calc-font-mono); font-weight: 600; font-size: 15px; color: var(--calc-purple);
  background: var(--calc-tint); border: 1px solid var(--calc-line); border-radius: 8px; padding: 4px 9px; white-space: nowrap;
}
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; margin: 14px 0 0;
  border-radius: 6px; background: linear-gradient(90deg, var(--calc-purple-soft), var(--calc-pink));
  outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid var(--calc-purple); box-shadow: 0 2px 6px rgba(27, 14, 51, .3); cursor: pointer;
}
input[type=range]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid var(--calc-purple);
  box-shadow: 0 2px 6px rgba(27, 14, 51, .3); cursor: pointer; border-width: 3px;
}
input[type=number] {
  font-family: var(--calc-font-mono); font-weight: 600; font-size: 15px; color: var(--calc-ink);
  width: 100%; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--calc-line); border-radius: 9px;
  background: var(--calc-card);
}
input:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid var(--calc-pink); outline-offset: 2px; }
.scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--calc-muted); font-family: var(--calc-font-mono); margin-top: 6px; }

/* ---------- results ---------- */
.results { display: flex; flex-direction: column; gap: 18px; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 520px) { .stat-row { grid-template-columns: 1fr; } }
.stat { background: var(--calc-card); border: 1px solid var(--calc-line); border-radius: var(--calc-radius); padding: 22px 22px 20px; position: relative; overflow: hidden; }
.stat .tag { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--calc-muted); }
.stat .num { font-family: var(--calc-font-mono); font-weight: 600; font-size: clamp(26px, 4vw, 34px); letter-spacing: -.01em; margin: 10px 0 2px; color: var(--calc-ink); line-height: 1; }
.stat .cap { font-size: 12.5px; color: var(--calc-muted); margin-top: 6px; line-height: 1.4; }
.stat.headline { background: var(--calc-ink); color: #fff; grid-column: 1 / -1; }
.stat.headline .tag { color: var(--calc-soft-on-dark); }
.stat.headline .num { color: #fff; font-size: clamp(30px, 5vw, 44px); }
.stat.headline .cap { color: var(--calc-soft-on-dark); }
.stat.headline::after {
  content: ""; position: absolute; inset: auto -40px -40px auto; width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 67, 140, .45), transparent 60%); filter: blur(8px);
}
.stat.headline .inner { position: relative; z-index: 2; }
.savings-band {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 20px;
  font-size: 12px; color: var(--calc-soft-on-dark); font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.savings-band .chip {
  font-family: var(--calc-font-mono); background: var(--calc-grad); border-radius: 999px;
  padding: 14px 30px; font-size: clamp(26px, 4vw, 38px); font-weight: 700; color: #fff; letter-spacing: -.01em; line-height: 1;
  box-shadow: 0 16px 44px -12px rgba(240, 67, 140, .8); align-self: stretch; text-align: center;
}
.book { margin-top: 20px; border-top: 1px solid rgba(239, 233, 247, .18); padding-top: 18px; }

/* ---------- chart ---------- */
.chart-card { margin-top: 28px; background: var(--calc-card); border: 1px solid var(--calc-line); border-radius: var(--calc-radius); box-shadow: var(--calc-shadow); padding: 26px; }
.chart-card h3 { font-size: 18px; font-weight: 800; letter-spacing: -.01em; margin: 0 0 4px; color: var(--calc-ink); }
.chart-card .sub { font-size: 14px; color: var(--calc-muted); margin: 0 0 18px; max-width: 74ch; }
.legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 16px; font-size: 12.5px; color: var(--calc-ink); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.swatch { width: 18px; height: 4px; border-radius: 3px; display: inline-block; }
.swatch.box { height: 14px; width: 14px; border-radius: 4px; }
svg.demand { width: 100%; height: auto; display: block; }
.assump { font-size: 12px; color: var(--calc-muted); margin-top: 22px; line-height: 1.5; border-top: 1px solid var(--calc-line); padding-top: 16px; }
.assump b { color: var(--calc-ink); font-weight: 600; }
.chart-wide { margin-top: 18px; }
.chart-wide .demand { max-height: 460px; }

/* ---------- metric chips ---------- */
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 520px) { .chips { grid-template-columns: 1fr 1fr; } }
.chip-stat { background: var(--calc-card); border: 1px solid var(--calc-line); border-radius: 12px; padding: 13px 14px; }
.chip-stat .k { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--calc-muted); font-weight: 600; }
.chip-stat .v { font-family: var(--calc-font-mono); font-weight: 600; font-size: 19px; color: var(--calc-ink); margin-top: 5px; line-height: 1; }
.chip-stat .s { font-size: 11px; color: var(--calc-muted); margin-top: 4px; }
.chip-stat.warn { border-color: #E7C200; background: #FFFBEB; }
.chip-stat.warn .v { color: #9a7b00; }

/* ---------- chart tabs ---------- */
.tabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--calc-line); margin-bottom: 22px; padding: 0; }
.tab {
  border: none; background: transparent; font-family: inherit; font-weight: 600; font-size: 14px; color: var(--calc-muted);
  padding: 13px 18px; cursor: pointer; position: relative; border-radius: 9px 9px 0 0;
  transition: color .15s ease, background .15s ease;
}
.tab:hover { color: var(--calc-ink); background: var(--calc-tint); }
.tab[aria-selected=true] { color: var(--calc-purple); }
.tab[aria-selected=true]::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 3px;
  border-radius: 3px 3px 0 0; background: var(--calc-grad);
}

.htable { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13px; }
.htable th, .htable td { text-align: right; padding: 8px 10px; border-top: 1px solid var(--calc-line); }
.htable th:first-child, .htable td:first-child { text-align: left; }
.htable th { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--calc-muted); font-weight: 700; border-top: none; }
.htable td { font-family: var(--calc-font-mono); color: var(--calc-ink); }
.htable td:first-child { font-family: var(--calc-font-body); font-weight: 600; }

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

/* ---------- compact controls ---------- */
.field .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.field .row2 .mini label { font-size: 12px; color: var(--calc-muted); font-weight: 600; display: block; margin-bottom: 5px; }
select, input[type=number].mini {
  font-family: var(--calc-font-mono); font-weight: 600; font-size: 14px; color: var(--calc-ink);
  width: 100%; padding: 9px 11px; border: 1px solid var(--calc-line); border-radius: 9px; background: var(--calc-card); cursor: pointer;
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns=%27http://www.w3.org/2000/svg%27 width=%2710%27 height=%276%27 viewBox=%270 0 10 6%27><path fill=%27%236B5A82%27 d=%27M0 0l5 6 5-6z%27/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px;
}

.adv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; padding: 8px 0 4px; }
.adv-grid .full { grid-column: 1 / -1; }
.adv-grid .mini label { font-size: 12px; color: var(--calc-ink); font-weight: 600; display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.adv-grid .mini label .v { color: var(--calc-purple); font-family: var(--calc-font-mono); }
.adv-grid input[type=range] { margin-top: 4px; }
.adv-sub { grid-column: 1 / -1; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--calc-muted); font-weight: 700; margin: 6px 0 -4px; }
.dow-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dow-grid .mini label { justify-content: center; font-size: 11px; }
.dow-grid input[type=number] { padding: 7px 4px; text-align: center; font-size: 13px; }

/* ---------- Advanced trigger button ---------- */
.adv-open-btn {
  margin-top: 18px; width: 100%; display: inline-flex; align-items: center; gap: 10px;
  font-family: inherit; font-weight: 700; font-size: 14px; color: var(--calc-purple); cursor: pointer;
  background: var(--calc-tint); border: 1px solid var(--calc-line); border-radius: 12px; padding: 15px 18px;
  transition: background .15s ease, transform .1s ease;
}
.adv-open-btn:hover { filter: brightness(.97); }
.adv-open-btn:active { transform: translateY(1px); }
.adv-open-btn .adv-open-arrow { margin-left: auto; font-size: 16px; }

/* ---------- modals (Advanced + lead) ---------- */
.adv-modal {
  border: none; padding: 0; margin: 0; width: 100%; height: 100%; max-width: 100%; max-height: 100%;
  inset: 0; background: transparent; overflow: visible;
  font-family: var(--calc-font-body); color: var(--calc-ink); line-height: 1.5;
}
.adv-modal::backdrop { background: rgba(27, 14, 51, .55); backdrop-filter: blur(6px); }
.adv-modal .modal-shell { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; }
.adv-modal .modal-card {
  background: var(--calc-card); border: 1px solid var(--calc-line); border-radius: 18px;
  box-shadow: 0 44px 110px -32px rgba(27, 14, 51, .65); width: min(1060px, 94vw); max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.adv-modal .modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 24px 28px; border-bottom: 1px solid var(--calc-line); }
.adv-modal .modal-head h3 { font-size: 19px; font-weight: 800; letter-spacing: -.01em; margin: 0; color: var(--calc-ink); text-transform: none; }
.adv-modal .modal-head .sub { font-size: 13px; color: var(--calc-muted); margin: 4px 0 0; max-width: 62ch; }
.adv-modal .modal-close {
  flex: 0 0 auto; border: 1px solid var(--calc-line); background: var(--calc-card); border-radius: 11px;
  width: 40px; height: 40px; font-size: 22px; line-height: 1; color: var(--calc-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: background .15s ease, color .15s ease;
}
.adv-modal .modal-close:hover { background: var(--calc-tint); color: var(--calc-ink); }
.adv-modal .modal-body { padding: 26px 28px; overflow-y: auto; }
.adv-modal .modal-body .adv-grid { grid-template-columns: repeat(3, 1fr); gap: 20px 28px; padding: 0; }
.adv-modal .modal-foot { padding: 18px 28px; border-top: 1px solid var(--calc-line); display: flex; justify-content: flex-end; }
.adv-modal .modal-done {
  background: var(--calc-grad); color: #fff; border: none; border-radius: 12px;
  padding: 13px 30px; font-family: inherit; font-weight: 700; font-size: 14.5px; cursor: pointer;
  box-shadow: 0 12px 30px -14px rgba(240, 67, 140, .8); transition: transform .15s ease;
}
.adv-modal .modal-done:hover { transform: translateY(-2px); }
@media (max-width: 820px) { .adv-modal .modal-body .adv-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .adv-modal .modal-body .adv-grid { grid-template-columns: 1fr; } }

/* ---------- export / print ("Save as PDF") ---------- */
.print-only { display: none; }
.pdf-btn {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px;
  background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .45);
  font-family: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer;
  padding: 11px 18px; border-radius: 11px; transition: background .15s ease;
}
.pdf-btn:hover { background: rgba(255, 255, 255, .12); }
.print-chart-block { margin: 0 0 26px; }
.print-chart-block h3 { font-size: 17px; font-weight: 800; letter-spacing: -.01em; margin: 0 0 4px; }
.print-chart-block .sub { font-size: 13px; color: var(--calc-muted); margin: 0 0 12px; }

/* ---------- lead capture ---------- */
#lead-modal input[type=text],
#lead-modal input[type=email] {
  font-family: var(--calc-font-body); font-weight: 500; font-size: 15px; color: var(--calc-ink);
  width: 100%; margin-top: 7px; padding: 12px 13px; border: 1px solid var(--calc-line); border-radius: 10px; background: var(--calc-card);
}
#lead-modal .lead-field { margin-bottom: 16px; }
#lead-modal .lead-field label { font-weight: 600; font-size: 14px; color: var(--calc-ink); display: block; }
#lead-modal .lead-field label .opt { color: var(--calc-muted); font-weight: 500; }
#lead-modal .lead-hp { position: absolute; left: -9999px; top: -9999px; height: 0; width: 0; opacity: 0; overflow: hidden; }
#lead-modal .lead-status { font-size: 13px; color: var(--calc-muted); margin-right: auto; align-self: center; }
#lead-modal .lead-status.err { color: #c0392b; }
#lead-modal .lead-status.ok { color: #1e7d44; }
.lead-submit {
  background: var(--calc-grad); color: #fff; border: none; border-radius: 12px;
  padding: 13px 26px; font-family: inherit; font-weight: 700; font-size: 14.5px; cursor: pointer;
  box-shadow: 0 12px 30px -14px rgba(240, 67, 140, .8); transition: transform .15s ease;
}
.lead-submit:hover { transform: translateY(-2px); }
.lead-submit:disabled { opacity: .6; cursor: default; transform: none; }
.lead-cancel {
  background: var(--calc-card); color: var(--calc-muted); border: 1px solid var(--calc-line); border-radius: 12px;
  padding: 13px 22px; font-family: inherit; font-weight: 600; font-size: 14.5px; cursor: pointer;
}

@media print {
  @page { margin: 14mm; }
  .shyftoff-calc, .shyftoff-calc * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  .shyftoff-calc { background: #fff !important; }
  /* Intro ("The model" head) becomes a cover: vertically centered on its own
     first page, the model content starts on page two. */
  .section-head {
    min-height: 75vh;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 0;
    break-after: page;
    page-break-after: always;
  }
  .tabs, .no-print, .screen-only, .adv-modal, .adv-open-btn { display: none !important; }
  .print-only { display: block !important; }
  .tool { padding: 0 !important; }
  .grid { display: block !important; }
  .grid.workspace { height: auto !important; align-items: start !important; }
  .grid.workspace > .panel,
  .grid.workspace > .results { height: auto !important; overflow: visible !important; position: static !important; }
  .panel { margin-bottom: 18px; box-shadow: none !important; }
  .panel, .stat, .chip-stat, .print-chart-block { break-inside: avoid; }
  .chart-card { box-shadow: none !important; border: none !important; padding: 0 !important; }
}

