/* Gathic Mind · site layer for Speak with Zarathushtra (a project by Gathic Mind).
   Needs tokens.css (v2) first. Maps the page's variable names onto the brand tokens (Night & Saffron, dark-first)
   and applies the type, colour and component rules of the brand guide v2. */

:root{
  --bg:var(--gm-bg); --panel:var(--gm-surface); --ink:var(--gm-fg); --muted:var(--gm-muted); --rule:var(--gm-line);
  --gold:var(--gm-accent); --teal:var(--gm-accent); --ash:var(--gm-muted); --rose:var(--gm-fg);
  --soft:#1E2540; --gold-soft:rgba(240,181,74,.13); --teal-soft:rgba(240,181,74,.13); --ash-soft:rgba(167,171,186,.14);
  --l2:var(--gm-muted); --l3:var(--gm-muted); --l4:var(--gm-muted);
  --l2-soft:var(--ash-soft); --l3-soft:var(--ash-soft); --l4-soft:var(--ash-soft);
  --glow:transparent; --halo:var(--gm-surface);
  --tx:var(--gm-font-text);
  --f-disp:var(--gm-font-display); --f-ui:var(--tx); --f-av:var(--gm-font-text);
}
@media (prefers-color-scheme: light){:root:not([data-theme="dark"]){
  --soft:#ECE7DB; --gold-soft:rgba(138,90,10,.10); --teal-soft:rgba(138,90,10,.10); --ash-soft:rgba(85,91,112,.10)}}
:root[data-theme="light"]{--soft:#ECE7DB; --gold-soft:rgba(138,90,10,.10); --teal-soft:rgba(138,90,10,.10); --ash-soft:rgba(85,91,112,.10)}
html[lang="fa"]{--tx:var(--gm-font-persian);--f-disp:var(--gm-font-persian-display);--f-ui:var(--gm-font-persian);--f-av:var(--gm-font-persian)}

/* ---- ground and type ---- */
body{background:var(--bg);color:var(--ink);font-family:var(--tx);font-size:16px;line-height:1.55}
html[lang="fa"] body{font-size:17.5px;line-height:1.8}
/* headings: Noto Serif Display, wdth 87.5, weight 600 (the .gm-display recipe) */
h1,h2,h3{font-family:var(--gm-font-display);font-variation-settings:var(--gm-display-axes);font-weight:var(--gm-weight-display);letter-spacing:-.01em;line-height:1.12}
h1{line-height:var(--gm-leading-display)}
h2{font-size:20px} h3{font-size:18px}
/* Persian: Noto Kufi Arabic 700 for h1 and h2, Vazirmatn 600 for h3 */
html[lang="fa"] :is(h1,h2){font-family:var(--gm-font-persian-display);font-variation-settings:normal;font-weight:700;letter-spacing:0;line-height:1.5}
html[lang="fa"] h3{font-family:var(--gm-font-persian);font-variation-settings:normal;font-weight:600;letter-spacing:0;line-height:1.5}
.eyebrow{color:var(--gm-muted);font-weight:600}
.av{font-family:var(--gm-font-text);font-style:italic}
[lang="ae"]{font-family:var(--gm-font-avestan)}
a{color:var(--gm-accent)}

/* ---- site header (v4): the lockup sits at the inline-start side with a page gutter (left in English and French,
   right in Persian), never mirrored, with a small "A project by" line above it; the language switch sits at the opposite edge. ---- */
header.site{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 16px;margin:0;max-width:none;
  padding:12px calc(clamp(16px,3vw,40px) + env(safe-area-inset-right,0px)) 12px calc(clamp(16px,3vw,40px) + env(safe-area-inset-left,0px));border-bottom:1px solid var(--rule)}
header.site .lang{display:flex;gap:6px;margin:0;padding:0}
.lang a{color:var(--ink);font-size:14px;border:1px solid var(--rule);border-radius:999px;padding:3px 12px;text-decoration:none;white-space:nowrap}
.lang a:hover{border-color:var(--gm-accent)}
.lang a[aria-current="page"]{background:var(--soft);border-color:var(--gm-muted);font-weight:600}
.brand{display:inline-flex;flex-direction:column;align-items:flex-start;gap:5px;line-height:0;flex:none;text-decoration:none}
.brand img{height:clamp(34px,10vw,46px);width:auto;display:block}
.brand .by{font:400 clamp(12px,3.3vw,14px)/1 var(--gm-font-text);letter-spacing:.02em;color:var(--gm-muted);white-space:nowrap}
html[lang="fa"] .brand .by{font-family:var(--gm-font-persian);font-size:clamp(12.5px,3.5vw,15px);letter-spacing:0}
.brand .lk-l{display:none}
@media (prefers-color-scheme: light){:root:not([data-theme="dark"]) .brand .lk-d{display:none}:root:not([data-theme="dark"]) .brand .lk-l{display:block}}
:root[data-theme="light"] .brand .lk-d{display:none}
:root[data-theme="light"] .brand .lk-l{display:block}
@media (max-width:760px){
  header.site .lang{margin:0;gap:0}
  header.site .lang a{border:0;border-radius:6px;padding:3px 5px;font-size:12.5px;color:var(--gm-muted)}
  header.site .lang a[aria-current="page"]{background:transparent;color:var(--ink);font-weight:600;box-shadow:inset 0 -2px 0 var(--gm-muted)}
}
.back{font-size:14px}
.hd-end{display:flex;align-items:center;gap:10px}
.theme{display:inline-grid;place-items:center;width:34px;height:34px;padding:0;border:1px solid var(--rule);border-radius:999px;background:transparent;color:var(--ink);cursor:pointer}
.theme:hover{border-color:var(--gm-accent)}
.theme .i-moon{display:none}
@media (prefers-color-scheme: light){:root:not([data-theme="dark"]) .theme .i-sun{display:none}:root:not([data-theme="dark"]) .theme .i-moon{display:block}}
:root[data-theme="light"] .theme .i-sun{display:none}
:root[data-theme="light"] .theme .i-moon{display:block}
@media (max-width:760px){.hd-end{gap:4px}.theme{width:30px;height:30px}}

/* the mark beside his name; 24 px small cut */
.mk{width:24px;height:24px;flex:0 0 24px;display:inline-block;background:url(/brand/logo/mark-small-dark-ground.svg) center/contain no-repeat}
@media (prefers-color-scheme: light){:root:not([data-theme="dark"]) .mk{background-image:url(/brand/logo/mark-small-light-ground.svg)}}
:root[data-theme="light"] .mk{background-image:url(/brand/logo/mark-small-light-ground.svg)}

/* ---- his words: the refrain in the display face and Saffron ---- */
/* his words in transliteration: the .gm-translit recipe, Noto Serif Display 400 in the accent colour */
.refrain{font-family:var(--gm-font-translit);font-variation-settings:var(--gm-display-axes);font-weight:var(--gm-weight-translit);font-style:normal;line-height:1.2;font-size:clamp(24px,2.4vw,28px);color:var(--gm-accent)}
.side .refrain{font-size:clamp(24px,2.2vw,28px)}
.refrain small{font-family:var(--tx);font-variation-settings:normal;font-weight:400;font-size:14px;letter-spacing:0;line-height:1.5;color:var(--gm-muted);margin-top:8px}

/* ---- panels ---- */
.panel{box-shadow:0 14px 36px -28px rgba(0,0,0,.55)}
.portrait .arch,.side .portrait .arch{box-shadow:0 0 0 6px var(--panel),0 0 0 7px var(--rule),0 30px 60px -30px rgba(0,0,0,.6)}
.portrait figcaption{color:var(--gm-muted)}
.unavail{background:var(--soft)}

/* ---- level switch ---- */
.levels .lbl,.reader .lbl,.reader .kind{color:var(--gm-muted);font-weight:600}
.seg button b{font-family:var(--tx);font-weight:600;letter-spacing:0}
.seg button[aria-checked="true"]{background:var(--soft);color:var(--ink);box-shadow:inset 0 -3px 0 var(--gm-accent)}
.seg button[aria-checked="true"] span{color:var(--gm-muted);opacity:1}
.qs button:hover,.qs button:focus-visible{border-color:var(--gm-accent);box-shadow:none}

/* ---- conversation ---- */
.msg.you{background:var(--soft)}
.msg.z{border-color:var(--rule)}
.msg .who{font-family:var(--tx);font-weight:600;font-size:14px;color:var(--ink);display:flex;align-items:center;gap:8px}
.msg .who small{color:var(--gm-muted)}
.msg.err{border-style:dashed}
.btn{font-family:var(--tx);font-weight:600}
.btn.pri{background:var(--gm-accent);color:var(--gm-on-accent);border-color:var(--gm-accent)}
.btn.pri:hover:not(:disabled){filter:brightness(1.07)}
.btns{flex:none}
.askrow{flex-wrap:wrap}
.askrow textarea{flex:1 1 260px}

/* ---- citations: Haze, a Saffron mark only for the stanza now open ---- */
.rf{color:var(--gm-muted);font-weight:600;border-bottom:1px dotted var(--gm-muted)}
.rf:hover,.rf:focus-visible,.rf[aria-current="true"]{color:var(--gm-accent);border-bottom-color:var(--gm-accent)}

/* ---- tags: type and outline first, colour second ---- */
.tg{background:transparent;border:1px solid var(--gm-line);color:var(--gm-muted);font-weight:600}
.tg.gat{color:var(--gm-accent);border-color:var(--gm-accent)}
.tg.ctd{color:var(--ink);border-color:var(--gm-muted)}
.tg.bey{color:var(--gm-muted);border-color:var(--gm-muted);border-style:dashed}
.tg.l2,.tg.l3,.tg.l4,.tg.lo{background:var(--ash-soft);color:var(--gm-muted);border-color:transparent}
.tg.ten{background:transparent;color:var(--ink);border-color:var(--ink)}

/* ---- stanza reader ---- */
.reader .id{font-family:var(--gm-font-display);font-variation-settings:var(--gm-display-axes);font-weight:var(--gm-weight-display);font-size:32px;letter-spacing:0}
.reader .mills{font-family:var(--gm-font-text);font-style:italic;color:var(--gm-muted)}
.reader .split{background:var(--soft);border-inline-start:3px solid var(--gm-muted)}
.terms span{background:var(--soft)}
.trs summary{color:var(--ink)}

/* agreement: broad in Ash; partial in Haze with a Saffron tick; disagreement carries the word, never red */
.agr{border-inline-start-color:var(--gm-line)}
.agr-h{border-inline-start-color:var(--ink)}
.agr-p{border-inline-start-color:var(--gm-muted);position:relative}
.agr-p::before{content:"";position:absolute;inset-block-start:4px;inset-inline-start:-3px;width:3px;height:16px;background:var(--gm-accent)}
.agr-l{border-inline-start-color:var(--ink);border-inline-start-style:dashed}
.agr-l p:first-of-type b{text-decoration:underline;text-underline-offset:3px}

/* ---- sources pages ---- */
.st{background:transparent;border:1px solid var(--gm-line);color:var(--gm-muted);font-weight:600}
.st.ok{color:var(--ink);border-color:var(--gm-muted)}
.st.todo{color:var(--gm-muted);border-color:var(--gm-muted);border-style:dashed}
.warn{background:var(--soft)}
.t{font-weight:600}

/* ---- Persian: Vazirmatn, one step up from the Latin beside it ---- */
html[lang="fa"] :is(button,input,textarea,.btn,.eyebrow,.lbl,.tg,.rf,.seg b,.seg span,.who,.who small,.st,.warn,summary,figcaption,.lang a){font-family:var(--gm-font-persian)}
html[lang="fa"] .msg{font-size:17.5px}
html[lang="fa"] .qs button{font-size:16.5px}
html[lang="fa"] .reader .gist{font-size:18px}
html[lang="fa"] .cv p,html[lang="fa"] .agr p,html[lang="fa"] .trs p{font-size:16.5px}
html[lang="fa"] .refrain{font-family:var(--gm-font-persian);font-variation-settings:normal;font-weight:400;letter-spacing:0;line-height:1.55;font-size:clamp(22px,2.2vw,26px)}
html[lang="fa"] .refrain small{font-size:15px}
html[lang="fa"] .rf,html[lang="fa"] .tg{font-family:var(--gm-font-text)}
html[lang="fa"] .lede,html[lang="fa"] .tier{font-size:17px}

/* ---- narrow screens ---- */
@media (max-width:760px){
  .side .refrain{font-size:20px;line-height:1.3}
  .side .portrait .arch{box-shadow:0 0 0 3px var(--panel),0 0 0 4px var(--rule)}
  .askrow textarea{flex-basis:100%}
  .btns{flex-direction:row;width:100%}
  .btns .btn{flex:1}
}

/* ---- side column ---- */
.side .eyebrow{font-size:12px}
.side h1{font-size:clamp(30px,3vw,40px)}
@media (max-width:760px){
  .side{gap:16px;align-items:center}
  .side .portrait .arch{width:150px;max-width:150px;box-shadow:0 0 0 3px var(--panel),0 0 0 4px var(--rule)}
  .side .eyebrow{display:block;font-size:11px;letter-spacing:.1em;text-align:start}
  .side .txt{align-items:flex-start;gap:8px;min-width:0}
  .side h1{font-size:24px;text-align:start}
  .side .refrain{font-size:18px;text-align:start}
  .side .refrain small{display:none}
}

/* ---- credit: one quiet line after "Sources and references" ---- */
footer .credit{margin:.6em 0 0}
footer .credit strong{color:var(--ink);font-weight:600}
footer .credit a{color:inherit;text-decoration:underline;text-decoration-color:var(--rule);text-underline-offset:3px}
footer .credit a:hover,footer .credit a:focus-visible{text-decoration-color:var(--gm-accent)}

/* ---- header: one row at every width, in every language. Language codes on phones. ---- */
header.site{flex-wrap:nowrap}
.lang .short{display:none}
@media (max-width:760px){
  header.site{gap:8px}
  .lang .full{display:none}
  .lang .short{display:inline;font-size:12.5px;letter-spacing:.04em}
  header.site .lang a{padding:5px 6px}
  .hd-end{gap:2px}
}
header.site .lang a{display:inline-flex;align-items:center;line-height:1}

/* ---- privacy note + optional age range under the ask box ---- */
.priv{margin:10px 0 0;display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px;font-size:13px;color:var(--gm-muted)}
.priv p{margin:0;flex:1 1 280px}
.priv label{display:inline-flex;align-items:center;gap:8px;white-space:nowrap}
.priv select{font:inherit;font-size:13px;color:var(--ink);background:var(--panel);border:1px solid var(--rule);border-radius:8px;padding:4px 8px}
