:root {
  --limestone: #EFE8DC;
  --sand: #DDCFB8;
  --date: #2B1E16;
  --date-soft: #5C4C40;
  --espresso: #1E1611;
  --emerald: #1F4D45;
  --brass: #B08D57;
  --date-red: #6B2E22;

  --font-display: "Marcellus", "Times New Roman", serif;
  --font-body: "Readex Pro", system-ui, sans-serif;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

  --gutter: clamp(16px, 3.2vw, 48px);
  --gutter-left: max(var(--gutter), env(safe-area-inset-left));
  --gutter-right: max(var(--gutter), env(safe-area-inset-right));
  --arch-w: 380px;
  --floor-inset: calc(var(--arch-w) * 0.08);

  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--sand) var(--limestone);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--limestone);
  color: var(--date);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--emerald);
  overflow-x: hidden;
}

/* Grain: a canvas-drawn noise tile set by main.js. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background-image: var(--grain, none);
  background-size: 160px 160px;
  opacity: 0.32;
}

::selection { background: var(--date); color: var(--sand); }

:focus-visible {
  outline: 2px solid var(--emerald);
  outline-offset: 3px;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
}

p { margin: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Preloader */

#preloader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--espresso);
  color: var(--sand);
  clip-path: inset(0 0 0 0);
}

.intro-done #preloader { display: none; }

.preloader__count {
  display: flex;
  font-family: var(--font-display);
  font-size: clamp(4.5rem, 12vw, 9rem);
  line-height: 1;
  letter-spacing: 0;
}

.preloader__count span {
  display: inline-block;
  width: 0.66em;
  text-align: center;
}

/* Page */

.page {
  position: relative;
  display: grid;
  grid-template-rows: minmax(340px, 1fr) auto auto;
  min-height: 100vh;
  min-height: 100svh;
}

.page > main { display: contents; }

.masthead {
  position: absolute;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(clamp(16px, 2.6vw, 32px), env(safe-area-inset-top)) var(--gutter-right) clamp(16px, 2.6vw, 32px) var(--gutter-left);
  pointer-events: none;
}

.masthead > * { pointer-events: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--date);
}

.brand__mark { width: auto; height: 42px; flex: none; }
.brand__word { width: auto; height: 35px; flex: none; }

.masthead__aside {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.06em;
}

/* Stage: wordmark, arch and sofa share one centre axis. */

.stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
}

.wordmark {
  position: absolute;
  left: 50%;
  bottom: calc(var(--floor-inset) + var(--arch-w) * 0.115);
  z-index: 0;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: min(calc(var(--arch-w) * 0.8), 19vw);
  line-height: 0.74;
  letter-spacing: 0.02em;
  margin-right: -0.02em;
  white-space: nowrap;
  color: var(--sand);
  user-select: none;
}

.wordmark .char { display: inline-block; will-change: transform, filter; }

.arch {
  position: absolute;
  left: 50%;
  bottom: var(--floor-inset);
  z-index: 1;
  width: var(--arch-w);
  height: auto;
  aspect-ratio: 100 / 122;
  transform: translateX(-50%);
  overflow: visible;
  color: var(--date);
}

/* Stroke widths are in viewBox units, set by layout() to hold 1.5px and 0.75px on screen. */
.arch__line {
  fill: none;
  stroke: var(--brass);
}

.arch__line--outer { stroke-width: var(--arch-stroke, 0.4); }
.arch__line--inner { stroke-width: calc(var(--arch-stroke, 0.4) / 2); }

.arch__pattern { opacity: 0.06; }

.sofa {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

.floor {
  position: absolute;
  left: var(--gutter-left);
  right: var(--gutter-right);
  bottom: var(--floor-inset);
  z-index: 1;
  height: 1px;
  background: var(--brass);
  transform-origin: 50% 50%;
}

/* Offer */

.offer {
  display: grid;
  justify-items: center;
  padding: 18px var(--gutter-right) 0 var(--gutter-left);
  text-align: center;
}

.fabric {
  display: flex;
  align-items: center;
  gap: 14px;
}

.fabric__swatches { display: flex; }

.swatch {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 160ms var(--ease-out);
}

.swatch::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgb(43 30 22 / 0.36);
}

.swatch::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 1px solid var(--brass);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 200ms var(--ease-out), transform 260ms var(--ease-out);
}

.swatch[aria-checked="true"]::after { opacity: 1; transform: scale(1); }
.swatch:active { transform: scale(0.94); }
.swatch:focus-visible { outline-offset: 0; }

.fabric__name {
  min-width: 9.5em;
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--date-soft);
}

.fabric__name span { display: inline-block; color: var(--date); }

.headline {
  margin: 18px 0 0;
  max-width: 18ch;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 1.1rem + 2.2vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.lede {
  margin-top: 12px;
  max-width: 44rem;
  color: var(--date-soft);
  text-wrap: balance;
}

.follow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  margin-top: 26px;
  padding: 0 28px;
  border-radius: 1px;
  background: var(--date);
  color: var(--limestone);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 160ms var(--ease-out), background-color 200ms var(--ease-out);
}

.follow:active { transform: scale(0.97); }

.follow__icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.follow__dot { fill: currentColor; stroke: none; }

.colophon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px var(--gutter-right) max(clamp(18px, 2.6vh, 30px), env(safe-area-inset-bottom)) var(--gutter-left);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--date-soft);
}

.colophon::before,
.colophon::after {
  content: "";
  width: 32px;
  height: 1px;
  background: var(--brass);
}

.colophon p { margin-right: -0.32em; }

/* Wide screens: the headline holds one line so the arch keeps its height. */
@media (min-width: 1100px) {
  .headline { max-width: none; font-size: clamp(2.4rem, 1rem + 2vw, 3.1rem); }
}

@media (hover: hover) and (pointer: fine) {
  .follow:hover { background: var(--espresso); }
  .swatch:hover::after { opacity: 0.5; transform: scale(1); }
  .swatch[aria-checked="true"]:hover::after { opacity: 1; }
  .sofa { cursor: grab; }
  .sofa.is-dragging { cursor: grabbing; }
}

/* Phones: arch and sofa own the top 55svh, content stacks below. */
@media (max-width: 700px) {
  .page { grid-template-rows: 55svh auto auto; }

  .brand__mark { height: 34px; }
  .brand__word { height: 29px; }

  .wordmark {
    bottom: calc(var(--floor-inset) + var(--arch-w) * 0.25);
    font-size: min(calc(var(--arch-w) * 0.8), 23vw);
  }

  .offer { padding-top: 14px; }
  .headline { margin-top: 14px; font-size: clamp(1.875rem, 8.4vw, 2.25rem); }
  .lede { font-size: 0.9375rem; }

  .follow { width: min(100%, 22rem); min-height: 52px; margin-top: 22px; }
  .colophon { padding-top: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .swatch,
  .swatch::after,
  .follow { transition-property: opacity, background-color; }
  .swatch:active,
  .follow:active { transform: none; }
}

/* Touch screens: 44px targets for the swatches. */
@media (pointer: coarse) {
  .swatch { width: 44px; height: 44px; }
  .swatch::before { inset: 12px; }
  .swatch::after { inset: 7px; }
}

/* Narrow phones (320–380px): the fabric name drops under the swatches. */
@media (max-width: 380px) {
  .fabric { flex-direction: column; gap: 0; }
  .fabric__name { min-width: 0; text-align: center; }
  .follow { padding: 0 16px; gap: 10px; letter-spacing: 0.1em; }
}

/* Short portrait phones: a little less stage so the Instagram button stays on screen. */
@media (max-width: 700px) and (max-height: 700px) and (orientation: portrait) {
  .page { grid-template-rows: 49svh auto auto; }
  .headline { margin-top: 10px; }
  .follow { margin-top: 18px; }
}

/* Phones held sideways: keep the stage tall enough for the sofa, let the page scroll. */
@media (max-height: 500px) and (orientation: landscape) {
  .page { grid-template-rows: minmax(300px, 88svh) auto auto; }
  .headline { font-size: clamp(1.75rem, 1rem + 2vw, 2.4rem); }
}

/* Without WebGL the arch and wordmark stand alone; the fabric switcher has nothing to dress. */
.no-webgl .sofa,
.no-webgl .fabric { display: none; }
