/* Shared by every page: the palette, fonts, and the site nav (top bar, phone menu, light/dark button).
   Page-specific styles stay in each page; a page can add its own tokens or override these. */
html,body{margin:0}
img{max-width:100%}
[hidden]{display:none!important}

:root{
  --bg:#eef0f3; --surface:#fbfbfc; --ink:#1b2234; --muted:#5a6276; --line:#d3d8e2;
  --lapis:#2747a3; --lapis-soft:#dfe5f6; --ochre:#a8701a; --ochre-soft:#f5ead6; --crimson:#b0313e; --crimson-soft:#f6e1e3;
  --display:"Cinzel","Trajan Pro",Georgia,serif;
  --body:"Alegreya",Georgia,"Times New Roman",serif;
  --ui:"Alegreya Sans","Segoe UI",system-ui,sans-serif;
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --bg:#10141f; --surface:#181e2d; --ink:#e7e9f0; --muted:#9aa2b8; --line:#2c3449;
  --lapis:#8ea6f0; --lapis-soft:#22305a; --ochre:#e0ac55; --ochre-soft:#3a2d17; --crimson:#e0707b; --crimson-soft:#3a1d22; color-scheme:dark}}
:root[data-theme="dark"]{
  --bg:#10141f; --surface:#181e2d; --ink:#e7e9f0; --muted:#9aa2b8; --line:#2c3449;
  --lapis:#8ea6f0; --lapis-soft:#22305a; --ochre:#e0ac55; --ochre-soft:#3a2d17; --crimson:#e0707b; --crimson-soft:#3a1d22; color-scheme:dark}

/* Site nav: sticks to the top; site.js builds it and sets --navh to its height */
.sitenav{display:flex;flex-wrap:wrap;gap:4px 18px;align-items:baseline;padding-block:14px 0;font-family:var(--ui);font-size:14px}
.sitenav .home{font-family:var(--display);font-weight:700;letter-spacing:.04em;color:var(--ink);margin-right:auto}
.sitenav a{color:var(--muted);text-decoration:none;padding:4px 0;border-bottom:2px solid transparent}
.sitenav a:hover{color:var(--ink)}
.sitenav a[aria-current="page"]{color:var(--ink);border-bottom-color:var(--ochre)}
.sitenav{position:sticky;top:env(safe-area-inset-top,0px);z-index:8;background:var(--bg);padding-bottom:10px;border-bottom:1px solid transparent;transition:border-color .15s}
.sitenav.stuck{border-bottom-color:var(--line)}
.sitenav .ns{display:none}
/* Where all the tabs will not fit on one line, drop the site name and use short labels (site.js decides) */
.sitenav.compact{gap:4px 14px}
.sitenav.compact .home,.sitenav.compact .nl{display:none}
.sitenav.compact .ns{display:inline}
.sitenav.compact>a:first-of-type{margin-left:auto}
@media (max-width:820px){
  /* Phones: site name, a Menu button that opens every page, and the theme toggle */
  .sitenav{flex-wrap:nowrap;gap:8px;align-items:center}
  .sitenav>a{display:none}
  .sitenav .home{font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
  .sitenav .menu-btn{display:inline-flex}
  .sitenav .theme-btn .tl{display:none}
  .sitenav .theme-btn{flex:none}
  .sitenav .acct-btn .an{display:none}
}
@media (max-width:360px){.sitenav .home{font-size:13px;letter-spacing:.02em}.sitenav .home .nt{display:none}}
/* A wider screen where even the compact tabs will not fit on one line: use the phone layout (site.js decides) */
.sitenav.tight{flex-wrap:nowrap;gap:8px;align-items:center}
.sitenav.tight>a{display:none}
.sitenav.tight .home{display:inline}
.sitenav.tight .menu-btn{display:inline-flex}
.menu-btn{display:none;align-items:center;gap:6px;font:inherit;font-size:13px;font-weight:700;border:1px solid var(--line);background:var(--surface);color:var(--ink);padding:4px 12px;border-radius:999px;cursor:pointer}
.menu-btn[aria-expanded="true"]{background:var(--ink);color:var(--surface);border-color:var(--ink)}
.menu-btn:focus-visible{outline:2px solid var(--lapis);outline-offset:2px}
.site-menu{position:absolute;left:0;right:0;top:100%;margin-top:6px;background:var(--surface);border:1px solid var(--line);border-radius:10px;box-shadow:0 12px 32px rgba(0,0,0,.18);padding:6px;display:grid;gap:2px;max-height:calc(100vh - 90px);overflow:auto;white-space:normal}
.site-menu a{display:block;border:0;padding:9px 12px;border-radius:8px;color:var(--ink);text-decoration:none}
.site-menu a b{display:block;font-size:15px}
.site-menu a span{display:block;font-size:12.5px;color:var(--muted);font-weight:500}
.site-menu a:hover,.site-menu a:focus-visible{background:var(--bg);outline:none}
.site-menu a[aria-current="page"]{background:var(--lapis-soft)}
.site-menu a[aria-current="page"] b::after{content:" · you are here";font-size:12px;font-weight:500;color:var(--muted)}
.sitenav a:focus-visible{outline:2px solid var(--lapis);outline-offset:2px}
.theme-btn{font-family:var(--ui);font-size:13px;font-weight:500;border:1px solid var(--line);background:var(--surface);color:var(--ink);padding:3px 10px;border-radius:999px;cursor:pointer}
.theme-btn:hover{border-color:var(--muted)}
.theme-btn:focus-visible{outline:2px solid var(--lapis);outline-offset:2px}

/* Account: Sign in, or the signed-in reader's menu (only when the site is served by the app) */
.acct{position:relative;flex:none}
.acct-btn{display:inline-flex;align-items:center;gap:6px;font-family:var(--ui);font-size:13px;font-weight:700;border:1px solid var(--line);background:var(--surface);color:var(--ink);padding:3px 10px;border-radius:999px;cursor:pointer;text-decoration:none}
.sitenav a.acct-btn{color:var(--ink);border:1px solid var(--line);padding:3px 10px}
.acct-btn:hover{border-color:var(--muted)}
.acct-btn:focus-visible{outline:2px solid var(--lapis);outline-offset:2px}
.acct-btn .av{display:inline-grid;place-items:center;width:18px;height:18px;border-radius:50%;background:var(--lapis);color:var(--surface);font-size:11px;line-height:1}
button.acct-btn{padding-left:4px}
.acct-menu{position:absolute;right:0;top:calc(100% + 8px);min-width:220px;background:var(--surface);border:1px solid var(--line);border-radius:10px;box-shadow:0 12px 32px rgba(0,0,0,.18);padding:6px;display:grid;gap:2px;z-index:9}
.acct-menu .who{padding:8px 10px 10px;border-bottom:1px solid var(--line);margin-bottom:4px;font-size:13px;color:var(--muted);overflow-wrap:anywhere}
.acct-menu .who b{display:block;color:var(--ink);font-size:14px}
.acct-menu a,.acct-menu button{display:block;text-align:left;font:inherit;font-size:14px;color:var(--ink);background:none;border:0;padding:8px 10px;border-radius:8px;cursor:pointer;text-decoration:none}
.acct-menu a:hover,.acct-menu button:hover,.acct-menu a:focus-visible,.acct-menu button:focus-visible{background:var(--bg);outline:none}
