:root {
  --paper: #f2ede3;
  --paper-2: #ebe4d6;
  --ink: #1b1915;
  --ink-soft: #5d574d;
  --rule: rgba(27, 25, 21, 0.22);
  --terracotta: #b5643c;
  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --sans: 'Jost', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --gutter: clamp(16px, 2.4vw, 36px);
  --scroll-length: 1875vh;
  --progress: 0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

#gl {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100lvh;
  display: block;
  z-index: 0;
  touch-action: pan-y;
}

#scroll { height: var(--scroll-length); position: relative; z-index: -1; }

.mono { font-family: var(--mono); }
.eyebrow {
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 0 0 18px;
  color: var(--ink-soft);
}
.eyebrow.mono { font-family: var(--mono); letter-spacing: 0.06em; text-transform: none; font-size: 12px; }
em { font-style: italic; color: var(--terracotta); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: transparent;
  font: 500 12px/1 var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.solid:hover { background: var(--terracotta); border-color: var(--terracotta); }
.btn:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 3px; }

/* ── Drawing sheet ─────────────────────────────────────────────── */
#sheet { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
.frame {
  position: absolute;
  inset: var(--gutter);
  border: 1.5px solid var(--ink);
  outline: 0.75px solid var(--ink);
  outline-offset: -7px;
}
.hero {
  position: absolute;
  left: 63%;
  right: calc(var(--gutter) + 40px);
  top: 15vh;
  max-width: 520px;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 3.6vw, 58px);
  line-height: 1.04;
  letter-spacing: -0.01em;
  margin: 0 0 22px;
}
.lede { font-size: 16px; line-height: 1.6; font-weight: 300; margin: 0 0 34px; max-width: 34em; }
.hero.finale { visibility: hidden; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; pointer-events: auto; }
.cue {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.cue span { display: block; width: 1px; height: 34px; background: var(--ink); position: relative; overflow: hidden; }
.cue span::after {
  content: '';
  position: absolute;
  left: 0;
  top: -40%;
  width: 1px;
  height: 40%;
  background: var(--paper);
  animation: cue 2.2s ease-in-out infinite;
}
@keyframes cue { to { top: 120%; } }

.titleblock {
  position: absolute;
  right: calc(var(--gutter) + 7px);
  bottom: calc(var(--gutter) + 7px);
  width: min(430px, 34vw);
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 0.75px solid var(--ink);
  border-left: 0.75px solid var(--ink);
  background: var(--paper);
}
.titleblock > div {
  border-right: 0.75px solid var(--ink);
  border-bottom: 0.75px solid var(--ink);
  padding: 8px 12px 9px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.titleblock .tb-project { grid-column: 1 / -1; }
.titleblock .k { font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-soft); }
.titleblock .v { font-size: 13px; }
.titleblock .v.big { font-family: var(--serif); font-size: 24px; line-height: 1.1; }
.titleblock .mono { font-size: 12px; }
.titleblock .north { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 12px; }
.titleblock .north svg { width: 38px; height: 38px; color: var(--ink); font-family: var(--sans); }

/* ── Captions ─────────────────────────────────────────────────── */
.caption {
  position: fixed;
  left: calc(var(--gutter) + 18px);
  bottom: calc(var(--gutter) + 18px);
  max-width: 470px;
  z-index: 3;
  pointer-events: none;
  visibility: hidden;
}
.caption .line { font-family: var(--serif); font-size: clamp(22px, 2vw, 30px); line-height: 1.22; margin: 0; }
.caption.dark.top { left: 63%; right: calc(var(--gutter) + 90px); top: 14vh; bottom: auto; }
.caption.dark .eyebrow { color: var(--ink-soft); }
.caption.light { color: #fbf6ec; text-shadow: 0 1px 18px rgba(20, 12, 4, 0.55), 0 0 2px rgba(20, 12, 4, 0.35); }
.caption.light .eyebrow { color: rgba(251, 246, 236, 0.88); }

/* ── Stop rail and phone progress ─────────────────────────────── */
#rail {
  position: fixed;
  right: calc(var(--gutter) + 10px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
  mix-blend-mode: difference;
}
#rail button, #rail a {
  all: unset;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #f2ede3;
  opacity: 0.45;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: opacity 0.4s;
}
#rail button::after, #rail a::after { content: ''; width: 14px; height: 1px; background: currentColor; transition: width 0.4s; }
#rail .on, #rail a:hover, #rail button:hover { opacity: 1; }
#rail .on::after { width: 30px; }
#rail a { margin-top: 8px; opacity: 0.8; }
#rail button:focus-visible, #rail a:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }

#bar { display: none; }

/* ── Loader ───────────────────────────────────────────────────── */
#loader {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--paper);
  display: grid;
  place-content: center;
  gap: 14px;
  transition: opacity 0.8s ease;
}
#loader p { margin: 0; font-size: 11px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--ink-soft); }
#loader .bar { width: 180px; height: 1px; background: rgba(27, 25, 21, 0.15); }
#loader-bar { height: 1px; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform 0.4s ease; }
body.ready #loader { opacity: 0; pointer-events: none; }
body.record #rail, body.record #bar { display: none; }

/* ── Website sections ─────────────────────────────────────────── */
#site {
  position: relative;
  z-index: 5;
  background: var(--paper);
  border-top: 1px solid var(--ink);
  box-shadow: 0 -40px 80px rgba(242, 237, 227, 0.9);
}
.block {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(72px, 10vw, 140px) var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(28px, 5vw, 80px);
  border-bottom: 1px solid var(--rule);
}
.block-head h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(32px, 3.6vw, 52px);
  line-height: 1.06;
  margin: 0 0 18px;
}
.block-head .lede { max-width: 26em; }
.note { grid-column: 2; font-size: 13px; color: var(--ink-soft); margin: 0; }

.fact-grid { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.fact-grid > div { padding: 22px 0 24px; border-bottom: 1px solid var(--rule); }
.fact-grid > div:nth-child(odd) { padding-right: 24px; }
.fact-grid > div:nth-child(even) { padding-left: 24px; border-left: 1px solid var(--rule); }
.fact-grid dt { font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-soft); }
.fact-grid dd { margin: 8px 0 4px; font-family: var(--serif); font-size: clamp(30px, 3vw, 42px); line-height: 1; }
.fact-grid dd.mono { font-family: var(--mono); font-size: clamp(22px, 2.2vw, 30px); }
.fact-grid dd small { font-family: var(--sans); font-size: 13px; letter-spacing: 0.08em; color: var(--ink-soft); }
.fact-grid span { font-size: 13.5px; color: var(--ink-soft); }

.points { margin: 0; padding: 0; list-style: none; counter-reset: pt; }
.points li { position: relative; padding: 0 0 26px 54px; font-size: 16.5px; line-height: 1.6; font-weight: 300; }
.points li::before {
  counter-increment: pt;
  content: counter(pt, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 2px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--terracotta);
}
.points strong { font-weight: 500; display: block; margin-bottom: 2px; }

.schedule { width: 100%; border-collapse: collapse; font-size: 15px; }
.schedule th { text-align: left; font-weight: 400; font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-soft); padding: 0 12px 12px 0; border-bottom: 1px solid var(--ink); }
.schedule td { padding: 15px 12px 15px 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.schedule td:first-child { font-family: var(--serif); font-size: 21px; }
.schedule td.mono { font-size: 13.5px; white-space: nowrap; }
.schedule td:last-child { color: var(--ink-soft); font-size: 13.5px; }

.swatches { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px 22px; }
.swatches img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; margin-bottom: 14px; }
.swatches h3 { font-family: var(--serif); font-weight: 500; font-size: 22px; margin: 0 0 6px; }
.swatches p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink-soft); }

.drawing figure { margin: 0; display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 28px; align-items: end; }
.drawing figure img { width: 100%; height: auto; display: block; border: 1px solid var(--rule); background: #fff; }
.drawing figcaption p { margin: 0 0 14px; font-size: 14.5px; line-height: 1.6; color: var(--ink-soft); }
.drawing figcaption .btn { margin-top: 8px; }

#enquiry { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; align-content: start; }
#enquiry label { display: flex; flex-direction: column; gap: 8px; font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-soft); }
#enquiry label small { letter-spacing: 0.08em; text-transform: none; font-size: 12px; }
#enquiry .wide { grid-column: 1 / -1; }
#enquiry input, #enquiry textarea {
  font: 300 17px/1.4 var(--sans);
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink);
  padding: 8px 0;
  border-radius: 0;
  outline: none;
  resize: vertical;
}
#enquiry input:focus, #enquiry textarea:focus { border-bottom-color: var(--terracotta); }
#enquiry .check { flex-direction: row; align-items: center; gap: 12px; letter-spacing: 0.08em; text-transform: none; font-size: 15px; color: var(--ink); }
#enquiry .check input { width: 18px; height: 18px; accent-color: var(--ink); }
#enquiry .send { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
#enquiry .sent-note { display: none; margin: 0; font-size: 14px; color: var(--ink-soft); }
#enquiry.sent .sent-note { display: block; }

.foot { max-width: 1180px; margin: 0 auto; padding: 40px var(--gutter) 60px; display: flex; justify-content: space-between; gap: 30px; font-size: 12.5px; color: var(--ink-soft); }
.foot p { margin: 0; max-width: 60ch; }

/* ── Phones and narrow screens ─────────────────────────────────── */
@media (max-width: 820px), (max-aspect-ratio: 1/1) {
  .hero { left: calc(var(--gutter) + 18px); right: calc(var(--gutter) + 18px); top: calc(var(--gutter) + 22px); bottom: auto; max-width: none; }
  .hero .eyebrow { margin-bottom: 10px; }
  .hero h1 { font-size: 30px; margin-bottom: 10px; }
  .lede { font-size: 14px; line-height: 1.5; margin-bottom: 0; }
  .hero .actions { margin-top: 18px; }
  .hero.finale { top: auto; bottom: calc(var(--gutter) + 22px); background: var(--paper); padding: 16px; margin: 0 -16px; }
  .cue { display: none; }
  .titleblock { display: none; }
  .caption, .caption.dark.top { left: calc(var(--gutter) + 4px); right: calc(var(--gutter) + 4px); top: auto; bottom: calc(var(--gutter) + 26px + env(safe-area-inset-bottom)); max-width: none; }
  .caption .line { font-size: 21px; }
  .eyebrow.mono { font-size: 11px; }
  #rail { display: none; }
  #bar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: fixed;
    left: calc(var(--gutter) + 4px);
    right: calc(var(--gutter) + 4px);
    bottom: calc(var(--gutter) - 4px + env(safe-area-inset-bottom));
    z-index: 4;
    mix-blend-mode: difference;
    color: #f2ede3;
  }
  #bar span { flex: 1; height: 1px; background: rgba(242, 237, 227, 0.35); position: relative; }
  #bar span::after { content: ''; position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--progress)); background: #f2ede3; }
  #bar em { font-style: normal; font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: inherit; }
  .block { grid-template-columns: 1fr; gap: 26px; }
  .note { grid-column: 1; }
  .fact-grid { grid-template-columns: 1fr 1fr; }
  .fact-grid > div:nth-child(odd) { padding-right: 14px; }
  .fact-grid > div:nth-child(even) { padding-left: 14px; }
  .swatches { grid-template-columns: 1fr 1fr; gap: 24px 16px; }
  .drawing figure { grid-template-columns: 1fr; }
  #enquiry { grid-template-columns: 1fr; }
  .schedule td:first-child { font-size: 18px; }
  .schedule th:last-child, .schedule td:last-child { display: none; }
  .foot { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .cue span::after { animation: none; }
}

/* ── Back to the developer's site ── */
.home {
  position: fixed;
  top: calc(var(--gutter) + 16px);
  left: calc(var(--gutter) + 18px);
  z-index: 6;
  font: 500 10.5px/1 var(--sans);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #f2ede3;
  mix-blend-mode: difference;
  text-decoration: none;
}
.home:hover { text-decoration: underline; text-underline-offset: 4px; }
body.record .home { display: none; }
