/* Better One — three product chapters: detail (loupe), text (type study), control (layout board) */

.chapter { padding: clamp(5rem, 11vw, 11rem) var(--gutter); overflow: clip; }
.chapter__head { display: grid; gap: 1.75rem; margin-bottom: clamp(3rem, 6vw, 6rem); }
.chapter__head .display { max-width: 11.5ch; }
.chapter--text .chapter__head { justify-items: end; text-align: right; }

.chips, .board__presets { display: flex; flex-wrap: wrap; gap: .5rem; }
.chips button, .board__presets button {
  padding: .8em 1em; font: 500 .66rem/1 var(--f-mono); letter-spacing: .11em; text-transform: uppercase;
  box-shadow: inset 0 0 0 1px var(--line); transition: background-color .3s var(--ease), color .3s var(--ease);
}
.chips button:hover, .board__presets button:hover, .board__presets button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

/* ---------- 01 · detail ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: end; gap: clamp(2rem, 5vw, 5rem); }
.loupe { aspect-ratio: 4 / 3; cursor: crosshair; touch-action: pan-y; }
.loupe__lens {
  --size: clamp(9rem, 19vw, 16.5rem);
  position: absolute; z-index: 2; left: calc(var(--lx, .6) * 100%); top: calc(var(--ly, .52) * 100%);
  width: var(--size); height: var(--size); translate: -50% -50%; border-radius: 50%; pointer-events: none;
  background: var(--ink-2) url("../art/detail.svg") no-repeat;
  box-shadow: 0 0 0 2px var(--bone), 0 0 0 3px rgba(11, 10, 9, .6), 0 1.6rem 3.5rem rgba(0, 0, 0, .6);
}
.detail__notes { display: grid; gap: clamp(1.5rem, 3vw, 2.5rem); }
.notes { border-top: 1px solid var(--line); }
.notes > div { display: grid; grid-template-columns: 6rem minmax(0, 1fr); align-items: baseline; gap: 1rem; padding-block: 1rem; border-bottom: 1px solid var(--line); }
.notes dt { font: 500 .68rem/1.6 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.notes dd { font: 400 clamp(1.3rem, 1.9vw, 1.8rem)/1.12 var(--f-serif); letter-spacing: -.01em; }

/* ---------- 02 · text ---------- */
.sign { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); align-items: end; gap: clamp(2rem, 5vw, 5rem); }
.sign__side { display: grid; gap: clamp(1.5rem, 3vw, 2.5rem); }
.sign__form { display: grid; gap: .9rem; }
.sign__form label { font: 500 .68rem/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.sign__form input {
  width: 100%; padding: .3rem 0 .6rem; background: none; border: 0; border-bottom: 1px solid var(--fg);
  font: 400 clamp(1.9rem, 3.2vw, 3.1rem)/1.1 var(--f-serif); letter-spacing: -.012em;
}
.sign__form input:focus-visible { outline: 0; border-bottom-color: var(--accent); box-shadow: 0 2px 0 var(--accent); }

.sign__plate { aspect-ratio: 5 / 4; container-type: inline-size; }
.sign__scene { position: absolute; inset: 0; overflow: hidden; perspective: 900px; perspective: 127cqw; perspective-origin: 28% 46%; background: #a86f43; }
.sign__wall {
  position: absolute; inset: -70% -150% -70% -4%; transform-origin: 0 50%; transform: rotateY(32deg);
  display: grid; align-content: center; padding: 0 0 3% 11%;
  background:
    radial-gradient(50% 39% at 8% 42%, rgba(255, 238, 205, .6), rgba(255, 238, 205, 0) 62%),
    linear-gradient(90deg, #e6bd8e, #d09a66 52%, #a56c41);
}
.sign__text {
  width: 60%; display: grid; gap: .05em; color: #1c120c; mix-blend-mode: multiply; opacity: .94;
  font: 900 4rem/.84 var(--f-wide); font-stretch: 66%; letter-spacing: -.012em; text-transform: uppercase;
}
.sign__text span { display: block; width: max-content; white-space: nowrap; }
.sign__text span:nth-child(2) { color: #9c1f0b; }
.sign__light {
  position: absolute; inset: -10%; mix-blend-mode: multiply; filter: blur(3px);
  background: repeating-linear-gradient(118deg, rgba(84, 44, 22, .5) 0 5.5%, rgba(84, 44, 22, 0) 5.5% 9.5%);
  -webkit-mask-image: linear-gradient(118deg, transparent 34%, #000 44%, #000 63%, transparent 74%);
          mask-image: linear-gradient(118deg, transparent 34%, #000 44%, #000 63%, transparent 74%);
}
.sign__ground { position: absolute; inset: 66% 0 0; background: linear-gradient(180deg, #3b2416, #170e08); clip-path: polygon(0 66%, 100% 6%, 100% 100%, 0 100%); }
.sign__post { position: absolute; left: 61%; top: -4%; bottom: 7%; width: max(7px, 1.2%); background: linear-gradient(90deg, #0d0806, #33211690 55%, #0d0806), #1a100a; box-shadow: 1.1rem .4rem 1.4rem rgba(40, 16, 6, .4); }
.sign__post::after { content: ""; position: absolute; left: -90%; right: -90%; bottom: -1%; height: 3.5%; background: #0d0806; }
.sign__awning {
  position: absolute; left: -3%; top: -2%; width: 47%; height: 15%;
  background: repeating-linear-gradient(90deg, #a3200c 0 8.5%, #ede6d7 8.5% 17%);
  clip-path: polygon(0 0, 100% 0, 92% 100%, 0 78%); filter: drop-shadow(0 1.2rem 1rem rgba(40, 16, 6, .5));
}

/* ---------- 03 · control ---------- */
.board { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: end; gap: clamp(2rem, 5vw, 5rem); }
.board__stage {
  aspect-ratio: 3 / 2; user-select: none; -webkit-user-select: none;
  background:
    radial-gradient(55% 34% at 30% 68%, rgba(237, 230, 215, .1), transparent),
    linear-gradient(180deg, #2c2722 0, #1f1b18 66%, #0e0c0b 66%, #191613 100%);
}
.board__grid {
  position: absolute; inset: 0; z-index: 200; pointer-events: none;
  background-image: linear-gradient(to right, rgba(237, 230, 215, .26) 1px, transparent 1px), linear-gradient(to bottom, rgba(237, 230, 215, .26) 1px, transparent 1px);
  background-size: 33.3334% 33.3334%;
}
.obj {
  position: absolute; left: calc(var(--x, 50) * 1%); top: calc(var(--y, 80) * 1%); z-index: var(--z, 1);
  width: calc(var(--w) * 1%); translate: -50% -100%; transform: scale(var(--s, 1)); transform-origin: 50% 100%;
  cursor: grab; touch-action: none;
}
.obj:active { cursor: grabbing; }
.obj::after { content: ""; position: absolute; z-index: -1; left: -6%; right: -55%; bottom: -6%; height: 13%; background: radial-gradient(closest-side, rgba(0, 0, 0, .7), rgba(0, 0, 0, 0)); }
.obj.is-active { outline: 1px dashed rgba(237, 230, 215, .85); outline-offset: 7px; }
.obj:focus-visible { outline: 2px solid var(--verm); outline-offset: 7px; }
.board__stage.is-animating .obj { transition: left .9s var(--ease), top .9s var(--ease), transform .9s var(--ease); }
.obj__shape { position: relative; display: block; width: 100%; }
.board__stage .plate__tag { z-index: 201; }

.obj--arch { --w: 17; }
.obj--arch .obj__shape { aspect-ratio: 1 / 1.7; border-radius: 999px 999px 0 0; background: linear-gradient(100deg, #f6f0e2, #ddd4c0 46%, #9a907b); }
.obj--arch .obj__shape::after { content: ""; position: absolute; inset: 24% 24% 0; border-radius: inherit; background: linear-gradient(100deg, #554e42, #24201b); }
.obj--block { --w: 15; }
.obj--block .obj__shape { aspect-ratio: 1 / .8; margin-top: 16%; background: linear-gradient(100deg, #ff7147, #ff4b1f 42%, #9c1f0b); }
.obj--block .obj__shape::before { content: ""; position: absolute; inset: auto 0 100%; height: 20%; background: #ff9470; transform: skewX(-42deg); transform-origin: 0 100%; }
.obj--column { --w: 6.5; }
.obj--column .obj__shape { aspect-ratio: 1 / 4.4; border-radius: 50% 50% 0 0 / 5% 5% 0 0; background: linear-gradient(90deg, #e6b95e, #c9963b 38%, #74531a); }
.obj--column .obj__shape::before { content: ""; position: absolute; inset: 0 0 auto; height: 9%; border-radius: 50%; background: #f0cd84; }

.board__panel { display: grid; gap: clamp(1.25rem, 2.4vw, 2rem); }
.readout { width: 100%; border-collapse: collapse; font: 400 .78rem/1 var(--f-mono); font-variant-numeric: tabular-nums; }
.readout th, .readout td { padding: .8em 0; text-align: right; font-weight: 400; border-bottom: 1px solid var(--line); transition: color .3s; }
.readout th:first-child { text-align: left; }
.readout thead th { font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.readout tbody th { letter-spacing: .1em; text-transform: uppercase; }
.readout tr.is-active > * { color: var(--accent); }
.board__scale { display: inline-flex; align-items: center; gap: 1rem; font: 500 .68rem/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; }
.board__scale b { font-weight: 500; color: var(--accent); }
.board__scale button { width: 2.75rem; height: 2.75rem; font: 400 1.2rem/1 var(--f-mono); box-shadow: inset 0 0 0 1px var(--line); transition: background-color .3s, color .3s; }
.board__scale button:hover { background: var(--fg); color: var(--bg); }

@media (max-width: 800px) {
  .detail, .sign, .board { grid-template-columns: minmax(0, 1fr); }
  .chapter--text .chapter__head { justify-items: start; text-align: left; }
  .sign__plate { order: -1; }
  .board__stage { aspect-ratio: 4 / 3; }
}
