/* =====================================================================
   THEME — COLOUR PALETTES                                  v2.0.0
   ---------------------------------------------------------------------
   This is the single place to edit colours or add new palettes.
   Every page links it before style.css.

   • :root                 → the DEFAULT palette (indigo / violet)
   • [data-palette="alt"]  → the ALTERNATE palette (Castleton green)

   Which one is shown is decided by  src/js/theme-config.js
   (and the in-page palette toggle button). To add a third palette,
   copy the [data-palette="alt"] block, rename it e.g.
   [data-palette="ocean"], change the values, then reference "ocean"
   from theme-config.js.

   HOW THE TOKENS WORK
   • --primary-color / --secondary-color / --accent-color  → hex values
   • --*-rgb            → the SAME colours as "R, G, B" channels so that
                          translucent tints can be written as
                          rgba(var(--primary-rgb), 0.1)
   • --gradient-*       → ready-made gradients derived from the tokens
   ===================================================================== */

/* ---------------------------------------------------------------------
   DEFAULT PALETTE — Indigo / Violet
   --------------------------------------------------------------------- */
:root {
    --blog-a: #3730a3; --blog-b: #6d28d9; --blog-hl: #f0abfc;   /* blog card art */
    /* Core brand colours */
    --primary-color:   #3730a3;   /* deep indigo (white text 9.9:1) */
    --primary-dark:    #312e81;
    --secondary-color: #5b21b6;   /* deep violet (white text 9.0:1) */
    --accent-color:    #f0abfc;
    --accent-text:     var(--secondary-color);   /* dates / company / institution labels */

    /* RGB channels — lets every rgba() tint track the active palette */
    --primary-rgb:    55,  48, 163;   /* #3730a3 */
    --secondary-rgb:  91,  33, 182;   /* #5b21b6 */
    --accent-rgb:    219,  39, 119;   /* #db2777 */
    --mid-rgb:       124,  58, 237;   /* #7c3aed purple mid-stop */
    --edu-start-rgb:  67,  56, 202;   /* #4338ca indigo used in education section */

    /* Named gradients — derived from palette tokens */
    --gradient:          linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    --gradient-warm:     linear-gradient(135deg, var(--primary-color) 0%, rgb(var(--mid-rgb)) 50%, rgb(var(--accent-rgb)) 100%);
    --gradient-timeline: linear-gradient(180deg, var(--primary-color) 0%, rgb(var(--mid-rgb)) 50%, rgb(var(--accent-rgb)) 100%);
    --gradient-dot:      linear-gradient(135deg, var(--primary-color) 0%, rgb(var(--mid-rgb)) 100%);
    --gradient-edu-line: linear-gradient(180deg, rgb(var(--edu-start-rgb)) 0%, var(--secondary-color) 50%, rgb(var(--accent-rgb)) 100%);
    --gradient-edu-dot:  linear-gradient(135deg, rgb(var(--edu-start-rgb)) 0%, var(--secondary-color) 100%);
    --gradient-blog-1:   linear-gradient(135deg, var(--primary-color) 0%, rgb(var(--mid-rgb)) 100%);
    --gradient-blog-2:   linear-gradient(135deg, #0ea5e9 0%, var(--primary-color) 100%);
    --gradient-blog-5:   linear-gradient(135deg, rgb(var(--accent-rgb)) 0%, var(--secondary-color) 100%);
}

/* Indigo (the default :root palette) in dark mode: text accents switch to light indigo and violet;
   fills behind white text keep deep gradients, written out because they would otherwise follow the
   lighter --primary-color. */
[data-theme="dark"]:not([data-palette]) {
    --blog-a: #312e81; --blog-b: #6d28d9; --blog-hl: #f0abfc;
    --primary-color: #a5b4fc;   /* 9.0:1 on the dark background */
    --primary-dark:  #818cf8;
    --primary-rgb:   165, 180, 252;
    --accent-text:   #c4b5fd;
    --gradient:        linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    --gradient-warm:   linear-gradient(135deg, #4338ca 0%, #6d28d9 50%, #be185d 100%);
    --gradient-dot:    linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    --gradient-blog-1: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    --gradient-blog-2: linear-gradient(135deg, #0369a1 0%, #4338ca 100%);
}
[data-theme="dark"]:not([data-palette]) .logo { background: linear-gradient(135deg, #a5b4fc 0%, #f0abfc 100%); -webkit-background-clip: text; background-clip: text; }
[data-theme="dark"]:not([data-palette]) .cta-button-secondary { color: #3730a3; }

/* ---------------------------------------------------------------------
   ALTERNATE PALETTE — Castleton / British Racing Green
   Source swatch: #0A5C36 #0F5132 #14452F #18392B #1D2E28
   --------------------------------------------------------------------- */
[data-palette="alt"] {
    --blog-a: #0a5c36; --blog-b: #14452f; --blog-hl: #86efac;
    /* Core brand colours */
    --primary-color:   #0a5c36;   /* Castleton green */
    --primary-dark:    #0f5132;   /* Castleton green (dark) */
    --secondary-color: #14452f;   /* British racing green */
    --accent-color:    #86efac;   /* Light mint — bright highlights */
    --accent-text:     #15803d;   /* lighter green for dates / company / institution labels */

    /* RGB channels — must match the hex values above (R, G, B) */
    --primary-rgb:    10,  92,  54;   /* #0a5c36 */
    --secondary-rgb:  20,  69,  47;   /* #14452f */
    --accent-rgb:     16, 185, 129;   /* #10b981 emerald — keeps tints visible */
    --mid-rgb:        21, 128,  61;   /* #15803d — lightened so date badges read brighter */
    --edu-start-rgb:  21, 128,  61;   /* #15803d — matches --accent-text so institution name & badge share the same green */

    /* Gradients auto-derive from the tokens above */
    --gradient:          linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    --gradient-warm:     linear-gradient(135deg, var(--primary-color) 0%, rgb(var(--mid-rgb)) 50%, rgb(var(--accent-rgb)) 100%);
    --gradient-timeline: linear-gradient(180deg, var(--primary-color) 0%, rgb(var(--mid-rgb)) 50%, rgb(var(--accent-rgb)) 100%);
    --gradient-dot:      linear-gradient(135deg, var(--primary-color) 0%, rgb(var(--mid-rgb)) 100%);
    --gradient-edu-line: linear-gradient(180deg, rgb(var(--edu-start-rgb)) 0%, var(--secondary-color) 50%, rgb(var(--accent-rgb)) 100%);
    --gradient-edu-dot:  linear-gradient(135deg, rgb(var(--edu-start-rgb)) 0%, var(--secondary-color) 100%);
    --gradient-blog-1:   linear-gradient(135deg, var(--primary-color) 0%, rgb(var(--mid-rgb)) 100%);
    --gradient-blog-2:   linear-gradient(135deg, #0ea5e9 0%, var(--primary-color) 100%);
    --gradient-blog-5:   linear-gradient(135deg, rgb(var(--accent-rgb)) 0%, var(--secondary-color) 100%);
}

/* Castleton green — matching deep-green dark-mode backgrounds */
[data-theme="dark"][data-palette="alt"] {
    --bg-primary:   #0a1f15;
    --bg-secondary: #102a1c;
    --bg-dark:      #051009;
    --surface:      #14301f;
    --nav-bg:       10, 31, 21;
    --accent-text:  #4ade80;   /* brighter label green for dark bg */
}

/* ---------------------------------------------------------------------
   COBALT PALETTE — deep cobalt blue to cyan (science / AI / technology)
   White text: 10.4:1 on #1e3a8a, 5.4:1 on #0e7490.
   --------------------------------------------------------------------- */
[data-palette="cobalt"] {
    --blog-a: #1e3a8a; --blog-b: #0e7490; --blog-hl: #67e8f9;
    --primary-color:   #1e3a8a;   /* cobalt navy */
    --primary-dark:    #172554;
    --secondary-color: #0e7490;   /* deep cyan */
    --accent-color:    #67e8f9;   /* light cyan highlights */
    --accent-text:     #0369a1;   /* dates / company / institution labels */

    --primary-rgb:    30,  58, 138;   /* #1e3a8a */
    --secondary-rgb:  14, 116, 144;   /* #0e7490 */
    --accent-rgb:      6, 182, 212;   /* #06b6d4 */
    --mid-rgb:        37,  99, 235;   /* #2563eb */
    --edu-start-rgb:   2, 132, 199;   /* #0284c7 */
}

/* Cobalt — matching deep-navy dark-mode backgrounds. Text accents switch to a light blue
   (#60a5fa, 7.3:1 on the background); the fills behind white text keep deep gradients,
   written out here because they would otherwise follow the lighter --primary-color. */
[data-theme="dark"][data-palette="cobalt"] {
    --blog-a: #1e3a8a; --blog-b: #0e7490; --blog-hl: #67e8f9;
    --bg-primary:   #0a1325;
    --bg-secondary: #0f1b33;
    --bg-dark:      #050b17;
    --surface:      #13213d;
    --nav-bg:       10, 19, 37;
    --accent-text:  #38bdf8;
    --primary-color: #60a5fa;
    --primary-dark:  #3b82f6;
    --primary-rgb:   96, 165, 250;
    --gradient:        linear-gradient(135deg, #1e40af 0%, #0e7490 100%);
    --gradient-warm:   linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #0e7490 100%);
    --gradient-dot:    linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    --gradient-blog-1: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    --gradient-blog-2: linear-gradient(135deg, #0369a1 0%, #1e40af 100%);
}
/* The name in the navbar is gradient text: give it a light gradient on the dark background. */
[data-theme="dark"][data-palette="cobalt"] .logo { background: linear-gradient(135deg, #60a5fa 0%, #22d3ee 100%); -webkit-background-clip: text; background-clip: text; }

/* =====================================================================
   EXPERIMENTAL EXTRA PALETTES  (selectable via the navbar swatch)
   ---------------------------------------------------------------------
   Each block only overrides the ~10 colour tokens — every gradient,
   shadow and tint AUTO-DERIVES from them (the gradient definitions in
   :root resolve var() lazily against the active palette).
   Each green palette has a paired dark-mode block giving it matching
   deep-green backgrounds instead of the default slate.
   ===================================================================== */

/* 1 — Deep Forest Metallic (moss green + metallic-gold education accent) */
[data-palette="forest"] {
    --primary-color:   #2e5d4f;   /* sea moss */
    --primary-dark:    #1f4034;
    --secondary-color: #16352d;   /* deep pine */
    --accent-color:    #7fb295;   /* sage highlight */
    --accent-text:     #2e6b50;   /* label green on white (~5:1) */
    --primary-rgb:     46,  93,  79;
    --secondary-rgb:   22,  53,  45;
    --accent-rgb:     127, 178, 149;   /* sage */
    --mid-rgb:         53, 112,  86;   /* readable mid for badges */
    --edu-start-rgb:  197, 165, 114;   /* metallic gold */
}
[data-theme="dark"][data-palette="forest"] {
    --bg-primary:   #0b1f1a;
    --bg-secondary: #13312b;
    --bg-dark:      #060f0c;
    --surface:      #16352d;
    --nav-bg:       11, 31, 26;
    --accent-text:  #9ccbae;
}

/* 2 — Emerald Noir (sleek SaaS emerald + mint glow) */
[data-palette="emerald"] {
    --primary-color:   #1b6b52;   /* emerald */
    --primary-dark:    #124a39;
    --secondary-color: #0f2a22;
    --accent-color:    #3ddc97;   /* mint shine */
    --accent-text:     #047857;
    --primary-rgb:     27, 107,  82;
    --secondary-rgb:   15,  42,  34;
    --accent-rgb:      61, 220, 151;   /* mint */
    --mid-rgb:         24, 120,  90;
    --edu-start-rgb:   13, 148, 136;   /* teal */
}
[data-theme="dark"][data-palette="emerald"] {
    --bg-primary:   #08120f;
    --bg-secondary: #0f2a22;
    --bg-dark:      #050b09;
    --surface:      #123026;
    --nav-bg:       8, 18, 15;
    --accent-text:  #3ddc97;
}

/* 3 — Dark Sea Patina (oxidised sea-green, editorial) */
[data-palette="patina"] {
    --primary-color:   #2f6f65;   /* sea green */
    --primary-dark:    #1f4d46;
    --secondary-color: #14302e;
    --accent-color:    #6fb3a8;   /* patina mist */
    --accent-text:     #2a665d;
    --primary-rgb:     47, 111, 101;
    --secondary-rgb:   20,  48,  46;
    --accent-rgb:     111, 179, 168;   /* patina mist */
    --mid-rgb:         45, 117, 105;
    --edu-start-rgb:   47, 143, 127;
}
[data-theme="dark"][data-palette="patina"] {
    --bg-primary:   #0a1818;
    --bg-secondary: #14302e;
    --bg-dark:      #050d0d;
    --surface:      #173432;
    --nav-bg:       10, 24, 24;
    --accent-text:  #6fb3a8;
}

/* 4 — Hunter Chrome (deep hunter green + chrome muted) */
[data-palette="hunter"] {
    --primary-color:   #2a4a33;   /* hunter green */
    --primary-dark:    #1c3324;
    --secondary-color: #1a2a1f;
    --accent-color:    #8fa68e;   /* chrome muted */
    --accent-text:     #44734f;
    --primary-rgb:     42,  74,  51;
    --secondary-rgb:   26,  42,  31;
    --accent-rgb:     143, 166, 142;   /* chrome */
    --mid-rgb:         58,  90,  68;
    --edu-start-rgb:  105, 130, 105;
}
[data-theme="dark"][data-palette="hunter"] {
    --bg-primary:   #0d1410;
    --bg-secondary: #1a2a1f;
    --bg-dark:      #070b08;
    --surface:      #1d2e22;
    --nav-bg:       13, 20, 16;
    --accent-text:  #b6c7b0;
}

/* 5 — Jade Obsidian (jewel jade + warm-brass education accent) */
[data-palette="jade"] {
    --primary-color:   #1f5f4a;   /* jade */
    --primary-dark:    #154235;
    --secondary-color: #102a22;
    --accent-color:    #46c2a0;   /* bright jade */
    --accent-text:     #15795a;
    --primary-rgb:     31,  95,  74;
    --secondary-rgb:   16,  42,  34;
    --accent-rgb:      70, 194, 160;   /* bright jade */
    --mid-rgb:         31, 115,  89;
    --edu-start-rgb:  168, 137, 107;   /* warm brass */
}
[data-theme="dark"][data-palette="jade"] {
    --bg-primary:   #06100d;
    --bg-secondary: #102a22;
    --bg-dark:      #040a08;
    --surface:      #133026;
    --nav-bg:       6, 16, 13;
    --accent-text:  #46c2a0;
}
/* "Download CV" is a light button even in dark mode: keep its label deep cobalt (8.7:1). */
[data-theme="dark"][data-palette="cobalt"] .cta-button-secondary { color: #1e40af; }

/* Tag text (the pills under Experience and Education), per palette, 4.5:1 or more on the tinted pill */
:root                                      { --tag-text: #6d28d9; }   /* Indigo: violet 700 */
[data-theme="dark"]:not([data-palette])    { --tag-text: #c4b5fd; }   /* Indigo, dark: violet 300 */
[data-palette="cobalt"]                    { --tag-text: #0369a1; }
[data-theme="dark"][data-palette="cobalt"] { --tag-text: #38bdf8; }
[data-palette="alt"]                       { --tag-text: #15803d; }
[data-theme="dark"][data-palette="alt"]    { --tag-text: #4ade80; }
