/*-----------------------------------------------------------------------------------
    Color Presets - theme variable definitions + preset switcher UI
    Default preset: Deep Ocean
    The palette is consumed by assets/sass/style.css through var(--cp-*).

    Variable roles:
      --cp-navy        Primary background / headings / text-on-accent
      --cp-ocean       Secondary background / dark bands
      --cp-aqua        Buttons, icons, highlights (home style 1-2)
      --cp-aqua-s3     Accent for home style 3
      --cp-aqua-s4     Accent for home style 4
      --cp-aqua-dark   Accent hover / dark shade
      --cp-aqua-light  Accent light shade
      --cp-aqua-pale   Accent pale shade
      --cp-ice         Page surface, text on dark, light sections
      --cp-card        Card / component light background
      --cp-text        Primary body text on light surfaces
      --cp-gray        Secondary text
      --cp-border      Borders
-----------------------------------------------------------------------------------*/

/* -----------------------------------------------
   Preset: Deep Ocean (default)
----------------------------------------------- */
:root,
html[data-theme="deep-ocean"] {
  --cp-navy: #061D3A;
  --cp-ocean: #114272;
  --cp-aqua: #1C7EC9;
  --cp-aqua-s3: #1C7EC9;
  --cp-aqua-s4: #1C7EC9;
  --cp-aqua-dark: #1565A3;
  --cp-aqua-light: #5FA8DD;
  --cp-aqua-pale: #BFE3F7;
  --cp-ice: #DCE7ED;
  --cp-card: #FFFFFF;
  --cp-text: color-mix(in srgb, var(--cp-ice) 84%, var(--cp-navy));
  --cp-gray: #707879;
  --cp-border: #707879;
}

/* -----------------------------------------------
   Preset: Original (template factory palette)
----------------------------------------------- */
html[data-theme="original"] {
  --cp-navy: #1C3F39;
  --cp-ocean: #131514;
  --cp-aqua: #F1F45D;
  --cp-aqua-s3: #FFA903;
  --cp-aqua-s4: #A66EFF;
  --cp-aqua-dark: #EDF132;
  --cp-aqua-light: #F5F78D;
  --cp-aqua-pale: #FFFDC7;
  --cp-ice: #FFFFFF;
  --cp-card: #FFFFFF;
  --cp-text: color-mix(in srgb, var(--cp-ice) 84%, var(--cp-navy));
  --cp-gray: #5C5C5C;
  --cp-border: #E3E3E3;
}

/* -----------------------------------------------
   Preset: Coral Reef
----------------------------------------------- */
html[data-theme="coral-reef"] {
  --cp-navy: #062A42;
  --cp-ocean: #0E4A6E;
  --cp-aqua: #FF6B6B;
  --cp-aqua-s3: #FF8C42;
  --cp-aqua-s4: #FF6B9D;
  --cp-aqua-dark: #E05252;
  --cp-aqua-light: #FFA8A8;
  --cp-aqua-pale: #FFE3E3;
  --cp-ice: #E6F2F5;
  --cp-card: #FFFFFF;
  --cp-text: color-mix(in srgb, var(--cp-ice) 84%, var(--cp-navy));
  --cp-gray: #6E7F89;
  --cp-border: #6E7F89;
}

/* -----------------------------------------------
   Preset: Emerald Lagoon
----------------------------------------------- */
html[data-theme="emerald-lagoon"] {
  --cp-navy: #052E2B;
  --cp-ocean: #0B4F46;
  --cp-aqua: #14B8A6;
  --cp-aqua-s3: #10B981;
  --cp-aqua-s4: #2DD4BF;
  --cp-aqua-dark: #0E9488;
  --cp-aqua-light: #5EEAD4;
  --cp-aqua-pale: #CCFBF1;
  --cp-ice: #E3F4F1;
  --cp-card: #FFFFFF;
  --cp-text: color-mix(in srgb, var(--cp-ice) 84%, var(--cp-navy));
  --cp-gray: #6B7F7A;
  --cp-border: #6B7F7A;
}

/* -----------------------------------------------
   Preset: Sunset Harbor
----------------------------------------------- */
html[data-theme="sunset-harbor"] {
  --cp-navy: #232946;
  --cp-ocean: #3A3F6B;
  --cp-aqua: #F59E0B;
  --cp-aqua-s3: #F97316;
  --cp-aqua-s4: #EC4899;
  --cp-aqua-dark: #D97706;
  --cp-aqua-light: #FBBF24;
  --cp-aqua-pale: #FEF3C7;
  --cp-ice: #EEEAF3;
  --cp-card: #FFFFFF;
  --cp-text: color-mix(in srgb, var(--cp-ice) 84%, var(--cp-navy));
  --cp-gray: #767B8C;
  --cp-border: #767B8C;
}

/* -----------------------------------------------
   Preset: Royal Abyss
----------------------------------------------- */
html[data-theme="royal-abyss"] {
  --cp-navy: #160F30;
  --cp-ocean: #2A1B5E;
  --cp-aqua: #8B5CF6;
  --cp-aqua-s3: #A78BFA;
  --cp-aqua-s4: #C084FC;
  --cp-aqua-dark: #7C3AED;
  --cp-aqua-light: #C4B5FD;
  --cp-aqua-pale: #EDE9FE;
  --cp-ice: #EAE7F5;
  --cp-card: #FFFFFF;
  --cp-text: color-mix(in srgb, var(--cp-ice) 84%, var(--cp-navy));
  --cp-gray: #77718A;
  --cp-border: #77718A;
}

/* =================================================================================
   Preset switcher UI (floating panel)
   Self-contained: only adds new fixed-position elements,
   does not alter any existing style, layout or animation.
================================================================================== */
.cp-theme-switcher {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  z-index: 9999;
  font-family: "Rubik", sans-serif;
}

@property --cp-toggle-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

.cp-theme-toggle {
  position: relative;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 0 6px 6px 0;
  background: var(--cp-navy);
  color: var(--cp-ice);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 2px 2px 12px rgba(0, 0, 0, 0.25);
  transition: background 0.3s ease;
}

/* endlessly flowing gradient ring around the toggle */
.cp-theme-toggle::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(
    from var(--cp-toggle-angle),
    var(--cp-aqua),
    #ff6b6b,
    #ffd93d,
    #4ecdc4,
    var(--cp-aqua)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  clip-path: inset(0 0 0 2px); /* drop the ring's left segment (edge is flush to viewport) */
  pointer-events: none;
  animation: cp-toggle-border-spin 3s linear infinite;
}

@keyframes cp-toggle-border-spin {
  to {
    --cp-toggle-angle: 360deg;
  }
}
.cp-theme-toggle:hover,
.cp-theme-toggle:focus {
  background: var(--cp-aqua);
  color: var(--cp-navy);
  outline: none;
}
.cp-theme-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
}

.cp-theme-panel {
  position: absolute;
  top: 50%;
  left: 56px;
  transform: translateY(-50%) translateX(-12px);
  width: 232px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  padding: 14px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}
.cp-theme-switcher.cp-open .cp-theme-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

.cp-theme-panel h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #222831;
  font-family: "Rubik", sans-serif;
}

.cp-theme-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cp-theme-list button {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-family: "Rubik", sans-serif;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  color: #222831;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.cp-theme-list button:hover,
.cp-theme-list button:focus {
  border-color: var(--cp-aqua);
  outline: none;
}
.cp-theme-list button.cp-active {
  border-color: var(--cp-aqua);
  box-shadow: 0 0 0 1px var(--cp-aqua);
}

.cp-theme-swatches {
  display: flex;
  gap: 4px;
}
.cp-theme-swatches span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

@media (max-width: 575px) {
  .cp-theme-panel {
    width: 200px;
    left: 50px;
  }
  .cp-theme-toggle {
    width: 40px;
    height: 40px;
  }
}
