/* ============================================================
   PORTFOLIO PRO — global.css
   Global CSS Variables, Reset, Typography, Dark/Light Mode
   ============================================================ */

/* ── Google Fonts Import (fast-loading, distinctive pair)
   Syne        → Display / Headings  (geometric, modern, bold)
   DM Sans     → Body text           (clean, readable, neutral)
   ──────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');


/* ============================================================
   CSS CUSTOM PROPERTIES — DARK MODE (Default)
   ============================================================ */
:root,
[data-theme="dark"] {
  /* ── Site Colors */
  --color-bg:           #171717;
  --color-bg-alt:       #1f1f1f;
  --color-bg-card:      #242424;
  --color-surface:      #2a2a2a;

  /* ── Brand Colors */
  --color-primary:      #6E53F9;
  --color-primary-hover:#5a3ff0;
  --color-primary-glow: rgba(110, 83, 249, 0.25);

  /* ── Text Colors */
  --color-text:         #ffffff;
  --color-text-muted:   #8D9093;
  --color-text-subtle:  #5a5a5a;

  /* ── Secondary / Accent */
  --color-secondary:    #8D9093;
  --color-accent:       #8D9093;

  /* ── Border */
  --color-border:       rgba(250, 250, 255, 0.1);
  --color-border-strong:rgba(250, 250, 255, 0.2);

  /* ── Utility */
  --color-white:        #ffffff;
  --color-black:        #000000;

  /* ── Shadows */
  --shadow-sm:          0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:          0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:          0 8px 32px rgba(0,0,0,0.6);
  --shadow-primary:     0 4px 24px rgba(110, 83, 249, 0.3);

  /* ── Theme Toggle Icon */
  --toggle-icon:        '🌙';
}


/* ============================================================
   CSS CUSTOM PROPERTIES — LIGHT MODE
   ============================================================ */
[data-theme="light"] {
  /* ── Site Colors */
  --color-bg:           #ffffff;
  --color-bg-alt:       #f5f5fa;
  --color-bg-card:      #fafafa;
  --color-surface:      #f0f0f7;

  /* ── Brand Colors (same) */
  --color-primary:      #6E53F9;
  --color-primary-hover:#5a3ff0;
  --color-primary-glow: rgba(110, 83, 249, 0.15);

  /* ── Text Colors */
  --color-text:         #000000;
  --color-text-muted:   #464555;
  --color-text-subtle:  #888899;

  /* ── Secondary / Accent */
  --color-secondary:    #464555;
  --color-accent:       #6E53F9;

  /* ── Border */
  --color-border:       rgba(0, 0, 0, 0.08);
  --color-border-strong:rgba(0, 0, 0, 0.15);

  /* ── Utility */
  --color-white:        #ffffff;
  --color-black:        #000000;

  /* ── Shadows */
  --shadow-sm:          0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:          0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:          0 8px 32px rgba(0,0,0,0.12);
  --shadow-primary:     0 4px 24px rgba(110, 83, 249, 0.2);

  /* ── Theme Toggle Icon */
  --toggle-icon:        '☀️';
}


/* ============================================================
   GLOBAL DESIGN TOKENS (Theme-Independent)
   ============================================================ */
:root {
  /* ── Typography */
  --font-display:   'Syne', sans-serif;
  --font-body:      'DM Sans', sans-serif;

  --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:       2rem;        /* 32px */
  --text-3xl:       2.5rem;      /* 40px */
  --text-4xl:       3.5rem;      /* 56px */
  --text-5xl:       4.5rem;      /* 72px */

  --font-light:     300;
  --font-normal:    400;
  --font-medium:    500;
  --font-semibold:  600;
  --font-bold:      700;
  --font-extrabold: 800;

  --leading-tight:  1.1;
  --leading-snug:   1.3;
  --leading-normal: 1.6;
  --leading-loose:  1.8;

  --tracking-tight: -0.03em;
  --tracking-normal: 0;
  --tracking-wide:  0.05em;
  --tracking-wider: 0.1em;

  /* ── Spacing Scale */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* ── Border Radius */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   20px;
  --radius-2xl:  32px;
  --radius-full: 9999px;

  /* ── Transitions */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
  --transition-slow:   400ms ease;
  --transition-theme:  300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* ── Layout */
  --container-sm:   640px;
  --container-md:   768px;
  --container-lg:   1024px;
  --container-xl:   1280px;
  --container-2xl:  1440px;

  --header-height:  80px;
  --footer-height:  auto;

  /* ── Z-index layers */
  --z-base:     1;
  --z-above:    10;
  --z-header:   100;
  --z-overlay:  200;
  --z-modal:    300;
  --z-toast:    400;
  --z-toggle:   500;
}


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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  transition:
    background-color var(--transition-theme),
    color var(--transition-theme);
  overflow-x: hidden;
  min-height: 100vh;
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary);
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
  transition: color var(--transition-theme);
}


/* ============================================================
   TYPOGRAPHY SCALE
   ============================================================ */
h1 { font-size: clamp(2.5rem, 6vw, var(--text-5xl)); font-weight: var(--font-extrabold); }
h2 { font-size: clamp(2rem,   4vw, var(--text-4xl)); font-weight: var(--font-bold); }
h3 { font-size: clamp(1.5rem, 3vw, var(--text-3xl)); font-weight: var(--font-bold); }
h4 { font-size: clamp(1.25rem,2vw, var(--text-2xl)); font-weight: var(--font-semibold); }
h5 { font-size: var(--text-xl);  font-weight: var(--font-semibold); }
h6 { font-size: var(--text-lg);  font-weight: var(--font-medium); }

p {
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text-muted);
  transition: color var(--transition-theme);
}

.lead {
  font-size: var(--text-md);
  line-height: var(--leading-loose);
  color: var(--color-text-muted);
}

small,
.text-sm {
  font-size: var(--text-sm);
}

strong, b {
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

em, i {
  font-style: italic;
}

.label {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-primary);
}


/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

@media (min-width: 768px) {
  .container { padding-inline: var(--space-8); }
}

@media (min-width: 1280px) {
  .container { padding-inline: var(--space-12); }
}

.section {
  padding-block: var(--space-20);
}

@media (min-width: 768px) {
  .section { padding-block: var(--space-32); }
}


/* ============================================================
   THEME TOGGLE BUTTON — Fixed in Footer
   ============================================================ */
.theme-toggle {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toggle);

  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);

  display: flex;
  align-items: center;
  justify-content: center;

  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border-strong);
  box-shadow: var(--shadow-lg), 0 0 0 0 var(--color-primary-glow);

  cursor: pointer;
  transition:
    background-color var(--transition-theme),
    border-color var(--transition-theme),
    box-shadow var(--transition-base),
    transform var(--transition-base);

  /* No default outline — custom focus style below */
  outline: none;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-lg), 0 0 0 6px var(--color-primary-glow);
  border-color: var(--color-primary);
}

.theme-toggle:focus-visible {
  box-shadow: var(--shadow-lg), 0 0 0 3px var(--color-primary);
}

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

/* Icon inside button */
.theme-toggle__icon {
  width: 22px;
  height: 22px;
  transition: opacity var(--transition-base), transform var(--transition-slow);
  pointer-events: none;
}

/* Sun icon — visible in light mode */
.theme-toggle__icon--sun {
  display: block;
  color: #f59e0b;
}

/* Moon icon — visible in dark mode */
.theme-toggle__icon--moon {
  display: block;
  color: #a78bfa;
}

/* Hide/show logic via data-theme */
[data-theme="dark"]  .theme-toggle__icon--sun  { display: none; }
[data-theme="dark"]  .theme-toggle__icon--moon { display: block; }
[data-theme="light"] .theme-toggle__icon--moon { display: none; }
[data-theme="light"] .theme-toggle__icon--sun  { display: block; }

/* Spin on toggle */
.theme-toggle.is-switching .theme-toggle__icon {
  transform: rotate(360deg);
}


/* ============================================================
   SCROLLBAR STYLING
   ============================================================ */
::-webkit-scrollbar               { width: 6px; height: 6px; }
::-webkit-scrollbar-track         { background: var(--color-bg); }
::-webkit-scrollbar-thumb         { background: var(--color-border-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover   { background: var(--color-primary); }


/* ============================================================
   SELECTION
   ============================================================ */
::selection {
  background-color: var(--color-primary);
  color: var(--color-white);
}


/* ============================================================
   FOCUS VISIBLE (Accessibility)
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}


/* ============================================================
   NO-JS FALLBACK
   ============================================================ */
.no-js .theme-toggle { display: none; }


/* ============================================================
   TRANSITION DISABLE (respects user preference)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
