/* ============================================================
   The Quiet AI — ENHANCE layer  (shared by index.html + work.html)
   "Drafting table": the architectural signature — blueprint grid,
   a precise cursor, magnetic CTAs, pointer-tilt media,
   blueprint→render card reveals, a velocity marquee.
   ADDITIVE over each page's inline base. Everything motion-bearing
   is gated on (hover:hover)+(pointer:fine) and prefers-reduced-motion.
   ============================================================ */

/* ---- 1 · BLUEPRINT — a real architectural drawing, one per page --
   Each page sets its own --bp-art on <body> (home = villa archway
   elevation, work = rooftop pool & terrace plan). Source code is
   draughted into each drawing as the annotation callouts. */
.hero, .phero, .pov, .work, .tier, .route, .close { position:relative; isolation:isolate; }
.hero > .wrap, .phero > .wrap, .pov > .wrap, .work > .wrap, .tier > .wrap,
.route > .wrap, .close > .wrap { position:relative; z-index:1; }

/* feature: the hero carries the drawing large — title block, dims, code and all.
   The background-IMAGE is set per page in each document's inline <style>
   (a relative url() in a custom property would resolve against THIS file). */
.hero::before, .phero::before{
  content:""; position:absolute; inset:0; z-index:0; pointer-events:none;
  background-repeat: no-repeat;
  background-position: right top;
  background-size: min(1060px, 96%) auto;
  opacity:.3;
  -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent 98%);
          mask-image: linear-gradient(180deg, #000 62%, transparent 98%);
}
/* echoes: the same drawing peeks fainter, lower — there if you look closely */
.pov::before, .work::before, .tier::before, .route::before, .close::before{
  content:""; position:absolute; inset:0; z-index:0; pointer-events:none;
  background-repeat: no-repeat;
  background-position: left bottom;
  background-size: min(900px, 80%) auto;
  opacity:.13;
  -webkit-mask-image: radial-gradient(125% 125% at 10% 92%, #000 30%, transparent 76%);
          mask-image: radial-gradient(125% 125% at 10% 92%, #000 30%, transparent 76%);
}
@media (max-width:760px){
  .hero::before, .phero::before{ background-size:165% auto; background-position:center top; opacity:.15; }
  .pov::before, .work::before, .tier::before, .route::before, .close::before{ opacity:.06; }
}

/* ---- 2 · PRECISE CURSOR (additive ring + dot + label) ----------- */
.cursor__ring, .cursor__dot{ display:none; }
@media (hover:hover) and (pointer:fine){
  .cursor__ring, .cursor__dot{ position:fixed; top:0; left:0; z-index:300; pointer-events:none; display:flex;
    align-items:center; justify-content:center; }
  .cursor__ring{ width:34px; height:34px; margin:-17px 0 0 -17px; border:1px solid var(--accent); border-radius:50%;
    opacity:0; background:transparent;
    transition:width .28s var(--ease), height .28s var(--ease), margin .28s var(--ease),
               opacity .3s, background-color .25s, border-color .25s; }
  .cursor__dot{ width:5px; height:5px; margin:-2.5px 0 0 -2.5px; border-radius:50%; background:var(--accent);
    opacity:0; transition:opacity .3s, transform .18s var(--ease); }
  body.cursor-on  .cursor__ring{ opacity:.5; }
  body.cursor-on  .cursor__dot { opacity:1; }
  body.cursor-down .cursor__dot{ transform:scale(2.2); }
  body.cursor-link .cursor__ring{ width:64px; height:64px; margin:-32px 0 0 -32px;
    background:var(--accent); border-color:var(--accent); opacity:1; }
  body.cursor-link .cursor__dot { opacity:0; }
  .cursor__label{ font-family:var(--mono); font-size:9.5px; letter-spacing:.13em; text-transform:uppercase;
    color:var(--paper); opacity:0; transition:opacity .2s; white-space:nowrap; }
  body.cursor-link .cursor__label{ opacity:1; }

  /* give the magnetic set a transform transition so the snap-back eases */
  .btn, .nav-cta, .lk, .route a.big, .close a.big{ will-change:transform; }
  .nav-cta{ transition:border-color .2s, color .2s, background .2s, transform .3s var(--ease); }
  .lk{ transition:background .2s, color .2s, border-color .2s, transform .3s var(--ease); }
  .route a.big, .close a.big{ transition:color .3s, transform .4s var(--ease); }

  /* pointer-tilt media surfaces */
  .feat__media, .card__media, .b__media{ transition:transform .45s var(--ease); transform-style:preserve-3d; }
}
@media (hover:none), (pointer:coarse){ .cursor__ring, .cursor__dot{ display:none !important; } }

/* ---- 3 · BLUEPRINT → RENDER reveal (line-art develops to colour) - */
@media (prefers-reduced-motion: no-preference){
  .b .b__media img, .b .b__media video,
  .card:not(.card--hero) .card__media img, .card:not(.card--hero) .card__media video{
    filter:grayscale(.92) contrast(1.05) brightness(1.03);
    transition:filter 1.2s var(--ease), transform 1.1s var(--ease);
  }
  .b.in .b__media img, .b.in .b__media video,
  .card.in:not(.card--hero) .card__media img, .card.in:not(.card--hero) .card__media video{
    filter:none;
  }
  /* a blueprint tint that lifts as the card resolves */
  .b .b__media::after, .card:not(.card--hero) .card__media::after{
    content:""; position:absolute; inset:0; z-index:2; pointer-events:none;
    background:linear-gradient(135deg, var(--accent-glow), transparent 60%);
    mix-blend-mode:multiply; opacity:.9; transition:opacity 1.2s var(--ease);
  }
  .b.in .b__media::after, .card.in:not(.card--hero) .card__media::after{ opacity:0; }
}

/* ---- 4 · VELOCITY MARQUEE (capability ribbon) ------------------- */
.marq{ overflow:hidden; border-top:1px solid var(--line); border-bottom:1px solid var(--line);
  background:var(--paper); padding:clamp(16px,2.4vw,26px) 0; position:relative; z-index:1; }
.marq__row{ display:inline-flex; align-items:center; white-space:nowrap; width:max-content;
  animation:marq 40s linear infinite; will-change:transform; }
.marq:hover .marq__row{ animation-play-state:paused; }
.marq__row span{ font-family:var(--serif); font-weight:400; font-size:clamp(20px,3.4vw,38px);
  letter-spacing:-0.01em; color:var(--ink); padding:0 .55em; display:inline-flex; align-items:center; }
.marq__row span::after{ content:"✳"; font-family:var(--mono); font-size:.42em; color:var(--accent);
  margin-left:1.1em; transform:translateY(-.15em); }
.marq__row span.alt{ color:var(--ink-faint); font-style:italic; }
@keyframes marq{ from{ transform:translateX(0); } to{ transform:translateX(-50%); } }
@media (prefers-reduced-motion: reduce){ .marq__row{ animation:none; } }

/* ---- 5 · RICHER SCROLL REVEALS (scroll-triggered choreography) --
   Upgrades the base .rise: more travel, a gentle de-blur + settle,
   and a REAL stagger (base shipped a --i that was never set, so
   cards revealed all at once — enhance.js now sets --i per child). */
@media (prefers-reduced-motion: no-preference){
  .rise{
    opacity:0; transform:translateY(32px) scale(.984); filter:blur(5px);
    transition:opacity .9s var(--ease), transform 1.05s var(--ease), filter .8s var(--ease);
    transition-delay:calc(var(--i,0) * .085s);
  }
  .rise.in{ opacity:1; transform:none; filter:blur(0); }
}

/* ---- 6 · CASE-STUDY FILM (portrait, click-to-play screening) ---- */
.film{ background:var(--ink); color:var(--paper); position:relative; z-index:1; }
.film .wrap{ display:grid; grid-template-columns:1fr auto; gap:clamp(28px,5vw,80px); align-items:center; }
.film__copy .kicker{ color:#9FB3BD; }
.film__copy h2{ color:var(--paper); font-size:clamp(28px,4.6vw,50px); line-height:1.03; letter-spacing:-0.02em; margin:.15em 0 .5em; }
.film__copy h2 em{ font-style:italic; color:#9FB3BD; }
.film__copy p{ color:#C9C8C2; max-width:36ch; font-size:clamp(16px,1.9vw,19px); }
.film__copy .meta{ font-family:var(--mono); font-size:11.5px; letter-spacing:.14em; text-transform:uppercase; color:#828C92; margin-top:1.5em; }
.player{ position:relative; width:min(300px,72vw); aspect-ratio:9/16; border-radius:22px; overflow:hidden; flex:none;
  background:#000; border:1px solid rgba(255,255,255,.12); box-shadow:0 44px 100px -46px rgba(0,0,0,.75); }
.player video{ width:100%; height:100%; object-fit:cover; display:block; }
.player__poster{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; transition:opacity .5s var(--ease); }
.player.playing .player__poster{ opacity:0; pointer-events:none; }
.player__play{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; cursor:pointer;
  border:0; background:rgba(0,0,0,.18); transition:background .3s; }
.player.playing .player__play{ display:none; }
.player__play:hover{ background:rgba(0,0,0,.05); }
.player__play span{ width:66px; height:66px; border-radius:50%; background:rgba(241,240,235,.94);
  display:flex; align-items:center; justify-content:center; transition:transform .3s var(--ease); }
.player__play:hover span{ transform:scale(1.09); }
.player__play span::before{ content:""; border-style:solid; border-width:11px 0 11px 18px;
  border-color:transparent transparent transparent var(--ink); margin-left:5px; }
@media (max-width:760px){
  .film .wrap{ grid-template-columns:1fr; justify-items:center; text-align:center; }
  .film__copy p{ margin-inline:auto; }
}
