/* Da Rec Studio — dark theme. Brand: #111111 background, #ED1E24 red, white. */

/* Jost (SIL Open Font License 1.1), self-hosted variable font, Latin subset. */
@font-face {
  font-family: "Jost";
  src: url("/assets/fonts/jost-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  --bg: #111111;
  --surface: #1a1a1a;
  --surface-2: #232323;
  --line: #2e2e2e;
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --red: #ed1e24;
  --red-soft: rgba(237, 30, 36, 0.14);
  --red-button: #d91a21; /* white text on it passes WCAG AA (5.1:1); #ed1e24 stays for accents */
  --ok: #3ccf7a;
  --warn: #f2b33d;
  --radius: 14px;
  --font: "Jost", "Futura", "Century Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.55 var(--font); /* rem: respects the user's text size */
  -webkit-font-smoothing: antialiased;
  font-optical-sizing: auto;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--text); }
img { max-width: 100%; }
/* Tracking and leading are size-specific: tighter as type grows, slightly open when small. */
h1, h2, h3 { margin: 0 0 0.5em; font-weight: 600; text-wrap: balance; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.06; letter-spacing: -0.022em; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.15; letter-spacing: -0.015em; }
h3 { font-size: 1.15rem; line-height: 1.25; letter-spacing: -0.005em; }
p { margin: 0 0 1em; text-wrap: pretty; }
.muted { color: var(--muted); }
.red { color: var(--red); }
.small { font-size: 0.88rem; letter-spacing: 0.01em; }
.num, .price-big, .amount { font-variant-numeric: tabular-nums; }

.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(680px, 100% - 32px); margin-inline: auto; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; }
.topbar img { height: 44px; width: auto; display: block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  background: var(--red-button); color: #fff; font: 600 1rem var(--font); letter-spacing: 0.005em; cursor: pointer; text-decoration: none;
  touch-action: manipulation; /* no double-tap delay */
  transition: transform 100ms ease-out, background 150ms ease;
}
@media (hover: hover) { .btn:hover { background: #c4161c; } }
/* Feedback lives on the press, and it's instant. */
.btn:active, .choice:active, .option-card:active, .stepper button:active { transform: scale(0.97); transition-duration: 60ms; }
.btn:focus-visible, .choice:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid #fff; outline-offset: 2px;
}
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.ghost:hover { border-color: var(--muted); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.busy { pointer-events: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }

.rec-dot { display: inline-block; width: 0.6em; height: 0.6em; border-radius: 50%; background: var(--red); margin-right: 0.35em; vertical-align: 0.05em; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } .btn { transition: none; } }

/* Questionnaire */
.progress { height: 4px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--red); width: 0; transition: width 0.3s ease; }
.lead-in { color: var(--muted); font-size: 1.05rem; min-height: 1.5em; }
.question { font-size: clamp(1.35rem, 3vw, 1.75rem); font-weight: 600; margin: 4px 0 18px; }
.choices { display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: 500 1rem var(--font); cursor: pointer; touch-action: manipulation;
  transition: transform 100ms ease-out, border-color 120ms ease, background 120ms ease;
}
@media (hover: hover) { .choice:hover { border-color: #555; } }
.choice[aria-pressed="true"] { border-color: var(--red); background: var(--red-soft); }
.choice .mark { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #555; flex: none; }
.choice[aria-pressed="true"] .mark { border-color: var(--red); background: var(--red); box-shadow: inset 0 0 0 3px var(--surface); }
.choice.multi .mark { border-radius: 6px; }
.actions { display: flex; gap: 12px; justify-content: space-between; align-items: center; margin-top: 22px; flex-wrap: wrap; }

input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"], textarea, select {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: 400 1rem var(--font);
}
textarea { min-height: 96px; resize: vertical; }
label { display: block; font-weight: 500; margin-bottom: 6px; }
.field { margin-bottom: 18px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 5px; accent-color: var(--red); width: 18px; height: 18px; flex: none; }

.notice { border-left: 3px solid var(--red); padding: 12px 16px; background: var(--surface); border-radius: 0 10px 10px 0; }
.notice.ok { border-color: var(--ok); }
.notice.warn { border-color: var(--warn); }
.error { color: #ff6b6b; min-height: 1.4em; }

/* Proposal and configurator */
.price-big { font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.tag { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.included { color: var(--ok); border-color: rgba(60, 207, 122, 0.4); }
.tag.additional { color: #fff; border-color: var(--red); }
.tag.quote { color: var(--warn); border-color: rgba(242, 179, 61, 0.4); }
.config-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.config-row .controls { display: flex; gap: 8px; align-items: center; }
.config-row input[type="number"] { width: 84px; }
.config-row select { width: auto; }
.options { display: grid; gap: 14px; }
@media (min-width: 760px) { .options { grid-template-columns: 1fr 1fr; } }
.option-card { cursor: pointer; }
.option-card[aria-pressed="true"] { border-color: var(--red); background: var(--red-soft); }
.sticky-total { position: sticky; bottom: 0; background: rgba(17, 17, 17, 0.94); border-top: 1px solid var(--line); padding: 14px 0; backdrop-filter: blur(6px); }

footer { padding: 40px 0; color: var(--muted); font-size: 0.85rem; }
[hidden] { display: none !important; }
.sr-title { font-size: clamp(1.4rem, 3vw, 1.9rem); text-align: center; }

/* Materials: floating translucent chrome that content scrolls beneath, with a soft
   scroll-edge fade instead of a hard divider. */
.chrome {
  position: sticky; top: 0; z-index: 30;
  background: rgba(17, 17, 17, 0.72); backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
}
.chrome::after {
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 16px; pointer-events: none;
  background: linear-gradient(rgba(17, 17, 17, 0.55), transparent);
}
.sticky-total {
  background: rgba(17, 17, 17, 0.72); backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-top: 1px solid rgba(255, 255, 255, 0.06); /* light catching the material's edge */
}
.sticky-total::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 20px; pointer-events: none;
  background: linear-gradient(transparent, rgba(17, 17, 17, 0.6));
}

/* Steppers: big targets, immediate response. */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); }
.stepper button {
  width: 44px; height: 44px; border: 0; background: transparent; color: var(--text); font: 500 1.3rem/1 var(--font);
  border-radius: 999px; cursor: pointer; touch-action: manipulation; transition: transform 100ms ease-out, background 120ms ease;
}
.stepper button:disabled { opacity: 0.3; cursor: default; }
@media (hover: hover) { .stepper button:not(:disabled):hover { background: #2c2c2c; } }
.stepper output { min-width: 2.2ch; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Ongoing status: totals dim while the server recomputes, never blocking input. */
.recalculating { opacity: 0.55; transition: opacity 120ms ease; }
.settled { transition: opacity 200ms ease; }
.field-error { color: #ff6b6b; font-size: 0.85rem; margin-top: 6px; min-height: 1.2em; }
input[aria-invalid="true"] { border-color: #ff6b6b; }

/* Questionnaire step transitions: forward enters from the right, back from the left (same path). */
.step-enter-fwd { animation: step-in-fwd 320ms cubic-bezier(0.23, 1, 0.32, 1); }
.step-enter-back { animation: step-in-back 320ms cubic-bezier(0.23, 1, 0.32, 1); }
.step-leave { opacity: 0.35; transform: translateX(-12px); transition: opacity 180ms ease, transform 220ms cubic-bezier(0.23, 1, 0.32, 1); }
@keyframes step-in-fwd { from { opacity: 0; transform: translateX(24px); } }
@keyframes step-in-back { from { opacity: 0; transform: translateX(-24px); } }
.thinking { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .btn:active, .choice:active, .option-card:active, .stepper button:active { transform: none; }
  .step-enter-fwd, .step-enter-back { animation: step-fade 160ms ease-out; }
  .step-leave { transform: none; }
  .progress > span { transition: none; }
}
@keyframes step-fade { from { opacity: 0; } }
@media (prefers-reduced-transparency: reduce) {
  .chrome, .sticky-total { background: #161616; backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --muted: #d4d4d4; --line: #6b6b6b; }
  .chrome, .sticky-total { background: #000; border-bottom: 1px solid #fff; }
}

.sticky-total { transition: transform 280ms cubic-bezier(0.23, 1, 0.32, 1), opacity 200ms ease; }
.sticky-total.away { transform: translateY(110%); opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .sticky-total.away { transform: none; } }

/* Proposal: diagnosis lists */
.lead-text { font-size: clamp(1.1rem, 2vw, 1.3rem); line-height: 1.5; color: #dcdcdc; max-width: 62ch; }
.obstacles, .reasons { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.obstacles li, .reasons li { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.obstacles li:last-child, .reasons li:last-child { border-bottom: 0; }
.obstacles .tag { align-self: flex-start; }
.insight { border-left: 3px solid var(--red-button); }
.insight p { margin: 0; max-width: 62ch; }
.reasons span { color: #cfcfcf; }

.tax-lines { display: grid; gap: 2px; margin: 8px 0; color: var(--muted, #a8a8a8); }
.tax-lines div { display: flex; justify-content: space-between; gap: 12px; }
fieldset.channel { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0; }
fieldset.channel legend { padding: 0 6px; }
select { font: inherit; }
