/* ==========================================================================
   Light / dark mode
   Dark is the default and lives in main.css. Light mode only re-points the
   palette tokens, so every rule that already uses var(--ptah-*) follows.
   The <html data-theme="light"> attribute is set by an inline script in
   <head> (see ptah_theme_preload in functions.php) before first paint.
   ========================================================================== */

:root { color-scheme: dark; }

html[data-theme="light"] {
  color-scheme: light;

  /* "black" tokens are the surfaces, so they become parchment */
  --ptah-black:      #f6f1e6;
  --ptah-black-2:    #eee7d7;
  --ptah-black-3:    #e5dcc8;

  /* Gold darkened well past 4.5:1 on parchment. Buttons put
     var(--ptah-black) text on a gold fill, which stays readable because
     both tokens flip together. Hover goes darker, not brighter. */
  --ptah-gold:       #5e4610;
  --ptah-gold-bright:#3f2f0a;
  --ptah-gold-dim:   #6f5a2a;

  --ptah-blue:       #114a7e;
  --ptah-blue-glow:  #1a65a8;

  /* "ivory" tokens are the text, so they become ink */
  --ptah-ivory:      #0a0806;
  --ptah-ivory-dim:  #2e2920;
  --ptah-line:       rgba(127,97,27,0.25);
}

/* Jost at 300 reads grey on a light ground even in near-black ink */
html[data-theme="light"] body { font-weight: 400; }

/* Hardcoded colours in main.css that don't go through the tokens */
html[data-theme="light"] .ptah-header { background: rgba(246,241,230,0.88); }
html[data-theme="light"] .ptah-menu.is-open li,
html[data-theme="light"] .ptah-trust li { border-bottom-color: rgba(0,0,0,0.07); }
html[data-theme="light"] .ptah-glow-bg::before {
  background: radial-gradient(circle, rgba(26,101,168,0.07) 0%, rgba(26,101,168,0) 60%);
}
html[data-theme="light"] ul.products li.product img,
html[data-theme="light"] .ptah-cat-portrait img,
html[data-theme="light"] .ptah-author-portrait-img { box-shadow: 0 16px 40px rgba(60,45,15,0.22); }
html[data-theme="light"] .ptah-cover-img {
  box-shadow: 0 24px 60px rgba(60,45,15,0.25), 0 0 0 1px var(--ptah-line);
}

/* ---------- The toggle button ---------- */
.ptah-theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  background: none; cursor: pointer;
  color: var(--ptah-ivory);
  border: 1px solid var(--ptah-line);
  border-radius: var(--radius);
  transition: color .25s ease, border-color .25s ease;
}
.ptah-theme-toggle:hover { border-color: var(--ptah-gold); color: var(--ptah-gold-bright); }
.ptah-theme-toggle:focus-visible { outline: 1px solid var(--ptah-gold); outline-offset: 2px; }
.ptah-theme-toggle svg { width: 18px; height: 18px; }

/* Show the mode you'd switch TO: a sun while dark, a moon while light */
.ptah-theme-toggle .ptah-icon-moon { display: none; }
html[data-theme="light"] .ptah-theme-toggle .ptah-icon-sun { display: none; }
html[data-theme="light"] .ptah-theme-toggle .ptah-icon-moon { display: block; }

/* ---------- Logo swap ----------
   ptah-mark.png sits on solid black, which reads as a dark tile on
   parchment. Light mode shows a small cut of ptah-transparent.png instead;
   it is lazy-loaded, so dark-mode visitors never download it. */
.ptah-footer-mark { opacity: 1; }
.ptah-logo-light { display: none; }
html[data-theme="light"] .ptah-logo-dark { display: none; }
html[data-theme="light"] .ptah-logo-light { display: block; }
