/* sizes.css — "how big is it, really?"
 *
 * This page behaves like an instrument, not a brochure: one calibration, then
 * one rectangle at a time. So the styling is quiet — a pale stage, a hairline
 * sheet, a dimension label that never moves. Nothing here animates on scroll;
 * the only motion is the sheet resizing while you drag the card.
 */

[hidden] { display: none !important; }

.sz {
  margin: 26px 0 8px;
}

/* ── calibration ─────────────────────────────────────────────────────────── */

.sz-cal {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
  padding: 20px 18px 18px;
  max-width: 34rem;
}
.sz-cal h2 { margin: 0 0 4px; font-size: 1.05rem; letter-spacing: -.01em; }
.sz-cal p { margin: 0 0 16px; font-size: .88rem; line-height: 1.55; color: var(--text-soft); }

.sz-cardwrap {
  display: flex;
  justify-content: center;
  padding: 6px 0 18px;
  /* the card is allowed to be wider than the column: it is a physical object
     being matched, not a layout element */
  overflow-x: auto;
  scrollbar-width: none;
}
.sz-cardwrap::-webkit-scrollbar { display: none; }

.sz-card {
  position: relative;
  height: 202.4px;              /* set in JS; this is the 96 dpi default */
  border: 1.5px dashed var(--pine);
  border-radius: 3.18mm;        /* a card's corner radius, visually */
  background: var(--pine-soft);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--pine-deep);
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  touch-action: none;
  user-select: none;
}

.sz-grip {
  position: absolute;
  top: -1.5px;
  right: -11px;
  width: 22px;
  height: calc(100% + 3px);
  cursor: ew-resize;
  display: grid;
  place-items: center;
}
.sz-grip::before {
  content: "";
  width: 4px;
  height: 42%;
  border-radius: 2px;
  background: var(--pine);
  opacity: .55;
}
.sz-grip:active::before { opacity: 1; }

.sz-fine {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 16px;
}
.sz-fine button {
  font: inherit;
  font-size: 1rem;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
}
.sz-fine button:active { transform: scale(.96); }
.sz-fine span { font-size: .8rem; color: var(--text-mute); }

.sz-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* ── the tool ────────────────────────────────────────────────────────────── */

.sz-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin: 0 0 16px;
}
.sz-fams { display: flex; gap: 6px; flex-wrap: wrap; }

.sz-fam, .sz-chip {
  font: inherit;
  font-size: .84rem;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--text-soft);
  cursor: pointer;
  transition: background-color 150ms, color 150ms, border-color 150ms, transform 120ms cubic-bezier(.2,.8,.2,1);
}
.sz-fam:active, .sz-chip:active { transform: scale(.97); }
.sz-fam[aria-pressed="true"], .sz-chip[aria-pressed="true"] {
  background: var(--pine);
  border-color: var(--pine);
  color: var(--btn-fg);
}

.sz-field { display: grid; gap: 6px; }
.sz-field > span {
  font-size: .74rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.sz-field select {
  font: inherit;
  font-size: 1rem;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--ink);
  min-width: 11rem;
}

/* the stage is the "desk": a plain ground, so the sheet reads as paper */
.sz-stage {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper-2);
  padding: 18px;
  /* 🔴 a FIXED height, not min-height + max-height. The old pair let the
     stage size itself from an empty sheet on the first draw, so every size
     was measured against ~264 px of room and drawn at 40% even when the
     screen had twice that. A fixed box is measured once and stays honest. */
  height: min(70vh, 620px);
  display: grid;
  place-items: center;
  overflow: auto;
}

.sz-sheet {
  position: relative;
  background: #FFFDF9;
  border: 1px solid #D8CDB9;
  box-shadow: 0 1px 2px rgba(30, 24, 16, .12), 0 14px 30px -22px rgba(30, 24, 16, .5);
  display: grid;
  place-items: end center;
  flex: 0 0 auto;
}
/* the print's own edge, so an unprinted sheet is still legible */
.sz-sheet::after {
  content: "";
  position: absolute;
  inset: 6mm;
  border: 1px dashed rgba(36, 31, 24, .12);
  pointer-events: none;
}

.sz-dim {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -26px;
  text-align: center;
  font-size: .78rem;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}

.sz-truth {
  margin: 34px 0 0;
  font-size: .9rem;
  line-height: 1.6;
  color: var(--text-soft);
}
.sz-truth b { color: var(--ink); font-weight: 500; }
.sz-truth .sz-warn { color: var(--danger); }

.sz-foot {
  margin-top: 8px;
  font-size: .8rem;
  color: var(--text-faint);
  line-height: 1.6;
}

/* a static list that works with JavaScript off */
.sz-table { width: 100%; border-collapse: collapse; margin: 10px 0 0; font-size: .88rem; }
.sz-table th, .sz-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--rule-soft);
}
.sz-table th { color: var(--text-mute); font-weight: 500; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.sz-table td:last-child { color: var(--text-soft); }

@media (max-width: 520px) {
  .sz-cal { padding: 16px 14px; }
  .sz-stage { padding: 12px; height: min(58vh, 520px); }
  .sz-field select { min-width: 100%; }
}

/* ── modes: on the screen / on your wall ─────────────────────────────────── */

.sz-modes {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 0 0 20px;
}
.sz-mode {
  font: inherit;
  font-size: .86rem;
  padding: 8px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background-color 160ms, color 160ms;
}
.sz-mode[aria-selected="true"] {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 1px 2px var(--card-shadow);
}

/* ── the wall ────────────────────────────────────────────────────────────── */

.wl-step {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
  padding: 20px 18px;
  max-width: 40rem;
}
.wl-step h2 { margin: 0 0 4px; font-size: 1.05rem; letter-spacing: -.01em; }
.wl-step p { margin: 0 0 14px; font-size: .88rem; line-height: 1.55; color: var(--text-soft); }
.wl-step p:last-child { margin-bottom: 0; }

.wl-pickrow { display: flex; gap: 10px; flex-wrap: wrap; }

/* the photo and everything drawn on it share one positioned box, so the
   handles line up with the picture and not with the card around it */
.wl-frame {
  position: relative;
  width: 100%;
  margin: 0 0 14px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--paper-2);
  touch-action: none;
}
.wl-frame img { display: block; width: 100%; height: auto; }

.wl-handle {
  position: absolute;
  left: 0;
  right: 0;
  height: 34px;
  margin-top: -17px;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
.wl-handle::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #FFFFFF;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .45);
}
.wl-handle::after {
  content: "";
  width: 34px;
  height: 8px;
  border-radius: 4px;
  background: #FFFFFF;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .45);
  position: relative;
}
.wl-handle:focus-visible { outline: 2px solid var(--pine); outline-offset: -2px; }

.wl-line {
  position: absolute;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: rgba(255, 255, 255, .75);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .3);
  pointer-events: none;
}

.wl-refrow {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}
.wl-refrow .sz-field { flex: 0 0 9rem; }
.wl-refrow input[type="number"] {
  font: inherit;
  font-size: 1rem;
  padding: 10px 12px;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
}

.wl-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
  margin: 0 0 12px;
}

/* the print itself: a white sheet on the photo, with its own edge */
.wl-print {
  position: absolute;
  background: #FFFDF9;
  border: 1px solid rgba(30, 24, 16, .55);
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .55);
  cursor: grab;
  display: grid;
  place-items: end center;
  padding-bottom: 2px;
  touch-action: none;
}
.wl-print:active { cursor: grabbing; }
.wl-print::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed rgba(36, 31, 24, .18);
  pointer-events: none;
}
.wl-print span {
  position: relative;
  font-size: .62rem;
  color: #5C5246;
  background: rgba(255, 253, 249, .9);
  padding: 1px 4px;
  border-radius: 3px;
  margin-bottom: 3px;
  white-space: nowrap;
  pointer-events: none;
}

@media (max-width: 520px) {
  .wl-step { padding: 16px 14px; }
  .wl-refrow .sz-field { flex: 1 1 100%; }
}
