/* ════════════════════════════════════════════════════════════════
   CHAPTERS — Hartwell Remodeling (hand-built concept)
   A gallery walk: full-bleed chapters, wall text, plan-line fields.
   ════════════════════════════════════════════════════════════════ */

:root {
  --deep: #221d18;
  --pale: #efe9de;
  --bone: #f4efe6;
  --ink: #221d18;
  --accent: #bc7a33;
  --line-deep: rgba(244, 239, 230, 0.30);
  --line-pale: rgba(34, 29, 24, 0.26);
  --hair-deep: rgba(244, 239, 230, 0.22);
  --hair-pale: rgba(34, 29, 24, 0.20);
  --gut: clamp(1.25rem, 5.6vw, 4.5rem);
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Inter", -apple-system, "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--deep);
  color: var(--bone);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.locked { overflow: hidden; }

::selection { background: var(--accent); color: var(--bone); }

a:focus-visible, button:focus-visible,
input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.tick {
  display: inline-block;
  width: 9px; height: 9px;
  background: var(--accent);
  margin-right: 0.7rem;
  flex: none;
}

/* ── Chrome ─────────────────────────────────────────────────── */

.site-head {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem var(--gut);
  transition: color 0.45s ease;
}
.site-head[data-scheme="deep"] { color: var(--bone); }
.site-head[data-scheme="pale"] { color: var(--ink); }
.site-head.menu-open { color: var(--bone); }

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  color: inherit;
  text-decoration: none;
  min-height: 48px;
  align-items: center;
}
.brand-tick { width: 10px; height: 10px; background: var(--accent); flex: none; align-self: center; }
.brand-word {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: 0.32em;
  white-space: nowrap;
}
.brand-sub {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  opacity: 0.62;
  white-space: nowrap;
}
@media (max-width: 719px) { .brand-sub { display: none; } }

.head-right { display: flex; align-items: center; gap: clamp(0.9rem, 3vw, 2rem); }
.head-phone {
  color: inherit;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  white-space: nowrap;
  border-bottom: 1.5px solid var(--accent);
  padding-bottom: 0.18rem;
}
@media (max-width: 559px) { .head-phone { display: none; } }

.menu-toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 48px;
  padding: 0.6rem 0 0.6rem 0.7rem;
  background: none;
  border: 0;
  color: inherit;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  cursor: pointer;
}
.menu-toggle-rules { display: flex; flex-direction: column; gap: 6px; width: 26px; }
.menu-toggle-rules span {
  display: block;
  height: 2px;
  background: currentColor;
  transition: transform 0.35s ease;
}
.site-head.menu-open .menu-toggle-rules span:first-child { transform: translateY(4px) rotate(45deg); }
.site-head.menu-open .menu-toggle-rules span:last-child { transform: translateY(-4px) rotate(-45deg); }

/* ── Menu sheet ─────────────────────────────────────────────── */

.menu-sheet {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: var(--deep);
  color: var(--bone);
  display: flex;
  flex-direction: column;
  padding: 6.8rem var(--gut) 2.4rem;
  overflow-y: auto;
}
.menu-sheet[hidden] { display: none; }
.menu-sheet.open { animation: sheet-in 0.38s ease both; }
@keyframes sheet-in { from { opacity: 0; } to { opacity: 1; } }

.sheet-nav { display: flex; flex-direction: column; }
.sheet-nav a {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.9rem, 8.4vw, 3.1rem);
  line-height: 1.14;
  color: inherit;
  text-decoration: none;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--hair-deep);
  width: 100%;
}
.sheet-nav a:first-child { border-top: 1px solid var(--hair-deep); }
.sheet-nav a.sheet-nav-accent { color: var(--accent); }

.sheet-call {
  margin-top: auto;
  padding-top: 2.4rem;
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
}
.sheet-call-label {
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.3em; text-transform: uppercase; opacity: 0.6;
}
.sheet-call a {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.5rem, 6.4vw, 2.1rem);
  color: inherit;
  text-decoration: none;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.15rem;
}
.sheet-meta {
  margin-top: 1.1rem;
  font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.28em; text-transform: uppercase; opacity: 0.5;
}

/* ── Chapters ───────────────────────────────────────────────── */

.chapter {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  /* The top padding reserves the motif zone: the wall block can
     never rise into the drawing, on any viewport height. */
  padding: calc(5.6rem + 37svh) var(--gut) 5.4rem;
}
.chapter--process, .chapter--voice, .chapter--begin { padding-top: 6.5rem; }
.chapter--process { padding-top: calc(5.6rem + 18svh); }
.chapter--deep { background: var(--deep); color: var(--bone); --line: var(--line-deep); --hair: var(--hair-deep); }
.chapter--pale { background: var(--pale); color: var(--ink); --line: var(--line-pale); --hair: var(--hair-pale); }

.motif {
  position: absolute;
  top: 5rem;
  right: 0;
  width: 100%;
  height: 37svh;
  color: var(--line);
  pointer-events: none;
}
.motif * {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.motif--slim { height: 20svh; }

.wall { position: relative; z-index: 2; max-width: 62rem; }
.wall--wide { max-width: 76rem; }

.marker {
  display: flex;
  align-items: center;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0.72;
}

.wall-word {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(4.3rem, 19.5vw, 11rem);
  line-height: 0.99;
  letter-spacing: -0.01em;
  margin-top: 1.1rem;
}
.wall-word--name { font-size: clamp(4.5rem, 20.5vw, 13rem); }
.wall-word--owner { font-size: clamp(3.4rem, 14.5vw, 9rem); }
.wall-word--mid { font-size: clamp(2.9rem, 11.5vw, 6.2rem); }

.wall-sub {
  margin-top: 1.3rem;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  opacity: 0.78;
  line-height: 2;
}

.wall-proof {
  margin-top: 1.7rem;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.28rem, 4.8vw, 1.65rem);
  line-height: 1.45;
  max-width: 31ch;
}

.wall-call {
  margin-top: 1.9rem;
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
}
.wall-call-label {
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.3em; text-transform: uppercase; opacity: 0.6;
}
.wall-call a {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.55rem, 6.6vw, 2.15rem);
  color: inherit;
  text-decoration: none;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.15rem;
}

.wall-story {
  margin-top: 1.5rem;
  font-size: clamp(1rem, 3.9vw, 1.16rem);
  line-height: 1.62;
  max-width: 37ch;
  opacity: 0.9;
}
.wall-note { font-family: var(--serif); font-style: italic; opacity: 0.78; }

.wall-link { margin-top: 1.7rem; }
.wall-link a {
  display: inline-block;
  color: inherit;
  text-decoration: none;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  border-bottom: 1.5px solid var(--accent);
  padding-bottom: 0.35rem;
}

/* the next chapter's edge, visible at the fold */
.ch-edge {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gut);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}
.ch-edge--pale { background: var(--pale); color: var(--ink); }
.ch-edge--deep { background: var(--deep); color: var(--bone); }

/* ── Process movements ──────────────────────────────────────── */

.movements { list-style: none; margin-top: 2.3rem; border-top: 1px solid var(--hair); }
.move {
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--hair);
  display: grid;
  gap: 0.35rem;
}
.move-name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.65rem, 6.2vw, 2.5rem);
  line-height: 1.12;
}
.move-name em { font-style: italic; color: var(--accent); margin-right: 0.4rem; }
.move-desc { font-size: 0.96rem; line-height: 1.55; opacity: 0.82; max-width: 46ch; }

/* ── Voice chapter (the void) ───────────────────────────────── */

.voice-mark {
  position: absolute;
  top: 1%;
  left: calc(var(--gut) - 0.08em);
  font-family: var(--serif);
  font-size: clamp(11rem, 42vw, 22rem);
  line-height: 1;
  color: var(--accent);
  opacity: 0.13;
  pointer-events: none;
}
.voice-quote {
  margin-top: 1.4rem;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.85rem, 7.2vw, 3.3rem);
  line-height: 1.28;
  max-width: 23ch;
}
.voice-attr {
  margin-top: 1.9rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0.68;
}

/* ── Towns ──────────────────────────────────────────────────── */

.towns { margin-top: 2.5rem; }
.towns-label {
  font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.3em; text-transform: uppercase; opacity: 0.62;
}
.towns-list { list-style: none; margin-top: 0.9rem; max-width: 34rem; }
.towns-list li {
  display: flex;
  align-items: center;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.35rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--hair);
}
.towns-list .tick { width: 7px; height: 7px; }

/* ── Begin: the form as a drawing frame ─────────────────────── */

.frame {
  margin-top: 2.3rem;
  max-width: 45rem;
  border: 1.5px solid rgba(34, 29, 24, 0.55);
  padding: clamp(1.4rem, 5vw, 2.3rem);
}
.frame-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 1.6rem;
}
.field--wide { grid-column: 1 / -1; }
@media (max-width: 559px) { .frame-fields { grid-template-columns: 1fr; } }

.field label {
  display: block;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  opacity: 0.66;
  margin-bottom: 0.15rem;
}
.field-opt { letter-spacing: 0.12em; text-transform: none; font-weight: 400; }
.field input, .field textarea {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1.5px solid rgba(34, 29, 24, 0.42);
  border-radius: 0;
  padding: 0.6rem 0;
  font-family: var(--sans);
  font-size: 1.05rem;
  color: var(--ink);
  resize: vertical;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-bottom-color: var(--accent);
}
.field input::placeholder, .field textarea::placeholder { color: rgba(34, 29, 24, 0.34); }

.frame-btn {
  margin-top: 1.9rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ink);
  color: var(--pale);
  border: 0;
  padding: 1.15rem 1.35rem;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s ease;
}
.frame-btn:hover { background: var(--accent); }

.frame-note { margin-top: 1.05rem; font-size: 0.92rem; line-height: 1.55; }
.frame-note a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }

.frame-block {
  margin-top: 1.7rem;
  border-top: 1px solid rgba(34, 29, 24, 0.4);
  padding-top: 0.75rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  opacity: 0.62;
}

.begin-alt { margin-top: 1.5rem; font-size: 0.98rem; }
.begin-alt a {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.25rem;
  color: inherit;
  text-decoration: none;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.1rem;
  margin-left: 0.4rem;
}

/* ── Footer — the closing spread ────────────────────────────── */

.foot {
  background: var(--deep);
  color: var(--bone);
  padding: 4.6rem var(--gut) 2.1rem;
}
.foot-name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(3.4rem, 12.5vw, 7rem);
  line-height: 1;
}
.foot-sub {
  margin-top: 0.9rem;
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.32em; text-transform: uppercase; opacity: 0.66;
}
.foot-cols {
  margin-top: 3.2rem;
  display: grid;
  gap: 2.4rem;
}
.foot-col-h {
  font-size: 0.64rem; font-weight: 600;
  letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
}
.foot-col a {
  display: block;
  color: inherit;
  text-decoration: none;
  font-size: 0.98rem;
  padding: 0.32rem 0;
  opacity: 0.88;
}
.foot-col a.foot-phone {
  font-family: var(--serif);
  font-size: 1.45rem;
  opacity: 1;
}
.foot-area { margin-top: 0.7rem; font-size: 0.92rem; line-height: 1.6; opacity: 0.7; }
.foot-base {
  margin-top: 3.2rem;
  border-top: 1px solid var(--hair-deep);
  padding-top: 1.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  justify-content: space-between;
  font-size: 0.76rem;
  opacity: 0.62;
}

/* ── Desktop composition ────────────────────────────────────── */

@media (min-width: 900px) {
  .chapter { padding-top: calc(6.4rem + 44vh); }
  .chapter--process { padding-top: calc(6.4rem + 20vh); }
  .chapter--voice, .chapter--begin { padding-top: 7rem; }
  .motif { width: min(62%, 64rem); height: 44vh; top: 6rem; right: var(--gut); }
  .motif--slim { height: 22vh; }
  .move { grid-template-columns: 1fr 1fr; align-items: baseline; gap: 2rem; }
  .towns-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 3rem; max-width: 44rem; }
  .foot-cols { grid-template-columns: 1.2fr 1fr 1fr; }
}

/* ── Motion ─────────────────────────────────────────────────── */

html.js .rv {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.6, 0.2, 1);
  transition-delay: calc(var(--i, 0) * 90ms);
}
html.js .chapter.in .rv { opacity: 1; transform: none; }

/* Draw-in is driven by WAAPI in app.js (CSS transitions on
   stroke-dashoffset stall in the headless shell); CSS only holds
   the pre-draw state, and .noanim (reduced motion / no WAAPI)
   shows the lines outright. */
html.js .motif [pathLength]:not(.dash) {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
html.js .noanim .motif [pathLength]:not(.dash) { stroke-dashoffset: 0; }

html.js .motif .dash { opacity: 0; transition: opacity 1.1s ease 0.8s; }
html.js .chapter.in .motif .dash { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .rv { opacity: 1; transform: none; transition: none; }
  html.js .motif [pathLength]:not(.dash) { stroke-dashoffset: 0; }
  html.js .motif .dash { opacity: 1; transition: none; }
  .menu-sheet.open { animation: none; }
}
