/* Wallpaper calculator. Scoped to .calc so nothing leaks into the shared
   stylesheet. Uses the site tokens from styles.css: square panels on ink,
   pill controls, signal red for the one number that matters. */
.calc {
  --c-surface: var(--ink-2);
  --c-sunk: var(--ink-3);
  --c-line-hi: rgba(239,237,230,0.28);
  padding-top: 0;
}
.calc .num { font-variant-numeric: tabular-nums; }

/* disclaimer: visible before anyone types a number */
.calc-disclaimer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
  padding: 1rem 1.15rem;
  border: 1px solid var(--signal-a45);
  background: var(--signal-a08);
  color: var(--mute);
  font-size: 0.9rem;
  line-height: 1.55;
  max-width: 78ch;
  margin-bottom: clamp(1.5rem, 3vh, 2.25rem);
}
.calc-disclaimer strong { color: var(--bone); font-weight: 600; }
.calc-disclaimer .bang {
  width: 1.6rem; height: 1.6rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--signal);
  color: var(--bone);
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1;
}

.calc-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.calc-cols > * { min-width: 0; background: var(--ink); }
@media (min-width: 980px) {
  .calc-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 27rem); align-items: stretch; }
}

.calc-panel { padding: clamp(1.25rem, 2.6vw, 2rem); }
.calc-panel + .calc-panel { border-top: 1px solid var(--line); }
.calc-panel .label { display: block; color: var(--signal-hi); margin-bottom: 0.4rem; }
.calc-panel h2 { color: var(--bone); }
.calc-hint { color: var(--mute-2); font-size: 0.84rem; line-height: 1.5; margin-top: 0.45rem; max-width: 60ch; }

.calc-grid { display: grid; gap: 1rem 1.25rem; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); margin-top: 1.25rem; }
.calc-grid > * { min-width: 0; }

/* inputs: same underline field language as the contact form */
.calc .f { display: grid; gap: 0.35rem; min-width: 0; }
.calc .f > label,
.calc .f-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute-2);
}
.calc .in { position: relative; display: grid; }
.calc input[type=number],
.calc select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 0.55rem 2.1rem 0.55rem 0;
  background: transparent;
  color: var(--bone);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  font-size: 1.02rem;
  font-variant-numeric: tabular-nums;
  transition: border-color var(--t1) var(--e);
  -moz-appearance: textfield;
}
.calc select { padding-right: 0; cursor: pointer; }
.calc select option { background: var(--ink-2); color: var(--bone); }
.calc input::-webkit-outer-spin-button,
.calc input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.calc input::placeholder { color: var(--mute-2); }
.calc input:hover, .calc select:hover { border-color: var(--c-line-hi); }
.calc input:focus, .calc select:focus { outline: none; }
.calc .in::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 1.5px;
  background: var(--signal-hi);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t2) var(--e);
  pointer-events: none;
}
.calc .in:focus-within::after { transform: scaleX(1); }
.calc .u {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  font-size: 0.78rem; color: var(--mute-2); pointer-events: none;
}

/* pill segmented control and chips */
.seg { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; margin-top: 0.35rem; }
.seg button {
  flex: 1 1 0; min-width: 0; min-height: 40px;
  border-radius: 999px;
  color: var(--mute);
  font-size: 0.84rem; font-weight: 600;
  transition: background-color var(--t1) var(--e), color var(--t1) var(--e);
}
.seg button:hover { color: var(--bone); }
.seg button[aria-pressed=true] { background: var(--bone); color: var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.85rem; }
.chip {
  min-height: 36px;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--mute);
  font-size: 0.8rem; font-weight: 600;
  transition: border-color var(--t1) var(--e), color var(--t1) var(--e), background-color var(--t1) var(--e);
}
.chip:hover { border-color: var(--bone); color: var(--bone); }
.chip.is-on { background: var(--bone); border-color: var(--bone); color: var(--ink); }

/* wall rows */
.wall {
  display: grid;
  grid-template-columns: 4.5rem minmax(0,1fr) minmax(0,1fr) auto;
  gap: 1rem;
  align-items: end;
  padding-block: 0.9rem;
  border-bottom: 1px solid var(--line);
}
.wall .n { font-family: "Syne", sans-serif; font-weight: 700; color: var(--bone); padding-bottom: 0.7rem; font-size: 0.95rem; }
.dim { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.kill {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--mute);
  font-size: 1.15rem; line-height: 1;
  transition: border-color var(--t1) var(--e), color var(--t1) var(--e);
}
.kill:hover { border-color: var(--signal-hi); color: var(--signal-hi); }
@media (max-width: 600px) {
  .wall { grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; row-gap: 0.4rem; }
  .wall .n { grid-column: 1 / -1; padding: 0; }
}
.calc-add { margin-top: 1.25rem; }

/* results */
.calc-res { position: relative; }
@media (min-width: 980px) {
  .calc-res-in { position: sticky; top: calc(var(--nav-h) + var(--nav-gap) + 1rem); }
}
.calc-head {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  margin-top: 1.1rem;
}
.calc-head > div { background: var(--ink-2); padding: 1rem 1.05rem; }
.calc-head .big {
  display: block;
  font-family: "Syne", sans-serif; font-weight: 800;
  font-size: clamp(2rem, 4vw, 2.6rem);
  letter-spacing: -0.04em; line-height: 1.05;
  color: var(--bone);
  font-variant-numeric: tabular-nums;
}
.calc-head .cap { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--mute-2); }
.calc-head .order { background: var(--signal); }
.calc-head .order .cap { color: rgba(239,237,230,0.85); }

/* gold, the site's secondary accent: answers the "add 10-15%" habit */
.calc-included {
  margin-top: 0.75rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(216,184,74,0.55);
  background: rgba(216,184,74,0.1);
  color: #e9d68f;
  font-size: 0.84rem; line-height: 1.5;
}
.calc-included strong { color: #f3e4a6; font-weight: 700; }

.calc-rows { margin: 1.1rem 0 0; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 0.55rem 1rem; font-size: 0.9rem; }
.calc-rows dt { color: var(--mute); min-width: 0; }
.calc-rows dd { margin: 0; text-align: right; color: var(--bone); font-weight: 600; font-variant-numeric: tabular-nums; }

.check { display: flex; gap: 0.65rem; align-items: center; margin-top: 1.1rem; min-height: 44px; cursor: pointer; font-size: 0.9rem; color: var(--bone); }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--signal); flex: 0 0 auto; }

.cnote { padding: 0.65rem 0.8rem; font-size: 0.84rem; line-height: 1.5; margin-top: 0.75rem; border-left: 2px solid; background: var(--ink-2); color: var(--mute); }
.cnote b { color: var(--bone); font-weight: 600; }
.cnote.warn { border-color: #d8b84a; }
.cnote.bad { border-color: var(--signal-hi); }
.cnote.ok { border-color: var(--bone); }

.diag { margin-top: 1.25rem; display: grid; gap: 0.5rem; }
.diag .row { display: grid; grid-template-columns: 3.6rem minmax(0,1fr) 2.2rem; gap: 0.6rem; align-items: center; }
.diag .lbl, .diag .cnt { font-size: 0.74rem; color: var(--mute-2); font-variant-numeric: tabular-nums; }
.diag .cnt { text-align: right; }
.bar { display: flex; gap: 2px; height: 24px; min-width: 0; }
.bar span { background: rgba(239,237,230,0.16); border: 1px solid rgba(239,237,230,0.4); min-width: 2px; }
.bar span.part { background: repeating-linear-gradient(45deg, transparent, transparent 3px, var(--signal-hi) 3px, var(--signal-hi) 4px); border-color: var(--signal-hi); }
.diag-key { font-size: 0.74rem; color: var(--mute-2); margin-top: 0.15rem; }

.calc-res-note { margin-top: 1.1rem; font-size: 0.8rem; color: var(--mute-2); line-height: 1.5; }
.calc-actions { display: grid; gap: 0.6rem; margin-top: 1.25rem; }
.calc-actions .btn { justify-content: space-between; width: 100%; }

/* worksheet: the same math, step by step */
.ws-pick { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 1rem; }
.ws { font-size: 0.92rem; line-height: 2; color: var(--mute); margin-top: 0.5rem; overflow-x: auto; }
.ws .ltr { display: block; margin-top: 1.25rem; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--bone); }
.ws .ltr:first-child { margin-top: 0.5rem; }
.ws .ru { color: var(--signal-hi); font-weight: 700; font-size: 0.74rem; letter-spacing: 0.08em; }
.ws .br { display: block; margin-top: 0.5rem; padding-left: 1rem; border-left: 2px solid var(--line); }
.ws .br.on { border-left-color: var(--signal-hi); }
.ws .br.off { opacity: 0.42; }
.ws [hidden] { display: none !important; }
.ws hr { border: 0; border-top: 1px solid var(--line); margin: 1.4rem 0 0; }
.ws b { color: var(--bone); }
u.v {
  display: inline-block; min-width: 3.2rem; padding: 0 0.3rem; text-align: center;
  text-decoration: none; border-bottom: 1.5px solid var(--line);
  color: var(--bone); font-weight: 700; font-variant-numeric: tabular-nums;
}
u.v.w { min-width: 5.2rem; }
u.v.empty { color: var(--mute-2); font-weight: 400; }
/* collapsible boxes: summary carries the title plus a one-line recap, so a
   closed box still tells you what's inside it */
.calc-box > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 44px;
}
.calc-box > summary::-webkit-details-marker { display: none; }
.calc-box > summary:focus-visible { outline-offset: 6px; }
.calc-box .box-t { display: grid; min-width: 0; }
.calc-box .box-t .label { margin-bottom: 0.4rem; }
.calc-box .box-sm {
  margin-top: 0.4rem;
  font-size: 0.84rem; color: var(--mute);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.calc-box .box-sm b { color: var(--bone); font-weight: 600; }
.calc-box[open] .box-sm { display: none; }
.calc-box > summary .pm {
  width: 36px; height: 36px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  color: var(--bone); font-weight: 600; font-size: 1.05rem;
  transition: border-color var(--t1) var(--e), transform var(--t2) var(--e), background-color var(--t1) var(--e);
}
.calc-box > summary:hover .pm { border-color: var(--bone); }
.calc-box[open] > summary .pm { transform: rotate(45deg); }
.calc-box:not([open]) > summary .pm { background: var(--bone); border-color: var(--bone); color: var(--ink); }
.calc-box .box-body { margin-top: 0.35rem; }

/* below desktop: inputs split into separate boxes with breathing room */
@media (max-width: 979px) {
  .calc-cols { gap: 0.85rem; background: none; border: 0; }
  .calc-cols > * { background: none; }
  .calc-inputs { display: grid; gap: 0.85rem; }
  .calc-panel { border: 1px solid var(--line); background: var(--ink); }
  .calc-panel + .calc-panel { border-top: 1px solid var(--line); }
  .calc-box:not([open]) { padding-block: 1.05rem; }
}

.ws-form { font-size: 0.82rem; color: var(--mute-2); margin-top: 1.1rem; padding-top: 0.9rem; border-top: 1px solid var(--line); }

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