/* Tanjong Vale Architects: practice site (fictional studio).
   Rules: ../DESIGN-RULES.md, plus the practice-site exceptions in its section 13
   (one glass element, full scroll motion, CSS 3D). Square corners, no gradients,
   no shadows at rest, one accent. */

/* Self-hosted fonts (Latin subset, from Google Fonts; both SIL Open Font Licence). No request ever
   leaves the site for type. Mona Sans is variable: weight 400 to 700, width 75% to 125%. */
@font-face {
  font-family: "Mona Sans";
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 75% 125%;
  font-display: swap;
  src: url("fonts/mona-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/instrument-serif-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ground: #f2f3f0;
  --surface: #e3e6e1;
  --ink: #141715;
  --ink-soft: #3a413c;
  /* Orange accent, after Claude's own orange. The bright tone fills buttons, marks and tints
     (ink text on it is 5.8:1). Text in the accent uses the deeper tone, which keeps 4.8:1 on the
     ground. The ground stays cool off-white, so this is not the banned cream-and-terracotta pairing. */
  --accent: #d97757;
  --accent-rgb: 217, 119, 87;
  --accent-ink: #a8401f; /* 5.5:1 on the ground, 4.85:1 on the surface tone */
  --accent-wash: #f6e6dd;
  --on-accent: var(--ink);
  --placeholder: #d3d8d2;
  --glass: rgba(242, 243, 240, 0.72);
  --glass-fallback: rgba(242, 243, 240, 0.97);

  --font: "Mona Sans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  --size-display: clamp(2.5rem, 1.2rem + 5.5vw, 6rem);
  --size-h2: clamp(1.875rem, 1.2rem + 2.2vw, 3rem);
  --size-h3: 1.375rem;
  --size-body: 1.0625rem;
  --size-small: 1rem;

  --margin: clamp(16px, 3vw, 32px);
  --gutter: clamp(16px, 2vw, 32px);
  --section: clamp(64px, 10vw, 140px);
  --header-h: 76px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--size-body);
  line-height: 1.55;
  overflow-x: clip;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p,
ul,
ol,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
}

.on-dark a {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 3px solid var(--accent-ink);
  outline-offset: 3px;
}

.on-dark :focus-visible {
  outline-color: var(--ground);
}

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

[id] {
  scroll-margin-top: var(--header-h);
}

.skip {
  position: absolute;
  left: var(--margin);
  top: -100px;
  background: var(--accent-ink);
  color: var(--ground);
  padding: 12px 20px;
  z-index: 50;
}

.skip:focus {
  top: 12px;
}

.wrap {
  width: 100%;
  max-width: 1600px;
  margin-inline: auto;
  padding-inline: var(--margin);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  column-gap: var(--gutter);
  row-gap: 40px;
}

/* Header. On the home page it is fixed and turns to glass once the hero has passed:
   the one glass element on this site. */
.site-header {
  padding-block: 16px;
}

.site-header.is-fixed {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  transition: background-color 300ms var(--ease-out), -webkit-backdrop-filter 300ms var(--ease-out), backdrop-filter 300ms var(--ease-out);
}

.site-header.is-fixed.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
}

.site-header.is-fixed.glass.over-dark {
  background: rgba(20, 23, 21, 0.62);
  color: var(--ground);
}

.site-header.is-fixed.over-dark,
.site-header.is-fixed.over-dark .site-nav a {
  color: var(--ground);
}

.site-header.is-fixed.over-dark :focus-visible {
  outline-color: var(--ground);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header.is-fixed.glass {
    background: var(--glass-fallback);
  }

  .site-header.is-fixed.glass.over-dark {
    background: rgba(20, 23, 21, 0.97);
  }
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 32px;
  row-gap: 0;
}

.wordmark {
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  column-gap: 28px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  color: var(--ink-soft);
  transition: color 160ms ease;
}

/* Type */
.display {
  font-size: var(--size-display);
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 600;
  text-wrap: balance;
}

h2 {
  font-size: var(--size-h2);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 600;
  text-wrap: balance;
}

h3 {
  font-size: var(--size-h3);
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 600;
}

p {
  text-wrap: pretty;
  max-width: 62ch;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 28px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  transition: transform 160ms var(--ease-out), background-color 160ms ease;
}

.btn:active {
  transform: scale(0.97);
}

.on-dark .btn {
  background: var(--ground);
  color: var(--ink);
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    background: var(--ink);
    color: var(--ground);
  }

  .on-dark .btn:hover {
    background: var(--surface);
    color: var(--ink);
  }

  .site-nav a:hover {
    color: var(--accent-ink);
  }

  .site-header.is-fixed.over-dark .site-nav a:hover {
    color: var(--ground);
  }

  a:not(.btn):not(.wordmark):not(.skip):hover {
    color: var(--accent-ink);
  }

  .on-dark a:not(.btn):hover {
    color: var(--ground);
  }
}

/* Image placeholders (replace with real photographs and the video, see NOTES.md) */
.ph {
  background: var(--placeholder);
  color: var(--ink-soft);
  display: flex;
  align-items: flex-end;
  padding: 16px;
  font-size: var(--size-small);
  width: 100%;
}

.ph span {
  max-width: 44ch;
}

/* ---------- Hero scene ---------- */
.scene-hero {
  position: relative;
}

.stage {
  position: relative;
  padding-top: calc(var(--header-h) + clamp(24px, 6vh, 72px));
}

.hero-copy {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 40px;
  justify-items: start;
}

.hero-copy .lede {
  font-size: 1.25rem;
  line-height: 1.5;
}

.stage-3d {
  position: relative;
  margin-top: clamp(40px, 6vh, 72px);
  perspective: 1400px;
  perspective-origin: 50% 0%;
  display: grid;
  justify-items: center;
}

.plane {
  width: min(100%, 1100px);
  transform-origin: 50% 100%;
  transform-style: preserve-3d;
}

.drawing {
  width: 100%;
  height: auto;
}

.drawing .ln {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: square;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.film {
  margin-top: clamp(40px, 6vw, 88px);
  overflow: hidden;
}

.film-inner {
  aspect-ratio: 16 / 9;
  min-height: 320px;
}

/* With motion: the hero becomes a pinned stage that plays as you scroll. */
.motion .scene-hero {
  height: 340vh;
}

.motion .stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.motion .stage-3d {
  position: absolute;
  inset: var(--header-h) 0 0 0;
  margin: 0;
  align-content: end;
  padding-bottom: 7vh;
  padding-bottom: 7svh;
}

.motion .plane {
  max-height: 100%;
  will-change: transform;
}

.motion .drawing {
  max-height: 46vh;
  max-height: 46svh;
}

.motion .drawing .ln {
  stroke-dashoffset: 1;
}

.motion .film {
  position: absolute;
  inset: 0;
  margin: 0;
  z-index: 3;
  opacity: 0;
  clip-path: inset(40%);
}

.motion .film-inner {
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
  padding: calc(var(--margin) + 8px);
  will-change: transform;
}

@media (max-width: 899px) {
  .motion .scene-hero {
    height: 260vh;
  }

  .motion .drawing {
    max-height: 34vh;
    max-height: 34svh;
  }

  .motion .stage-3d {
    padding-bottom: 18vh;
    padding-bottom: 18svh;
  }
}

/* Hero copy entrance on load */
.motion .intro {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out);
  transition-delay: var(--delay, 0ms);
}

.motion.ready .intro {
  opacity: 1;
  transform: none;
}

/* ---------- Sections ---------- */
.section {
  padding-block: var(--section);
}

.section-surface {
  background: var(--surface);
}

.section-dark {
  background: var(--ink);
  color: var(--ground);
  overflow: hidden;
}

.section-dark p {
  color: var(--ground);
}

/* Text reveals */
.motion [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: opacity 700ms var(--ease-out), transform 900ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 80ms);
}

.motion [data-reveal].in {
  opacity: 1;
  transform: none;
}

/* Work: frames with 3D settle and parallax inside */
.frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  transform-origin: 50% 100%;
}

.frame-inner {
  position: absolute;
  inset: 0;
}

.motion .frame {
  will-change: transform;
}

.motion .frame-inner {
  inset: -8% 0;
  padding-bottom: calc(16px + 8%);
  will-change: transform;
}

.project {
  display: grid;
  gap: 16px;
}

.project p {
  color: var(--ink-soft);
}

.project .where {
  font-size: var(--size-small);
}

.project h3 {
  color: var(--accent-ink);
}

/* Approach: sticky heading, steps with a progress rail */
.approach-steps {
  position: relative;
}

.steps {
  display: grid;
  gap: 32px;
}

.steps h3 {
  margin-bottom: 4px;
}

.steps p {
  color: var(--ink-soft);
}

.rail {
  display: none;
}

.motion .approach-steps {
  padding-left: 32px;
}

.motion .rail {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--placeholder);
}

.motion .rail-fill {
  height: 100%;
  background: var(--accent);
  transform-origin: 50% 0;
  transform: scaleY(0);
}

/* Services */
.services li {
  padding-block: 20px;
  border-top: 1px solid var(--ink);
}

.services li:last-child {
  border-bottom: 1px solid var(--ink);
}

/* Contact + footer */
.contact-copy {
  display: grid;
  gap: 32px;
  justify-items: start;
}

.footer-name {
  margin-top: clamp(64px, 10vw, 140px);
  font-size: var(--size-display);
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 600;
  text-wrap: balance;
  max-width: none;
}

.motion .footer-name {
  will-change: transform;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  column-gap: 28px;
  margin-top: 32px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.footer-note {
  margin-top: 16px;
  font-size: var(--size-small);
  max-width: 70ch;
}

/* Legal pages */
.legal {
  padding-block: clamp(48px, 8vw, 112px);
}

.legal h1 {
  font-size: var(--size-h2);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin-bottom: 24px;
}

.legal h2 {
  font-size: var(--size-h3);
  letter-spacing: -0.01em;
  margin-top: 48px;
  margin-bottom: 12px;
}

.legal p,
.legal li {
  max-width: 70ch;
}

.legal p + p {
  margin-top: 16px;
}

.legal ul {
  list-style: disc;
  padding-left: 1.25em;
}

.legal li + li {
  margin-top: 8px;
}

.legal .draft {
  background: var(--surface);
  padding: 16px 20px;
  margin-bottom: 40px;
  max-width: 70ch;
}

/* Wider layouts */
@media (min-width: 900px) {
  .grid {
    grid-template-columns: repeat(12, 1fr);
  }

  .hero-copy {
    grid-template-columns: repeat(12, 1fr);
    column-gap: var(--gutter);
  }

  .hero-copy h1 {
    grid-column: 1 / span 10;
  }

  .hero-copy .lede,
  .hero-copy .btn {
    grid-column: 1 / span 6;
  }

  .work-head {
    grid-column: 1 / -1;
  }

  .work-lead {
    grid-column: 1 / span 8;
  }

  .work-side {
    grid-column: 9 / span 4;
    display: grid;
    gap: 40px;
    align-content: start;
  }

  .approach-head {
    grid-column: 1 / span 5;
  }

  .motion .approach-head {
    position: sticky;
    top: calc(var(--header-h) + 40px);
    align-self: start;
  }

  .approach-steps {
    grid-column: 7 / span 6;
  }

  .motion .steps {
    gap: 96px;
    padding-block: 8px;
  }

  .studio-head {
    grid-column: 1 / span 6;
  }

  .studio-list {
    grid-column: 8 / span 5;
  }

  .contact-copy {
    grid-column: 1 / span 8;
  }
}

/* ---------- Second pass: glass, gloss, glow, word reveals ---------- */
:root {
  --glow: rgba(91, 141, 184, 0.72);
  --glass-light: rgba(242, 243, 240, 0.55);
  --glass-edge-light: rgba(255, 255, 255, 0.6);
  --glass-dark: rgba(255, 255, 255, 0.07);
  --glass-edge-dark: rgba(255, 255, 255, 0.16);
}

/* Small glass chips: the hero film caption and the project location tags */
.glass-chip {
  position: absolute;
  z-index: 2;
  margin: 0;
  padding: 8px 14px;
  font-size: var(--size-small);
  color: var(--ink);
  background: var(--glass-light);
  border: 1px solid var(--glass-edge-light);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  backdrop-filter: blur(14px) saturate(1.5);
}

.frame-chip {
  top: 16px;
  left: 16px;
}

.film-caption {
  right: var(--margin);
  bottom: var(--margin);
}

.film {
  position: relative;
}

/* Nav: a short underline draws in on hover */
.site-nav a {
  position: relative;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 200ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .site-nav a:hover::after {
    transform: scaleX(1);
  }
}

/* Word-by-word heading reveal: blur in (chosen in the demo) */
.w {
  display: inline-block;
}

.wi {
  display: inline-block;
}

.motion [data-split="load"]:not(.is-split) {
  visibility: hidden;
}

/* Each word blurs in while stretching from narrow to full width. The stretch is a horizontal scale,
   not the font's width axis: the word keeps its full-width space from the first frame, so the
   heading wraps onto its final lines at once and the browser never re-flows text while it plays. */
.motion .is-split .wi {
  opacity: 0;
  filter: blur(12px);
  transform: translate3d(0, 8px, 0) scaleX(0.8);
  transform-origin: 50% 100%;
  transition: opacity 900ms var(--ease-out), filter 900ms var(--ease-out), transform 1100ms var(--ease-out);
  transition-delay: calc(var(--wi, 0) * 70ms + var(--base, 0ms));
}

.motion .is-split.in .wi,
.motion.ready h1.is-split .wi {
  opacity: 1;
  filter: blur(0);
}

.motion .is-split.in .wi,
.motion.ready h1.is-split .wi {
  transform: none;
}

h1.is-split {
  --base: 80ms;
}

/* Approach: the step the rail has reached turns to the accent */
.motion .steps h3 {
  transition: color 300ms ease;
}

.motion .steps li.on h3 {
  color: var(--accent-ink);
}

/* Services: a small nudge on hover */
@media (hover: hover) and (pointer: fine) {
  .services li {
    transition: transform 200ms var(--ease-out);
  }

  .services li {
    transition: transform 200ms var(--ease-out), color 200ms var(--ease-out);
  }

  .services li:hover {
    transform: translate3d(8px, 0, 0);
    color: var(--accent-ink);
  }
}

/* The 3D glass pane */
.pane-scene {
  position: relative;
  perspective: 1200px;
  padding-block: clamp(24px, 4vw, 56px);
  isolation: isolate;
}

.pane-glow {
  position: absolute;
  z-index: 0;
  /* No blur filter: the gradient already fades to nothing at its edge, and a blurred layer that
     drifts forces the glass pane's own blur above it to be redrawn every frame. */
  left: calc(8% - 28px);
  top: -28px;
  width: calc(84% + 56px);
  aspect-ratio: 1;
  background: radial-gradient(closest-side, var(--glow), rgba(91, 141, 184, 0));
  opacity: 0.7;
  will-change: transform;
  pointer-events: none;
  transition: opacity 400ms ease;
}

.pane {
  position: relative;
  z-index: 1;
  overflow: hidden;
  padding: clamp(28px, 3.5vw, 48px);
  display: grid;
  gap: 16px;
  color: var(--ground);
  background: var(--glass-dark);
  border: 1px solid var(--glass-edge-dark);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 40px 80px -30px rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  backdrop-filter: blur(22px) saturate(1.5);
  transform: rotateY(-23deg) rotateX(8.6deg);
  transform-style: preserve-3d;
}

.pane::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.05) 38%, rgba(255, 255, 255, 0) 62%);
  pointer-events: none;
}

.pane-sheen {
  position: absolute;
  top: -50%;
  bottom: -50%;
  left: 0;
  width: 45%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.32) 50%, rgba(255, 255, 255, 0) 100%);
  transform: translate3d(-160%, 0, 0) rotate(12deg);
  pointer-events: none;
}

.pane-title {
  font-size: var(--size-h3);
  font-weight: 600;
  letter-spacing: -0.01em;
  position: relative;
}

.pane-address {
  font-style: normal;
  line-height: 1.6;
  position: relative;
}

.pane-mail {
  position: relative;
}

.pane-mail a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

@media (hover: hover) and (pointer: fine) {
  .pane-scene:hover .pane-glow {
    opacity: 1;
  }
}

.motion .pane-glow {
  animation: glow-drift 14s ease-in-out infinite alternate;
  animation-play-state: paused;
}

.motion .pane-scene.live .pane-glow {
  animation-play-state: running;
}

/* While the page scrolls, the glow behind the glass pane holds still, so the pane's blur has less
   to recompute. */
.motion.is-scrolling .pane-scene.live .pane-glow {
  animation-play-state: paused;
}

@keyframes glow-drift {
  from {
    transform: translate3d(-6%, -4%, 0) scale(1);
  }
  to {
    transform: translate3d(6%, 5%, 0) scale(1.08);
  }
}

@media (max-width: 899px) {
  .pane {
    transform: rotateY(-8deg) rotateX(4deg);
  }

  .pane-scene {
    margin-top: 24px;
  }
}

@media (min-width: 900px) {
  .contact-copy {
    grid-column: 1 / span 6;
    align-self: center;
  }

  .pane-scene {
    grid-column: 8 / span 5;
  }
}

/* ---------- Third pass: photographs, marquee, image reveals ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

img.frame-inner,
img.film-inner {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Keep the stilt house in frame when a narrow screen crops the sides. */
  object-position: 80% 50%;
  padding: 0;
}

.frame img.frame-inner {
  height: auto;
  position: absolute;
  inset: 0;
  height: 100%;
}

.motion .frame img.frame-inner {
  inset: -8% 0;
  height: 116%;
  padding: 0;
}

.film {
  background: var(--ink);
}

.motion .film img.film-inner {
  height: 100%;
  padding: 0;
}

.credit {
  font-size: var(--size-small);
  color: var(--ink-soft);
}

.footer-note a {
  color: inherit;
}

/* Frames open from the bottom as they arrive, and the photo leans in on hover */
.motion .frame {
  clip-path: inset(100% 0 0 0);
  transition: clip-path 1000ms var(--ease-in-out);
}

.motion .frame.in {
  clip-path: inset(0 0 0 0);
}

.frame .frame-chip {
  transition: transform 300ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .frame img.frame-inner {
    transition: scale 700ms var(--ease-out);
  }

  .frame:hover img.frame-inner {
    scale: 1.04;
  }

  .frame:hover .frame-chip {
    transform: translate3d(6px, 6px, 0);
  }
}

/* Marquee: two rows of what the studio designs, moving in opposite directions with the scroll */
.marquee {
  padding-block: clamp(48px, 8vw, 112px);
  overflow: hidden;
  display: grid;
  gap: clamp(8px, 1vw, 16px);
}

.marquee-row {
  display: flex;
  gap: clamp(32px, 5vw, 80px);
  white-space: nowrap;
  font-size: var(--size-display);
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 600;
  will-change: transform;
}

.marquee-row-soft {
  color: var(--ink-soft);
  font-weight: 400;
}
/* ---------- Fourth pass: drawing-to-photo swap on project frames ---------- */
/* Each frame first shows its line drawing; as it scrolls toward the middle of the screen the lines
   draw themselves, then the drawing wipes away to reveal the photo. Hovering reveals the photo at once.
   Without motion, only the photo shows. */
.frame-drawing {
  display: none;
}

.motion .frame-drawing {
  display: block;
  position: absolute;
  inset: 0;
  /* Above the location tag, so the tag appears with the photo instead of floating on a blank frame. */
  z-index: 3;
  background: var(--ground);
  clip-path: inset(0 0 0 0);
}

.motion .frame-drawing.is-hover {
  transition: clip-path 600ms var(--ease-out);
}

.frame-drawing svg {
  width: 100%;
  height: 100%;
  padding: 6%;
}

.frame-drawing .ln {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: square;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

/* ---------- Fifth pass: contrast selection, text sweep, focus text, glass ribbons ---------- */

/* Contrast selection: black highlight with white text on light sections, inverted on dark ones */
::selection {
  background: var(--ink);
  color: #ffffff;
}

.on-dark ::selection,
.site-header.over-dark ::selection {
  background: #ffffff;
  color: var(--ink);
}

/* Light sweep: a soft band of light passes through the letters of a heading when the pointer is
   over it. The band is a copy of the heading's own text (data-sweep, set by script.js) laid exactly
   over it, with the light clipped to the glyphs, so nothing lights up outside the letters. */
.sweep {
  position: relative;
}

.sweep::after {
  content: attr(data-sweep);
  /* Same text, but marked as decoration so screen readers never read the heading twice. */
  content: attr(data-sweep) / "";
  position: absolute;
  inset: 0;
  padding: inherit;
  box-sizing: border-box;
  pointer-events: none;
  color: transparent;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.75) 50%, rgba(255, 255, 255, 0) 60%) no-repeat;
  background-size: 260% 100%;
  background-position: 130% 0;
  -webkit-background-clip: text;
  background-clip: text;
  opacity: 0;
}

.on-dark .sweep::after {
  background-image: linear-gradient(100deg, rgba(var(--accent-rgb), 0) 40%, rgba(var(--accent-rgb), 0.9) 50%, rgba(var(--accent-rgb), 0) 60%);
}

/* The footer keeps its original cool light. */
footer .sweep::after {
  background-image: linear-gradient(100deg, rgba(91, 141, 184, 0) 40%, rgba(140, 180, 214, 0.9) 50%, rgba(91, 141, 184, 0) 60%);
}

@media (hover: hover) and (pointer: fine) {
  .motion .sweep:hover::after {
    opacity: 1;
    background-position: -30% 0;
    transition: background-position 1800ms cubic-bezier(0.65, 0, 0.35, 1), opacity 200ms ease;
  }
}

/* Focus text (after the attached reference): the statement sits soft and blurred, one word at a time
   comes into focus, and four corner marks glide to frame it. Hovering a word focuses it. */
.focus-text {
  position: relative;
  margin-top: 28px;
  font-size: clamp(1.5rem, 1rem + 1.4vw, 2.25rem);
  line-height: 1.3;
  letter-spacing: -0.015em;
  font-weight: 500;
  max-width: 26ch;
}

.fw {
  display: inline-block;
}

.motion .focus-text.is-live .fw {
  opacity: 0.35;
  filter: blur(2px);
  transition: opacity 240ms ease, filter 240ms ease;
}

.motion .focus-text.is-live .fw.on {
  opacity: 1;
  filter: none;
}

.fc {
  position: absolute;
  left: 0;
  top: 0;
  width: 10px;
  height: 10px;
  border: 0 solid var(--accent);
  pointer-events: none;
  opacity: 0;
  transition: transform 280ms cubic-bezier(0.77, 0, 0.175, 1), opacity 200ms ease;
}

.focus-text.is-live .fc {
  opacity: 1;
}

.fc-tl { border-top-width: 1.5px; border-left-width: 1.5px; }
.fc-tr { border-top-width: 1.5px; border-right-width: 1.5px; }
.fc-bl { border-bottom-width: 1.5px; border-left-width: 1.5px; }
.fc-br { border-bottom-width: 1.5px; border-right-width: 1.5px; }

/* Glass ribbons: translucent, glossy tubes drifting behind a section */
.has-ribbons {
  position: relative;
  isolation: isolate;
}

.has-ribbons > .wrap {
  position: relative;
  z-index: 1;
}

.ribbons {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  /* The ribbons are their own compositor layer: their ripples repaint only themselves, and the
     scroll drift moves the whole layer without any repaint. They may run past the SVG box (the
     section clips them), so their ends never show a cut when the layer drifts. */
  overflow: visible;
  contain: size layout style;
  will-change: transform;
}

.has-ribbons {
  overflow: clip;
}

.ribbon {
  will-change: transform;
}

.ribbons path {
  fill: none;
  stroke-linecap: round;
}

.rb-shade {
  stroke: rgba(20, 23, 21, 0.06);
  stroke-width: 64;
}

.rb-body {
  stroke: rgba(255, 255, 255, 0.45);
  stroke-width: 56;
}

.rb-shine {
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 6;
}

.ribbons .thin.rb-shade { stroke-width: 30; }
.ribbons .thin.rb-body { stroke-width: 26; }
.ribbons .thin.rb-shine { stroke-width: 3; }

.rb-body.dark {
  stroke: rgba(140, 180, 214, 0.1);
  stroke-width: 60;
}

.rb-shine.dark {
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 4;
}

.ribbons .dark.thin.rb-body { stroke-width: 28; }
.ribbons .dark.thin.rb-shine { stroke-width: 2; }

/* ---------- Seventh pass: morphing drawings ---------- */
/* A pinned stage between the hero and the work: one line drawing turns from the courtyard house into
   the timber warehouse, then into the reading room, as you scroll. The caption of the building on show
   is marked. Without motion the three drawings sit side by side instead. */
.morph {
  position: relative;
  padding-block: var(--section);
}

.morph-stage {
  display: grid;
  gap: clamp(24px, 4vh, 48px);
}

.morph-art {
  display: grid;
  gap: 24px;
}

.morph-svg {
  width: 100%;
  height: auto;
  max-height: 52vh;
}

.morph-svg path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: square;
  stroke-linejoin: miter;
  vector-effect: non-scaling-stroke;
}

.morph-statics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--gutter);
}

.morph-statics svg {
  width: 100%;
  height: auto;
}

.morph-captions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: var(--gutter);
}

.morph-captions li {
  display: grid;
  gap: 4px;
  padding-top: 16px;
  border-top: 3px solid var(--placeholder);
  transition: border-color 300ms ease;
}

.morph-name {
  font-weight: 600;
  color: var(--ink-soft);
  transition: color 300ms ease;
}

.morph-where {
  font-size: var(--size-small);
  color: var(--ink-soft);
}

.morph-captions li.on {
  border-top-color: var(--accent);
}

.morph-captions li.on .morph-name {
  color: var(--accent-ink);
}

.motion .morph {
  height: 320vh;
  padding: 0;
}

.motion .morph-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  padding-top: calc(var(--header-h) + clamp(24px, 5vh, 56px));
  padding-bottom: clamp(24px, 5vh, 56px);
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.motion .morph-art {
  align-content: center;
  min-height: 0;
}

.motion .morph-svg {
  max-height: 100%;
}

@media (max-width: 899px) {
  .motion .morph {
    height: 260vh;
  }

  .morph-name {
    font-size: var(--size-small);
  }
}

/* ---------- Eighth pass: serif, liquid glass, highlighter, feature card, mask reveals ---------- */
:root {
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --marker: rgba(var(--accent-rgb), 0.38);
  --marker-dark: rgba(var(--accent-rgb), 0.6);
}

/* Second typeface: Instrument Serif (upright only) for section headings and statements */
h2,
.focus-text,
.marquee-row-soft {
  font-family: var(--serif);
  font-weight: 400;
}

h2 {
  font-size: clamp(2.25rem, 1.3rem + 2.8vw, 3.75rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
}

.focus-text {
  font-size: clamp(1.75rem, 1.1rem + 1.6vw, 2.5rem);
  line-height: 1.2;
  letter-spacing: 0;
}

.marquee-row-soft {
  letter-spacing: -0.01em;
}

.legal h1,
.legal h2 {
  font-family: var(--font);
  font-weight: 600;
}

/* Liquid glass wordmark */
.liquid-wrap {
  position: relative;
  margin-top: clamp(64px, 10vw, 140px);
  max-width: 820px;
}

/* A soft neutral light behind the glass name: just enough brightness for the glass to read against
   the black footer, with no colour of its own (blue, then orange, both removed on 2026-11-08).
   Soft edges into the footer. */
.liquid-field {
  position: absolute;
  inset: -34% -16% -40% -12%;
  background:
    radial-gradient(closest-side at 50% 48%, rgba(236, 238, 236, 0.2), rgba(236, 238, 236, 0.06) 60%, rgba(236, 238, 236, 0)),
    radial-gradient(closest-side at 48% 52%, rgba(150, 156, 152, 0.16), rgba(150, 156, 152, 0));
  /* No blur filter: these radials fade to nothing inside the box (closest-side), and a 26px blur
     over this area was costly to redraw. */
  pointer-events: none;
}

.liquid {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* Performance: the drifting wrapper, the filtered glass and the moving effects each get their own
   compositor layer. The glass (two SVG filters) is then painted once and only moved, never
   re-filtered, while the page scrolls, the ribbons ripple, the glint passes or the rim light moves. */
.liquid-wrap,
.liquid,
.liquid-fx {
  will-change: transform;
}

.liquid-fx {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.lq-text {
  font-family: var(--font);
  font-size: 150px;
  font-weight: 500;
  font-stretch: 100%;
  letter-spacing: 0;
}

.liquid-wrap + .footer-links {
  margin-top: clamp(110px, 14vw, 190px);
}

/* Hand-drawn highlighter: an uneven marker stroke drawn in behind the words */
mark.hl {
  position: relative;
  background: none;
  color: inherit;
  white-space: nowrap;
  isolation: isolate;
}

.hl-svg {
  position: absolute;
  left: -0.18em;
  right: -0.18em;
  top: 0.12em;
  bottom: -0.02em;
  width: calc(100% + 0.36em);
  height: calc(100% - 0.1em);
  z-index: -1;
  overflow: visible;
  pointer-events: none;
}

.hl-svg path {
  fill: none;
  stroke: var(--marker);
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: url(#marker-rough);
}

.on-dark .hl-svg path {
  stroke: var(--marker-dark);
}

.motion .hl-svg path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 800ms cubic-bezier(0.65, 0, 0.35, 1);
}

.motion .hl-svg path + path {
  transition-delay: 450ms;
}

.motion mark.hl.in .hl-svg path {
  stroke-dashoffset: 0;
}

/* Standalone feature card with a deep glow behind it */
.card-section {
  padding-block: clamp(48px, 8vw, 120px);
}

.feature-card {
  position: relative;
  isolation: isolate;
  max-width: 1080px;
  margin-inline: auto;
  background: var(--ink);
  color: var(--ground);
  border-radius: 14px;
  box-shadow: 0 50px 120px -30px rgba(var(--accent-rgb), 0.55), 0 20px 40px -20px rgba(20, 23, 21, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: visible;
}

/* Performance: the soft edge is drawn into the gradient itself (a wider box with a long fade)
   instead of a 40px blur filter, which the browser had to recompute while the card scrolled. */
.card-glow {
  position: absolute;
  z-index: -1;
  inset: calc(10% - 60px) calc(8% - 60px) calc(-14% - 60px) calc(8% - 60px);
  background: radial-gradient(closest-side at 50% 58%, rgba(var(--accent-rgb), 0.46), rgba(var(--accent-rgb), 0.22) 45%, rgba(var(--accent-rgb), 0.06) 75%, rgba(var(--accent-rgb), 0));
  pointer-events: none;
}

.feature-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 70%) var(--my, 20%), rgba(240, 170, 140, 0.16), rgba(240, 170, 140, 0) 70%);
  transition: opacity 300ms ease;
}

.card-body {
  position: relative;
  display: grid;
  gap: 28px;
  justify-items: start;
  padding: clamp(36px, 6vw, 88px);
}

.card-body p {
  color: var(--ground);
  font-size: 1.25rem;
  line-height: 1.5;
  max-width: 46ch;
}

/* Soft mask reveal for paragraphs (after paligan.com): text dissolves in from the left */
@property --rv {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}

.motion p[data-reveal] {
  --rv: 0%;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(var(--rv) - 25%), transparent var(--rv));
  mask-image: linear-gradient(90deg, #000 calc(var(--rv) - 25%), transparent var(--rv));
  transition: opacity 700ms var(--ease-out), transform 900ms var(--ease-out), --rv 1200ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 80ms);
}

.motion p[data-reveal].in {
  --rv: 130%;
}

/* Page transitions between the home page and the legal pages (where the browser supports them) */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: vt-out 280ms var(--ease-out) both;
}

::view-transition-new(root) {
  animation: vt-in 520ms var(--ease-out) both;
}

@keyframes vt-out {
  to { opacity: 0; transform: translate3d(0, -12px, 0); }
}

@keyframes vt-in {
  from { opacity: 0; transform: translate3d(0, 16px, 0); }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}

/* Gradient G1, the site's only gradient (Eben allows gradients one at a time, with approval, and
   each can be reverted): the hero's ground warms to a faint peach toward the bottom, like morning
   light on drawing paper. To revert, delete this rule. */
.stage {
  background: linear-gradient(180deg, var(--ground) 0%, var(--ground) 38%, var(--accent-wash) 100%);
}

/* ---------- Ninth pass: 3D house plan beside the hero ---------- */
/* Wide screens only. On phones and tablets the hero keeps the single drawing as its own composition. */
.plan3d {
  display: none;
}

@media (min-width: 1024px) {
  .hero-copy {
    align-items: start;
  }

  .plan3d {
    display: block;
    grid-column: 7 / span 6;
    grid-row: 2 / span 2;
    justify-self: stretch;
    align-self: start;
    margin-top: -32px;
  }

  /* While the hero is a pinned scene, let the model hang below the copy instead of pushing the
     button down. In the static page it keeps its full height in the flow. */
  .motion .plan3d {
    margin-bottom: -150px;
  }
}

.p3-view {
  position: relative;
  height: clamp(220px, 32vh, 300px);
  perspective: 1100px;
  perspective-origin: 50% 35%;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.p3-dragging .p3-view {
  cursor: grabbing;
}

/* Gradient G2 (approved by Eben, 2026-11-08): a soft orange glow behind the 3D plan, after the
   feature card's glow. It is dim while the plan lies flat, full once the walls stand, and a little
   brighter while you drag. To revert, delete this rule, the two below it, and the .p3-glow div. */
.p3-glow {
  position: absolute;
  /* Soft edge drawn into the gradient (wider box, longer fade) rather than a 34px blur filter. */
  inset: calc(6% - 40px) calc(2% - 40px) calc(-10% - 40px) calc(2% - 40px);
  background: radial-gradient(closest-side, rgba(var(--accent-rgb), 0.8), rgba(var(--accent-rgb), 0.4) 45%, rgba(var(--accent-rgb), 0.12) 75%, rgba(var(--accent-rgb), 0));
  opacity: 0.85;
  pointer-events: none;
  transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out);
}

.p3-flat .p3-glow {
  opacity: 0.35;
  transform: scale(0.9);
}

.p3-dragging .p3-glow {
  opacity: 1;
  transform: scale(1.06);
}

.p3-view:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 4px;
}

.p3-model {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 500px;
  height: 280px;
  margin: -140px 0 0 -250px;
  transform-style: preserve-3d;
  transform: scale(0.8) rotateX(58deg) rotateZ(-30deg);
  will-change: transform;
}

.p3-sheet,
.p3-bldg {
  position: absolute;
  transform-style: preserve-3d;
}

.p3-sheet {
  inset: 0;
  background: var(--surface);
}

.p3-plan {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.p3-plan path {
  fill: none;
  stroke: var(--ink);
}

.p3-poche path {
  stroke-width: 5;
  stroke-linecap: square;
}

.p3-low path {
  stroke-width: 3;
  stroke-linecap: square;
}

.p3-thin path {
  stroke-width: 1;
}

.p3-bldg {
  left: 30px;
  top: 30px;
  width: 440px;
  height: 220px;
}

.p3-room {
  position: absolute;
  left: calc(var(--x) * 1px);
  top: calc(var(--y) * 1px);
  width: calc(var(--w) * 1px);
  height: calc(var(--h) * 1px);
  transform: translateZ(0.5px);
  transition: background-color 200ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .p3-room:hover {
    background-color: rgba(var(--accent-rgb), 0.16);
  }
}

/* Walls stand up from their plan line. Solid walls are a pale wash with a fine edge, glazed walls a
   clearer blue, and the courtyard's garden walls are low. */
.p3-wall {
  position: absolute;
  left: calc(var(--x) * 1px);
  top: calc(var(--y) * 1px);
  width: calc(var(--l) * 1px);
  height: var(--wh, 64px);
  transform-origin: 0 0;
  transform: rotateZ(calc(var(--a, 0) * 1deg)) rotateX(90deg);
  background: rgba(var(--accent-rgb), 0.07);
  border: 1px solid rgba(20, 23, 21, 0.6);
  pointer-events: none;
  clip-path: inset(0);
  transition: clip-path 420ms var(--ease-out) calc(var(--i, 0) * 40ms);
}

.p3-wall.low {
  --wh: 24px;
}

.p3-wall.glass {
  background: rgba(var(--accent-rgb), 0.18);
  border-color: rgba(var(--accent-rgb), 0.75);
}

.p3-flat .p3-wall {
  clip-path: inset(0 0 100% 0);
  transition-duration: 280ms;
  transition-delay: 0ms;
}

.p3-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
}

.p3-caption {
  font-size: var(--size-small);
  color: var(--ink-soft);
  min-height: 1.55em;
}

.p3-toggle {
  display: flex;
  gap: 8px;
  flex: none;
}

.p3-toggle button {
  min-width: 56px;
  min-height: 44px;
  padding: 0 14px;
  font: inherit;
  font-size: var(--size-small);
  color: var(--ink);
  background: transparent;
  border: 1px solid rgba(20, 23, 21, 0.35);
  cursor: pointer;
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}

.p3-toggle button[aria-pressed="true"] {
  background: var(--surface);
  border-color: var(--ink);
  font-weight: 600;
}

.p3-toggle button:active {
  transform: scale(0.97);
}

.p3-toggle button:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .p3-toggle button[aria-pressed="false"]:hover {
    border-color: var(--ink);
  }
}

@media (prefers-reduced-motion: reduce) {
  .p3-wall,
  .p3-flat .p3-wall {
    transition: none;
  }
}

/* Reduced motion: no class "motion" is added, so every scene above renders as a static page.
   This block only softens what remains. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn:active {
    transform: none;
  }
}
