/* ============================================================================
   Jaq Figueroa Interiors — "Grand Tour"
   Pattern: full-page scroll-scrubbed film (one continuous walk through one home).
   Forked from the CertiPro Pattern-3 engine; retinted to the Figueroa brand.
   Modes:
     scrub  → desktop/fine-pointer: 192-frame canvas scrubbed by whole-page scroll
     video  → mobile/coarse/low-mem/save-data: ambient looping <video> bg
     static → prefers-reduced-motion: single poster frame, no motion
   Legibility doctrine: text NEVER sits raw on the bright film. It rides an
   Inkwell-glass island with a brass hairline, or a local scrim. The film is
   decoration; the dark glass carries the contrast.
   ============================================================================ */

/* ─────────────────────────── Tokens ─────────────────────────── */
:root {
  /* Brand palette (locked — brand-dna/02_color-palette.md) */
  --ink:      #14141A;   /* Inkwell — never pure black */
  --ink-2:    #1B1B22;   /* elevated ink */
  --brass:    #B8965A;   /* Champagne Brass — primary metallic */
  --brass-soft: #C9A572; /* Antique Gold — softer metallic */
  --bone:     #F5F1EA;   /* Bone — primary "white" */
  --carrara:  #FAFAF7;   /* Marble white */
  --greige:   #A9A097;   /* grounding mid — captions only */
  --mauve:    #C9A0A4;   /* soft blush accent */
  --wine:     #5C1F26;   /* drama accent — red roses */
  --forest:   #2D3B2A;   /* botanical accent */

  --warm-dim: #D8D2C6;   /* muted warm body over dark glass */

  /* Per-beat accent (JS swaps --accent / --accent-soft as each beat activates) */
  --accent:      var(--brass);
  --accent-soft: var(--brass-soft);

  /* Inkwell-glass surfaces (dark tint + alpha over the bright film) */
  --glass:        rgba(20, 20, 26, 0.60);
  --glass-strong: rgba(15, 15, 20, 0.78);
  --glass-line:   rgba(184, 150, 90, 0.32);   /* brass hairline */
  --glass-line-2: rgba(245, 241, 234, 0.12);  /* bone hairline */

  /* Type */
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

  /* Rhythm */
  --pad-section: clamp(5rem, 12vh, 9rem);
  --radius: 22px;
  --radius-sm: 14px;
  --maxw: 1200px;
  --ease-lux: cubic-bezier(0.16, 1, 0.3, 1);

  /* Shadows */
  --shadow-island: 0 30px 80px -30px rgba(0,0,0,0.7), 0 8px 24px -12px rgba(0,0,0,0.55);
  --shadow-soft:   0 18px 50px -24px rgba(0,0,0,0.62);
}

/* ─────────────────────────── Reset ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--bone);
  background: var(--ink); /* base behind everything, until canvas paints */
  line-height: 1.6;
  font-weight: 400;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: --accent 0.6s;
}
img, svg, video, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-family: var(--serif); font-weight: 600; line-height: 1.05; letter-spacing: -0.015em; }
p { margin: 0; }
ol, ul { margin: 0; padding: 0; list-style: none; }
em { font-style: italic; color: var(--accent-soft); font-weight: 500; transition: color .6s var(--ease-lux); }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1.25rem, 5vw, 3rem); }

.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 200;
  background: var(--brass); color: var(--ink); padding: .65rem 1rem; border-radius: 10px;
  font-weight: 600; transition: top .2s;
}
.skip-link:focus { top: 1rem; }

:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 6px; }

/* ─────────────────────────── Background stage (the film) ─────────────────────────── */
#stage { position: fixed; inset: 0; z-index: 0; background: var(--ink); }
#film, #ambient, #poster {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity .8s ease;
}
/* Mode switching — body class decides which background layer is live */
body.mode-scrub  #film    { opacity: 1; }
body.mode-video  #ambient { opacity: 1; }
body.mode-static #poster  { opacity: 1; }

/* Legibility helpers baked into the stage: a soft vignette anchors nav + footer
   and gently darkens the bright film top-and-bottom so UI never floats un-bedded. */
.stage-vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(20,20,26,0.55) 0%, rgba(20,20,26,0) 20%, rgba(20,20,26,0) 66%, rgba(20,20,26,0.62) 100%),
    radial-gradient(120% 85% at 50% 42%, rgba(20,20,26,0) 52%, rgba(20,20,26,0.38) 100%);
}
/* Film grain — kills gradient banding on the dark scrims (premium-dark rule) */
.stage-grain {
  position: absolute; inset: -50%; pointer-events: none; opacity: .045; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* ─────────────────────────── Loader ─────────────────────────── */
#loader {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center;
  background: radial-gradient(120% 120% at 50% 32%, #1d1d26 0%, var(--ink) 70%);
  transition: opacity .7s ease, visibility .7s ease;
}
body:not(.is-loading) #loader { opacity: 0; visibility: hidden; }
.loader-inner { text-align: center; width: min(340px, 76vw); }
.loader-mark { font-family: var(--serif); font-size: 2.1rem; font-weight: 600; letter-spacing: -.02em; color: var(--bone); }
.loader-mark__accent { color: var(--brass); font-style: italic; }
.loader-sub { font-family: var(--sans); font-size: .74rem; letter-spacing: .42em; text-transform: uppercase; color: var(--greige); margin: .35rem 0 1.5rem; padding-left: .42em; }
.loader-track { height: 2px; background: rgba(245,241,234,.12); border-radius: 99px; overflow: hidden; }
.loader-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--brass), var(--brass-soft)); border-radius: 99px; transition: width .25s ease; }
.loader-pct { margin-top: .9rem; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--warm-dim); letter-spacing: .04em; }
.loader-pct__sign { color: var(--brass); }
.loader-cue { margin-top: .3rem; font-size: .78rem; color: rgba(216,210,198,.6); letter-spacing: .16em; text-transform: uppercase; }

/* ─────────────────────────── Buttons ─────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--sans); font-weight: 600; font-size: .92rem; letter-spacing: .01em;
  padding: .82rem 1.5rem; border-radius: 99px; cursor: pointer; border: 1px solid transparent;
  transition: transform .35s var(--ease-lux), background .3s, color .3s, border-color .3s, box-shadow .3s;
  will-change: transform;
}
.btn--lg { padding: 1rem 1.9rem; font-size: .98rem; }
.btn--brass { background: linear-gradient(135deg, var(--brass-soft), var(--brass) 55%, #8E6F3F); color: var(--ink); box-shadow: 0 10px 30px -10px rgba(184,150,90,.55); }
.btn--brass:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -12px rgba(184,150,90,.7); }
.btn--ghost { background: rgba(245,241,234,.06); color: var(--bone); border-color: rgba(245,241,234,.24); backdrop-filter: blur(6px); }
.btn--ghost:hover { background: rgba(245,241,234,.12); border-color: var(--brass); transform: translateY(-2px); }

/* ─────────────────────────── Eyebrow ─────────────────────────── */
.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  font-size: .74rem; font-weight: 600; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent-soft); margin: 0 0 1.1rem; transition: color .6s var(--ease-lux);
}
.eyebrow--center { justify-content: center; }
.eyebrow__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); transition: background .6s var(--ease-lux), box-shadow .6s var(--ease-lux); }

/* ─────────────────────────── Nav ─────────────────────────── */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 90; transition: background .4s, backdrop-filter .4s, border-color .4s; border-bottom: 1px solid transparent; }
.nav__inner {
  max-width: var(--maxw); margin-inline: auto; padding: 1.05rem clamp(1.25rem, 5vw, 3rem);
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
}
.nav.is-scrolled { background: rgba(18,18,24,.72); backdrop-filter: blur(16px) saturate(1.3); border-bottom-color: var(--glass-line-2); }
.nav__brand { display: inline-flex; align-items: baseline; gap: .5rem; color: var(--bone); }
.nav__name { font-family: var(--serif); font-weight: 600; font-size: 1.32rem; letter-spacing: -.01em; }
.nav__name .accent, .footer__brand .accent { color: var(--brass); font-style: italic; }
.nav__tag { font-family: var(--sans); font-size: .62rem; letter-spacing: .34em; text-transform: uppercase; color: var(--greige); }
.nav__links { display: flex; gap: 2rem; }
.nav__links a { font-size: .9rem; font-weight: 500; color: var(--bone); opacity: .82; position: relative; padding: .25rem 0; transition: opacity .25s; }
.nav__links a::after { content: ""; position: absolute; left: 0; bottom: -2px; width: 0; height: 2px; background: var(--brass); transition: width .3s var(--ease-lux); }
.nav__links a:hover { opacity: 1; }
.nav__links a:hover::after { width: 100%; }
.nav__actions { display: flex; align-items: center; gap: 1.2rem; }
.nav__area { font-size: .78rem; font-weight: 500; letter-spacing: .04em; color: var(--warm-dim); opacity: .85; }
.nav__burger { display: none; flex-direction: column; gap: 5px; width: 42px; height: 42px; background: rgba(245,241,234,.06); border: 1px solid rgba(245,241,234,.2); border-radius: 10px; cursor: pointer; align-items: center; justify-content: center; }
.nav__burger span { width: 18px; height: 2px; background: var(--bone); border-radius: 2px; transition: transform .3s, opacity .3s; }
body.drawer-open .nav__burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.drawer-open .nav__burger span:nth-child(2) { opacity: 0; }
body.drawer-open .nav__burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile drawer */
.drawer {
  position: fixed; inset: 0 0 0 auto; width: min(82vw, 360px); z-index: 80;
  background: var(--glass-strong); backdrop-filter: blur(20px) saturate(1.3);
  border-left: 1px solid var(--glass-line);
  transform: translateX(100%); transition: transform .45s var(--ease-lux);
  display: flex; flex-direction: column; justify-content: center; gap: 1.4rem; padding: 2rem;
}
body.drawer-open .drawer { transform: translateX(0); }
.drawer__links { display: flex; flex-direction: column; gap: 1.1rem; }
.drawer__links a { font-family: var(--serif); font-size: 1.6rem; color: var(--bone); }
.drawer__links a:hover { color: var(--brass-soft); }
.drawer__cta { margin-top: 1rem; }
.drawer__area { font-size: .8rem; color: var(--greige); letter-spacing: .04em; }

/* ─────────────────────────── Generic section ─────────────────────────── */
.section { position: relative; z-index: 2; padding-block: var(--pad-section); min-height: 100vh; display: flex; align-items: center; }
.section__title { font-size: clamp(2rem, 5.2vw, 3.7rem); }
.section__lead { margin-top: 1.2rem; color: var(--warm-dim); font-size: clamp(1rem, 1.3vw, 1.16rem); max-width: 54ch; }

/* Scrub-mode scroll runway. The three interior beats grow tall ONLY when the
   film is being scrubbed (body.mode-scrub — desktop, fine pointer), so each
   scroll pixel advances far less film and the walk stops feeling like flying.
   Their centred islands stay the dwell landings; the extra height is the glide
   runway between rooms. Video (mobile) + static (reduced-motion) tiers never
   get mode-scrub, so they keep the compact 100vh heights untouched. */
body.mode-scrub .section--living,
body.mode-scrub .section--dining,
body.mode-scrub .section--private { min-height: 255vh; }

/* ─────────────────────────── Glass island ─────────────────────────── */
.island {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  border: 1px solid var(--glass-line-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-island);
  padding: clamp(1.9rem, 4vw, 3.3rem);
  position: relative; overflow: hidden;
}
.island::before { /* top accent hairline — tints per beat */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: .55;
  transition: background .6s var(--ease-lux);
}
.island--wide { max-width: 1000px; }
.island--narrow { max-width: 680px; }
.island__head { max-width: 680px; margin-bottom: 2.6rem; }
.island__link { display: inline-block; margin-top: 1.8rem; font-weight: 600; font-size: .92rem; letter-spacing: .02em; color: var(--brass-soft); border-bottom: 1px solid var(--glass-line); padding-bottom: 3px; transition: color .3s, border-color .3s; }
.island__link:hover { color: var(--bone); border-color: var(--brass); }

/* ─────────────────────────── HERO (beat 1 — foyer) ─────────────────────────── */
.hero { position: relative; z-index: 2; min-height: 100vh; display: flex; align-items: center; padding: 8rem 0 5rem; }
.hero__scrim {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(78% 72% at 30% 52%, rgba(20,20,26,0.72) 0%, rgba(20,20,26,0.34) 44%, transparent 74%),
    linear-gradient(to right, rgba(20,20,26,0.62) 0%, transparent 62%);
}
.hero__inner { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1.25rem, 5vw, 3rem); }
.hero__copy { max-width: 780px; }
.hero__title { font-size: clamp(2.5rem, 5.8vw, 5rem); margin: 0 0 1.5rem; text-shadow: 0 2px 40px rgba(20,20,26,.4); }
.hero__title .line { display: block; overflow: hidden; }
.hero__title .line > span { display: block; }
.hero__sub { font-size: clamp(1.05rem, 1.6vw, 1.3rem); color: var(--warm-dim); max-width: 52ch; margin-bottom: 2rem; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 1rem; }
.hero__scrollcue { position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: .6rem; font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: rgba(216,210,198,.7); }
.hero__scrollcue-line { width: 1px; height: 42px; background: linear-gradient(var(--brass), transparent); animation: cue 2.2s ease-in-out infinite; transform-origin: top; }
@keyframes cue { 0%,100% { transform: scaleY(.4); opacity:.4 } 50% { transform: scaleY(1); opacity:1 } }

/* ─────────────────────────── LIVING (beat 2 — principles) ─────────────────────────── */
.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.principle { position: relative; padding-top: 1.3rem; border-top: 1px solid var(--glass-line-2); }
.principle__num { font-family: var(--serif); font-style: italic; font-size: 1rem; font-weight: 500; color: var(--accent-soft); letter-spacing: .01em; transition: color .6s var(--ease-lux); }
.principle h3 { font-size: 1.16rem; margin: .5rem 0; }
.principle p { font-size: .92rem; color: var(--warm-dim); line-height: 1.55; }

/* ─────────────────────────── DINING (beat 3 — gathering) ─────────────────────────── */
.dining__grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 1.6rem; align-items: stretch; width: 100%; }
.dining__copy { display: flex; flex-direction: column; gap: 1.8rem; justify-content: center; }
.dining__aside { display: flex; }
.stat-island {
  width: 100%;
  background: var(--glass-strong); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-line); border-radius: var(--radius);
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem 1rem; padding: 2rem; box-shadow: var(--shadow-island);
  align-content: center;
}
.stat__num { display: block; font-family: var(--serif); font-size: clamp(2rem, 3.6vw, 2.8rem); font-weight: 600; color: var(--brass); line-height: 1; font-variant-numeric: tabular-nums; }
.stat__label { display: block; margin-top: .5rem; font-size: .8rem; color: var(--warm-dim); letter-spacing: .01em; line-height: 1.4; }
.quote { margin: 0; padding-top: 1.6rem; border-top: 1px solid var(--glass-line-2); }
.quote blockquote { margin: 0; font-family: var(--serif); font-style: italic; font-size: 1.14rem; line-height: 1.5; color: var(--bone); }
.quote figcaption { margin-top: .9rem; font-size: .84rem; color: var(--warm-dim); font-weight: 500; }

/* ─────────────────────────── CTA (beat 5 — golden hour) ─────────────────────────── */
.section--cta { padding-block: clamp(6rem, 14vh, 11rem); }
.cta-island {
  max-width: 780px; margin-inline: auto; text-align: center;
  background: var(--glass-strong); backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3);
  border: 1px solid var(--glass-line); border-radius: var(--radius);
  padding: clamp(2.4rem, 6vw, 4.2rem); box-shadow: var(--shadow-island); position: relative; overflow: hidden;
}
.cta-island::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; background: linear-gradient(90deg, transparent, var(--brass), transparent); }
.cta__title { font-size: clamp(2.3rem, 6vw, 4.2rem); margin-bottom: 1.2rem; }
.cta__lead { color: var(--warm-dim); font-size: 1.1rem; max-width: 52ch; margin: 0 auto 2rem; }
.cta__actions { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; }
.cta__area { margin-top: 1.6rem; font-size: .88rem; color: var(--brass-soft); letter-spacing: .01em; }
.cta__fineprint { margin-top: .6rem; font-size: .8rem; color: rgba(216,210,198,.55); }

/* ─────────────────────────── ABOUT strip ─────────────────────────── */
.section--about { min-height: auto; padding-block: clamp(4rem, 10vh, 7rem); text-align: center; }
.about__inner { max-width: 820px; margin-inline: auto; }
.about__statement { font-family: var(--serif); font-size: clamp(1.3rem, 2.6vw, 1.9rem); font-weight: 400; line-height: 1.4; color: var(--bone); margin-top: 1rem; text-shadow: 0 2px 30px rgba(20,20,26,.5); }

/* ─────────────────────────── FOOTER ─────────────────────────── */
.footer { position: relative; z-index: 2; background: var(--ink); border-top: 1px solid var(--glass-line-2); padding-top: 4rem; }
.footer__inner { display: grid; grid-template-columns: 1.7fr 1fr 1fr 1.3fr; gap: 2.5rem; padding-bottom: 3rem; align-items: start; }
.footer__brand .nav__name { font-size: 1.5rem; }
.footer__brand .nav__tag { display: block; margin-top: .2rem; }
.footer__brand p { margin-top: .9rem; color: var(--warm-dim); font-size: .92rem; max-width: 34ch; }
.footer__col h4 { font-family: var(--sans); font-size: .76rem; letter-spacing: .18em; text-transform: uppercase; color: var(--brass-soft); margin-bottom: 1.1rem; }
.footer__col a, .footer__col p { display: block; color: var(--warm-dim); font-size: .92rem; margin-bottom: .6rem; transition: color .25s; }
.footer__col a:hover { color: var(--brass-soft); }
.footer__lang { color: var(--brass-soft); font-style: italic; }
.footer__base { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-block: 1.5rem; border-top: 1px solid var(--glass-line-2); font-size: .82rem; color: rgba(216,210,198,.55); flex-wrap: wrap; }
.footer__demo-note { color: rgba(184,150,90,.55); }

/* ─────────────────────────── Per-beat accent (JS sets body[data-active-beat]) ─────────────────────────── */
body[data-active-beat="foyer"]   { --accent: var(--brass);      --accent-soft: var(--brass-soft); }
body[data-active-beat="living"]  { --accent: var(--brass-soft); --accent-soft: #D8B98A; }
body[data-active-beat="dining"]  { --accent: var(--wine);       --accent-soft: #A8636B; }
body[data-active-beat="private"] { --accent: var(--mauve);      --accent-soft: #D8B6BA; }
body[data-active-beat="reveal"]  { --accent: var(--brass);      --accent-soft: var(--brass-soft); }

/* ─────────────────────────── Reveal states (JS adds .is-in) ─────────────────────────── */
.reveal { opacity: 0; transform: translateY(34px); transition: opacity .9s var(--ease-lux), transform .9s var(--ease-lux); }
.reveal.is-in { opacity: 1; transform: none; }
.reveal-line > span { transform: translateY(110%); transition: transform 1s var(--ease-lux); display: block; }
.reveal-line.is-in > span { transform: none; }
.principle.reveal { transition-delay: calc(var(--i, 0) * 90ms); }

/* ─────────────────────────── Responsive ─────────────────────────── */
@media (max-width: 1000px) {
  .dining__grid { grid-template-columns: 1fr; }
  .principles { grid-template-columns: 1fr; gap: 1.6rem; }
  .footer__inner { grid-template-columns: 1fr 1fr; gap: 2rem; }
}
@media (max-width: 820px) {
  .nav__links, .nav__area { display: none; }
  .nav__burger { display: flex; }
  .nav__cta { display: none; }
}
@media (max-width: 620px) {
  .stat-island { grid-template-columns: 1fr 1fr; }
  .footer__inner { grid-template-columns: 1fr; }
  .hero__cta .btn, .cta__actions .btn { flex: 1 1 auto; }
  .section { min-height: auto; padding-block: 5rem; }
}

/* ─────────────────────────── Reduced motion ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .reveal-line > span { transform: none !important; }
  .hero__scrollcue-line { animation: none; }
}
