/* ══════════════════════════════════════════════════════════════════════════
   EGY METAL — fx layer
   Everything here is additive. If fx.js never boots, the page below still
   reads and works exactly as it did before; every effect either starts from
   the resting state or is gated behind a flag class set by JS.
   ══════════════════════════════════════════════════════════════════════════ */

:root{
  --seam:rgba(255,255,255,.14);
}

/* ── 09 · scroll-driven light inversion ────────────────────────────────────
   fx.js writes --inv (0 dark → 1 light) on <html>; every surface token is
   derived from it, so nav, cursor, seams and type all turn over together. */
html.fx-invert{
  --inv:0;
  --base:color-mix(in oklab, #0e0f0f calc((1 - var(--inv)) * 100%), #e9e7e2);
  --panel:color-mix(in oklab, #121717 calc((1 - var(--inv)) * 100%), #dedbd4);
  --paper:color-mix(in oklab, #ffffff calc((1 - var(--inv)) * 100%), #14171a);
  --dim:color-mix(in oklab, #bababa calc((1 - var(--inv)) * 100%), #4a4f52);
  --mute:color-mix(in oklab, #8b8e8f calc((1 - var(--inv)) * 100%), #6a6f72);
  --accent:color-mix(in oklab, #c9cfd6 calc((1 - var(--inv)) * 100%), #3f4a52);
  --line:color-mix(in oklab, rgba(255,255,255,.12) calc((1 - var(--inv)) * 100%), rgba(14,15,15,.16));
  --seam:color-mix(in oklab, rgba(255,255,255,.14) calc((1 - var(--inv)) * 100%), rgba(14,15,15,.2));
}
html.fx-invert body{background:var(--base);color:var(--paper)}
/* sections that hard-coded their own surface must follow the same curve */
html.fx-invert .bg-panel{background:var(--panel)}

/* Persistent chrome stays dark through the inversion. The nav bar carries a
   white-marked logo that would vanish on a light plate, and the footer is the
   last element on the page so there is no scroll runway left to ramp back out.
   Both keep the dark palette: light contact panel between dark chrome. */
html.fx-invert #nav,
html.fx-invert #foot{
  --base:#0e0f0f; --panel:#121717; --paper:#ffffff;
  --dim:#bababa; --mute:#8b8e8f; --accent:#c9cfd6;
  --line:rgba(255,255,255,.12);
  color:#fff;
}
html.fx-invert #foot{background:#0e0f0f}
/* the nav is transparent until it gains .solid — only repaint that state */
html.fx-invert #nav.solid{background:rgba(14,15,15,.72)}

/* ── 00 · loader ────────────────────────────────────────────────────────
   Was: a huge centred logo with a 4.5rem counter jammed in one corner and
   "/ 100" in the other — three competing focal points on a black field.
   Now one centred column: mark, a hairline rule that fills, and the count
   set small underneath it. Everything on a single axis. */
#loader{background:#0b0c0c;flex-direction:column}
/* the wide EM mark, not the bordered square lockup — its micro-tagline is
   illegible at this size and the border reads as a stray box */
#loader img{height:2.5rem;width:auto}
@media (min-width:768px){ #loader img{height:3rem} }
/* the "/ 100" span becomes the progress rule — app.js drives --lp */
#loader .of{position:static;order:2;margin-top:1.9rem;width:min(46vw,14rem);height:1px;
  font-size:0;color:transparent;
  background:linear-gradient(to right,
    var(--accent) var(--lp,0%), rgba(255,255,255,.13) var(--lp,0%))}
#loader .count{position:static;order:3;margin-top:1.05rem;font-family:var(--font-mono);
  font-size:.75rem;letter-spacing:.16em;color:var(--mute);font-weight:400;
  font-variant-numeric:tabular-nums}

/* ── 01 · hero ──────────────────────────────────────────────────────────
   The headline runs at --d-xl (up to 10rem). On a wide desktop that fills the
   whole viewport and crushes the sub-copy into the bottom edge, so the hero
   gets its own tighter ceiling and a bit more room to breathe. */
#hero h1{font-size:clamp(2.4rem,6.4vw,5.6rem);max-width:16ch}
#hero .inner{padding-bottom:7.5rem}
@media (min-width:768px){ #hero .inner{padding-bottom:8.5rem} }
#hero .sub{max-width:34rem}

/* The video is busy and mid-toned; the stock scrim left the headline mushy. */
#hero .scrim{background:
  linear-gradient(to top, var(--base) 2%, rgba(14,15,15,.82) 22%,
                  rgba(14,15,15,.42) 58%, rgba(14,15,15,.66) 100%),
  linear-gradient(to right, rgba(14,15,15,.72), rgba(14,15,15,.12) 62%)}

#hero .media video{transition:opacity .6s ease}
#hero.scrub-on .media video{opacity:0}

/* build readout, clear of the frame brackets */
#hero .scrub-ui{position:absolute;left:var(--pad);bottom:3.25rem;z-index:3;
  display:none;align-items:center;gap:.875rem;color:var(--mute);
  opacity:0;transition:opacity .5s ease}
#hero.scrub-on .scrub-ui{display:flex;opacity:1}
#hero .scrub-ui .bar{width:7rem;height:1px;background:rgba(255,255,255,.18);position:relative}
#hero .scrub-ui .bar i{position:absolute;left:0;top:0;bottom:0;width:0%;
  background:var(--accent);display:block}
#hero .scrub-ui .pct{font-variant-numeric:tabular-nums;min-width:8ch}
#hero .scroll{bottom:7.5rem}

/* The hero becomes a scroll stage: tall wrapper, sticky viewport-height frame. */
#hero-stage{position:relative}
#hero-stage.staged{height:300svh}
#hero-stage.staged>#hero{position:sticky;top:0;height:100svh}

/* ── 02 · WebGL glass refraction ────────────────────────────────────────
   .hero-media is position:absolute with z-index:auto, so it is NOT a stacking
   context — a z-index on the canvas would otherwise escape into the root and
   paint over the hero copy. Isolate #hero so these layers stay local. */
#hero{isolation:isolate}
#glass-canvas{position:absolute;inset:0;width:100%;height:100%;z-index:1;
  pointer-events:none;opacity:0;transition:opacity 1s ease}
#glass-canvas.on{opacity:1}
#hero.scrub-on .media video{opacity:0}
#hero .media{z-index:0}
#hero .media .scrim{z-index:2}
#hero .frame{z-index:2}
#hero .inner{z-index:3}
#hero .scroll{z-index:3}

/* ── 03 · curtain-wall transition ──────────────────────────────────────── */
.curtain{position:fixed;inset:0;z-index:70;pointer-events:none;display:none;
  grid-template-columns:repeat(var(--cw-cols,6),1fr);
  grid-template-rows:repeat(var(--cw-rows,4),1fr)}
.curtain.live{display:grid}
.curtain .unit{position:relative;
  background:linear-gradient(150deg, rgba(201,207,214,.30), rgba(18,23,23,.94) 42%, rgba(63,74,82,.6));
  border:1px solid var(--seam);
  transform:scaleY(0);transform-origin:top;
  backdrop-filter:blur(6px) saturate(1.15);
  -webkit-backdrop-filter:blur(6px) saturate(1.15)}
/* mullion cap — reads as an aluminium profile edge, not a CSS border */
.curtain .unit::after{content:"";position:absolute;left:0;right:0;top:0;height:2px;
  background:linear-gradient(90deg,transparent,rgba(201,207,214,.85),transparent)}

/* section-level glazing reveal: panels clear off the content beneath */
.glaze{position:relative}
.glaze>.glaze-units{position:absolute;inset:0;z-index:4;pointer-events:none;
  display:grid;grid-template-columns:repeat(var(--gz-cols,4),1fr)}
.glaze>.glaze-units i{display:block;background:var(--base);
  border-right:1px solid var(--seam);transform-origin:bottom}

/* ── 07 · cursor ───────────────────────────────────────────────────────── */
@media (hover:hover) and (pointer:fine){
  html.fx-cursor,html.fx-cursor *{cursor:none}
}
#cursor{position:fixed;top:0;left:0;z-index:90;pointer-events:none;
  width:12px;height:12px;border-radius:999px;background:var(--accent);
  transform:translate3d(-100px,-100px,0);will-change:transform;
  transition:width .28s cubic-bezier(.2,.7,.3,1),height .28s cubic-bezier(.2,.7,.3,1),
             background-color .28s ease,opacity .2s ease;
  display:none;mix-blend-mode:difference}
#cursor.live{display:block}
#cursor .label{position:absolute;inset:0;display:grid;place-items:center;
  font-family:var(--font-mono);font-size:.6875rem;letter-spacing:.12em;
  text-transform:uppercase;color:#0e0f0f;opacity:0;transition:opacity .2s ease;
  white-space:nowrap}
#cursor.wide{width:84px;height:84px;mix-blend-mode:normal;background:#c9cfd6}
#cursor.wide .label{opacity:1}
#cursor.dot-lg{width:34px;height:34px}
#cursor.hide{opacity:0}

/* hover reel that rides under the cursor on project rows */
#reel{position:fixed;top:0;left:0;z-index:88;pointer-events:none;width:min(26vw,340px);
  aspect-ratio:16/10;overflow:hidden;opacity:0;
  transform:translate3d(-9999px,-9999px,0) scale(.92);
  transition:opacity .3s ease,transform .3s cubic-bezier(.2,.7,.3,1);
  box-shadow:0 30px 80px rgba(0,0,0,.55)}
#reel.live{opacity:1}
#reel video,#reel img{width:100%;height:100%;object-fit:cover}
#reel .rl-tag{position:absolute;left:.75rem;bottom:.625rem;z-index:2;
  font-family:var(--font-mono);font-size:.625rem;letter-spacing:.14em;
  text-transform:uppercase;color:#fff;text-shadow:0 1px 8px rgba(0,0,0,.8)}

/* ── 04 · configurator ─────────────────────────────────────────────────── */
#configurator .cfg{display:grid;gap:2.5rem;margin-top:3.5rem}
@media (min-width:960px){
  #configurator .cfg{grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);gap:4rem;align-items:start}
}
#configurator .stage{position:relative;aspect-ratio:4/3;overflow:hidden;
  background:var(--panel);border:1px solid var(--line)}
#configurator .stage .shot{position:absolute;inset:0;opacity:0;transition:opacity .45s ease}
#configurator .stage .shot.on{opacity:1}
#configurator .stage .shot img{width:100%;height:100%;object-fit:cover}
/* tint + finish are real layers, so any system photo can host any combination */
#configurator .stage .tint{position:absolute;inset:0;pointer-events:none;z-index:2;
  mix-blend-mode:multiply;transition:background-color .45s ease,opacity .45s ease}
#configurator .stage .sheen{position:absolute;inset:0;pointer-events:none;z-index:2;
  mix-blend-mode:screen;opacity:.5;
  background:linear-gradient(115deg,transparent 30%,rgba(255,255,255,.16) 46%,transparent 62%);
  transition:opacity .45s ease}
#configurator .stage .bk{position:absolute;width:1rem;height:1rem;
  border-color:rgba(255,255,255,.5);z-index:3}
#configurator .stage .bk.br-tl{top:.75rem;left:.75rem;border-top:1px solid;border-left:1px solid}
#configurator .stage .bk.br-tr{top:.75rem;right:.75rem;border-top:1px solid;border-right:1px solid}
#configurator .stage .bk.br-bl{bottom:.75rem;left:.75rem;border-bottom:1px solid;border-left:1px solid}
#configurator .stage .bk.br-br{bottom:.75rem;right:.75rem;border-bottom:1px solid;border-right:1px solid}
#configurator .stage .readout{position:absolute;left:1.25rem;bottom:1.25rem;z-index:3;
  display:flex;gap:1.25rem;flex-wrap:wrap;color:rgba(255,255,255,.82)}

#configurator .ctrl+.ctrl{margin-top:2rem}
#configurator .ctrl>.lb{display:block;color:var(--mute);margin-bottom:.875rem}
#configurator .opts{display:flex;flex-wrap:wrap;gap:.5rem}
#configurator .opts button{border:1px solid var(--line);background:transparent;
  color:var(--dim);padding:.5rem 1rem;border-radius:999px;
  font-family:var(--font-mono);font-size:.6875rem;letter-spacing:.12em;
  text-transform:uppercase;transition:border-color .2s,color .2s,background-color .2s}
#configurator .opts button:hover{border-color:var(--accent);color:var(--accent)}
#configurator .opts button[aria-pressed="true"]{background:var(--accent);
  border-color:var(--accent);color:#0e0f0f}
#configurator .opts button .sw{display:inline-block;width:.625rem;height:.625rem;
  border-radius:2px;margin-right:.5rem;vertical-align:-1px;border:1px solid rgba(0,0,0,.25)}

#configurator .area{display:flex;align-items:center;gap:1rem;margin-top:.5rem}
#configurator input[type=range]{flex:1;-webkit-appearance:none;appearance:none;height:1px;
  background:var(--line);outline-offset:8px}
#configurator input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;
  width:14px;height:14px;border-radius:999px;background:var(--accent);cursor:pointer}
#configurator input[type=range]::-moz-range-thumb{width:14px;height:14px;border:0;
  border-radius:999px;background:var(--accent);cursor:pointer}
#configurator .area output{font-family:var(--font-mono);font-size:.8125rem;
  color:var(--paper);min-width:10ch;text-align:right;font-variant-numeric:tabular-nums}

#configurator .est{margin-top:2.5rem;border-top:1px solid var(--line);padding-top:1.5rem}
#configurator .est .row{display:flex;justify-content:space-between;align-items:baseline;
  gap:1rem;padding:.5rem 0}
#configurator .est .row span:first-child{color:var(--mute);font-family:var(--font-mono);
  font-size:.6875rem;letter-spacing:.12em;text-transform:uppercase}
#configurator .est .row span:last-child{font-family:var(--font-mono);font-size:.9375rem;
  font-variant-numeric:tabular-nums}
#configurator .est .total{border-top:1px solid var(--line);margin-top:.5rem;padding-top:1rem}
#configurator .est .total span:last-child{font-family:var(--font-display);
  font-size:1.75rem;letter-spacing:-.02em}
#configurator .disclaim{color:var(--mute);font-size:.75rem;line-height:1.6;margin-top:1rem}
#configurator .cfg-cta{margin-top:1.5rem;display:flex;gap:.75rem;flex-wrap:wrap}

/* ── 05 · before / after ───────────────────────────────────────────────── */
.ba{position:relative;overflow:hidden;touch-action:pan-y;-webkit-user-select:none;user-select:none}
.ba .after{position:absolute;inset:0;z-index:2;clip-path:inset(0 0 0 var(--split,50%))}
.ba .after img{width:100%;height:100%;object-fit:cover}
.ba .handle{position:absolute;top:0;bottom:0;left:var(--split,50%);width:1px;
  background:rgba(255,255,255,.9);z-index:4;pointer-events:none}
.ba .handle::before{content:"";position:absolute;left:50%;top:50%;width:2.75rem;height:2.75rem;
  transform:translate(-50%,-50%);border:1px solid rgba(255,255,255,.9);border-radius:999px;
  background:rgba(14,15,15,.35);backdrop-filter:blur(4px)}
.ba .handle::after{content:"↔";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);
  color:#fff;font-size:.9375rem;line-height:1}
.ba .lbl{position:absolute;top:1rem;z-index:5;color:rgba(255,255,255,.85);
  font-family:var(--font-mono);font-size:.625rem;letter-spacing:.14em;text-transform:uppercase;
  text-shadow:0 1px 8px rgba(0,0,0,.7)}
.ba .lbl.l{left:1rem} .ba .lbl.r{right:1rem}

/* ── 06 · horizontal gallery ───────────────────────────────────────────── */
#gallery{overflow:hidden}
#gallery .track{display:flex;gap:2rem;will-change:transform;padding-left:var(--pad)}
#gallery .card{position:relative;flex:0 0 auto;width:min(78vw,520px)}
#gallery .card .frm{position:relative;aspect-ratio:3/4;overflow:hidden;background:var(--panel)}
#gallery .card .frm img{width:100%;height:100%;object-fit:cover;will-change:transform}
#gallery .card .cap{margin-top:1.25rem;display:flex;justify-content:space-between;
  gap:1rem;align-items:baseline;border-top:1px solid var(--line);padding-top:1rem}
#gallery .card .cap h3{font-family:var(--font-display);text-transform:uppercase;
  letter-spacing:-.03em;font-size:1.125rem;font-weight:500}
#gallery .hint{margin-top:2.5rem;color:var(--mute)}

/* ── 08 · Egypt map ────────────────────────────────────────────────────── */
#map .mapwrap{display:grid;gap:3rem;margin-top:3.5rem}
@media (min-width:960px){#map .mapwrap{grid-template-columns:1fr 1fr;gap:4.5rem;align-items:center}}
/* SVG text is sized in user units, so it scales with the box. Left uncapped
   the outline swelled to fill a 1.15fr column on a wide desktop and the pin
   labels rendered at ~24px, sprawling across the country. Cap the drawing. */
#map svg{width:100%;max-width:34rem;height:auto;overflow:visible;
  display:block;margin-inline:auto}
#map .land{fill:rgba(255,255,255,.055);stroke:rgba(255,255,255,.22);stroke-width:1;
  vector-effect:non-scaling-stroke}
#map .lead{stroke:var(--line);stroke-width:1;vector-effect:non-scaling-stroke}
#map .coast{fill:none;stroke:var(--accent);stroke-width:1.5;vector-effect:non-scaling-stroke;
  stroke-linecap:round;stroke-linejoin:round}
#map .nile{fill:none;stroke:rgba(201,207,214,.3);stroke-width:1;vector-effect:non-scaling-stroke}
#map .pin{cursor:pointer}
#map .pin .ring{fill:none;stroke:var(--accent);stroke-width:1.25;opacity:.5;
  vector-effect:non-scaling-stroke}
#map .pin .core{fill:var(--accent);transition:fill .25s ease}
#map .pin .plabel{font-family:var(--font-mono);font-size:5px;letter-spacing:.08em;
  text-transform:uppercase;fill:var(--mute);transition:fill .25s ease}
#map .pin.sel .core{fill:#fff}
#map .pin.sel .plabel{fill:var(--paper)}
#map .pcard{border-top:1px solid var(--line);padding-top:1.5rem}
#map .pcard .loc{color:var(--accent)}
#map .pcard h3{font-family:var(--font-display);text-transform:uppercase;letter-spacing:-.03em;
  font-size:clamp(1.5rem,3vw,2.25rem);line-height:1;margin:.75rem 0 1rem;font-weight:500}
#map .pcard p{color:var(--mute);font-size:.9375rem;line-height:1.7;max-width:44ch}
#map .pcard .figs{margin-top:1.5rem;display:flex;flex-wrap:wrap;gap:1.75rem}
#map .pcard .figs div{display:flex;flex-direction:column;gap:.25rem}
#map .pcard .figs b{font-family:var(--font-display);font-size:1.5rem;font-weight:500;
  letter-spacing:-.02em}
#map .pcard .figs span{color:var(--mute)}

/* ── shared furniture for the new sections ─────────────────────────────── */
.fx-sec h2{font-size:var(--d-lg);max-width:56rem;margin-bottom:1.25rem}
.fx-sec .lede{color:var(--mute);max-width:48ch;line-height:1.7}

/* NOTE: content-visibility:auto was tried here and removed on purpose.
   Offscreen sections then report contain-intrinsic-size instead of their real
   height, so the document height changes as you scroll. Every ScrollTrigger
   start/end — and the gallery's pin in particular — is measured against a
   layout that no longer exists, which left the pinned section stranded and
   the whole page feeling loose. Not worth the paint saving. */

/* ── motion opt-out: everything degrades to plain, legible, static ─────── */
@media (prefers-reduced-motion:reduce){
  #cursor,#reel,#glass-canvas,.curtain{display:none!important}
  html.fx-cursor,html.fx-cursor *{cursor:auto}
  #hero-stage.staged{height:auto}
  #hero-stage.staged>#hero{position:relative}
  #hero .scrub{display:none}
  #hero.scrub-on .media video{opacity:1}
  #gallery .track{flex-wrap:wrap;transform:none!important}
  .glaze>.glaze-units{display:none}
}
