/* DEMO ONLY: colour switch for the client to compare palettes (Joel, 2026-11-21).
   Remove this file, demo/palette.js and the footer-logo-brown image when Cocoon picks a palette.
   Palettes: brown (default, = styles.css), earth (light jute surfaces, light footer), indigo (blue from their striped jute). */

/* ---- Light earth ---- */
:root[data-palette="earth"] { --color-surface: #f7f1e6; --color-surface-2: #ede2cf; }
:root[data-palette="earth"] .site-footer { background: var(--color-surface-2); color: var(--color-ink);
  border-top: 1px solid color-mix(in srgb, var(--color-muted) 30%, transparent); }
:root[data-palette="earth"] .footer-logo-white { display: none; }
:root[data-palette="earth"] .footer-logo-brown { display: block; }

/* ---- Jute and indigo ---- */
:root[data-palette="indigo"] {
  --color-surface: #f7f3ec; --color-surface-2: #ece4d6; --color-ink: #1f2328; --color-muted: #55524c;
  --color-brand: #2f5f8a; --color-link: #2f5f8a; --color-accent: #7a5123; --color-on-brand: #ffffff;
}

/* ---- Dark mode: each palette keeps a dark version (the light overrides above must not leak into it) ---- */
@media (prefers-color-scheme: dark) {
  :root[data-palette="earth"]:not([data-theme="light"]) { --color-surface: #1a1612; --color-surface-2: #241e18; }
  :root[data-palette="earth"]:not([data-theme="light"]) .footer-logo-white { display: block; }
  :root[data-palette="earth"]:not([data-theme="light"]) .footer-logo-brown { display: none; }
  :root[data-palette="indigo"]:not([data-theme="light"]) {
    --color-surface: #16181b; --color-surface-2: #1f2226; --color-ink: #eef0f2; --color-muted: #b2b6bc;
    --color-brand: #8fb6dd; --color-link: #8fb6dd; --color-accent: #d9a86a; --color-on-brand: #16181b;
  }
}
:root[data-palette="earth"][data-theme="dark"] { --color-surface: #1a1612; --color-surface-2: #241e18; }
:root[data-palette="earth"][data-theme="dark"] .footer-logo-white { display: block; }
:root[data-palette="earth"][data-theme="dark"] .footer-logo-brown { display: none; }
:root[data-palette="indigo"][data-theme="dark"] {
  --color-surface: #16181b; --color-surface-2: #1f2226; --color-ink: #eef0f2; --color-muted: #b2b6bc;
  --color-brand: #8fb6dd; --color-link: #8fb6dd; --color-accent: #d9a86a; --color-on-brand: #16181b;
}

.footer-logo-brown { display: none; }
/* room under the footer so the pill never sits on the last row of content */
.site-footer { padding-bottom: calc(48px + 72px + env(safe-area-inset-bottom)); }

/* ---- The switch: floating pill, bottom left; above the phone contact bar ---- */
.palette-switch { position: fixed; z-index: 16; left: max(16px, env(safe-area-inset-left)); bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 2px; margin: 0; padding: 2px 4px 2px 14px; border: 1px solid var(--color-muted); border-radius: 999px;
  background: var(--color-surface); color: var(--color-ink); font: 500 0.9375rem/1 var(--font-text); }
.palette-switch legend { float: left; padding: 0; margin-right: 6px; }
.palette-switch label { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; cursor: pointer; border-radius: 50%; }
.palette-switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.palette-switch .sw { width: 26px; height: 26px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--color-ink) 35%, transparent);
  transition: transform 120ms ease-out; }
.palette-switch input:checked + .sw { outline: 2px solid var(--color-ink); outline-offset: 3px; }
.palette-switch input:focus-visible + .sw { outline: 2px solid var(--color-accent); outline-offset: 3px; }
.palette-switch label:active .sw { transform: scale(0.92); }
.sw-brown { background: linear-gradient(135deg, #7a5123 50%, #faf6f0 50%); }
.sw-earth { background: linear-gradient(135deg, #7a5123 50%, #ede2cf 50%); }
.sw-indigo { background: linear-gradient(135deg, #2f5f8a 50%, #ece4d6 50%); }
@media (max-width: 767px) {
  .palette-switch { bottom: calc(var(--bar-h) + 16px + env(safe-area-inset-bottom)); padding-left: 12px; }
}

/* A short cross-fade when the palette changes, so the change reads as one move (off with reduced motion) */
@media (prefers-reduced-motion: no-preference) {
  .palette-anim, .palette-anim *, .palette-anim *::before { transition: background-color 250ms ease-out, color 250ms ease-out, border-color 250ms ease-out !important; }
}
