/* ============================================================
   IMIC v3 — "The Illuminated Hours"
   Night-sky chrome (live canvas: stars, the actual moon, the sun's
   true position) framing warm paper content ruled like a manuscript
   page. Shared by every /beta page. imic.css (v2) stays untouched —
   the production muharram-1448 page depends on it.
   Bump the ?v= letter on pages whenever this file or imic3.js change.
   ============================================================ */

:root{
  --night:#060b1c; --night-2:#0b1730; --ink:#0a1326;
  --lapis:#16315e; --lapis-2:#0c1b3a;
  --gold:#d8b15a; --gold-2:#f3dc97; --gold-3:#a9802b;
  --turq:#2bb6a3; --terra:#c2643a;
  --cream:#f7f3ea; --cream-2:#efe7d6; --paper:#fffdf8; --text:#1d2a2f; --muted:#5a6a6b;
  --serif:'Cormorant Garamond',Georgia,serif; --sans:'Inter',system-ui,sans-serif; --fa:'Vazirmatn',var(--sans);
  --shadow:0 18px 50px -22px rgba(12,27,58,.4); --shadow-sm:0 6px 18px rgba(12,27,58,.08);
  --r:16px; --r-lg:24px; --ease:cubic-bezier(.2,.7,.2,1);
  /* the sky follows the real phase of day in Thornhill (set by imic3.js) */
  --sky-a:#060b1c; --sky-b:#0d1b3a; --halo:rgba(216,177,90,.15);
}
html[data-phase="dawn"]{--sky-a:#0b1836; --sky-b:#3a2a52; --halo:rgba(228,158,132,.42)}
html[data-phase="day"]{--sky-a:#123061; --sky-b:#2f5b96; --halo:rgba(243,220,151,.4)}
html[data-phase="dusk"]{--sky-a:#081026; --sky-b:#33203f; --halo:rgba(202,110,58,.44)}

*{margin:0;box-sizing:border-box}
html{scroll-behavior:smooth;overflow-x:clip} /* clip, not hidden: kills sideways zoom-out on phones without becoming a scroll container */
body{font-family:var(--sans);color:var(--text);background:var(--night);-webkit-font-smoothing:antialiased;overflow-x:hidden}
body[data-lang="fa"]{font-family:var(--fa);line-height:1.75}
body[data-lang="en"] .fa{display:none} body[data-lang="fa"] .en{display:none}
.fa{font-family:var(--fa)} a{color:inherit;text-decoration:none}
img{max-width:100%;display:block}
.wrap{max-width:1180px;margin-inline:auto;padding-inline:clamp(18px,4vw,40px)}
main.page{background:var(--cream);position:relative;z-index:1}
section{padding-block:clamp(3rem,6vw,5rem)}
.reveal{opacity:0;transform:translateY(26px);transition:opacity .8s var(--ease),transform .8s var(--ease)}
.reveal.in{opacity:1;transform:none}
@media(prefers-reduced-motion:reduce){.reveal{opacity:1;transform:none;transition:none}}

/* ---------- buttons ---------- */
.btn{display:inline-flex;align-items:center;gap:.5rem;font-family:inherit;font-weight:600;border:none;cursor:pointer;
  border-radius:12px;padding:.72rem 1.15rem;transition:transform .18s var(--ease),box-shadow .25s,background .2s,color .2s}
.btn:hover{transform:translateY(-2px)}
.btn-gold{background:linear-gradient(135deg,var(--gold),#bd9540);color:#241c08;box-shadow:0 8px 20px -8px rgba(216,177,90,.7)}
.btn-teal{background:var(--turq);color:#04201c;box-shadow:0 10px 22px -10px rgba(43,182,163,.7)}
.btn-ghost{background:transparent;border:1.5px solid rgba(255,255,255,.28);color:#fff}
.btn-ghost:hover{border-color:var(--gold);color:var(--gold-2)}
.btn-ghost.dark{border-color:rgba(243,220,151,.4);color:var(--gold-2)}
.btn-line{background:transparent;border:1.5px solid rgba(12,27,58,.18);color:var(--lapis)}
.btn-line:hover{border-color:var(--gold);color:#8a6a1e}
/* one primary CTA per page may carry .shine — a slow gold gleam */
.btn-gold.shine{position:relative;overflow:hidden}
.btn-gold.shine::after{content:"";position:absolute;top:-40%;bottom:-40%;width:34%;left:0;
  background:linear-gradient(105deg,transparent,rgba(255,255,255,.5),transparent);
  transform:translateX(-260%) skewX(-18deg);animation:btnshine 6s var(--ease) 2s infinite}
@keyframes btnshine{0%{transform:translateX(-260%) skewX(-18deg)}16%{transform:translateX(420%) skewX(-18deg)}100%{transform:translateX(420%) skewX(-18deg)}}
@media(prefers-reduced-motion:reduce){.btn-gold.shine::after{animation:none}}

/* ---------- topbar + nav (fixed night, the sky lives in the hero) ---------- */
.topbar{background:rgba(255,255,255,.025);color:#9fb0c6;font-size:.8rem;border-bottom:1px solid rgba(255,255,255,.05)}
.topbar .wrap{display:flex;gap:1.3rem;align-items:center;padding-block:.5rem;flex-wrap:wrap}
.topbar a{display:inline-flex;gap:.4rem;align-items:center;color:#b7c5d8}
.topbar a:hover{color:var(--gold-2)}
.topbar .sp{margin-inline-start:auto;display:flex;gap:.9rem}
/* solid night (no backdrop blur: it costs real GPU on mid-range phones) */
nav.bar{position:sticky;top:0;z-index:50;background:rgba(6,11,28,.96);border-bottom:1px solid rgba(216,177,90,.16)}
nav.bar .wrap{display:flex;align-items:center;gap:1rem;padding-block:.7rem;color:#eee}
.brand{display:flex;align-items:center;gap:.6rem;font-weight:700;font-size:1.06rem;color:#fff;white-space:nowrap}
.brand img{width:38px;height:38px;border-radius:9px;background:#fff;padding:2px}
.brand b{color:var(--gold-2);font-weight:600}
.links{display:flex;gap:.1rem;margin-inline-start:auto;align-items:center}
.links a{position:relative;padding:.5rem .75rem;border-radius:10px;color:#d7e0ec;font-weight:500;font-size:.95rem;transition:color .2s,background .2s}
.links a:hover,.links a.here{color:var(--gold-2);background:rgba(255,255,255,.06)}
.links a.btn-gold:hover,.links a.btn-gold.here{background:linear-gradient(135deg,var(--gold),#bd9540);color:#241c08}
.links a:not(.btn)::after{content:"";position:absolute;inset-inline:14%;bottom:3px;height:2px;border-radius:2px;
  background:linear-gradient(90deg,transparent,var(--gold),transparent);transform:scaleX(0);opacity:0;transition:transform .32s var(--ease),opacity .32s}
.links a:not(.btn):hover::after,.links a[aria-current="page"]::after{transform:scaleX(1);opacity:1}
@media(prefers-reduced-motion:reduce){.links a:not(.btn)::after{transition:none}}
.ltog{margin-inline-start:.3rem;border:1.5px solid rgba(216,177,90,.4);background:transparent;color:var(--gold-2);border-radius:999px;padding:.4rem .8rem;font-weight:600;cursor:pointer;font-family:inherit;display:inline-flex;gap:.4rem;align-items:center}
.menu-btn{display:none}

/* ---------- the sky hero (shared canvas chrome) ---------- */
.sky-hero{position:relative;color:#eadfc4;text-align:center;overflow:hidden;
  background:radial-gradient(120% 95% at 50% 112%,var(--halo),transparent 62%),linear-gradient(180deg,var(--sky-a),var(--sky-b) 82%,var(--sky-a) 118%)}
.sky-hero canvas.sky{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.sky-hero .wrap{position:relative;z-index:2;padding-block:clamp(3.6rem,8vw,6rem)}
.sky-hero.tall .wrap{min-height:min(78vh,760px);display:flex;flex-direction:column;justify-content:center;padding-block:clamp(4rem,10vw,7rem)}
.sky-hero .k{font-size:.72rem;letter-spacing:.3em;text-transform:uppercase;color:var(--gold-2);opacity:.92;text-shadow:0 1px 16px rgba(6,11,28,.75)}
.sky-hero h1{font-family:var(--serif);font-weight:600;font-size:clamp(2.5rem,6.4vw,4.4rem);color:#fff;line-height:1.04;margin:.55rem 0;
  text-shadow:0 2px 44px rgba(6,11,28,.92),0 1px 4px rgba(6,11,28,.55)} /* stays readable over the sun's bloom */
body[data-lang="fa"] .sky-hero h1{font-family:var(--fa);font-weight:800}
.sky-hero p.lede{color:#c3d0e2;max-width:60ch;margin-inline:auto;line-height:1.7;text-shadow:0 1px 16px rgba(6,11,28,.75)}
.sky-hero .hpills{display:flex;flex-wrap:wrap;gap:.6rem;justify-content:center;margin-top:1.4rem}
.sky-hero .cta-row{display:flex;flex-wrap:wrap;gap:.8rem;justify-content:center;margin-top:1.6rem}
/* the ruled base of the frontispiece: double gold hairline */
.sky-hero::after{content:"";position:absolute;inset-inline:0;bottom:0;height:12px;pointer-events:none;z-index:2;
  background:linear-gradient(90deg,transparent,rgba(216,177,90,.6),transparent) center bottom/min(560px,72%) 1px no-repeat,
             linear-gradient(90deg,transparent,rgba(216,177,90,.28),transparent) center calc(100% - 6px)/min(330px,46%) 1px no-repeat}
/* page-load rise (top-of-page, so animation not IO) */
.sky-hero .wrap>*{animation:rise .85s var(--ease) backwards}
.sky-hero .wrap>*:nth-child(2){animation-delay:.08s}
.sky-hero .wrap>*:nth-child(3){animation-delay:.16s}
.sky-hero .wrap>*:nth-child(4){animation-delay:.24s}
.sky-hero .wrap>*:nth-child(5){animation-delay:.32s}
.sky-hero .wrap>*:nth-child(6){animation-delay:.4s}
@keyframes rise{from{opacity:0;transform:translateY(18px)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){.sky-hero .wrap>*{animation:none}}
/* the quiet thesis line under hero content */
.skyline{margin-top:1.5rem;font-size:.8rem;letter-spacing:.06em;color:#8fa1bd}
.skyline i{color:var(--gold-2);margin-inline-end:.35rem}
body[data-lang="fa"] .skyline{letter-spacing:0}

.pill{display:inline-flex;align-items:center;gap:.5rem;background:rgba(255,255,255,.06);border:1px solid rgba(216,177,90,.3);color:#eadfc4;border-radius:999px;padding:.55rem .95rem;font-size:.86rem;font-weight:600}
.pill i{color:var(--gold-2)}

/* ---------- section heads: shamsa + jadval rule ---------- */
.sec-head{text-align:center;margin-bottom:2rem;position:relative}
.orn,.sec-head::before{content:"";display:block;width:34px;height:34px;margin:0 auto .55rem;opacity:.92;
  background:center/contain no-repeat url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%20100%20100%22%20fill%3D%22none%22%20stroke%3D%22%23d8b15a%22%20stroke-width%3D%225%22%3E%3Crect%20x%3D%2228%22%20y%3D%2228%22%20width%3D%2244%22%20height%3D%2244%22/%3E%3Crect%20x%3D%2228%22%20y%3D%2228%22%20width%3D%2244%22%20height%3D%2244%22%20transform%3D%22rotate%2845%2050%2050%29%22/%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%229%22/%3E%3C/svg%3E")}
.sec-head::after{content:"";display:block;width:min(220px,52%);height:9px;margin:.9rem auto 0;opacity:.85;
  background:center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 10'%3E%3Cline x1='14' y1='5' x2='206' y2='5' stroke='%23d8b15a' stroke-opacity='.55' stroke-width='1'/%3E%3Crect x='2' y='1' width='8' height='8' transform='rotate(45 6 5)' fill='%23d8b15a'/%3E%3Crect x='210' y='1' width='8' height='8' transform='rotate(45 214 5)' fill='%23d8b15a'/%3E%3Ccircle cx='110' cy='5' r='2.4' fill='%23d8b15a'/%3E%3C/svg%3E")}
.sec-head .k{font-size:.72rem;letter-spacing:.28em;text-transform:uppercase;color:var(--turq);font-weight:600}
.sec-head h2{font-family:var(--serif);font-weight:600;font-size:clamp(2rem,4vw,2.9rem);color:var(--lapis)}
body[data-lang="fa"] .sec-head h2{font-family:var(--fa);font-weight:700}
.sec-head p{color:var(--muted);max-width:60ch;margin:.5rem auto 0;line-height:1.6}

/* ---------- girih motif divider (drawn on scroll; injected by imic3.js) ---------- */
.motif{display:flex;justify-content:center;padding:1.4rem 0}
.motif svg{width:84px;height:84px;overflow:visible}
.motif svg [data-draw]{fill:none;stroke:var(--gold);stroke-width:1.4;stroke-linejoin:round;stroke-linecap:round;
  stroke-dasharray:var(--len,1200);stroke-dashoffset:var(--len,1200);transition:stroke-dashoffset 1.6s var(--ease)}
.motif.in svg [data-draw]{stroke-dashoffset:0}
.motif svg .inner[data-draw]{stroke-width:1;transition-delay:.55s;opacity:.85}
.motif .dot{fill:var(--gold-2);opacity:0;transition:opacity .6s 1.25s}
.motif.in .dot{opacity:.9}
@media(prefers-reduced-motion:reduce){.motif svg [data-draw]{stroke-dashoffset:0;transition:none}}

/* ---------- footer ---------- */
footer.imic{background:linear-gradient(180deg,#081026,var(--night));color:#aeb9cb;padding-block:3rem 1.5rem;border-top:1px solid rgba(216,177,90,.22)}
footer.imic .grid{display:grid;grid-template-columns:1.4fr 1fr 1fr;gap:2rem;margin-bottom:1.6rem}
footer.imic h4{color:#fff;margin-bottom:.8rem;font-family:var(--serif);font-weight:600;font-size:1.3rem}
body[data-lang="fa"] footer.imic h4{font-family:var(--fa);font-weight:700}
footer.imic a{color:#aeb9cb;display:block;padding:.2rem 0}footer.imic a:hover{color:var(--gold-2)}
footer.imic .fnav{display:grid;grid-template-columns:1fr 1fr;column-gap:1.2rem}
footer.imic .soc a{display:inline-grid;place-items:center;width:38px;height:38px;border-radius:10px;background:rgba(255,255,255,.06);margin-inline-end:.4rem}
footer.imic .bot{border-top:1px solid rgba(255,255,255,.1);padding-top:1.1rem;text-align:center;font-size:.82rem;color:#8090a6}

/* ---------- mobile app bar + "More" sheet ---------- */
.abar{position:fixed;inset-inline:0;bottom:0;z-index:90;display:none;align-items:stretch;
  background:rgba(6,11,28,.97);border-top:1px solid rgba(216,177,90,.22);
  padding-bottom:env(safe-area-inset-bottom)}
.abar a,.abar button{flex:1;display:flex;flex-direction:column;align-items:center;gap:.24rem;padding:.55rem .2rem .5rem;
  background:none;border:none;color:#93a3bd;font-size:.6rem;font-weight:600;font-family:inherit;cursor:pointer;position:relative}
.abar i{font-size:1.1rem}
.abar .on{color:var(--gold-2)}
.abar .on::before{content:"";position:absolute;top:0;inset-inline-start:50%;transform:translateX(-50%);width:26px;height:2px;border-radius:2px;background:var(--gold)}
body[data-lang="fa"] .abar a,body[data-lang="fa"] .abar button{font-size:.66rem}
/* the raised give button — the centre of the bar, literally */
.abar .ab-give i{width:42px;height:42px;display:grid;place-items:center;border-radius:50%;margin-top:-16px;font-size:1rem;
  background:linear-gradient(135deg,var(--gold),#bd9540);color:#241c08;box-shadow:0 6px 16px -6px rgba(216,177,90,.85),0 0 0 4px rgba(6,11,28,.94)}
.abar .ab-give.on i{box-shadow:0 6px 18px -5px rgba(216,177,90,1),0 0 0 4px rgba(6,11,28,.94)}
.abar .ab-give.on::before{display:none}
.sheet{position:fixed;inset:0;z-index:95;display:grid;align-items:end;background:rgba(4,8,20,.62);
  opacity:0;pointer-events:none;transition:opacity .3s}
.sheet.open{opacity:1;pointer-events:auto}
.sheet .card{background:linear-gradient(180deg,#0e1d3c,#081026);border-radius:22px 22px 0 0;border-top:1px solid rgba(216,177,90,.3);
  padding:1rem 1rem calc(1.15rem + env(safe-area-inset-bottom));transform:translateY(26px);transition:transform .34s var(--ease)}
.sheet.open .card{transform:none}
.sheet .grab{width:44px;height:4px;border-radius:4px;background:rgba(255,255,255,.22);margin:0 auto .9rem}
.sheet .sgrid{display:grid;grid-template-columns:repeat(3,1fr);gap:.55rem;max-height:min(58vh,430px);overflow-y:auto}
.sheet .sgrid a{display:flex;flex-direction:column;align-items:center;gap:.45rem;padding:.85rem .35rem;border-radius:14px;
  background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.07);color:#d7e0ec;font-size:.7rem;font-weight:600;text-align:center}
.sheet .sgrid a i{font-size:1.1rem;color:var(--gold-2)}
.sheet .sgrid a.on{border-color:rgba(216,177,90,.55);background:rgba(216,177,90,.1)}
@media(prefers-reduced-motion:reduce){.sheet,.sheet .card{transition:none}}

.betaflag{position:fixed;inset-inline-end:10px;bottom:10px;z-index:99;background:var(--gold);color:#241c08;font-weight:700;font-size:.72rem;padding:.35rem .7rem;border-radius:999px;box-shadow:var(--shadow)}

@media(max-width:720px){
  .abar{display:flex}
  body{padding-bottom:calc(62px + env(safe-area-inset-bottom))}
  .betaflag{bottom:calc(74px + env(safe-area-inset-bottom))}
  .links{display:none}
  /* one tidy row: phone + socials (the email lives in the footer and contact page) */
  .topbar a[href^="mailto"]{display:none}
  .topbar .wrap{gap:.9rem;justify-content:space-between;flex-wrap:nowrap}
  .topbar .sp{margin-inline-start:0}
  .skyline{font-size:.7rem;line-height:1.6;padding-inline:6px}
}
@media(min-width:721px){.sheet{display:none}}
@media(max-width:880px) and (min-width:721px){
  .links a:not(.btn){padding:.5rem .5rem;font-size:.88rem}
}
/* the footer stacks on narrow screens (the 3-column grid cannot shrink below
   its min-content and was pushing every page 169px past the viewport) */
@media(max-width:880px){
  footer.imic .grid{grid-template-columns:1fr;gap:1.6rem}
}
/* small phones: the brand and the language toggle must share one row */
@media(max-width:480px){
  .brand{font-size:.92rem;gap:.45rem}
  .brand img{width:32px;height:32px}
  .ltog{padding:.32rem .6rem;font-size:.85rem}
  nav.bar .wrap{gap:.6rem}
}

/* ---------- manuscript utilities (use sparingly: ornament frames content, never fills it) ---------- */
/* jadval: the ruled frame of a manuscript page — for one or two key panels per page at most */
.jadval{border:1px solid rgba(216,177,90,.55);outline:1px solid rgba(22,49,94,.22);outline-offset:5px;border-radius:2px}
/* rosette verse-marker list: gold marker instead of bullets */
.vlist{list-style:none;padding:0}
.vlist li{position:relative;padding-inline-start:1.55rem;margin-bottom:.55rem;line-height:1.65}
.vlist li::before{content:"";position:absolute;inset-inline-start:0;top:.36em;width:.85em;height:.85em;opacity:.9;
  background:center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='%23d8b15a'%3E%3Ccircle cx='50' cy='50' r='13'/%3E%3Cg%3E%3Ccircle cx='50' cy='14' r='8'/%3E%3Ccircle cx='50' cy='86' r='8'/%3E%3Ccircle cx='14' cy='50' r='8'/%3E%3Ccircle cx='86' cy='50' r='8'/%3E%3Ccircle cx='75' cy='25' r='8'/%3E%3Ccircle cx='25' cy='75' r='8'/%3E%3Ccircle cx='25' cy='25' r='8'/%3E%3Ccircle cx='75' cy='75' r='8'/%3E%3C/g%3E%3C/svg%3E")}

/* ---------- a11y ---------- */
/* parked above the viewport, not to the side: a left/right park becomes a
   10000px scrollable strip in RTL documents */
.skip{position:absolute;top:-120px;inset-inline-start:0;z-index:300;background:var(--lapis);color:#fff;padding:.7rem 1.15rem;border-radius:0 0 12px 0;font-weight:600;text-decoration:none}
.skip:focus{top:0}
body[data-lang="fa"] .skip{font-family:var(--fa)}
a:focus-visible,button:focus-visible,summary:focus-visible,[tabindex]:focus-visible{outline:2px solid var(--gold);outline-offset:2px}

/* fa typography: Persian is never letter-spaced */
body[data-lang="fa"] .k,body[data-lang="fa"] .lbl,body[data-lang="fa"] .lbl2,body[data-lang="fa"] .cd-k,body[data-lang="fa"] .tlabel,body[data-lang="fa"] .skyline{letter-spacing:0}

/* cross-page fade (MPA view transitions; harmless where unsupported) */
@view-transition{navigation:auto}
::view-transition-old(root),::view-transition-new(root){animation-duration:.22s}
@media(prefers-reduced-motion:reduce){::view-transition-old(root),::view-transition-new(root){animation:none}}

/* print: the chrome disappears, the page remains */
@media print{
  .topbar,nav.bar,.abar,.sheet,.betaflag,footer.imic,.sky-hero canvas.sky{display:none!important}
  body{background:#fff;padding-bottom:0}
  .sky-hero{background:#fff;color:#000}
  .sky-hero h1{color:#000}
}
