/* Site-wide polish. Colors/typography come from theme.json; this only adds
   small touches that theme.json can't express. Applies to every page. */

html { scroll-behavior: smooth; }

/* ============================================================
   Colour-mode switch (Dark / Light) — shared component.
   ADR-003 / BRAND.md §3.2 / FE-014. Markup + look only: PLAT-012's
   functions.php already wires clicks on `.bm-mode-btn`, persists the
   choice, sets `data-theme` on <html>, and reflects `aria-pressed` on
   every `.bm-mode-switch` on the page — no JS lives here.

   Self-contained token set (dark-first override pattern, same as every
   page stylesheet): default = dark edition; :root[data-theme="light"]
   wins explicitly in both directions; absent storage follows the OS unless
   a Dark or Light choice is saved. Site-wide, so every template can drop the same
   markup and inherit this styling even before its own page gets a
   light edition (FE-015/016/017).
   ============================================================ */
:root{
  --bm-switch-bg: linear-gradient(180deg, rgba(244,239,227,0.05), rgba(244,239,227,0.015));
  --bm-switch-border: rgba(244,239,227,0.14);
  --bm-switch-bezel-shadow: inset 0 1px 0 rgba(244,239,227,0.06), inset 0 -1px 3px rgba(8,11,8,0.65);
  --bm-switch-text: #8E8B7E;
  --bm-switch-text-hover: #F4EFE3;
  --bm-switch-accent: #E2A837;
  --bm-switch-accent-text: #0A0F0B;
  --bm-switch-thumb-start: #EFC35C;
  --bm-switch-thumb-end: #E2A837;
  --bm-switch-thumb-border: rgba(226,168,55,0.65);
  --bm-switch-thumb-shadow: 0 0 16px rgba(226,168,55,0.40), inset 0 1px 0 rgba(226,168,55,0.35);
}
:root[data-theme="light"]{
  --bm-switch-bg: linear-gradient(180deg, rgba(244,239,227,0.55), rgba(42,40,32,0.025));
  --bm-switch-border: rgba(42,40,32,0.16);
  --bm-switch-bezel-shadow: inset 0 1px 0 rgba(244,239,227,0.70), inset 0 -1px 2px rgba(42,40,32,0.08);
  --bm-switch-text: var(--bm-muted, #544E38);
  --bm-switch-text-hover: #2A2820;
  --bm-switch-accent: var(--bm-gold-ink, #664914);
  --bm-switch-accent-text: var(--bm-on-gold, #1A1712);
  --bm-switch-focus: var(--bm-focus, #664914);
  --bm-switch-thumb-fill: var(--bm-gold, #B9842A);
  --bm-switch-thumb-start: #B9842A;
  --bm-switch-thumb-end: #946815;
  --bm-switch-thumb-border: rgba(148,104,21,0.55);
  --bm-switch-thumb-shadow: 0 3px 7px rgba(42,40,32,0.30);
}
@media (prefers-color-scheme:light){
  :root:not([data-theme="dark"]){
    --bm-switch-bg: linear-gradient(180deg, rgba(244,239,227,0.55), rgba(42,40,32,0.025));
    --bm-switch-border: rgba(42,40,32,0.16);
    --bm-switch-bezel-shadow: inset 0 1px 0 rgba(244,239,227,0.70), inset 0 -1px 2px rgba(42,40,32,0.08);
    --bm-switch-text: var(--bm-muted, #544E38);
    --bm-switch-text-hover: #2A2820;
    --bm-switch-accent: var(--bm-gold-ink, #664914);
    --bm-switch-accent-text: var(--bm-on-gold, #1A1712);
    --bm-switch-focus: var(--bm-focus, #664914);
    --bm-switch-thumb-fill: var(--bm-gold, #B9842A);
    --bm-switch-thumb-start: #B9842A;
    --bm-switch-thumb-end: #946815;
    --bm-switch-thumb-border: rgba(148,104,21,0.55);
    --bm-switch-thumb-shadow: 0 3px 7px rgba(42,40,32,0.30);
  }
}

.bm-mode-switch{
  --bm-switch-cell-width: 66px;
  --bm-switch-gap: 2px;
  --bm-switch-padding: 3px;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--bm-switch-gap);
  padding: var(--bm-switch-padding);
  border: 1px solid var(--bm-switch-border);
  border-radius: 999px;
  background: var(--bm-switch-bg);
  box-shadow: var(--bm-switch-bezel-shadow);
  isolation: isolate;
  transition: border-color .3s ease, background .3s ease, box-shadow .3s ease;
}
.bm-mode-switch, .bm-mode-switch *{ box-sizing: border-box; }
.bm-mode-switch .bm-mode-thumb{
  position: absolute;
  z-index: 0;
  top: var(--bm-switch-padding);
  left: var(--bm-switch-padding);
  width: var(--bm-switch-cell-width);
  height: calc(100% - (var(--bm-switch-padding) * 2));
  border: 1.5px solid transparent;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
  transition: transform .45s cubic-bezier(.2,.7,.2,1), background .3s ease, border-color .3s ease, box-shadow .3s ease;
}
.bm-mode-switch .bm-mode-btn{
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 0 0 var(--bm-switch-cell-width);
  width: var(--bm-switch-cell-width);
  height: 30px;
  padding: 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0;
  text-transform: uppercase;
  line-height: 1;
  color: var(--bm-switch-text);
  background: transparent;
  border: 0;
  appearance: none;
  cursor: pointer;
  border-radius: 999px;
  transition: color .25s ease, background .3s ease, box-shadow .3s ease;
}
.bm-mode-switch .bm-mode-glyph{
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}
.bm-mode-switch .bm-mode-btn:hover{ color: var(--bm-switch-text-hover); }
.bm-mode-switch .bm-mode-btn[data-mode="dark"][aria-pressed="true"],
.bm-mode-switch .bm-mode-btn[data-mode="light"][aria-pressed="true"]{
  color: var(--bm-switch-accent-text);
  background: var(--bm-switch-thumb-fill, linear-gradient(180deg, var(--bm-switch-thumb-start), var(--bm-switch-thumb-end)));
  box-shadow: var(--bm-switch-thumb-shadow);
}
.bm-mode-switch .bm-mode-btn:focus-visible{
  outline: 2px solid var(--bm-switch-focus, var(--bm-switch-accent));
  outline-offset: 3px;
}

@supports selector(.bm-mode-switch:has(.bm-mode-btn)){
  .bm-mode-switch:has(.bm-mode-btn[data-mode="dark"][aria-pressed="true"]) .bm-mode-thumb,
  .bm-mode-switch:has(.bm-mode-btn[data-mode="light"][aria-pressed="true"]) .bm-mode-thumb{
    background: var(--bm-switch-thumb-fill, linear-gradient(180deg, var(--bm-switch-thumb-start), var(--bm-switch-thumb-end)));
    border-color: var(--bm-switch-thumb-border);
    box-shadow: var(--bm-switch-thumb-shadow);
  }
  .bm-mode-switch:has(.bm-mode-btn[data-mode="dark"][aria-pressed="true"]) .bm-mode-thumb{
    transform: translateX(0);
  }
  .bm-mode-switch:has(.bm-mode-btn[data-mode="light"][aria-pressed="true"]) .bm-mode-thumb{
    transform: translateX(calc(var(--bm-switch-cell-width) + var(--bm-switch-gap)));
  }
  .bm-mode-switch .bm-mode-btn[data-mode="dark"][aria-pressed="true"],
  .bm-mode-switch .bm-mode-btn[data-mode="light"][aria-pressed="true"]{
    background: transparent;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce){
  .bm-mode-switch, .bm-mode-switch .bm-mode-thumb, .bm-mode-switch .bm-mode-btn{ transition: none !important; }
}

/* ============================================================
   Account chrome (login link / reader menu) — shared component.
   Native <details>; no JavaScript. Gold is reserved for the
   monogram ring, focus, and hover edge.
   ============================================================ */
.bm-acct,
.bm-acct-login.bm-acct-login{
  flex:0 0 auto;
}

:where(.notebook-nav, .listing-nav, .about-nav, .career-nav) > .bm-mode-switch{
  margin-left:auto;
}

.bm-acct{
  position:relative;
  display:inline-flex;
  align-items:center;
  z-index:30;
}

.bm-acct-summary,
.bm-acct-login.bm-acct-login{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:38px;
  border-radius:999px;
  text-decoration:none;
  transition:color .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.bm-acct-summary{
  border:1px solid var(--bm-border, rgba(244,239,227,0.10));
  background:var(--bm-surface, #121A13);
  background:color-mix(in srgb, var(--bm-surface, #121A13) 78%, transparent);
  color:var(--bm-muted, #8E8B7E);
  box-shadow:inset 0 1px 0 rgba(244,239,227,0.05);
  gap:6px;
  padding:2px 9px 2px 2px;
  list-style:none;
  cursor:pointer;
  user-select:none;
}

.bm-acct-summary::-webkit-details-marker{
  display:none;
}

.bm-acct-summary::marker{
  content:"";
}

.bm-acct-login.bm-acct-login{
  gap:7px;
  padding:0 13px;
  font-family:var(--bm-font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-size:11px;
  font-weight:500;
  letter-spacing:.12em;
  line-height:1;
  white-space:nowrap;
  text-transform:uppercase;
  color:var(--bm-heading, #F4EFE3);
  border:1px solid var(--bm-border-gold, rgba(226,168,55,0.30));
  background:transparent;
}

.bm-acct-login-icon{
  width:14px;
  height:14px;
  flex:0 0 auto;
  color:var(--bm-gold-ink, var(--bm-gold, #E2A837));
}

.bm-acct-monogram{
  width:32px;
  height:32px;
  border:1px solid var(--bm-gold, #E2A837);
  border-radius:50%;
  background:var(--bm-surface, #121A13);
  color:var(--bm-gold-ink, var(--bm-gold, #E2A837));
  font-family:var(--bm-font-heading, "Fraunces", Georgia, serif);
  font-size:14px;
  font-weight:600;
  line-height:1;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:inset 0 0 0 1px var(--bm-border-gold, rgba(226,168,55,0.30));
}

.bm-acct-caret{
  width:10px;
  height:6px;
  flex:0 0 auto;
  transition:transform .18s ease;
}

.bm-acct[open] .bm-acct-caret{
  transform:rotate(180deg);
}

.bm-acct-summary:hover{
  border-color:var(--bm-border-gold, rgba(226,168,55,0.30));
  background:var(--bm-elevated, #1A241B);
  color:var(--bm-heading, #F4EFE3);
}

.bm-acct-login.bm-acct-login:hover{
  border-color:var(--bm-gold, #E2A837);
  background:color-mix(in srgb, var(--bm-gold, #E2A837) 8%, transparent);
  color:var(--bm-heading, #F4EFE3);
}

.bm-acct-summary:focus-visible,
.bm-acct-login.bm-acct-login:focus-visible,
.bm-acct .bm-acct-menu-link:focus-visible{
  outline:2px solid var(--bm-focus, var(--bm-gold, #E2A837));
  outline-offset:3px;
}

.bm-acct-menu{
  position:absolute;
  top:calc(100% + 9px);
  right:0;
  min-width:232px;
  padding:8px;
  border:1px solid var(--bm-border, rgba(244,239,227,0.10));
  border-top-color:var(--bm-border-gold, rgba(226,168,55,0.30));
  border-radius:14px;
  background:var(--bm-surface, #121A13);
  box-shadow:0 18px 44px rgba(8,11,8,0.42);
}

.bm-acct-header{
  padding:10px 10px 12px;
  border-bottom:1px solid var(--bm-border, rgba(244,239,227,0.10));
  margin-bottom:6px;
}

.bm-acct-header strong,
.bm-acct-header span{
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
}

.bm-acct-header strong{
  color:var(--bm-heading, #F4EFE3);
  font-family:var(--bm-font-heading, "Fraunces", Georgia, serif);
  font-size:16px;
  font-weight:500;
  line-height:1.2;
  letter-spacing:0;
}

.bm-acct-header span{
  margin-top:4px;
  color:var(--bm-muted, #8E8B7E);
  font-family:var(--bm-font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-size:11px;
  line-height:1.35;
  letter-spacing:.02em;
}

.bm-acct .bm-acct-menu-link{
  display:block;
  padding:9px 10px;
  border-radius:9px;
  color:var(--bm-body, #CFC9BB);
  font-family:var(--bm-font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-size:12px;
  font-weight:500;
  letter-spacing:.04em;
  line-height:1.2;
  text-decoration:none;
  transition:color .18s ease, background .18s ease;
}

.bm-acct .bm-acct-menu-link:hover{
  background:var(--bm-elevated, #1A241B);
  color:var(--bm-gold-ink-hover, var(--bm-gold-light, #EFC35C));
}

@media (prefers-color-scheme:light){
  :root:not([data-theme="dark"]) .bm-acct-summary{
    background:var(--bm-surface, #DFD7C3);
    background:color-mix(in srgb, var(--bm-surface, #DFD7C3) 84%, transparent);
    box-shadow:inset 0 1px 0 rgba(244,239,227,0.50);
  }
  :root:not([data-theme="dark"]) .bm-acct-menu{
    box-shadow:0 18px 38px rgba(42,40,32,0.22);
  }
  :root:not([data-theme="dark"]) .bm-acct-login.bm-acct-login{
    color:var(--bm-gold-ink, var(--bm-gold, #E2A837));
  }
}

:root[data-theme="light"] .bm-acct-summary{
  background:var(--bm-surface, #DFD7C3);
  background:color-mix(in srgb, var(--bm-surface, #DFD7C3) 84%, transparent);
  box-shadow:inset 0 1px 0 rgba(244,239,227,0.50);
}

:root[data-theme="light"] .bm-acct-menu{
  box-shadow:0 18px 38px rgba(42,40,32,0.22);
}

:root[data-theme="light"] .bm-acct-login.bm-acct-login{
  color:var(--bm-gold-ink, var(--bm-gold, #E2A837));
}

@media (max-width:420px){
  .bm-acct-menu{
    right:-6px;
    min-width:min(232px, calc(100vw - 28px));
  }
  .bm-acct-login.bm-acct-login{
    padding-inline:11px;
  }
}

@media (prefers-reduced-motion: reduce){
  .bm-acct-summary,
  .bm-acct-login.bm-acct-login,
  .bm-acct-caret,
  .bm-acct .bm-acct-menu-link{
    transition:none !important;
  }
}

::selection {
  background: #E2A837;   /* gold */
  color: #0A0F0B;        /* obsidian */
}

body { -webkit-font-smoothing: antialiased; }

/* Custom scrollbar in the brand palette */
* {
  scrollbar-width: thin;
  scrollbar-color: #B9842A #0A0F0B;
}
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-track { background: #0A0F0B; }
*::-webkit-scrollbar-thumb {
  background: #B9842A;
  border-radius: 8px;
  border: 2px solid #0A0F0B;
}
*::-webkit-scrollbar-thumb:hover { background: #B9842A; }

/* ---- About page helpers ---- */
.bm-kicker {
  color: #E2A837;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.bm-values {
  color: #8E8B7E;
  letter-spacing: 0.01em;
}

/* Pull quote — gold mark, generous room for the Arabic line.
   Scoped to .bmhud-about (FE-BUG-002): this RTL/Arabic treatment was authored
   for the old About page content and, unqualified, leaked onto every
   .wp-block-quote site-wide — including single posts, where single.css had
   to out-specificity it (see single.css's Move 2 comment). The current About
   template (page-about-basel-mefleh.php) hardcodes its copy and never calls
   the_content(), so no .wp-block-quote currently renders under .bmhud-about
   either — this rule appears unused theme-wide. Scoped defensively rather
   than removed; flagged for the lead to decide on removal. */
.bmhud-about .wp-block-quote {
  border-left: 2px solid rgba(226, 168, 55, 0.3);
  padding-left: 28px;
  margin: 40px 0;
}
.bmhud-about .wp-block-quote p:first-child {
  font-family: "Fraunces", Georgia, serif;
  font-size: 22px;
  color: #F4EFE3;
  direction: rtl;
  margin-bottom: 8px;
}
.bmhud-about .wp-block-quote p em {
  font-style: italic;
  color: #CFC9BB;
  font-size: 16px;
}
