/* ==========================================================================
   Anchor HQ -- Design Tokens
   Stardew Valley / Cozy Pixel-RPG Theme
   ==========================================================================
   Usage:  @import url("tokens.css");
           Themes activated via data-theme on <html> or <body>.
           Default (no attribute) = dark / warm-wood.
   ========================================================================== */


/* --------------------------------------------------------------------------
   1.  DARK / DEFAULT THEME  (warm wood tones, evening farm)
   -------------------------------------------------------------------------- */
:root,
[data-theme="dark"] {

  /* --- Backgrounds (deep purple-dark layers) --- */
  --bg-base:              #1a1425;
  --bg-mid:               #221a30;
  --bg-surface:           #2a2040;
  --bg-panel:             #2d2341;
  --bg-elevated:          #352a4d;
  --bg-overlay:           rgba(26, 20, 37, 0.85);

  /* --- Parchment (for cards, modals, highlighted panels) --- */
  --parchment:            #f5e6c8;
  --parchment-aged:       #d4b896;
  --parchment-dark:       #2d2341;
  --parchment-darker:     #241c36;

  /* --- Text --- */
  --text-primary:         #f0e6d3;
  --text-secondary:       #b8a89a;
  --text-subtle:          #6d5f52;
  --text-on-parchment:    #3d2b1a;
  --text-inverse:         #1a1425;
  --text-link:            #5b8dd9;
  --text-link-hover:      #7da8e8;

  /* --- Accent: Primary (Stardew orange-red) --- */
  --accent:               #e85d3a;
  --accent-hover:         #f06b4a;
  --accent-active:        #d04e2d;
  --accent-subtle:        rgba(232, 93, 58, 0.15);

  /* --- Accent: Secondary (Stardew green) --- */
  --accent-green:         #5ba84c;
  --accent-green-hover:   #6bbf5a;
  --accent-green-active:  #4e9340;
  --accent-green-subtle:  rgba(91, 168, 76, 0.15);

  /* --- Gold (XP, coins, achievements) --- */
  --gold:                 #ffd700;
  --gold-dim:             #c9a800;
  --gold-glow:            rgba(255, 215, 0, 0.35);

  /* --- Blue (water / inbox accents) --- */
  --blue:                 #5b8dd9;
  --blue-hover:           #6f9fe6;
  --blue-subtle:          rgba(91, 141, 217, 0.15);

  /* --- Purple (magic / rare) --- */
  --purple:               #8b5cf6;
  --purple-hover:         #9d75f8;
  --purple-subtle:        rgba(139, 92, 246, 0.15);

  /* --- Semantic --- */
  --success:              #5ba84c;
  --success-subtle:       rgba(91, 168, 76, 0.15);
  --warning:              #e8a33a;
  --warning-subtle:       rgba(232, 163, 58, 0.15);
  --danger:               #c9302c;
  --danger-subtle:        rgba(201, 48, 44, 0.15);
  --info:                 #5b8dd9;
  --info-subtle:          rgba(91, 141, 217, 0.15);

  /* --- Borders --- */
  --border-wood:          #8b6f47;
  --border-wood-light:    #a8895e;
  --border-dark:          rgba(255, 255, 255, 0.08);
  --border-dark-hover:    rgba(255, 255, 255, 0.14);
  --border-parchment:     #d4b896;
  --border-focus:         #e85d3a;

  /* --- Shadows (warm golden tones) --- */
  --shadow-sm:            0 1px 2px rgba(0, 0, 0, 0.25),
                          0 1px 3px rgba(0, 0, 0, 0.15);
  --shadow-md:            0 2px 6px rgba(0, 0, 0, 0.30),
                          0 4px 12px rgba(0, 0, 0, 0.18);
  --shadow-lg:            0 4px 12px rgba(0, 0, 0, 0.35),
                          0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-glow:          0 0 8px rgba(255, 215, 0, 0.30),
                          0 0 20px rgba(255, 215, 0, 0.15);
  --shadow-glow-accent:   0 0 8px rgba(232, 93, 58, 0.35),
                          0 0 20px rgba(232, 93, 58, 0.15);
  --shadow-inset:         inset 0 2px 4px rgba(0, 0, 0, 0.30);

  /* --- Gradients --- */
  --gradient-bg:          linear-gradient(180deg, #1a1425 0%, #221a30 50%, #2a2040 100%);
  --gradient-panel:       linear-gradient(180deg, #2d2341 0%, #241c36 100%);
  --gradient-gold:        linear-gradient(135deg, #ffd700 0%, #f0c000 50%, #ffd700 100%);
  --gradient-accent:      linear-gradient(135deg, #e85d3a 0%, #f06b4a 100%);
  --gradient-parchment:   linear-gradient(180deg, #f5e6c8 0%, #e8d5b0 100%);
}


/* --------------------------------------------------------------------------
   2.  LIGHT / DAY THEME  (blue sky + green grass, bright farm)
   -------------------------------------------------------------------------- */
[data-theme="light"] {

  /* --- Backgrounds --- */
  --bg-base:              #87ceeb;
  --bg-mid:               #a0d4e8;
  --bg-surface:           #c8e6c9;
  --bg-panel:             #faf0dc;
  --bg-elevated:          #fff8ee;
  --bg-overlay:           rgba(135, 206, 235, 0.80);

  /* --- Parchment --- */
  --parchment:            #faf0dc;
  --parchment-aged:       #e8d5b0;
  --parchment-dark:       #f0e2c4;
  --parchment-darker:     #e5d4ae;

  /* --- Text --- */
  --text-primary:         #3d2b1a;
  --text-secondary:       #5c4a38;
  --text-subtle:          #8b7a68;
  --text-on-parchment:    #3d2b1a;
  --text-inverse:         #f0e6d3;
  --text-link:            #2a6cb6;
  --text-link-hover:      #1d5a9e;

  /* --- Accent: Primary --- */
  --accent:               #d44a28;
  --accent-hover:         #e85d3a;
  --accent-active:        #b83e20;
  --accent-subtle:        rgba(212, 74, 40, 0.12);

  /* --- Accent: Secondary --- */
  --accent-green:         #4a9040;
  --accent-green-hover:   #5ba84c;
  --accent-green-active:  #3e7a35;
  --accent-green-subtle:  rgba(74, 144, 64, 0.12);

  /* --- Gold --- */
  --gold:                 #d4a800;
  --gold-dim:             #b89200;
  --gold-glow:            rgba(212, 168, 0, 0.30);

  /* --- Blue --- */
  --blue:                 #2a6cb6;
  --blue-hover:           #3578c4;
  --blue-subtle:          rgba(42, 108, 182, 0.12);

  /* --- Purple --- */
  --purple:               #7240d9;
  --purple-hover:         #8456e6;
  --purple-subtle:        rgba(114, 64, 217, 0.12);

  /* --- Semantic --- */
  --success:              #4a9040;
  --success-subtle:       rgba(74, 144, 64, 0.12);
  --warning:              #c98a20;
  --warning-subtle:       rgba(201, 138, 32, 0.12);
  --danger:               #b82828;
  --danger-subtle:        rgba(184, 40, 40, 0.12);
  --info:                 #2a6cb6;
  --info-subtle:          rgba(42, 108, 182, 0.12);

  /* --- Borders --- */
  --border-wood:          #b89970;
  --border-wood-light:    #cdb08a;
  --border-dark:          rgba(0, 0, 0, 0.10);
  --border-dark-hover:    rgba(0, 0, 0, 0.18);
  --border-parchment:     #d4b896;
  --border-focus:         #d44a28;

  /* --- Shadows --- */
  --shadow-sm:            0 1px 2px rgba(61, 43, 26, 0.10),
                          0 1px 3px rgba(61, 43, 26, 0.06);
  --shadow-md:            0 2px 6px rgba(61, 43, 26, 0.12),
                          0 4px 12px rgba(61, 43, 26, 0.08);
  --shadow-lg:            0 4px 12px rgba(61, 43, 26, 0.15),
                          0 8px 24px rgba(61, 43, 26, 0.10);
  --shadow-glow:          0 0 8px rgba(212, 168, 0, 0.25),
                          0 0 20px rgba(212, 168, 0, 0.10);
  --shadow-glow-accent:   0 0 8px rgba(212, 74, 40, 0.25),
                          0 0 20px rgba(212, 74, 40, 0.10);
  --shadow-inset:         inset 0 2px 4px rgba(61, 43, 26, 0.12);

  /* --- Gradients --- */
  --gradient-bg:          linear-gradient(180deg, #87ceeb 0%, #a8d88a 100%);
  --gradient-panel:       linear-gradient(180deg, #faf0dc 0%, #f0e2c4 100%);
  --gradient-gold:        linear-gradient(135deg, #d4a800 0%, #c09600 50%, #d4a800 100%);
  --gradient-accent:      linear-gradient(135deg, #d44a28 0%, #e85d3a 100%);
  --gradient-parchment:   linear-gradient(180deg, #faf0dc 0%, #e8d5b0 100%);
}


/* --------------------------------------------------------------------------
   3.  NIGHT THEME  (starry sky, lantern glow)
   -------------------------------------------------------------------------- */
[data-theme="night"] {

  /* --- Backgrounds (deep night sky) --- */
  --bg-base:              #0c1220;
  --bg-mid:               #141e30;
  --bg-surface:           #1a2640;
  --bg-panel:             rgba(42, 32, 64, 0.70);
  --bg-elevated:          rgba(53, 42, 77, 0.75);
  --bg-overlay:           rgba(12, 18, 32, 0.90);

  /* --- Parchment (semi-transparent with lantern glow) --- */
  --parchment:            rgba(245, 230, 200, 0.12);
  --parchment-aged:       rgba(212, 184, 150, 0.10);
  --parchment-dark:       rgba(45, 35, 65, 0.80);
  --parchment-darker:     rgba(36, 28, 54, 0.85);

  /* --- Text --- */
  --text-primary:         #d4c8b8;
  --text-secondary:       #9a8e80;
  --text-subtle:          #5c5248;
  --text-on-parchment:    #d4c8b8;
  --text-inverse:         #0c1220;
  --text-link:            #6f9fe6;
  --text-link-hover:      #8ab4f0;

  /* --- Accent: Primary --- */
  --accent:               #e86a48;
  --accent-hover:         #f07858;
  --accent-active:        #d05838;
  --accent-subtle:        rgba(232, 106, 72, 0.18);

  /* --- Accent: Secondary --- */
  --accent-green:         #52a046;
  --accent-green-hover:   #62b856;
  --accent-green-active:  #458c3a;
  --accent-green-subtle:  rgba(82, 160, 70, 0.18);

  /* --- Gold (lantern-warm) --- */
  --gold:                 #ffd700;
  --gold-dim:             #b89800;
  --gold-glow:            rgba(255, 215, 0, 0.40);

  /* --- Blue (moonlight) --- */
  --blue:                 #6f9fe6;
  --blue-hover:           #85b0f0;
  --blue-subtle:          rgba(111, 159, 230, 0.18);

  /* --- Purple (starlight) --- */
  --purple:               #9d75f8;
  --purple-hover:         #b08ffa;
  --purple-subtle:        rgba(157, 117, 248, 0.18);

  /* --- Semantic --- */
  --success:              #52a046;
  --success-subtle:       rgba(82, 160, 70, 0.18);
  --warning:              #e8a33a;
  --warning-subtle:       rgba(232, 163, 58, 0.18);
  --danger:               #d43a36;
  --danger-subtle:        rgba(212, 58, 54, 0.18);
  --info:                 #6f9fe6;
  --info-subtle:          rgba(111, 159, 230, 0.18);

  /* --- Borders --- */
  --border-wood:          #6a5535;
  --border-wood-light:    #8b7050;
  --border-dark:          rgba(255, 255, 255, 0.06);
  --border-dark-hover:    rgba(255, 255, 255, 0.12);
  --border-parchment:     rgba(212, 184, 150, 0.15);
  --border-focus:         #e86a48;

  /* --- Shadows (deep + glow) --- */
  --shadow-sm:            0 1px 2px rgba(0, 0, 0, 0.40),
                          0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-md:            0 2px 6px rgba(0, 0, 0, 0.45),
                          0 4px 12px rgba(0, 0, 0, 0.30);
  --shadow-lg:            0 4px 12px rgba(0, 0, 0, 0.50),
                          0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-glow:          0 0 12px rgba(255, 215, 0, 0.40),
                          0 0 30px rgba(255, 215, 0, 0.18);
  --shadow-glow-accent:   0 0 12px rgba(232, 106, 72, 0.40),
                          0 0 30px rgba(232, 106, 72, 0.18);
  --shadow-inset:         inset 0 2px 4px rgba(0, 0, 0, 0.45);

  /* --- Gradients --- */
  --gradient-bg:          linear-gradient(180deg, #0c1220 0%, #141e30 40%, #1a2640 100%);
  --gradient-panel:       linear-gradient(180deg, rgba(42,32,64,0.70) 0%, rgba(36,28,54,0.85) 100%);
  --gradient-gold:        linear-gradient(135deg, #ffd700 0%, #f0c000 50%, #ffd700 100%);
  --gradient-accent:      linear-gradient(135deg, #e86a48 0%, #f07858 100%);
  --gradient-parchment:   linear-gradient(180deg, rgba(245,230,200,0.12) 0%, rgba(212,184,150,0.10) 100%);
}


/* ==========================================================================
   4.  TYPOGRAPHY
   ========================================================================== */
:root {

  /* --- Font Families --- */
  --font-body:            "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
                          Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-pixel:           "Press Start 2P", "Courier New", monospace;
  --font-mono:            "JetBrains Mono", "Fira Code", "Cascadia Code",
                          "SF Mono", Consolas, monospace;

  /* --- Font Sizes (rem, 16px root) --- */
  --text-2xs:             0.625rem;   /*  10px -- pixel captions */
  --text-xs:              0.75rem;    /*  12px */
  --text-sm:              0.875rem;   /*  14px */
  --text-base:            1rem;       /*  16px */
  --text-md:              1.125rem;   /*  18px */
  --text-lg:              1.25rem;    /*  20px */
  --text-xl:              1.5rem;     /*  24px */
  --text-2xl:             1.875rem;   /*  30px */
  --text-3xl:             2.25rem;    /*  36px */
  --text-4xl:             3rem;       /*  48px */

  /* --- Pixel Font Sizes (smaller -- Press Start 2P runs large) --- */
  --pixel-xs:             0.5rem;     /*   8px */
  --pixel-sm:             0.625rem;   /*  10px */
  --pixel-base:           0.75rem;    /*  12px */
  --pixel-md:             0.875rem;   /*  14px */
  --pixel-lg:             1rem;       /*  16px */
  --pixel-xl:             1.25rem;    /*  20px */
  --pixel-2xl:            1.5rem;     /*  24px */

  /* --- Font Weights --- */
  --weight-normal:        400;
  --weight-medium:        500;
  --weight-semibold:      600;
  --weight-bold:          700;

  /* --- Line Heights --- */
  --leading-none:         1;
  --leading-tight:        1.25;
  --leading-snug:         1.375;
  --leading-normal:       1.5;
  --leading-relaxed:      1.625;
  --leading-loose:        2;

  /* --- Letter Spacing --- */
  --tracking-tight:      -0.025em;
  --tracking-normal:      0;
  --tracking-wide:        0.025em;
  --tracking-wider:       0.05em;
  --tracking-pixel:       0.1em;      /* extra spacing for pixel font legibility */
}


/* ==========================================================================
   5.  SPACING  (4px base scale)
   ========================================================================== */
:root {
  --space-1:              0.25rem;    /*   4px */
  --space-2:              0.5rem;     /*   8px */
  --space-3:              0.75rem;    /*  12px */
  --space-4:              1rem;       /*  16px */
  --space-5:              1.25rem;    /*  20px */
  --space-6:              1.5rem;     /*  24px */
  --space-8:              2rem;       /*  32px */
  --space-10:             2.5rem;     /*  40px */
  --space-12:             3rem;       /*  48px */
  --space-16:             4rem;       /*  64px */
  --space-20:             5rem;       /*  80px */
  --space-24:             6rem;       /*  96px */
}


/* ==========================================================================
   6.  BORDER RADIUS
   ========================================================================== */
:root {
  --radius-pixel:         2px;        /* pixel-sharp retro corners */
  --radius-sm:            4px;
  --radius-md:            8px;
  --radius-lg:            12px;
  --radius-xl:            16px;
  --radius-full:          9999px;     /* pill / circle */
}


/* ==========================================================================
   7.  Z-INDEX SCALE
   ========================================================================== */
:root {
  --z-hide:              -1;
  --z-base:               0;
  --z-dropdown:           100;
  --z-sticky:             200;
  --z-sidebar:            300;
  --z-overlay:            400;
  --z-modal:              500;
  --z-toast:              600;
  --z-tooltip:            700;
  --z-command-bar:        800;
  --z-max:                9999;
}


/* ==========================================================================
   8.  TRANSITIONS & ANIMATION
   ========================================================================== */
:root {
  /* --- Durations --- */
  --duration-instant:     50ms;
  --duration-fast:        100ms;
  --duration-normal:      200ms;
  --duration-moderate:    300ms;
  --duration-slow:        500ms;
  --duration-glacial:     800ms;

  /* --- Easings --- */
  --ease-default:         cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in:              cubic-bezier(0.4, 0, 1, 1);
  --ease-out:             cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out:          cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce:          cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-pixel:           steps(4, end);  /* steppy pixel feel */

  /* --- Shorthand Transitions --- */
  --transition-colors:    color var(--duration-normal) var(--ease-default),
                          background-color var(--duration-normal) var(--ease-default),
                          border-color var(--duration-normal) var(--ease-default);
  --transition-opacity:   opacity var(--duration-normal) var(--ease-default);
  --transition-transform: transform var(--duration-normal) var(--ease-default);
  --transition-shadow:    box-shadow var(--duration-normal) var(--ease-default);
  --transition-all:       all var(--duration-normal) var(--ease-default);
}


/* ==========================================================================
   9.  LAYOUT / CONTAINER TOKENS
   ========================================================================== */
:root {
  --sidebar-width:        260px;
  --sidebar-collapsed:    64px;
  --header-height:        56px;
  --content-max-width:    1200px;
  --panel-min-width:      280px;
  --panel-max-width:      400px;
}


/* ==========================================================================
   10. MISC / UTILITY TOKENS
   ========================================================================== */
:root {
  /* Pixel-art rendering hint (apply to images / sprites) */
  --pixel-rendering:      pixelated;

  /* Scrollbar dimensions */
  --scrollbar-width:      10px;
  --scrollbar-track:      var(--bg-mid);
  --scrollbar-thumb:      var(--border-wood);
  --scrollbar-thumb-hover:var(--border-wood-light);

  /* Focus ring */
  --focus-ring:           0 0 0 2px var(--bg-base),
                          0 0 0 4px var(--border-focus);
}
