/* Shared layer for every page except the homepage. It sits on top of site.css and
   brings these pages into the same world as the 3D homepage: the forge's warm
   light, a forged object in the hero, motion on scroll, and a smooth cut between
   pages. Nothing here changes a page's words or layout rules; remove the two tags
   that load pages.css and pages.js and a page is exactly as it was. */

/* ---------- the forge's light behind the page ---------- */
body::before{
  content:""; position:fixed; inset:0; z-index:-1; pointer-events:none;
  background:
    radial-gradient(42vw 42vw at 6% 8%, rgba(99,102,241,.13), transparent 70%),
    radial-gradient(38vw 38vw at 92% 12%, rgba(240,180,41,.10), transparent 70%),
    radial-gradient(46vw 40vw at 46% 104%, rgba(255,107,53,.10), transparent 70%);
}

/* ---------- moving between pages ---------- */
@view-transition{ navigation:auto; }
#hdr{ view-transition-name:site-header; }
body > div.fixed.bottom-0{ view-transition-name:site-bar; }
@media (prefers-reduced-motion:no-preference){
  ::view-transition-old(root){ animation:page-out .2s ease both; }
  ::view-transition-new(root){ animation:page-in .42s cubic-bezier(.22,1,.36,1) both; }
}
@keyframes page-out{ to{ opacity:0; transform:translateY(-10px); } }
@keyframes page-in{ from{ opacity:0; transform:translateY(14px); } }

/* ---------- reading progress under the header ---------- */
.fx-progress{ position:absolute; left:0; right:0; bottom:-2px; height:2px; background:#F0B429; transform:scaleX(0); transform-origin:left; opacity:0; transition:opacity .3s; pointer-events:none; }
.fx-scrolled .fx-progress{ opacity:.9; }

/* ---------- the forged object in a hero ---------- */
.fx-slot{ display:none; }
.fx3d .fx-slot{ display:block; position:relative; width:100%; max-width:440px; height:clamp(128px,23vh,210px); margin:0 auto 14px; }
.fx3d .fx-hero{ padding-top:86px !important; }
.fx-canvas{ position:absolute; left:50%; top:50%; width:min(190%,100vw); height:210%; transform:translate(-50%,-50%); pointer-events:none; opacity:0; transition:opacity .45s ease; }
.fx-live .fx-canvas{ opacity:1; }
/* before the object arrives: the hearth warming up, so the space is never blank */
.fx3d .fx-slot::before{ content:""; position:absolute; left:50%; bottom:4%; width:86%; height:74%; transform:translateX(-50%); border-radius:50%; pointer-events:none; opacity:1; transition:opacity .8s ease;
  background:radial-gradient(closest-side, rgba(255,107,53,.16), rgba(240,180,41,.05) 60%, transparent); animation:fx-kindle 1s ease both; }
.fx-live .fx-slot::before{ opacity:.55; }
@keyframes fx-kindle{ from{ opacity:0; transform:translateX(-50%) scale(.8); } }
.can-strike body{ cursor:grab; }
.is-grabbing body{ cursor:grabbing; -webkit-user-select:none; user-select:none; }
.fx-slot{ touch-action:pan-y; }
@media (min-width:640px){ .fx3d .fx-hero{ padding-top:96px !important; } .fx3d .fx-slot{ margin-bottom:26px; } }
/* a left-aligned hero keeps its words where they were; the object stands to the right */
@media (min-width:1024px){
  .fx3d .fx-hero--side{ padding-top:10rem !important; }
  .fx3d .fx-slot--side{ position:absolute; right:1%; top:50%; width:36%; max-width:none; height:300px; margin:-150px 0 0; }
}
@media (max-width:1023px){ .fx3d .fx-slot--side{ margin-left:0; max-width:300px; } }

/* the object takes the place of a picture that is already in the page (the Munshi
   phone). The picture keeps its space, and comes back if the 3D cannot run. */
.fx3d .fx-swap > :not(.fx-slot){ visibility:hidden; }
.fx3d .fx-swap > .fx-slot{ position:absolute; inset:-4% 0; width:auto; max-width:none; height:auto; margin:0; }
.fx-swap > .fx-slot .fx-canvas{ width:min(230%,100vw); height:128%; }

/* ---------- things arrive as you reach them ---------- */
.fx-r{ opacity:0; transform:translateY(20px); }
.fx-r.fx-on{ opacity:1; transform:none; transition:opacity .7s ease var(--d,0ms), transform .9s cubic-bezier(.22,1,.36,1) var(--d,0ms); }

/* ---------- cards answer the pointer ---------- */
.fx-glow{ position:absolute; inset:0; margin:0 !important; border:0 !important; border-radius:inherit; pointer-events:none; opacity:0; transition:opacity .35s ease;
  background:radial-gradient(280px circle at var(--mx,50%) var(--my,50%), rgba(240,180,41,.13), transparent 62%); }
.fx-card:hover > .fx-glow{ opacity:1; }
@media (hover:hover){
  .fx-card{ transition:transform .45s cubic-bezier(.22,1,.36,1), border-color .3s ease, background-color .3s ease, box-shadow .45s ease; }
  .fx-card:hover{ transform:translateY(-3px); border-color:rgba(240,180,41,.32) !important; box-shadow:0 26px 50px -30px rgba(0,0,0,.9); }
  .fx-card img{ transition:transform 1.1s cubic-bezier(.22,1,.36,1); }
  .fx-card:hover img{ transform:scale(1.035); }
}

/* ---------- phones: solid bars, as on the homepage ---------- */
@media (max-width:767px){
  #hdr.border-b{ background:#08090d !important; -webkit-backdrop-filter:none !important; backdrop-filter:none !important; }
  #mnav{ background:#08090d !important; -webkit-backdrop-filter:none !important; backdrop-filter:none !important; }
  body > div.fixed.bottom-0{ background:#08090d !important; -webkit-backdrop-filter:none !important; backdrop-filter:none !important; }
}

/* the footer's small print was a shade too dim to read comfortably (contrast 4.2 to 1) */
footer p.text-slate-500{ color:#94a3b8; }
/* a link in the middle of a sentence is underlined, so it does not depend on colour alone */
main p > a.text-gold{ text-decoration:underline; text-underline-offset:3px; text-decoration-color:rgba(240,180,41,.55); }

@media (prefers-reduced-motion:reduce){
  .fx-r{ opacity:1; transform:none; }
  .fx3d .fx-slot::before{ animation:none; }
}
