/* Калькулятор «Окна ПВХ» (components/calc/WindowsCalc.tsx).
   Рабочий чертёж: белый лист в рамке на сером столе, тушь, размерные
   линии с засечками, штамп со сметой. Один сигнальный цвет — красный
   карандаш (наведение, фокус, кнопка). Всё заперто под .win. */

.win {
  --win-ink: #141617; --win-mute: #666c70; --win-line: #c6cacc; --win-table: #e4e7e6; --win-red: #c4302b;
  --win-mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  display: grid; grid-template-columns: minmax(0, 1.28fr) minmax(0, 1fr);
  min-height: 560px; background: var(--win-table); color: var(--win-ink);
  font-family: var(--font-onest, system-ui, sans-serif);
}
.win button, .win input { font-family: inherit; color: inherit; }

/* ── лист ── */
.win-sheet {
  display: flex; flex-direction: column; margin: 18px 0 18px 18px; background: #fff;
  border: 1.5px solid var(--win-ink); outline: 1px solid var(--win-ink); outline-offset: 5px;
}
.win-draw { display: block; width: 100%; height: auto; padding: 8px 10px 0; box-sizing: border-box; }
.win-hint { margin: -4px 0 12px; text-align: center; font-size: .78rem; color: var(--win-mute); }

.win-frame { fill: #fff; stroke: var(--win-ink); stroke-width: 1.6; }
.win-frame-in, .win-glass, .win-mull { stroke: var(--win-ink); stroke-width: .8; }
.win-frame-in { fill: none; }
.win-mull { fill: #fff; }
.win-sframe { fill: #fff; stroke: var(--win-ink); stroke-width: 1; }
.win-glass { fill: #f2f6f7; }
.win-refl { stroke: #a3b0b4; stroke-width: .9; }
.win-netfill { opacity: .55; }
.win-net-l { fill: none; stroke: #7d8a8f; stroke-width: .4; }
.win-sym path { fill: none; stroke: var(--win-ink); stroke-width: .9; animation: win-open .5s cubic-bezier(.2,.7,.2,1) both; }
.win-handle { fill: var(--win-ink); }
.win-hit { fill: transparent; stroke: none; transition: fill .15s; }
.win-sash { cursor: pointer; outline: none; }
.win-sash:hover .win-hit { fill: rgba(196, 48, 43, .05); stroke: var(--win-red); stroke-width: 1.5; }
.win-sash:focus-visible .win-hit { stroke: var(--win-red); stroke-width: 2.5; }
/* схема открывания «раскрывается» от петель */
@keyframes win-open { from { transform: scale(0); opacity: 0; } }

.win-wall { fill: url(#win-hatch); stroke: var(--win-ink); stroke-width: .8; }
.win-hatch-l { stroke: #8f9598; stroke-width: 1; }
.win-sill { fill: #fff; stroke: var(--win-ink); stroke-width: 1; }
.win-drip { stroke: var(--win-ink); stroke-width: 1; stroke-dasharray: 7 4; }
.win-dim path { fill: none; stroke: var(--win-ink); stroke-width: .7; }
.win-dim text { fill: var(--win-ink); font-family: var(--win-mono); font-size: 14px; text-anchor: middle; }

/* ── штамп ── */
.win-stamp { display: grid; grid-template-columns: 104px minmax(0, 1fr); margin-top: auto; border-top: 1.5px solid var(--win-ink); }
.win-sec { display: block; width: 100%; height: auto; padding: 10px 12px; box-sizing: border-box; border-right: 1px solid var(--win-ink); }
.win-sec rect, .win-sec path { fill: none; stroke: var(--win-ink); stroke-width: 1; }
.win-sec rect { stroke-width: 1.4; }
.win-sec .win-sec-g { stroke-width: 1.6; stroke: #5f8a99; }
.win-sec text { font-family: var(--win-mono); font-size: 7px; fill: var(--win-mute); }
.win-stamp dl { margin: 0; align-self: start; }
.win-stamp dl div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 12px; border-bottom: 1px solid var(--win-line); font-size: .82rem; }
.win-stamp dl div:last-child { border-bottom: 0; }
.win-stamp dd { margin: 0; font-family: var(--win-mono); font-variant-numeric: tabular-nums; }
.win-total {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px 12px; border-top: 1px solid var(--win-ink);
}
.win-total > span { font-family: var(--win-mono); font-size: .72rem; line-height: 1.45; color: var(--win-mute); }
.win-total b {
  font-family: var(--font-unbounded, var(--font-onest), sans-serif); font-weight: 600; font-size: 1.6rem;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.win-total b small { font-family: var(--font-onest, sans-serif); font-size: .5em; font-weight: 500; letter-spacing: 0; }
.win-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── спецификация ── */
.win-spec { display: flex; flex-direction: column; padding: 26px 26px 24px 30px; }
.win-h { margin: 0 0 14px; font-size: 1.35rem; font-weight: 600; letter-spacing: -.015em; line-height: 1.2; }
.win-row {
  display: grid; grid-template-columns: 22px 100px minmax(0, 1fr); align-items: center; gap: 8px;
  min-height: 54px; padding: 4px 0; border-top: 1px solid var(--win-line); font-size: .9rem;
}
.win-row:last-of-type { border-bottom: 1px solid var(--win-line); margin-bottom: 18px; }
.win-pos { font-family: var(--win-mono); font-size: .78rem; color: var(--win-mute); }

.win-range { display: flex; align-items: center; gap: 10px; }
.win-range b { min-width: 7ch; white-space: nowrap; font-family: var(--win-mono); font-weight: 400; font-variant-numeric: tabular-nums; text-align: right; }
.win-range small { font-size: .78em; color: var(--win-mute); }
.win-range input { flex: 1; min-width: 0; -webkit-appearance: none; appearance: none; height: 40px; margin: 0; background: none; cursor: pointer; }
.win-range input::-webkit-slider-runnable-track { height: 1px; background: var(--win-ink); }
.win-range input::-moz-range-track { height: 1px; background: var(--win-ink); }
.win-range input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 10px; height: 22px; margin-top: -11px; background: #fff; border: 1.5px solid var(--win-ink);
}
.win-range input::-moz-range-thumb { width: 8px; height: 20px; border-radius: 0; background: #fff; border: 1.5px solid var(--win-ink); }
.win-range input:hover::-webkit-slider-thumb { border-color: var(--win-red); }

/* варианты — квадратики, как в бланке */
.win-opts { display: flex; flex-wrap: wrap; column-gap: 14px; }
.win-opts button {
  display: flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 2px; background: none; border: 0;
  cursor: pointer; font-size: .88rem; white-space: nowrap;
}
.win-opts button::before {
  content: ''; width: 11px; height: 11px; border: 1.5px solid var(--win-ink); background: #fff; flex: none;
}
.win-opts button[aria-checked="true"]::before { background: var(--win-ink); box-shadow: inset 0 0 0 2px #fff; }
.win-opts button[aria-checked="false"] { color: var(--win-mute); }
.win-opts button:hover { color: var(--win-ink); }

.win-ex { display: grid; grid-template-columns: 1fr 1fr; column-gap: 10px; }
.win-ex label { display: flex; align-items: center; gap: 8px; min-height: 40px; font-size: .88rem; cursor: pointer; }
.win-ex input {
  flex: none; -webkit-appearance: none; appearance: none; width: 15px; height: 15px; margin: 0;
  border: 1.5px solid var(--win-ink); background: #fff; cursor: pointer;
}
.win-ex input:checked {
  background:
    linear-gradient(45deg, transparent 43%, var(--win-ink) 43% 57%, transparent 57%),
    linear-gradient(-45deg, transparent 43%, var(--win-ink) 43% 57%, transparent 57%), #fff;
}

.win-legend { margin: -4px 0 18px; font-size: .8rem; line-height: 1.5; color: var(--win-mute); }
.win-btn {
  margin-top: auto; min-height: 52px; padding: 14px 18px; border: 0; cursor: pointer;
  background: var(--win-red); color: #fff !important; font-size: .95rem; font-weight: 600; transition: background .15s;
}
.win-btn:hover { background: #a72520; }
.win button:focus-visible, .win input:focus-visible { outline: 2px solid var(--win-red); outline-offset: 2px; }

@media (max-width: 720px) {
  .win { grid-template-columns: 1fr; min-height: 0; }
  .win-sheet { margin: 14px 14px 4px; }
  .win-draw { padding: 6px 2px 0; }
  .win-spec { padding: 18px 16px 20px; }
  .win-row { grid-template-columns: 18px 74px minmax(0, 1fr); gap: 6px; }
  .win-opts { column-gap: 10px; }
  .win-opts button, .win-ex label { font-size: .82rem; }
  .win-stamp { grid-template-columns: 84px minmax(0, 1fr); }
  .win-total b { font-size: 1.35rem; }
  .win-dim text { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .win-sym path { animation: none; }
}
