/*
  Gavan Interior Design (demo) - art direction
  Scene:   a showroom at night. Everything around is dark and quiet; the
           room itself is the one lit thing, like a stage set you can
           walk up to. All colour on the page lives inside the room.
  Palette: warm near-black ground, ivory text, hairlines. Gold only for
           prices and the budget meter.
  Type:    Heebo at its thinnest for headlines; Bona Nova italic for the
           one phrase that carries the feeling.
  Shape:   pills with a fine outline, numbered parts, a soft-cornered
           frame around the room.
*/

:root {
  --black: #0b0a09;
  --coal: #141210;
  --ivory: #f3efe7;
  --dim: #a39e94;
  --line: rgba(243, 239, 231, 0.18);
  --gold: #e9c877;
  --over: #ff8674;
  --sans: 'Heebo', system-ui, sans-serif;
  --serif: 'Bona Nova', 'Times New Roman', serif;
  --gutter: clamp(1rem, 4vw, 3.5rem);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  background: var(--black);
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--black);
  color: var(--ivory);
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 300;
  line-height: 1.55;
  overflow-x: clip;
}

h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; color: #fff4d8; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.ribbon-bar {
  position: sticky;
  top: 0;
  z-index: 6;
  padding: 0.4rem var(--gutter);
  border-bottom: 1px solid var(--line);
  background: #080706;
  font-size: 0.875rem;
  font-weight: 400;
  text-align: center;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 1.1rem var(--gutter) 0;
}
.brand { color: var(--dim); letter-spacing: 0.08em; font-size: 0.9375rem; font-weight: 400; }
.brand strong {
  margin-inline-end: 0.5em;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 2rem;
  letter-spacing: 0;
  color: var(--ivory);
}
.lang { padding: 0.5rem 0; font-weight: 400; text-underline-offset: 0.3em; }

.mark {
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  color: var(--dim);
}

/* ---------- ( I. ) Headline ---------- */

.hero { padding: 2.5rem var(--gutter) 1.5rem; }
h1 {
  margin-top: 0.8rem;
  font-weight: 200;
  font-size: clamp(2.6rem, 9vw, 6rem);
  line-height: 1;
  text-wrap: balance;
}
h1 em { display: block; }
.lede { margin-top: 1.2rem; max-inline-size: 44ch; color: #d8d3c8; font-size: 1.125rem; }

/* ---------- The room and its controls ---------- */

.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1rem var(--gutter) 3rem;
}

/* On a phone the room stays in view while the choices scroll under it. */
.stage-wrap {
  position: sticky;
  /* Just under the demo ribbon, however many lines it wraps to. */
  top: var(--ribbon-h, 2.9rem);
  z-index: 4;
  margin-inline: calc(var(--gutter) * -1);
  padding: 0.6rem var(--gutter) 0.7rem;
  background: var(--black);
  border-bottom: 1px solid var(--line);
}

.stage {
  --cut: 30%;
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 1rem;
  background: var(--coal);
  box-shadow: 0 30px 110px rgba(255, 214, 160, 0.14), 0 0 0 1px var(--line);
  transition: box-shadow 0.6s ease;
}
.stage[data-mood='evening'] { box-shadow: 0 30px 120px rgba(255, 170, 80, 0.22), 0 0 0 1px var(--line); }

.room, .room-holder { position: absolute; inset: 0; }
.room-svg { display: block; inline-size: 100%; block-size: 100%; }
/* Left of the line: before. Right of it: after. The same in both languages. */
.after { clip-path: inset(0 0 0 var(--cut)); }
.room-holder.is-arriving { animation: arrive 0.4s ease both; }
@keyframes arrive {
  from { opacity: 0; }
}

/* A little depth: the furniture drifts against the walls as the pointer moves. */
.layer { transition: transform 0.35s ease-out; }
.layer[data-depth='3'] { transform: translate(calc(var(--px, 0) * -7px), calc(var(--py, 0) * -3px)); }
.layer[data-depth='4'] { transform: translate(calc(var(--px, 0) * -13px), calc(var(--py, 0) * -5px)); }

.tag {
  position: absolute;
  bottom: 0.7rem;
  z-index: 2;
  padding: 0.15rem 0.7rem;
  border-radius: 999px;
  background: rgba(11, 10, 9, 0.72);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.tag-before { left: 0.7rem; }
.tag-after { right: 0.7rem; }

.divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--cut);
  z-index: 2;
  inline-size: 2px;
  translate: -1px 0;
  background: var(--ivory);
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.divider i {
  position: absolute;
  top: 50%;
  left: 50%;
  inline-size: 2.75rem;
  block-size: 2.75rem;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--ivory);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
}
.divider i::before,
.divider i::after {
  content: '';
  position: absolute;
  top: 50%;
  inline-size: 0.5rem;
  block-size: 0.5rem;
  border: solid var(--black);
  border-width: 2px 2px 0 0;
}
.divider i::before { left: 0.55rem; transform: translateY(-50%) rotate(-135deg); }
.divider i::after { right: 0.55rem; transform: translateY(-50%) rotate(45deg); }

/* The real control: an invisible slider laid over the whole picture. */
.cut {
  position: absolute;
  inset: 0;
  z-index: 3;
  inline-size: 100%;
  block-size: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  touch-action: pan-y;
}
.stage:focus-within .divider i { outline: 3px solid var(--gold); outline-offset: 3px; }

.moods { justify-content: center; margin-top: 0.7rem; }
.fallback { padding: 2rem; text-align: center; }

.panel { display: grid; gap: 0; align-content: start; }
.step { padding: 1.2rem 0; border-top: 1px solid var(--line); }
.panel .mark { padding-bottom: 1rem; }
.step h2, .step h3 { margin-bottom: 0.7rem; font-size: 1.2rem; font-weight: 300; line-height: 1.2; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips + .chips { margin-top: 0.6rem; }
.chips button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-block-size: 2.75rem;
  padding: 0.35rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font-weight: 400;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.chips button:hover { border-color: var(--ivory); }
.chips button[aria-pressed='true'] { background: var(--ivory); border-color: var(--ivory); color: var(--black); }
.chips i {
  inline-size: 1.35rem;
  block-size: 1.35rem;
  border-radius: 50%;
  border: 1px solid rgba(243, 239, 231, 0.5);
  background: var(--paint);
}
.chips button[aria-pressed='true'] i { border-color: rgba(11, 10, 9, 0.5); }
.chips span { display: inline-block; }
.chips span::first-letter { text-transform: uppercase; }
.chips b { font-weight: 400; font-size: 0.875rem; color: var(--gold); white-space: nowrap; }
.chips button[aria-pressed='true'] b { color: #6c5200; font-weight: 600; }

.check { display: flex; align-items: center; gap: 0.7rem; min-block-size: 2.75rem; margin-top: 0.6rem; cursor: pointer; font-weight: 400; }
.check input { inline-size: 1.35rem; block-size: 1.35rem; accent-color: var(--gold); }

/* ---------- ( III. ) Budget ---------- */

.money, .meet {
  padding: 4.5rem var(--gutter) 3rem;
  border-top: 1px solid var(--line);
}
.money > h2, .meet > h2 {
  margin-top: 0.8rem;
  font-weight: 200;
  font-size: clamp(2rem, 6.5vw, 4rem);
  line-height: 1.04;
  text-wrap: balance;
}
.money-grid { display: grid; gap: 2rem; margin-top: 2rem; }
.total { font-weight: 200; font-size: clamp(3rem, 13vw, 6.5rem); line-height: 1; letter-spacing: -0.02em; white-space: nowrap; }
.meter {
  --fill: 0%;
  position: relative;
  block-size: 6px;
  margin-top: 1.2rem;
  border-radius: 99px;
  background: rgba(243, 239, 231, 0.14);
  overflow: hidden;
}
.meter i {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  inline-size: var(--fill);
  border-radius: 99px;
  background: var(--ivory);
  transition: inline-size 0.4s ease, background-color 0.4s ease;
}
.meter[data-kind='near'] i,
.meter[data-kind='exact'] i { background: var(--gold); }
.meter[data-kind='over'] i { background: var(--over); }
.budget-note { margin-top: 0.8rem; min-block-size: 3.2em; font-weight: 400; }
.budget-note[data-kind='near'],
.budget-note[data-kind='exact'] { color: var(--gold); }
.budget-note[data-kind='over'] { color: var(--over); }

.field { display: grid; gap: 0.5rem; margin-top: 1rem; }
.field span { font-weight: 400; }
.field b { font-weight: 600; color: var(--gold); }
.field input[type='text'] {
  max-inline-size: 22rem;
  min-block-size: 3rem;
  padding: 0.4rem 0;
  border: 0;
  border-bottom: 1.5px solid var(--ivory);
  border-radius: 0;
  background: transparent;
  font-size: 1.2rem;
}
input[type='range']:not(.cut) {
  -webkit-appearance: none;
  appearance: none;
  inline-size: 100%;
  max-inline-size: 30rem;
  block-size: 2.75rem;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type='range']:not(.cut)::-webkit-slider-runnable-track { block-size: 2px; background: var(--ivory); }
input[type='range']:not(.cut)::-moz-range-track { block-size: 2px; background: var(--ivory); }
input[type='range']:not(.cut)::-webkit-slider-thumb {
  -webkit-appearance: none;
  inline-size: 1.7rem;
  block-size: 1.7rem;
  margin-top: calc(-0.85rem + 1px);
  border: 0;
  border-radius: 50%;
  background: var(--ivory);
}
input[type='range']:not(.cut)::-moz-range-thumb { inline-size: 1.7rem; block-size: 1.7rem; border: 0; border-radius: 50%; background: var(--ivory); }

.lines { display: grid; gap: 0; align-content: start; }
.lines li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}
.lines b { font-weight: 400; color: var(--gold); white-space: nowrap; }
.lines li:last-child { border-bottom: 0; font-weight: 400; }
.small { margin-top: 1.5rem; max-inline-size: 60ch; font-size: 0.875rem; color: var(--dim); }

/* ---------- ( IV. ) Meeting ---------- */

.meet .step:first-of-type { margin-top: 2rem; }
.meet .field { padding: 1.2rem 0; border-top: 1px solid var(--line); margin-top: 0; }
.meet .field span { font-size: 1.2rem; font-weight: 300; }
.meet .pill { margin-top: 1rem; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: 3.25rem;
  padding: 0.5rem 2.2rem;
  border: 1.5px solid var(--ivory);
  border-radius: 999px;
  background: transparent;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}
.pill:hover { background: rgba(243, 239, 231, 0.14); }
.pill-main { background: var(--ivory); color: var(--black); font-weight: 600; }
.pill-main:hover { background: #fff; box-shadow: 0 0 34px rgba(255, 255, 255, 0.3); }

/* ---------- Facts and footer ---------- */

.facts { display: grid; padding: 0 var(--gutter); border-top: 1px solid var(--line); }
.facts article { padding: 2.2rem 0; border-bottom: 1px solid var(--line); }
.facts h2 { margin: 0.6rem 0 0.5rem; font-size: 1.7rem; font-weight: 300; line-height: 1.15; }
.facts article > p:last-child { color: #cdc8bd; max-inline-size: 34ch; }

.foot {
  display: grid;
  gap: 1.6rem;
  justify-items: center;
  padding: 5rem var(--gutter) 5.5rem;
  text-align: center;
}
.foot p { font-weight: 200; font-size: clamp(1.7rem, 4.5vw, 2.7rem); line-height: 1.12; max-inline-size: 22ch; text-wrap: balance; }

/* ---------- Sheet ---------- */

dialog {
  inline-size: min(32rem, calc(100vw - 2rem));
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  background: #14120f;
  color: var(--ivory);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.78); }
dialog h2 { font-size: 1.7rem; font-weight: 300; line-height: 1.2; }
.bubble {
  margin: 1.25rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #1d1a16;
  font-weight: 400;
  white-space: pre-line;
  text-align: start;
  overflow-wrap: anywhere;
}
.note { margin-bottom: 1.5rem; color: #cdc8bd; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

@media (min-width: 62rem) {
  .hero { padding-top: 3.5rem; }
  .studio { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); column-gap: 3rem; align-items: start; }
  .stage-wrap { top: calc(var(--ribbon-h, 2.9rem) + 1.2rem); margin-inline: 0; padding: 0; border-bottom: 0; background: transparent; }
  .stage { border-radius: 1.4rem; }
  .moods { margin-top: 1.1rem; }
  .money-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); column-gap: 4rem; align-items: start; }
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .facts article { padding-block: 3rem; padding-inline: 0 2rem; border-bottom: 0; }
  .facts article + article { padding-inline-start: 2rem; border-inline-start: 1px solid var(--line); }
}

/* A short screen (a phone on its side): the room scrolls with the page, or it would cover the choices. */
@media (max-height: 34rem) {
  .stage-wrap { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  .room-holder.is-arriving { animation: none; }
  .layer, .stage, .meter i, .pill, .chips button, .tag { transition: none; }
  .layer[data-depth] { transform: none; }
}
