/* ============================================================
   Parti — concept studio
   Design system borrowed from Mountain Water Architecture:
   Archivo (structure) + Newsreader (flow),
   basalt / mist / water / timber, waterline motif.
   ============================================================ */

:root {
  --basalt: #252d2f;
  --mist: #eff1ee;
  --paper: #f7f8f6;
  --white: #ffffff;
  --water: #5f827d;
  --timber: #a5865f;
  --clay: #a8503c;          /* zoning failure, the only "alarm" in the room */
  --ink-60: rgba(37, 45, 47, 0.6);
  --ink-40: rgba(37, 45, 47, 0.4);
  --line: rgba(37, 45, 47, 0.14);
  --line-soft: rgba(37, 45, 47, 0.08);
  --water-tint: rgba(95, 130, 125, 0.12);
  --font-structure: "Archivo", system-ui, sans-serif;
  --font-flow: "Newsreader", Georgia, serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-structure);
  font-size: 14px;
  color: var(--basalt);
  background: var(--mist);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

button { font: inherit; color: inherit; cursor: pointer; }
input, output { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--water);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------------- top bar ---------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 20px;
  background: var(--mist);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 34px; height: 28px; flex: none; }
.brand-words { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.brand-tag {
  font-family: var(--font-flow);
  font-style: italic;
  font-size: 13.5px;
  color: var(--ink-60);
}

.project-name {
  flex: 1;
  min-width: 120px;
  max-width: 420px;
  margin-left: auto;
  border: none;
  border-bottom: 1px solid transparent;
  background: transparent;
  font-family: var(--font-flow);
  font-size: 19px;
  font-weight: 500;
  padding: 4px 2px;
  color: var(--basalt);
}
.project-name:hover { border-bottom-color: var(--line); }
.project-name:focus { border-bottom-color: var(--water); outline: none; }

.topbar-actions { display: flex; gap: 8px; }

.btn {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 9px 14px;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--water-tint); border-color: var(--water); }
.btn.solid {
  background: var(--basalt);
  border-color: var(--basalt);
  color: var(--mist);
}
.btn.solid:hover { background: #374245; }
.btn.small { padding: 6px 10px; font-size: 10.5px; }
.btn.danger:hover { border-color: var(--clay); background: rgba(168, 80, 60, 0.08); color: var(--clay); }

.waterline {
  width: 100%;
  height: 12px;
  flex: none;
  display: block;
  background: var(--mist);
}

/* ---------------- studio grid ---------------- */

.studio {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 236px minmax(360px, 1fr) 348px;
  background: var(--mist);
}

/* ---------------- left rail ---------------- */

.rail {
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 16px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-60);
}

.tool-list { display: flex; flex-direction: column; gap: 4px; }

.tool {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  text-align: left;
  font-size: 12.5px;
  transition: background 0.12s ease;
}
.tool svg { width: 17px; height: 17px; flex: none; color: var(--ink-60); }
.tool kbd {
  margin-left: auto;
  font-family: var(--font-structure);
  font-size: 10px;
  color: var(--ink-40);
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  padding: 1px 4px;
}
.tool:hover { background: var(--water-tint); }
.tool.active {
  background: var(--water-tint);
  border-color: var(--water);
}
.tool.active svg { color: var(--water); }

.tool-hint {
  margin: 10px 2px 0;
  font-family: var(--font-flow);
  font-style: italic;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-60);
}

.mass-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }

.mass-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 2px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 12.5px;
}
.mass-item:hover { background: var(--water-tint); }
.mass-item.selected { border-color: var(--water); background: var(--water-tint); }
.mass-dot { width: 10px; height: 10px; flex: none; border-radius: 1px; border: 1px solid rgba(37,45,47,0.35); }
.mass-item .mass-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mass-item .mass-fl { color: var(--ink-60); font-size: 11px; font-variant-numeric: tabular-nums; }

.empty-note {
  margin: 4px 2px;
  font-family: var(--font-flow);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-60);
  line-height: 1.45;
}

/* inspector */

.inspector { border-top: 1px solid var(--line); padding-top: 16px; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-60);
}
.field input[type="text"],
.field input[type="number"] {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--white);
  padding: 7px 8px;
  font-size: 13px;
  width: 100%;
}
.field input:focus { border-color: var(--water); outline: none; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row .field { margin-bottom: 12px; }

.stepper {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--white);
  overflow: hidden;
}
.stepper button {
  width: 28px;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--ink-60);
}
.stepper button:hover { background: var(--water-tint); color: var(--basalt); }
.stepper output {
  flex: 1;
  text-align: center;
  padding: 7px 0;
  font-variant-numeric: tabular-nums;
}

.swatch-row { display: flex; gap: 7px; }
.swatch {
  width: 24px;
  height: 24px;
  border-radius: 2px;
  border: 1px solid rgba(37,45,47,0.25);
  padding: 0;
}
.swatch.active { outline: 2px solid var(--basalt); outline-offset: 1px; }

.ins-stats {
  margin: 4px 0 14px;
  padding: 10px 0 2px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ins-stats > div { display: flex; justify-content: space-between; font-size: 12.5px; }
.ins-stats dt { color: var(--ink-60); }
.ins-stats dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 500; }

/* ---------------- canvas zone ---------------- */

.canvas-zone {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background:
    linear-gradient(rgba(247,248,246,0.92), rgba(247,248,246,0.92)),
    var(--paper);
}
.canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.canvas-label {
  position: absolute;
  top: 10px;
  left: 14px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-40);
  pointer-events: none;
}

.canvas-note {
  position: absolute;
  top: 10px;
  right: 14px;
  font-family: var(--font-flow);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-60);
  pointer-events: none;
  text-align: right;
  max-width: 55%;
}

/* sun bar */

.sunbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--mist);
}

.sun-season { display: flex; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.sun-season button {
  border: none;
  background: transparent;
  padding: 7px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-60);
}
.sun-season button + button { border-left: 1px solid var(--line); }
.sun-season button:hover { background: var(--water-tint); }
.sun-season button.active { background: var(--basalt); color: var(--mist); }

.sun-slider { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; }
.sun-icon { width: 17px; height: 17px; color: var(--timber); flex: none; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 22px;
  background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: linear-gradient(to right, var(--line) 0%, var(--timber) 30%, var(--timber) 70%, var(--line) 100%);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -6.5px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--basalt);
}
input[type="range"]::-moz-range-track { height: 2px; background: var(--line); }
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--white); border: 2px solid var(--basalt);
}

.sun-readout {
  flex: none;
  min-width: 168px;
  text-align: right;
  font-size: 12px;
  color: var(--ink-60);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sun-lat { display: flex; align-items: center; gap: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-60); }
.sun-lat input {
  width: 64px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--white);
  padding: 6px 7px;
  font-size: 12.5px;
}

/* ---------------- right board ---------------- */

.board {
  border-left: 1px solid var(--line);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.axon-wrap {
  flex: none;
  height: 300px;
  border-bottom: 1px solid var(--line);
}

.axon-rotate {
  position: absolute;
  bottom: 8px;
  left: 14px;
  right: 14px;
  width: auto !important;
  opacity: 0.65;
}
.axon-rotate:hover { opacity: 1; }

.verdict {
  margin: 0;
  padding: 18px 20px 16px;
  font-family: var(--font-flow);
  font-size: 17.5px;
  line-height: 1.5;
  font-weight: 400;
  border-bottom: 1px solid var(--line);
}
.verdict em { font-style: italic; color: var(--water); }
.verdict strong { font-weight: 500; font-variant-numeric: tabular-nums; }

.board-section { padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 10px;
}
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat output {
  font-size: 19px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.stat span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-60);
}

/* zoning */

.zoning-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin-bottom: 12px;
}
.zoning-inputs label,
.cost-inputs label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-60);
}
.zoning-inputs input,
.cost-inputs input {
  width: 62px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--white);
  padding: 5px 6px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.verdict-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.verdict-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
}
.verdict-list .v-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex: none; align-self: center;
  background: var(--water);
}
.verdict-list li.fail .v-dot { background: var(--clay); }
.verdict-list .v-label { flex: 1; color: var(--ink-60); }
.verdict-list .v-value { font-variant-numeric: tabular-nums; font-weight: 500; }
.verdict-list li.fail .v-value { color: var(--clay); }

/* program */

.program-rows { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.program-row {
  display: grid;
  grid-template-columns: 12px 1fr 58px 40px 18px;
  gap: 7px;
  align-items: center;
}
.program-row .p-dot { width: 10px; height: 10px; border-radius: 1px; border: 1px solid rgba(37,45,47,0.3); }
.program-row input {
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  background: var(--white);
  padding: 5px 6px;
  font-size: 12px;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.program-row input:focus { border-color: var(--water); outline: none; }
.program-row .p-del {
  border: none; background: none; color: var(--ink-40);
  font-size: 14px; padding: 0; line-height: 1;
}
.program-row .p-del:hover { color: var(--clay); }

.fit-bar { position: relative; margin: 14px 0 6px; height: 26px; }
.fit-track {
  display: flex;
  height: 14px;
  margin-top: 6px;
  border-radius: 1px;
  overflow: hidden;
  background: var(--line-soft);
}
.fit-track .seg { height: 100%; }
.fit-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--basalt);
}
.fit-marker span {
  position: absolute;
  top: -3px;
  left: 5px;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-60);
}
.fit-note {
  margin: 4px 0 0;
  font-family: var(--font-flow);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-60);
}
.fit-note.short { color: var(--clay); }

/* cost */

.cost-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-bottom: 12px; }
.cost-big { display: flex; flex-direction: column; gap: 2px; }
.cost-big output {
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.cost-big span {
  font-family: var(--font-flow);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-60);
}

.board-foot {
  margin-top: auto;
  padding: 14px 20px 18px;
}
.board-foot p {
  margin: 0;
  font-family: var(--font-flow);
  font-style: italic;
  font-size: 12px;
  color: var(--ink-40);
}

/* ---------------- narrow screens ---------------- */

@media (max-width: 1080px) {
  body { overflow: auto; }
  .studio { grid-template-columns: 1fr; }
  .rail { flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--line); }
  .canvas-wrap { min-height: 420px; }
  .board { border-left: none; border-top: 1px solid var(--line); }
}
