/* Canuto Architecture + Design: lot-to-home hero.
   The film fills the whole screen. The wordmark, the menu and one headline at a time sit on it.
   No band, shade or fog: the headline is anchored just above the roofline, over the dark far forest, where white
   letters measure 5.7 to 1 or better against the picture in every chapter (4.1 against its brightest tenth), and a
   soft shadow under the letters covers the rest. The menu sits over the bright lake, so it gets a small dark chip.
   Chapters 1 and 2 are a drawing on white paper: there the words are ink, with no shadow and no chip. */

@font-face { font-family: "Cormorant Garamond"; src: url("/fonts/cormorant-garamond-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/fonts/instrument-sans-var.woff2") format("woff2"); font-weight: 400 600; font-style: normal; font-display: swap; }

:root {
  --paper: #fff;
  --ink: #15171c;
  --muted: #5a5f6a;
  --night: #10121a;
  --night-muted: #a9afbd;
  --serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Instrument Sans", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --gut: clamp(1.25rem, 2.6vw, 2.75rem);
  --bar: 4rem;        /* wordmark and menu row */
  --seg: 85vh;        /* scroll distance for one build stage */
  --dwell: 90vh;      /* scroll distance held on the finished home while dusk plays */

  /* where the picture's parts land on screen. The frame is 16:9, shown full width with its bottom edge on the
     bottom of the screen; the chimney top is 33.5% down the frame. */
  --fw: min(100vw, calc((100vh - var(--bar) - 85px) * 2.6734));   /* film width: capped on very wide windows so at least 85px stays clear above the chimney */
  --fh: max(100vh, calc(var(--fw) * .5625));                      /* frame height on screen */
  --chim: calc(100vh - .665 * var(--fh));                         /* chimney top, from the top of the screen */
  --fs: min(clamp(2.25rem, 3.5vw, 3.75rem), calc((var(--chim) - var(--bar)) * .5));   /* headline size */

  /* colours while the film is a drawing on paper */
  --bg: var(--paper);
  --fg: var(--ink);
  --soft: var(--muted);
  --lift: none;
}
@supports (height: 100svh) {
  :root { --fw: min(100vw, calc((100svh - var(--bar) - 85px) * 2.6734)); --fh: max(100svh, calc(var(--fw) * .5625)); --chim: calc(100svh - .665 * var(--fh)); }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--night); color: var(--ink); font-family: var(--sans); font-size: 1rem; line-height: 1.5; }
img, video { display: block; max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.skip { position: absolute; left: var(--gut); top: -4rem; z-index: 10; padding: .6rem .9rem; background: var(--ink); color: #fff; text-decoration: none; }
.skip:focus { top: .6rem; }

/* ---------- hero ---------- */
.hero { position: relative; }
.js .hero { height: calc(100vh + 7 * var(--seg) + var(--dwell)); }

.stage { position: relative; height: 100vh; height: 100svh; overflow: hidden; background: var(--bg); color: var(--fg); transition: background-color .6s ease, color .5s ease; }
.js .stage { position: sticky; top: 0; }
/* once the photo has arrived (chapter 3 on); also the still page shown with scripting off or "reduce motion" on */
.stage.is-photo, html:not(.js) .stage { --bg: var(--night); --fg: #fff; --soft: var(--night-muted); --lift: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 26px rgba(0, 0, 0, .45); }

.film { position: absolute; inset: 0; display: flex; justify-content: center; }
.film-box { position: relative; width: var(--fw); height: 100%; overflow: hidden; }
.still, .reel { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: var(--ox, 50%) 100%; }
.reel { visibility: hidden; }
.reel.is-on { visibility: visible; }
.js .last { display: none; }
html:not(.js) .first { display: none; }
html:not(.js) .film-box { --ox: 26%; }

.bar { position: absolute; left: 0; right: 0; top: 0; z-index: 3; height: var(--bar); padding-inline: var(--gut); display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.mark { font-size: .8125rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; text-decoration: none; white-space: nowrap; text-shadow: var(--lift); transition: text-shadow .5s ease; }
.nav { display: flex; gap: clamp(1.1rem, 2vw, 2rem); padding: 0 1.25rem; margin-right: -1.25rem; background: transparent; transition: background-color .5s ease; }
.is-photo .nav, html:not(.js) .nav { background: rgba(16, 18, 26, .74); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); margin-right: 0; }
.nav a { font-size: .9375rem; text-decoration: none; padding-block: .6rem; background: linear-gradient(currentColor, currentColor) 0 calc(100% - .4rem) / 0 1px no-repeat; transition: background-size .25s ease-out; }
.nav a:hover, .nav a:focus-visible { background-size: 100% 1px; }
.menu-btn { display: none; font: inherit; font-size: .9375rem; color: inherit; background: none; border: 1px solid currentColor; border-radius: 0; padding: .45rem .9rem; min-height: 2.75rem; cursor: pointer; }

/* the headline: its bottom sits a little above the chimney top, whatever the window */
.title { position: absolute; z-index: 2; left: 0; right: 0; top: calc(var(--chim) - max(26px, .5 * var(--fs)) - var(--fs)); height: var(--fs); padding-inline: var(--gut); display: flex; align-items: center; justify-content: center; }
.step { display: none; margin: 0; font-size: .8125rem; letter-spacing: .14em; text-transform: uppercase; color: var(--soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.step-name { margin-left: .9em; color: var(--fg); }
.say { display: flex; align-items: center; gap: 1.75rem; }
.lines { margin: 0; display: grid; font-family: var(--serif); font-weight: 500; font-size: var(--fs); line-height: 1; letter-spacing: -.005em; text-align: center; white-space: nowrap; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 26px rgba(0, 0, 0, .45); }
.line { grid-area: 1 / 1; opacity: 0; visibility: hidden; transform: translateY(.3em); transition: opacity .35s ease-out, transform .35s ease-out, visibility 0s .35s; }
.line:nth-child(-n+2) { color: var(--ink); text-shadow: none; }     /* the two drawing chapters: ink on paper */
.line.is-on { opacity: 1; visibility: visible; transform: none; transition: opacity .45s ease-out .12s, transform .45s ease-out .12s, visibility 0s; }
/* before the script has set the first chapter: show headline 1 at once, with no swap from the last one */
.js:not(.ready) .line { opacity: 0; visibility: hidden; transition: none; }
.js:not(.ready) .line:first-child { opacity: 1; visibility: visible; transform: none; }
.cta { flex: none; display: inline-flex; align-items: center; min-height: 2.75rem; padding: .55rem 1.35rem; font-size: .9375rem; font-weight: 500; text-decoration: none; white-space: nowrap; background: #fff; color: var(--ink); transition: opacity .3s ease-out, transform .15s ease-out; }
.cta:hover { opacity: .88; }
.cta:active { transform: scale(.97); }
.js .cta { display: none; }
.js .at-end .cta { display: inline-flex; }

.cue { position: absolute; z-index: 2; right: var(--gut); bottom: 1.5rem; margin: 0; display: none; align-items: center; gap: .6rem; font-size: .8125rem; letter-spacing: .14em; text-transform: uppercase; color: var(--soft); transition: opacity .3s ease-out; }
.js .cue { display: flex; }
.js .is-moved .cue { opacity: 0; }
.cue svg { animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(3px); } }

.rule { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; height: 2px; background: var(--fg); transform: scaleX(var(--p, 0)); transform-origin: 0 50%; display: none; transition: background-color .5s ease; }
.js .rule { display: block; }

@media (max-height: 760px) and (min-width: 761px) { :root { --bar: 3.25rem; } }

/* ---------- phones and tall windows: film on top (whole frame), words under it ---------- */
@media (max-width: 760px), (max-aspect-ratio: 13/10) {
  :root { --seg: 70vh; --dwell: 80vh; --bar: 3.5rem; }
  .stage { display: flex; flex-direction: column; }
  .film { position: static; flex: none; display: block; }
  /* a window 79% of the frame's width: the plan sits in the middle of the frame (14 to 86%), the house to the left
     of middle (6 to 83%), so the window slides from 50% to 26% during the first stage (set by hero.js) */
  .film-box { width: 100%; height: auto; aspect-ratio: 1.404; }
  .still, .reel { object-position: var(--ox, 50%) 50%; }
  .rule { position: static; flex: none; }
  .title { position: static; flex: 1; height: auto; min-height: 0; display: grid; grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; align-content: start; justify-items: center; row-gap: 1rem; padding: clamp(1.5rem, 8vh, 5rem) var(--gut) 1.25rem; text-align: center; }
  .step { display: block; }
  .say { flex-direction: column; gap: 1.25rem; }
  .lines { font-size: clamp(2.125rem, 9.4vw, 3.25rem); line-height: 1.04; white-space: normal; text-wrap: balance; min-height: 2.08em; align-items: center; color: var(--fg); text-shadow: none; transition: color .5s ease; }
  .line:nth-child(-n+2) { color: inherit; }
  .cta { background: var(--fg); color: var(--bg); }
  .cue { right: 0; left: 0; justify-content: center; bottom: 1.25rem; }

  .menu-btn { display: inline-flex; align-items: center; background: transparent; transition: background-color .5s ease; }
  .is-photo .menu-btn, html:not(.js) .menu-btn { background: rgba(16, 18, 26, .74); border-color: transparent; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
  .nav, .is-photo .nav, html:not(.js) .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; gap: 0; margin: 0; padding: .25rem var(--gut) 1rem; background: var(--night); color: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .nav.is-open { display: flex; }
  .nav a { font-size: 1.0625rem; padding-block: .8rem; border-top: 1px solid #2a2e3a; background: none; }
  .nav a:first-child { border-top: 0; }
}
@media (max-width: 400px) { .mark { font-size: .6875rem; letter-spacing: .16em; } }

/* ---------- after the film ---------- */
.close { padding: clamp(5rem, 14vh, 9rem) var(--gut); background: var(--night); color: #fff; text-align: center; }
.close h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: clamp(2.25rem, 4.2vw, 4rem); line-height: 1.05; }
.close-where { margin: 1.5rem 0 0; font-size: .8125rem; letter-spacing: .2em; text-transform: uppercase; color: var(--night-muted); }
.close-mail { display: inline-flex; align-items: center; min-height: 2.75rem; margin-top: 1.25rem; font-size: 1.125rem; text-underline-offset: .3em; }
.foot { display: flex; justify-content: space-between; gap: 1rem; padding: 1.5rem var(--gut); background: var(--night); color: var(--night-muted); font-size: .8125rem; letter-spacing: .14em; text-transform: uppercase; border-top: 1px solid #2a2e3a; }
.foot p { margin: 0; }

/* 404 */
.lost { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lost h1 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: clamp(2.25rem, 4.2vw, 4rem); line-height: 1.05; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
