/* LumaSign LED Wall Calculator — page stylesheet (profile B, prefix lsg-).
   Loaded after lsg-home.css and reuses its tokens, header, footer, buttons. */

/* ---------- Intro ---------- */

.lsg-calc-intro {
  background-color: var(--lsg-bg-deep);
  padding-block: clamp(48px, 7vw, 96px) clamp(24px, 3vw, 40px);
}
.lsg-calc-intro::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 0;
  width: min(1100px, 140%);
  height: 420px;
  translate: -50% -40%;
  background: radial-gradient(ellipse, rgba(124, 58, 237, 0.22) 0%, rgba(6, 13, 32, 0) 70%);
}
.lsg-calc-intro__head { max-width: 860px; margin-bottom: 0; }
.lsg-calc-intro__title {
  font-size: clamp(2.125rem, 1.3rem + 3.6vw, 4rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: #fff;
}
.lsg-calc-intro__head .lsg-lead { margin-top: 20px; max-width: 680px; }

/* ---------- Calculator shell ---------- */

.lsg-calc {
  background-color: var(--lsg-bg);
  padding-block: clamp(24px, 3vw, 40px) clamp(64px, 8vw, 104px);
  overflow: visible;
}

.lsg-calc__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: clamp(24px, 3vw, 36px);
}
.lsg-calc__tab {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 260px;
  min-width: 0;
  max-width: 520px;
  min-height: 64px;
  padding: 14px 20px;
  border-radius: var(--lsg-radius);
  border: 1px solid var(--lsg-line-strong);
  background-color: var(--lsg-glass);
  color: var(--lsg-muted);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.lsg-calc__tab:hover { border-color: rgba(210, 187, 255, 0.4); color: var(--lsg-text); }
.lsg-calc__tab[aria-selected="true"] {
  color: #fff;
  border-color: rgba(210, 187, 255, 0.55);
  background-color: rgba(124, 58, 237, 0.16);
  box-shadow: inset 0 -3px 0 var(--lsg-cyan);
}
.lsg-calc__tab-num {
  flex: 0 0 auto;
  font-family: var(--lsg-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--lsg-cyan);
}
.lsg-calc__tab-title { min-width: 0; overflow-wrap: break-word; }

.lsg-calc__panel { outline-offset: 6px; }
.lsg-calc__panel[hidden] { display: none; }
.lsg-calc__panel-text { max-width: 760px; margin-bottom: clamp(20px, 2.5vw, 32px); }

.lsg-calc__box {
  min-width: 0;
  padding: clamp(20px, 2.4vw, 32px);
  border-radius: var(--lsg-radius);
  background-color: var(--lsg-surface);
  border: 1px solid var(--lsg-line);
  border-top-color: var(--lsg-line-strong);
}

.lsg-calc__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--lsg-gap);
  align-items: start;
}
@media (min-width: 1024px) {
  .lsg-calc__layout { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
}
@media (min-width: 1800px) {
  .lsg-calc__layout { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); }
}

.lsg-calc__h {
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}
.lsg-calc__sub {
  margin: 20px 0 10px;
  font-family: var(--lsg-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lsg-cyan);
}
.lsg-calc__h + .lsg-calc__sub { margin-top: 0; }
.lsg-calc__mono { font-family: var(--lsg-mono); }
.lsg-calc__caption {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 12px;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--lsg-muted);
}
.lsg-calc__error {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background-color: rgba(255, 92, 120, 0.1);
  border: 1px solid rgba(255, 92, 120, 0.35);
  color: #ffc9d3;
  font-size: 0.9375rem;
}
.lsg-calc__hint {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background-color: rgba(255, 196, 77, 0.08);
  border: 1px solid rgba(255, 196, 77, 0.4);
  color: #ffe2a8;
  font-size: 0.875rem;
}
.lsg-calc__hint[hidden],
.lsg-calc__error[hidden],
.lsg-proc__none[hidden] { display: none; }

/* ---------- Form ---------- */

.lsg-calc__form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.lsg-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.lsg-fieldset[hidden],
.lsg-field[hidden] { display: none; }
.lsg-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lsg-field__label {
  display: block;
  padding: 0;
  margin-bottom: 2px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--lsg-text);
}
.lsg-field__sublabel {
  font-family: var(--lsg-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--lsg-muted);
}
.lsg-field__control {
  display: flex;
  align-items: center;
  min-width: 0;
  border-radius: 12px;
  background-color: var(--lsg-bg-deep);
  border: 1px solid var(--lsg-line-strong);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.lsg-field__control:focus-within {
  border-color: var(--lsg-cyan);
  box-shadow: 0 0 0 3px rgba(76, 214, 255, 0.18);
}
.lsg-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #fff;
  font-family: var(--lsg-mono);
  font-size: 1rem;
  line-height: 1.4;
}
.lsg-input:focus { outline: none; }
.lsg-input::placeholder { color: rgba(195, 189, 210, 0.45); }
.lsg-select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--lsg-muted) 50%), linear-gradient(135deg, var(--lsg-muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}
.lsg-select option { background-color: var(--lsg-surface); color: var(--lsg-text); }
.lsg-field__unit {
  flex: 0 0 auto;
  padding-right: 14px;
  font-family: var(--lsg-mono);
  font-size: 0.875rem;
  color: var(--lsg-muted);
}
.lsg-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 10px;
}
.lsg-pair__x {
  padding-bottom: 12px;
  font-family: var(--lsg-mono);
  color: var(--lsg-muted);
}
.lsg-pair--wide { grid-template-columns: minmax(0, 1fr); gap: 18px; }
@media (min-width: 480px) {
  .lsg-pair--wide { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}
.lsg-calc__rule {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--lsg-muted);
}

/* Segmented radio */
.lsg-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.lsg-seg__opt {
  position: relative;
  display: inline-flex;
  flex: 1 1 140px;
  min-width: 0;
}
.lsg-seg__opt input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.lsg-seg__opt span {
  flex: 1 1 auto;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--lsg-line-strong);
  background-color: var(--lsg-bg-deep);
  color: var(--lsg-muted);
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.lsg-seg__opt input:checked + span {
  color: #fff;
  border-color: rgba(210, 187, 255, 0.55);
  background-color: rgba(124, 58, 237, 0.22);
}
.lsg-seg__opt input:focus-visible + span {
  outline: 2px solid var(--lsg-cyan);
  outline-offset: 3px;
}

/* ---------- Results ---------- */

.lsg-stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin: 0;
}
@media (min-width: 480px) {
  .lsg-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1440px) {
  .lsg-stats--grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 2200px) {
  .lsg-stats--grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.lsg-stat {
  min-width: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background-color: var(--lsg-bg-deep);
  border: 1px solid var(--lsg-line);
}
.lsg-stat dt {
  font-family: var(--lsg-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lsg-muted);
}
.lsg-stat dd {
  display: flex;
  flex-direction: column;
  margin: 6px 0 0;
  font-family: var(--lsg-mono);
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.3125rem);
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
  overflow-wrap: anywhere;
}
.lsg-stat__alt {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--lsg-muted);
}
.lsg-stat__alt:empty { display: none; }
.lsg-stat--key {
  border-color: rgba(76, 214, 255, 0.4);
  background-color: rgba(76, 214, 255, 0.06);
}
.lsg-stat--key dd { color: var(--lsg-cyan); }

.lsg-proc {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(210, 187, 255, 0.25);
  background-color: rgba(124, 58, 237, 0.08);
}
.lsg-proc__label {
  font-family: var(--lsg-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lsg-muted);
}
.lsg-proc__name {
  margin-top: 6px;
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
  overflow-wrap: anywhere;
}
.lsg-proc__spec {
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--lsg-text);
  overflow-wrap: anywhere;
}
.lsg-proc__spec:empty { display: none; }
.lsg-proc__none { margin-top: 6px; font-size: 0.875rem; color: #ffc9d3; }

/* ---------- Figures ---------- */

.lsg-calc__visuals {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--lsg-gap);
  margin-top: var(--lsg-gap);
}
@media (min-width: 900px) {
  .lsg-calc__visuals { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
}
.lsg-calc__figure { margin: 0; }
.lsg-calc__figure svg { display: block; width: 100%; height: auto; }
.lsg-calc__figure--wiring,
.lsg-power { margin-top: var(--lsg-gap); }
.lsg-calc__figure--swatch .lsg-swatch {
  max-width: 320px;
  margin-inline: auto;
}

/* Scene (tab 1). touch-action on the svg root: browsers ignore it on inner SVG
   shapes; pan-y keeps vertical page scroll, horizontal drags go to the figure. */
svg.lsg-scene { touch-action: pan-y pinch-zoom; }
.lsg-scene__bg { fill: var(--lsg-bg-deep); }
.lsg-scene__floor { stroke: rgba(219, 226, 253, 0.35); stroke-width: 2; }
.lsg-scene__wall { fill: var(--lsg-cyan); }
.lsg-scene__sight { stroke: rgba(76, 214, 255, 0.55); stroke-width: 1.5; stroke-dasharray: 5 5; }
.lsg-scene__viewer { color: #f1f3ff; }
.lsg-scene__viewer circle { fill: currentColor; }
.lsg-scene__viewer path { fill: none; stroke: currentColor; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.lsg-scene__viewer { cursor: grab; touch-action: pan-y pinch-zoom; outline: none; }
.lsg-scene__hit { fill: transparent; stroke: none; touch-action: pan-y pinch-zoom; }
.lsg-scene__viewer:focus-visible .lsg-scene__hit {
  stroke: var(--lsg-cyan);
  stroke-width: 2;
  stroke-dasharray: 5 4;
  fill: rgba(76, 214, 255, 0.08);
}
.lsg-dragging .lsg-scene__viewer { cursor: grabbing; transition: none !important; }
.lsg-scene__tag {
  fill: #fff;
  font-family: var(--lsg-mono);
  font-size: 15px;
  font-weight: 700;
}
.lsg-scene__zone--close { fill: rgba(255, 92, 120, 0.55); }
.lsg-scene__zone--ok { fill: rgba(255, 196, 77, 0.45); }
.lsg-scene__zone--ideal { fill: rgba(61, 220, 106, 0.7); }
.lsg-scene__tick { stroke: rgba(219, 226, 253, 0.45); stroke-width: 1; }
.lsg-scene__label {
  fill: var(--lsg-muted);
  font-family: var(--lsg-mono);
  font-size: 12px;
}

.lsg-legend { display: inline-flex; flex-wrap: wrap; gap: 6px 14px; }
.lsg-legend__item { display: inline-flex; align-items: center; gap: 6px; }
.lsg-legend__dot { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; }
.lsg-legend__dot--close { background-color: rgba(255, 92, 120, 0.85); }
.lsg-legend__dot--ok { background-color: rgba(255, 196, 77, 0.8); }
.lsg-legend__dot--ideal { background-color: rgba(61, 220, 106, 0.9); }

/* Swatch (tab 1) */
.lsg-swatch__cell { fill: #05080f; }
.lsg-swatch__frame { fill: none; stroke: rgba(210, 187, 255, 0.35); }

/* Wiring (tab 2) */
.lsg-wiring__frame {
  padding: clamp(10px, 1.5vw, 20px);
  border-radius: 12px;
  background-color: var(--lsg-bg-deep);
  border: 1px solid var(--lsg-line);
}
.lsg-wiring { max-height: 78vh; }
.lsg-wiring__cab { stroke-width: 1.5; }
.lsg-wiring__path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.lsg-wiring__label {
  fill: #fff;
  font-family: var(--lsg-mono);
  font-weight: 700;
}
.lsg-wiring:empty { display: none; }
.lsg-ports { display: inline-flex; flex-wrap: wrap; gap: 6px 12px; }
.lsg-ports__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--lsg-mono);
  font-size: 0.8125rem;
  color: var(--lsg-text);
}
.lsg-ports__dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }

/* Power */
.lsg-table-wrap { margin-top: 14px; overflow-x: auto; }
.lsg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.lsg-table th,
.lsg-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--lsg-line);
  text-align: right;
  vertical-align: top;
}
.lsg-table thead th {
  font-family: var(--lsg-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lsg-muted);
}
.lsg-table th[scope="row"],
.lsg-table thead th:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--lsg-text);
}
.lsg-table td {
  font-family: var(--lsg-mono);
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.lsg-power__warning {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background-color: rgba(255, 196, 77, 0.08);
  border: 1px solid rgba(255, 196, 77, 0.4);
  color: #ffe2a8;
  font-size: 0.9375rem;
}
.lsg-power__warning svg { flex: 0 0 auto; margin-top: 2px; }

/* ---------- Note, actions, summary ---------- */

.lsg-calc__footer { margin-top: clamp(28px, 4vw, 48px); }
.lsg-calc__note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 900px;
  padding: 16px 18px;
  border-radius: 12px;
  background-color: var(--lsg-surface);
  border: 1px solid var(--lsg-line);
  font-size: 0.9375rem;
  color: var(--lsg-muted);
}
.lsg-calc__note svg { flex: 0 0 auto; margin-top: 3px; color: var(--lsg-cyan); }
.lsg-calc__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-top: 24px;
}
@media (max-width: 479px) {
  .lsg-calc__actions .lsg-btn { flex: 1 1 100%; }
}
.lsg-calc__status { min-height: 1.6em; margin-top: 12px; font-size: 0.9375rem; color: var(--lsg-cyan); }
.lsg-calc__status [hidden] { display: none; }
.lsg-calc__summary-wrap { margin-top: 12px; max-width: 900px; }
.lsg-calc__summary-wrap[hidden] { display: none; }
.lsg-calc__summary {
  display: block;
  margin-top: 6px;
  font-size: 0.875rem;
  background-color: var(--lsg-bg-deep);
  border: 1px solid var(--lsg-line-strong);
  resize: vertical;
}

/* ---------- Motion (only under html.lsg-motion, set by the script) ---------- */

.lsg-motion .lsg-scene__viewer { transition: transform 0.45s ease; }
.lsg-motion .lsg-calc__panel.lsg-is-entering { animation: lsg-calc-in 0.35s ease both; }
@keyframes lsg-calc-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Edit mode (LDS plugin): nothing moves, every editable text reachable ---------- */

html.lds-selection-active .lsg-calc__panel[hidden],
body.lds-editing .lsg-calc__panel[hidden],
html.pencil-selection-active .lsg-calc__panel[hidden] { display: block; }
html.lds-selection-active .lsg-calc__panel + .lsg-calc__panel,
body.lds-editing .lsg-calc__panel + .lsg-calc__panel,
html.pencil-selection-active .lsg-calc__panel + .lsg-calc__panel { margin-top: clamp(32px, 4vw, 56px); }
html.lds-selection-active .lsg-calc *,
body.lds-editing .lsg-calc *,
html.pencil-selection-active .lsg-calc * {
  animation: none !important;
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .lsg-scene__viewer,
  .lsg-calc__panel { transition: none !important; animation: none !important; }
}
