:root {
  --paper: #f3eee5;
  --paper-2: #ebe4d8;
  --ink: #1d1b18;
  --muted: #675f55;
  --line: #d6ccbc;
  --accent: #8e3f22;
  --on-accent: #fbf7f0;
  --faint: #a79e91;
  --serif: "Zodiak", Georgia, "Times New Roman", serif;
  --sans: "Switzer", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --gutter: 20px;
  --top-h: 52px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.serif { font-family: var(--serif); }

/* ---------- header ---------- */
.top {
  display: flex; justify-content: space-between; align-items: center;
  height: var(--top-h); padding: 0 var(--gutter);
}
.brand { font: 500 19px/1 var(--serif); text-decoration: none; letter-spacing: -0.01em; }
.top-link { font-size: 14px; color: var(--muted); text-decoration: none; padding: 12px 0; }
.top-link:hover { color: var(--ink); }

/* ---------- the app: one screen, no page scroll inside it ---------- */
.app {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(200px, 128vw) auto;
  height: calc(100svh - var(--top-h));
  min-height: 600px;
  overflow: hidden;
}

/* the photograph */
.stage {
  position: relative; min-height: 0;
  overflow: hidden; background: var(--paper-2);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.photo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 60%;
  opacity: 0; transition: opacity .55s var(--ease);
}
.stage[data-shape="straight"] .photo { object-position: 40% 60%; }
.stage[data-shape="l"] .photo { object-position: 42% 60%; }
.photo.on { opacity: 1; }
.photo.quick { transition-duration: .15s; }

/* the control panel */
.panel { display: flex; flex-direction: column; background: var(--paper); }
.panel-head { display: none; }

/* step rail (phone): the running recipe of the kitchen */
.rail {
  position: relative; display: grid; grid-template-columns: repeat(5, 1fr);
  border-bottom: 1px solid var(--line); padding: 0 calc(var(--gutter) - 6px);
}
.rail button {
  display: grid; justify-items: center; gap: 1px;
  padding: 9px 2px 10px; min-height: 52px; min-width: 0;
}
.rail-k { font-size: 12px; line-height: 1.2; color: var(--muted); }
.rail-v {
  font-size: 14px; line-height: 1.3; font-weight: 500; color: var(--faint);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color .2s;
}
.rail [aria-selected="true"] .rail-v, .rail button.done .rail-v { color: var(--ink); }
.rail-mark {
  position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--ink);
  transition: transform .34s var(--ease), width .34s var(--ease);
}

/* steps */
.steps { position: relative; flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; padding: 14px var(--gutter) 4px; }
.step { display: none; min-width: 0; }
.step-inner { min-height: calc(22.3vw + 70px); }
.step.is-active { display: block; }
.step.enter-r { animation: in-r .28s var(--ease); }
.step.enter-l { animation: in-l .28s var(--ease); }
@keyframes in-r { from { transform: translateX(28px); opacity: 0; } }
@keyframes in-l { from { transform: translateX(-28px); opacity: 0; } }
.step-head { display: none; }
.note { margin: 10px 0 0; font-size: 14px; line-height: 1.45; color: var(--muted); min-height: 41px; }

/* choice tiles with one sliding frame */
.choices { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.marker {
  position: absolute; left: 0; top: 0; pointer-events: none;
  border: 1.5px solid var(--ink);
  transition: transform .34s var(--ease), width .34s var(--ease), height .34s var(--ease);
}
.tiles button {
  display: grid; gap: 6px; align-content: start; min-width: 0;
  padding: 5px; font-size: 13px; line-height: 1.25; color: var(--muted); text-align: left;
  transition: color .2s;
}
.tiles [aria-checked="true"] { color: var(--ink); }
.tiles button:active img, .tiles button:active svg { transform: scale(.97); }
.tiles img, .tiles svg { transition: transform .15s; }
.thumbs img, .slabs img {
  width: 100%; height: auto; object-fit: cover; background: var(--paper-2);
  box-shadow: 0 1px 0 rgba(0,0,0,.05), 0 2px 6px -3px rgba(40,30,20,.25);
}
.thumbs img { aspect-ratio: 3 / 2; }
.slabs img { aspect-ratio: 2.3 / 1; }
.thumbs .serif { font-size: 17px; line-height: 1.15; letter-spacing: -0.01em; }
.shapes button { justify-items: center; text-align: center; padding: 10px 2px 8px; }
.shapes svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.shapes [aria-checked="true"] svg { fill: var(--paper-2); }

/* size ruler */
.size-read { margin: 0 0 4px; font: 400 22px/1.2 var(--serif); }
.size-read span:first-child { font-variant-numeric: tabular-nums; }
.size-typ { font: 400 13px/1 var(--sans); color: var(--muted); margin-left: 6px; }
.ruler-wrap { position: relative; margin: 0 calc(var(--gutter) * -1); }
.ruler {
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
  scroll-snap-type: x mandatory; cursor: grab;
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}
.ruler::-webkit-scrollbar { display: none; }
.ruler-track { display: flex; width: max-content; padding: 0 calc(50% - 14px); height: 50px; }
.tick { position: relative; width: 28px; flex: none; scroll-snap-align: center; }
.tick::before { content: ""; position: absolute; left: 50%; top: 4px; width: 1px; height: 12px; background: var(--ink); opacity: .4; }
.tick.major::before { height: 20px; top: 0; opacity: .75; }
.tick.major::after {
  content: attr(data-n); position: absolute; left: 50%; top: 26px; transform: translateX(-50%);
  font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.needle { position: absolute; left: 50%; top: -4px; width: 2px; height: 28px; margin-left: -1px; background: var(--accent); pointer-events: none; }
.ruler:focus-visible { outline-offset: -2px; }
.text-link {
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
  color: var(--ink); padding: 10px 0; margin: -10px 0;
}

/* bottom bar: price and next */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.price { display: grid; text-align: left; min-height: 44px; gap: 1px; white-space: nowrap; }
.price-v { display: block; overflow: hidden; font: 400 24px/1.15 var(--serif); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.price-v span { display: inline-block; }
.price-v span.tick-in { animation: price-in .32s var(--ease); }
@keyframes price-in { from { transform: translateY(70%); opacity: 0; } }
.price-k { font-size: 12px; color: var(--muted); }
.price-k u { text-underline-offset: 2px; }
.next {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 48px; padding: 0 16px 0 20px;
  background: var(--ink); color: var(--paper); font-weight: 500; font-size: 15px; white-space: nowrap;
  transition: background .2s;
}
.next svg, .back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.next:hover { background: #34302b; }
.next:active { transform: translateY(1px); }

/* ---------- review and send (sheet over the room on phone) ---------- */
.review {
  position: absolute; z-index: 10; inset: 0;
  background: var(--paper);
  box-shadow: 0 -14px 34px -22px rgba(30,20,10,.55);
  transform: translateY(100%); transition: transform .42s var(--ease);
}
.review.open { transform: none; }
.review-scroll {
  height: 100%; overflow-y: auto; overscroll-behavior: contain;
  padding: 0 var(--gutter) calc(28px + env(safe-area-inset-bottom));
}
.back-row { position: sticky; top: 0; z-index: 1; margin: 0 calc(var(--gutter) * -1); padding: 4px var(--gutter); background: var(--paper); }
.review-photo { width: calc(100% + var(--gutter) * 2); max-width: none; margin: 0 calc(var(--gutter) * -1) 18px; aspect-ratio: 3 / 2; height: auto; object-fit: cover; background: var(--paper-2); }
.back {
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px;
  margin-left: -6px; padding-right: 10px; font-size: 15px; color: var(--muted);
}
.back:hover { color: var(--ink); }
.review-title { font: 400 30px/1.1 var(--serif); letter-spacing: -0.015em; margin: 2px 0 14px; outline: 0; }

.spec { border-top: 1px solid var(--line); }
.spec-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px; width: 100%;
  min-height: 46px; padding: 12px 0; border-bottom: 1px solid var(--line); text-align: left;
}
.spec-k { color: var(--muted); font-size: 15px; }
.spec-v { font-size: 15px; font-weight: 500; text-align: right; }
.spec-row:hover .spec-v { text-decoration: underline; text-underline-offset: 3px; }

.total { padding: 22px 0 6px; }
.total-v { font: 400 40px/1.05 var(--serif); letter-spacing: -0.02em; margin: 0 0 8px; font-variant-numeric: tabular-nums; }
.total-k { margin: 0; font-size: 14px; color: var(--muted); max-width: 40ch; }
.total-k .text-link { font-size: 14px; }

.send-form { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--ink); }
.send-title { font: 400 24px/1.15 var(--serif); letter-spacing: -0.01em; margin: 0 0 4px; }
.send-sub { margin: 0 0 16px; font-size: 15px; color: var(--muted); }

/* the three lines: a ruled card, not boxes */
.fields { border-top: 1px solid var(--line); }
.field {
  display: flex; align-items: center; gap: 12px; min-height: 56px;
  border-bottom: 1px solid var(--line); position: relative; cursor: text;
}
.field::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1.5px; background: var(--ink);
  transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease);
}
.field:focus-within::after { transform: scaleX(1); }
.field.missing::after { transform: scaleX(1); background: var(--accent); }
.field-k { flex: 0 0 64px; font-size: 15px; color: var(--muted); }
.field input {
  flex: 1; min-width: 0; height: 54px; padding: 0;
  font: 400 18px/1 var(--sans); color: var(--ink); background: transparent;
  border: 0; border-radius: 0; outline: 0; -webkit-appearance: none; appearance: none;
}
.areas {
  display: none; gap: 18px; overflow-x: auto; scrollbar-width: none; white-space: nowrap;
  padding: 10px 0 10px 76px; border-bottom: 1px solid var(--line);
  mask-image: linear-gradient(90deg, #000 85%, transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
}
.areas::-webkit-scrollbar { display: none; }
.areas.show { display: flex; }
.areas button { font-size: 14px; color: var(--muted); min-height: 32px; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.areas button:hover { color: var(--ink); }
.send-error { min-height: 22px; margin: 8px 0 0; font-size: 14px; color: var(--accent); }

.msg { margin: 6px 0 18px; padding: 14px 16px 16px; background: var(--paper-2); }
.msg-k { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.msg-v { margin: 0; font-size: 15px; line-height: 1.5; white-space: pre-line; }
.msg-v .blank { color: var(--faint); }

.send {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 56px;
  background: var(--accent); color: var(--on-accent);
  font: 500 17px/1 var(--sans); transition: background .2s;
}
.send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.send svg .fill { fill: currentColor; stroke: none; }
.send:hover { background: #7a341b; }
.send:active { transform: translateY(1px); }
.send-foot { margin: 12px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- studio ---------- */
.studio { padding: 56px var(--gutter) 24px; border-top: 1px solid var(--line); max-width: 1200px; }
.studio h2 { font: 400 28px/1.15 var(--serif); margin: 0 0 12px; letter-spacing: -0.01em; }
.studio > p { max-width: 58ch; margin: 0 0 28px; }
.work { display: grid; gap: 10px; }
.work img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: var(--paper-2); }
.contact { margin-top: 44px; }
.contact p { margin: 0 0 6px; }
.foot { padding: 24px var(--gutter) 40px; font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 32px; }
.foot p { margin: 0 0 6px; }

/* ---------- breakdown sheet ---------- */
.sheet {
  position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: 100%; max-height: 82svh;
  padding: 0; border: 0; background: var(--paper); color: var(--ink);
  transform: translateY(100%); transition: transform .3s var(--ease);
  box-shadow: 0 -10px 30px -18px rgba(30,20,10,.4);
}
.sheet.open { transform: none; }
.sheet::backdrop { background: rgba(29,27,24,.35); }
.sheet-body { padding: 26px var(--gutter) calc(20px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; overflow: auto; }
.sheet h2 { font: 400 24px/1.2 var(--serif); margin: 0 0 14px; }
.sum { list-style: none; margin: 0; padding: 0; }
.sum li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.sum-total { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 0 18px; font-size: 15px; }
.sum-total span { font: 400 26px/1 var(--serif); }
.incl { display: grid; gap: 14px; margin-bottom: 14px; }
.incl h3 { font-size: 14px; font-weight: 600; margin: 0 0 2px; }
.incl p { margin: 0; font-size: 15px; }
.quiet { color: var(--muted); font-size: 14px; }
.sheet-close { min-height: 48px; width: 100%; border: 1.5px solid var(--ink); margin-top: 8px; font-weight: 500; }

/* ---------- desktop: photo left, configurator right ---------- */
@media (min-width: 900px) {
  :root { --gutter: 36px; --top-h: 64px; }
  .app {
    display: grid; grid-template-columns: minmax(0, 1fr) 440px; grid-template-rows: 1fr;
    min-height: 640px;
  }
  .stage { max-height: none; height: 100%; }
  .stage .photo { object-position: 50% 55%; }
  .panel { position: relative; overflow: hidden; min-height: 0; padding: 24px var(--gutter) 0; }
  .panel-head { display: block; padding-bottom: 18px; }
  .title { font: 400 32px/1.1 var(--serif); letter-spacing: -0.015em; margin: 0 0 8px; }
  .lede { margin: 0; font-size: 15px; color: var(--muted); max-width: 36ch; }
  .rail { display: none; }

  /* every step is a row; the open one shows its choices */
  .steps { display: block; flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; }
  .step { display: block; border-top: 1px solid var(--line); }
  .step:last-child { border-bottom: 1px solid var(--line); }
  .step.enter-r, .step.enter-l { animation: none; }
  .step-head {
    display: flex; justify-content: space-between; align-items: center; width: 100%;
    min-height: 54px; font-size: 15px; font-weight: 500; text-align: left;
  }
  .step-v { font-weight: 400; color: var(--muted); }
  .step.is-active .step-v { color: var(--ink); }
  .step-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .36s var(--ease); }
  .step.is-active .step-body { grid-template-rows: 1fr; }
  .step-inner { min-height: 0; overflow: hidden; }
  .step-inner > .choices, .step-inner > .size-read { margin-top: 2px; }
  .note { padding-bottom: 14px; min-height: 0; }
  .ruler-wrap { margin: 0; }

  .bar { padding: 16px 0 22px; border-top: 0; }
  .price-v { font-size: 28px; }
  .next { min-height: 52px; padding: 0 20px 0 24px; }

  .review { top: 0; left: 0; right: 0; bottom: 0; transform: translateX(100%); box-shadow: none; }
  .review.open { transform: none; }
  .review-scroll { padding: 0 var(--gutter) 32px; }
  .back-row { padding-top: 14px; }
  .review-photo { display: none; }
  .total-v { font-size: 44px; }

  .studio { padding: 96px var(--gutter) 40px; }
  .studio h2 { font-size: 36px; }
  .work { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .sheet { inset: 0; margin: auto; max-width: 560px; height: fit-content; transform: translateY(16px); opacity: 0; transition: transform .3s var(--ease), opacity .25s; }
  .sheet.open { transform: none; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .photo, .marker, .sheet, .review, .rail-mark, .step-body, .field::after { transition: none !important; }
  .step, .price-v span { animation: none !important; }
}
