/* ============================================================
   FONTS
   ============================================================ */
@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-Variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-Variable-Italic.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-Variable.woff2") format("woff2-variations");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-Variable-Italic.woff2") format("woff2-variations");
  font-weight: 100 800;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Trajan Pro";
  src: url("../fonts/TrajanPro-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   DESIGN TOKENS — LIGHT (default)
   ============================================================ */
:root {
  /* --- Background --- */
  --color-bg:               #F5F4F1;
  --color-bg-clock:         #FAF9F8;
  --color-lifeos-border:    #D2D2D2;
  --color-lifeos-bg:        #EAEAE7;
  --color-lifeos-bg-2:      #F2F1ED;

  /* --- Text --- */
  --color-title:            #131313;
  --color-text:             #413F3F;
  --color-text-secondary:   #8B867E;

  /* --- Brand blues --- */
  --color-blue-primary:     #3047B6;
  --color-blue-mid:         #4766B4;
  --color-blue-light:       #898DD1;

  /* --- Extra / badge palette --- */
  --color-extra-1:  #454545;
  --color-extra-2:  #8C8B85;
  --color-extra-3:  #4978F6;
  --color-extra-4:  #1A1A1A;
  --color-extra-5:  #B0B0B0;
  --color-extra-6:  #7A7873;
  --color-extra-7:  #121212;
  --color-extra-8:  #FAF9F7;
  --color-extra-9:  #FEFEFA;
  --color-extra-10: #02B140;
  --color-extra-11: #9F2A42;
  --color-extra-12: #152F5B;
  --color-extra-13: #0047E9;
  --color-extra-14: #981736;
  --color-extra-15: #A41C36;
  --color-extra-16: #505050;
  --color-extra-17: #344DB5;
  --color-extra-18: #464645;
  --color-extra-19: #FFFFFF;
  --color-extra-20: #FAFAFA;
  --color-extra-21: #212121;

  /* --- Typography --- */
  --font-sans:   "Inter", system-ui, sans-serif;
  --font-mono:   "JetBrains Mono", monospace;
  --font-serif:  "Trajan Pro", serif;

  /* --- Font sizes (fluid: clamp(min, preferred, max)) --- */
  --text-xs:   clamp(0.6875rem, 0.65rem + 0.2vw, 0.75rem);   /* 11–12px */
  --text-sm:   clamp(0.75rem,   0.7rem  + 0.25vw, 0.875rem); /* 12–14px */
  --text-base: clamp(0.875rem,  0.8rem  + 0.375vw, 1rem);    /* 14–16px */
  --text-md:   clamp(1rem,      0.9rem  + 0.5vw, 1.125rem);  /* 16–18px */
  --text-lg:   clamp(1.125rem,  1rem    + 0.625vw, 1.25rem); /* 18–20px */
  --text-xl:   clamp(1.25rem,   1.1rem  + 0.75vw, 1.5rem);   /* 20–24px */
  --text-2xl:  clamp(1.5rem,    1.3rem  + 1vw, 2rem);        /* 24–32px */
  --text-3xl:  clamp(2rem,      1.7rem  + 1.5vw, 2.75rem);   /* 32–44px */
  --text-4xl:  clamp(2.75rem,   2.2rem  + 2.75vw, 4rem);     /* 44–64px */

  /* --- Font weights --- */
  --weight-light:    300;
  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  /* --- Line heights --- */
  --leading-tight:   1.2;
  --leading-snug:    1.35;
  --leading-normal:  1.5;
  --leading-relaxed: 1.65;
  --leading-loose:   1.8;

  /* --- Letter spacing --- */
  --tracking-tight:  -0.02em;
  --tracking-normal:  0em;
  --tracking-wide:    0.04em;
  --tracking-wider:   0.08em;
  --tracking-widest:  0.15em;

  /* --- Spacing scale (4px base) --- */
  --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 */
  --space-32:  8rem;      /* 128px */

  /* --- Border radius --- */
  --radius-sm:   0.25rem;   /*  4px */
  --radius-md:   0.5rem;    /*  8px */
  --radius-lg:   0.75rem;   /* 12px */
  --radius-xl:   1rem;      /* 16px */
  --radius-2xl:  1.5rem;    /* 24px */
  --radius-full: 9999px;

  /* --- Borders --- */
  --border-width: 1px;
  --border-color: var(--color-lifeos-border);

  /* --- Shadows --- */
  --shadow-sm:  0 1px 2px rgba(19, 19, 19, 0.06);
  --shadow-md:  0 4px 12px rgba(19, 19, 19, 0.08);
  --shadow-lg:  0 8px 24px rgba(19, 19, 19, 0.10);
  --shadow-xl:  0 16px 40px rgba(19, 19, 19, 0.12);

  /* --- Transitions --- */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
  --transition-slow:   400ms ease;
  --transition-theme:  300ms ease;

  /* --- Z-index layers --- */
  --z-below:    -1;
  --z-base:      0;
  --z-raised:   10;
  --z-overlay:  20;
  --z-dropdown: 30;
  --z-sticky:   40;
  --z-modal:    50;
  --z-toast:    60;
  --z-top:      100;

  /* --- Layout --- */
  --max-width-content: 680px;
  --max-width-wide:    960px;
  --max-width-full:   1280px;
}

/* ============================================================
   DESIGN TOKENS — DARK
   ============================================================ */
[data-theme="dark"] {
  /* --- Background --- */
  --color-bg:               #131313;
  --color-bg-clock:         #201F1F;
  --color-lifeos-border:    #2A2A2A;
  --color-lifeos-bg:        #1B1B1C;
  --color-lifeos-bg-2:      #27272A;  /* Uni */
  --color-lifeos-bg-3:      #39393C;  /* Work */

  /* --- Text --- */
  --color-title:            #F5F4F1;
  --color-text:             #F5F4F1;
  --color-text-secondary:   #FAF9F8;

  /* --- Brand blues (unchanged) --- */
  --color-blue-primary:     #3047B6;
  --color-blue-mid:         #4766B4;
  --color-blue-light:       #898DD1;

  /* --- Shadows (darker base) --- */
  --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg:  0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-xl:  0 16px 40px rgba(0, 0, 0, 0.55);
}

/* ============================================================
   CSS RESET + BASE
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  hanging-punctuation: first last;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  transition:
    background-color var(--transition-theme),
    color var(--transition-theme);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
video,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */

/* --- Visually hidden (accessible) --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Focus ring --- */
:focus-visible {
  outline: 2px solid var(--color-blue-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   THEME TOGGLE BUTTON
   ============================================================ */
.theme-toggle {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-full);
  background-color: var(--color-lifeos-bg);
  border: var(--border-width) solid var(--color-lifeos-border);
  transition:
    background-color var(--transition-theme),
    border-color var(--transition-theme),
    transform var(--transition-fast);
}

.theme-toggle:hover {
  transform: scale(1.08);
}

.theme-toggle:active {
  transform: scale(0.95);
}

/* Hide the icon that doesn't apply to the current theme */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
