/* Color options preview (css/palette.css + js/palette.js): a "Try colors" button that lets the owners compare 5 palettes.
 * Each palette only swaps the color tokens from css/site.css :root ("Harmony Blue", their current brand, is the default
 * and lives there). Pick with the button or a link: ?palette=teal-trust.
 * WordPress build: a theme setting, on for the preview, off at launch (off = don't enqueue these two files; copy the
 * chosen palette's values into :root). Every pair is checked by tools/palette_contrast.py. */

/* b. Midnight & Gold: crisp white with warm ivory tints, midnight navy, a warm gold accent */
html[data-palette="midnight-gold"] {
  --bg: #FFFFFF; --bg-rgb: 255, 255, 255; --surface: #FFFFFF;
  --tint: #F4F1E8; --tint-2: #FAF8F2; --tint-hover: #EAE3D0; --line: #E5DFCF; --line-2: #CFC4A8;
  --ink: #0F1B33; --text: #2C3448; --muted: #535B6E; --muted-2: #5E6577; --brand-sub: #5B6170;
  --primary: #1C2E5A; --primary-rgb: 28, 46, 90; --primary-hover: #12203F; --primary-2: #3A5596;
  --on-primary: #FFFFFF; --on-primary-soft: #DCE3F2;
  --hero: #0E1A36; --hero-mid: #0C1730; --hero-end: #0A142B; --hero-glow: #22356A;
  --on-hero: #FFFFFF; --on-hero-rgb: 255, 255, 255; --on-hero-soft: #E7EAF2; --on-hero-muted: #D5DAE6; --hero-em: #EDBE5A;
  --deep: #0E1A36; --deep-rgb: 14, 26, 54; --deep-2: #1A2849;
  --on-deep: #FFFFFF; --on-deep-rgb: 220, 226, 240; --on-deep-soft: #D9DFEC; --on-deep-link: #F0CF85; --on-deep-faint: #B6BFD3;
  --accent: #E0AE45; --accent-hover: #EDBE5A; --on-accent: #0E1A36;
  --star: #C98A12;
  --sw-tax: #8FA6E0; --sw-ins: #C9B8FF; --sw-hoa: #8FE3C8;
  --shadow-rgb: 10, 20, 40;
  --focus: #1C2E5A; --focus-on-dark: #EDBE5A;
}

/* c. Desert Sunset: their cream (#FCF8EE) with terracotta buttons and a dusk-navy hero and footer */
html[data-palette="desert-sunset"] {
  --bg: #FCF8EE; --bg-rgb: 252, 248, 238; --surface: #FFFFFF;
  --tint: #F4E9DA; --tint-2: #FAF2E6; --tint-hover: #EDDAC3; --line: #E6D9C3; --line-2: #D3C1A3;
  --ink: #1E2A44; --text: #34384A; --muted: #5A5560; --muted-2: #625C64; --brand-sub: #6A5E56;
  --primary: #A9452A; --primary-rgb: 169, 69, 42; --primary-hover: #8A361F; --primary-2: #D46A45;
  --on-primary: #FFFFFF; --on-primary-soft: #FBE6DC;
  --hero: #1E2A44; --hero-mid: #1B263E; --hero-end: #172038; --hero-glow: #463552;
  --on-hero: #FFFFFF; --on-hero-rgb: 255, 255, 255; --on-hero-soft: #EFE8DE; --on-hero-muted: #DDD3C6; --hero-em: #F4A47F;
  --deep: #1E2A44; --deep-rgb: 30, 42, 68; --deep-2: #2A3757;
  --on-deep: #FFFFFF; --on-deep-rgb: 236, 228, 216; --on-deep-soft: #E7DFD3; --on-deep-link: #F6B898; --on-deep-faint: #C9C0B3;
  --accent: #E8865A; --accent-hover: #F09B74; --on-accent: #1E2A44;
  --star: #C9801A;
  --sw-tax: #9BB4E8; --sw-ins: #D9C2F0; --sw-hoa: #9EDCC4;
  --shadow-rgb: 40, 30, 20;
  --focus: #A9452A; --focus-on-dark: #F4A47F;
}

/* d. Teal Trust: white and soft sea-glass tints, deep teal, a slate footer, an aqua highlight */
html[data-palette="teal-trust"] {
  --bg: #FFFFFF; --bg-rgb: 255, 255, 255; --surface: #FFFFFF;
  --tint: #E7F3F1; --tint-2: #F3F9F8; --tint-hover: #D3E9E6; --line: #D3E3E0; --line-2: #B3CBC7;
  --ink: #13262B; --text: #2B3A3F; --muted: #4C5D61; --muted-2: #5A6A6E; --brand-sub: #53656A;
  --primary: #0B6E69; --primary-rgb: 11, 110, 105; --primary-hover: #08524E; --primary-2: #2A9D94;
  --on-primary: #FFFFFF; --on-primary-soft: #D6EFEC;
  --hero: #0A3D3B; --hero-mid: #093735; --hero-end: #072F2D; --hero-glow: #12706A;
  --on-hero: #FFFFFF; --on-hero-rgb: 255, 255, 255; --on-hero-soft: #E3F1EF; --on-hero-muted: #CFE6E3; --hero-em: #86E3D5;
  --deep: #0A3D3B; --deep-rgb: 10, 61, 59; --deep-2: #125150;
  --on-deep: #FFFFFF; --on-deep-rgb: 214, 236, 233; --on-deep-soft: #D6ECE9; --on-deep-link: #8FE3D6; --on-deep-faint: #B3D0CC;
  --accent: #5ED3C3; --accent-hover: #86E3D5; --on-accent: #10292B;
  --star: #C98A12;
  --sw-tax: #8FB8E6; --sw-ins: #C9B8FF; --sw-hoa: #F2C46B;
  --shadow-rgb: 20, 45, 48;
  --focus: #0B6E69; --focus-on-dark: #86E3D5;
}

/* e. Slate & Coral: white and cool grays, charcoal slate, a coral accent */
html[data-palette="slate-coral"] {
  --bg: #FFFFFF; --bg-rgb: 255, 255, 255; --surface: #FFFFFF;
  --tint: #F0F2F5; --tint-2: #F7F8FA; --tint-hover: #E2E6EB; --line: #DCE0E6; --line-2: #C2C8D1;
  --ink: #1D2228; --text: #30363E; --muted: #535A64; --muted-2: #5E656F; --brand-sub: #5C626B;
  --primary: #2F3B4A; --primary-rgb: 47, 59, 74; --primary-hover: #1F2833; --primary-2: #5A6B80;
  --on-primary: #FFFFFF; --on-primary-soft: #DDE3EA;
  --hero: #232B36; --hero-mid: #202832; --hero-end: #1C232C; --hero-glow: #3A4657;
  --on-hero: #FFFFFF; --on-hero-rgb: 255, 255, 255; --on-hero-soft: #E6E9ED; --on-hero-muted: #D3D8DE; --hero-em: #FF9378;
  --deep: #232B36; --deep-rgb: 35, 43, 54; --deep-2: #2F3946;
  --on-deep: #FFFFFF; --on-deep-rgb: 220, 225, 231; --on-deep-soft: #D8DDE3; --on-deep-link: #FFA690; --on-deep-faint: #B5BCC6;
  --accent: #FF7A5C; --accent-hover: #FF9378; --on-accent: #1D2228;
  --star: #D08A12;
  --sw-tax: #8FB0E6; --sw-ins: #C9B8FF; --sw-hoa: #8FE3C8;
  --shadow-rgb: 25, 30, 38;
  --focus: #2F3B4A; --focus-on-dark: #FF9378;
}

/* ---------- the "Try colors" button and panel (bottom-left, clear of the chat button) ---------- */
.pal { position: fixed; left: 20px; bottom: 20px; z-index: 55; font-family: var(--font-b); }
.pal[hidden] { display: none; }
.pal-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 5px 16px 5px 5px; border-radius: 999px; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); font: 600 .925rem/1 var(--font-h); }
.pal-btn:hover { border-color: var(--primary); }
.pal-btn[aria-expanded="true"] { border-color: var(--primary); }
.pal-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--tint); color: var(--primary); flex: none; }
.pal-ic svg, .pal-x svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pal-panel { position: absolute; left: 0; bottom: calc(100% + 10px); width: min(310px, calc(100vw - 24px)); max-height: calc(100dvh - 110px); overflow-y: auto;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 16px; }
.pal-panel[hidden] { display: none; }
.pal-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pal-panel h2 { font: 700 1.1rem/1.2 var(--font-h); color: var(--ink); margin: 0; }
.pal-x { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: grid; place-items: center; flex: none; }
.pal-x:hover { background: var(--tint); }
.pal-panel > p { margin: 4px 0 12px; font-size: .875rem; color: var(--muted); line-height: 1.4; }
.pal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pal-opt { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 10px; border-radius: 12px; cursor: pointer; text-align: left;
  background: var(--surface); border: 2px solid var(--line); color: var(--ink); font: 600 .95rem/1.2 var(--font-b); }
.pal-opt:hover { border-color: var(--line-2); background: var(--tint-2); }
.pal-opt[aria-pressed="true"] { border-color: var(--primary); background: var(--tint); }
.pal-opt .sw { display: inline-flex; flex: none; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(var(--shadow-rgb), .18); }
.pal-opt .sw i { display: block; width: 14px; height: 28px; }
.pal-opt .cur { margin-left: auto; font: 700 .7rem/1 var(--font-b); letter-spacing: .05em; text-transform: uppercase; color: var(--on-primary); background: var(--primary); padding: 4px 7px; border-radius: 6px; visibility: hidden; }
.pal-opt[aria-pressed="true"] .cur { visibility: visible; }
/* phones: a 44px round icon, still bottom-left */
@media (max-width: 719px) {
  .pal { left: 12px; bottom: 16px; }
  .pal-btn { width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; border-radius: 50%; }
  .pal-txt { display: none; }
  .pal-ic { width: 42px; height: 42px; background: transparent; }
}
