/* ============================================================
   INDEX.CSS — Design System & Foundation
   The Silverlocks Compass — Author Website
   ============================================================
   Table of Contents:
   1. Font Imports
   2. CSS Reset (Modern)
   3. Custom Properties / Design Tokens
   4. Global Styles
   5. Typography Scale
   6. Utility Classes
   7. Responsive Breakpoints
   ============================================================ */

/* ============================================================
   1. FONT IMPORTS
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,900;1,700;1,900&family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600&display=swap');

/* ============================================================
   2. CSS RESET (Modern)
   ============================================================
   A minimal, modern reset that removes default margins,
   normalizes box-sizing, and ensures consistent rendering.
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Remove default list styles */
ul,
ol {
  list-style: none;
}

/* Prevent font size inflation on mobile */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

/* Set core body defaults */
body {
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Balance headings across multiple lines */
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
}

/* Remove built-in form typography */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* Avoid text overflows */
p,
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

/* Anchor tags reset */
a {
  text-decoration: none;
  color: inherit;
}

/* Media defaults */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Table reset */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* Remove animations for people who've turned them off */
@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;
  }
}

/* ============================================================
   3. CUSTOM PROPERTIES / DESIGN TOKENS
   ============================================================ */
:root {
  /* ---- Color Palette ---- */
  /* Primary Blues */
  --primary-deep-blue:    #0f2547;
  --primary-royal-blue:   #1a3f7a;
  --primary-mid-blue:     #2563a8;

  /* Accent Colors */
  --accent-emerald:       #2ecc71;
  --accent-crimson:       #e63946;
  --accent-gold:          #f0c040;
  --accent-magenta:       #c62a88;
  --accent-teal:          #17a2b8;

  /* Text Colors */
  --text-white:           #ffffff;
  --text-light:           #c8d6e5;
  --text-muted:           #8899aa;

  /* Surface Colors */
  --surface-glass:        rgba(255, 255, 255, 0.06);
  --surface-glass-border: rgba(255, 255, 255, 0.1);
  --surface-dark:         #0a1a33;

  /* Gradients */
  --gradient-hero:        linear-gradient(135deg, #0a1a33 0%, #0f2547 30%, #1a3f7a 70%, #2563a8 100%);
  --gradient-accent:      linear-gradient(135deg, var(--accent-emerald), var(--accent-teal));
  --gradient-warm:        linear-gradient(135deg, var(--accent-gold), var(--accent-crimson));
  --gradient-text:        linear-gradient(135deg, var(--text-white) 0%, var(--accent-gold) 50%, var(--accent-emerald) 100%);

  /* ---- Typography ---- */
  --font-heading:         'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body:            'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-label:           'Outfit', 'Inter', sans-serif;

  /* Font Sizes — Fluid Typography */
  --fs-display:           clamp(3rem, 5vw + 1rem, 5.5rem);
  --fs-h1:                clamp(2.25rem, 4vw + 0.5rem, 4rem);
  --fs-h2:                clamp(1.75rem, 3vw + 0.5rem, 3rem);
  --fs-h3:                clamp(1.375rem, 2vw + 0.5rem, 2rem);
  --fs-h4:                clamp(1.125rem, 1.5vw + 0.25rem, 1.5rem);
  --fs-h5:                clamp(1rem, 1vw + 0.25rem, 1.25rem);
  --fs-h6:                clamp(0.875rem, 0.75vw + 0.25rem, 1.125rem);
  --fs-body-lg:           1.125rem;
  --fs-body:              1rem;
  --fs-body-sm:           0.875rem;
  --fs-caption:           0.75rem;

  /* Font Weights */
  --fw-light:             300;
  --fw-regular:           400;
  --fw-medium:            500;
  --fw-semibold:          600;
  --fw-bold:              700;
  --fw-black:             900;

  /* Line Heights */
  --lh-tight:             1.2;
  --lh-snug:              1.35;
  --lh-normal:            1.6;
  --lh-relaxed:           1.75;

  /* Letter Spacing */
  --ls-tight:             -0.025em;
  --ls-normal:            0;
  --ls-wide:              0.05em;
  --ls-wider:             0.1em;
  --ls-widest:            0.2em;

  /* ---- Spacing Scale ---- */
  --space-xs:             0.25rem;   /*  4px */
  --space-sm:             0.5rem;    /*  8px */
  --space-md:             1rem;      /* 16px */
  --space-lg:             1.5rem;    /* 24px */
  --space-xl:             2rem;      /* 32px */
  --space-2xl:            3rem;      /* 48px */
  --space-3xl:            5rem;      /* 80px */
  --space-4xl:            8rem;      /* 128px */

  /* ---- Border Radius ---- */
  --radius-sm:            4px;
  --radius-md:            8px;
  --radius-lg:            12px;
  --radius-xl:            16px;
  --radius-2xl:           24px;
  --radius-full:          9999px;

  /* ---- Transitions ---- */
  --transition-fast:      0.2s ease;
  --transition-base:      0.3s ease;
  --transition-slow:      0.5s ease;
  --transition-spring:    0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out-expo:        cubic-bezier(0.16, 1, 0.3, 1);

  /* ---- Shadows ---- */
  --shadow-sm:            0 1px 3px rgba(10, 26, 51, 0.3);
  --shadow-md:            0 4px 12px rgba(10, 26, 51, 0.4);
  --shadow-lg:            0 8px 30px rgba(10, 26, 51, 0.5);
  --shadow-xl:            0 16px 50px rgba(10, 26, 51, 0.6);
  --shadow-glow-sm:       0 0 15px rgba(37, 99, 168, 0.3);
  --shadow-glow-md:       0 0 30px rgba(37, 99, 168, 0.4);
  --shadow-glow-lg:       0 0 50px rgba(37, 99, 168, 0.5);
  --shadow-glow-emerald:  0 0 30px rgba(46, 204, 113, 0.3);
  --shadow-glow-gold:     0 0 30px rgba(240, 192, 64, 0.3);
  --shadow-glow-teal:     0 0 25px rgba(23, 162, 184, 0.3);

  /* ---- Container Widths ---- */
  --container-sm:         640px;
  --container-md:         768px;
  --container-lg:         1024px;
  --container-xl:         1280px;

  /* ---- Z-Index Scale ---- */
  --z-behind:             -1;
  --z-base:               1;
  --z-dropdown:           100;
  --z-sticky:             200;
  --z-fixed:              300;
  --z-overlay:            400;
  --z-modal:              500;
  --z-toast:              600;
}

/* ============================================================
   4. GLOBAL STYLES
   ============================================================ */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px; /* Offset for fixed navbar */
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--text-light);
  background-color: var(--surface-dark);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(26, 63, 122, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(37, 99, 168, 0.1) 0%, transparent 50%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Selection styling */
::selection {
  background-color: var(--primary-mid-blue);
  color: var(--text-white);
}

::-moz-selection {
  background-color: var(--primary-mid-blue);
  color: var(--text-white);
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid var(--accent-teal);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--surface-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-royal-blue);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-mid-blue);
}

/* ============================================================
   5. TYPOGRAPHY SCALE
   ============================================================ */

/* ---- Headings ---- */
h1, .h1 {
  font-family: var(--font-heading);
  font-size: var(--fs-h1);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--text-white);
}

h2, .h2 {
  font-family: var(--font-heading);
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--text-white);
}

h3, .h3 {
  font-family: var(--font-heading);
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  color: var(--text-white);
}

h4, .h4 {
  font-family: var(--font-heading);
  font-size: var(--fs-h4);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  color: var(--text-white);
}

h5, .h5 {
  font-family: var(--font-label);
  font-size: var(--fs-h5);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--text-white);
}

h6, .h6 {
  font-family: var(--font-label);
  font-size: var(--fs-h6);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: var(--ls-wider);
}

/* ---- Body Text ---- */
p {
  margin-bottom: var(--space-md);
  color: var(--text-light);
}

p:last-child {
  margin-bottom: 0;
}

.text-lg {
  font-size: var(--fs-body-lg);
  line-height: var(--lh-relaxed);
}

.text-sm {
  font-size: var(--fs-body-sm);
}

.text-caption {
  font-size: var(--fs-caption);
  color: var(--text-muted);
  letter-spacing: var(--ls-wide);
}

/* ---- Links ---- */
a {
  transition: color var(--transition-fast);
}

.link {
  color: var(--accent-teal);
  position: relative;
}

.link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent-teal);
  transition: width var(--transition-base);
}

.link:hover::after {
  width: 100%;
}

/* ---- Emphasis & Decorative Text ---- */
strong, b {
  font-weight: var(--fw-semibold);
  color: var(--text-white);
}

em, i {
  font-style: italic;
}

/* Section label / kicker text */
.section-label {
  font-family: var(--font-label);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--ls-widest);
  color: var(--accent-teal);
  margin-bottom: var(--space-sm);
  display: inline-block;
}

/* Section heading underline decoration */
.section-heading {
  position: relative;
  display: inline-block;
  margin-bottom: var(--space-lg);
}

.section-heading::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: var(--gradient-accent);
  border-radius: var(--radius-full);
}

.section-heading--left::after {
  left: 0;
  transform: none;
}

/* ============================================================
   6. UTILITY CLASSES
   ============================================================ */

/* ---- Container ---- */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

.container--sm {
  max-width: var(--container-sm);
}

.container--md {
  max-width: var(--container-md);
}

.container--lg {
  max-width: var(--container-lg);
}

/* ---- Section Padding ---- */
.section-padding {
  padding-top: var(--space-3xl);
  padding-bottom: var(--space-3xl);
}

.section-padding--sm {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-2xl);
}

/* ---- Text Gradient ---- */
.text-gradient {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-gradient--emerald {
  background: linear-gradient(135deg, var(--accent-emerald), var(--accent-teal));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-gradient--warm {
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-crimson));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---- Glass Card ---- */
.glass-card {
  background: var(--surface-glass);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: var(--space-xl);
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base),
    border-color var(--transition-base);
}

.glass-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow-sm);
  border-color: rgba(255, 255, 255, 0.18);
}

.glass-card--sm {
  padding: var(--space-lg);
  border-radius: var(--radius-md);
}

.glass-card--no-hover:hover {
  transform: none;
  box-shadow: none;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-family: var(--font-label);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  padding: 0.85em 2em;
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition:
    all var(--transition-base);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::before {
  opacity: 1;
}

.btn--primary {
  background: var(--accent-emerald);
  color: var(--text-white);
  border-color: var(--accent-emerald);
  box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.btn--primary:hover {
  background: #27ae60;
  border-color: #27ae60;
  box-shadow: 0 6px 25px rgba(46, 204, 113, 0.45);
  transform: translateY(-2px);
}

.btn--primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(46, 204, 113, 0.3);
}

.btn--secondary {
  background: transparent;
  color: var(--text-white);
  border-color: var(--text-white);
}

.btn--secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-white);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.1);
}

.btn--secondary:active {
  transform: translateY(0);
}

.btn--accent {
  background: var(--accent-gold);
  color: var(--surface-dark);
  border-color: var(--accent-gold);
  box-shadow: 0 4px 15px rgba(240, 192, 64, 0.3);
}

.btn--accent:hover {
  box-shadow: 0 6px 25px rgba(240, 192, 64, 0.45);
  transform: translateY(-2px);
}

.btn--sm {
  padding: 0.6em 1.5em;
  font-size: var(--fs-caption);
}

.btn--lg {
  padding: 1em 2.5em;
  font-size: var(--fs-body);
}

/* ---- Text Alignment ---- */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

/* ---- Display ---- */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.flex-wrap   { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-xs      { gap: var(--space-xs); }
.gap-sm      { gap: var(--space-sm); }
.gap-md      { gap: var(--space-md); }
.gap-lg      { gap: var(--space-lg); }
.gap-xl      { gap: var(--space-xl); }
.gap-2xl     { gap: var(--space-2xl); }

/* ---- Margin helpers ---- */
.mt-sm  { margin-top: var(--space-sm); }
.mt-md  { margin-top: var(--space-md); }
.mt-lg  { margin-top: var(--space-lg); }
.mt-xl  { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mb-sm  { margin-bottom: var(--space-sm); }
.mb-md  { margin-bottom: var(--space-md); }
.mb-lg  { margin-bottom: var(--space-lg); }
.mb-xl  { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

/* ---- Visibility ---- */
.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;
}

/* ============================================================
   7. RESPONSIVE BREAKPOINTS
   ============================================================ */

/* -- Tablet: max-width 1024px -- */
@media (max-width: 1024px) {
  :root {
    --space-3xl: 4rem;
    --space-4xl: 6rem;
  }

  .container {
    padding-left: var(--space-xl);
    padding-right: var(--space-xl);
  }

  .section-padding {
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-2xl);
  }
}

/* -- Mobile: max-width 768px -- */
@media (max-width: 768px) {
  :root {
    --space-2xl: 2rem;
    --space-3xl: 3rem;
    --space-4xl: 4rem;
  }

  html {
    scroll-padding-top: 70px;
  }

  .container {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .section-padding {
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-2xl);
  }

  .btn {
    padding: 0.75em 1.6em;
    font-size: var(--fs-caption);
  }

  .btn--lg {
    padding: 0.85em 2em;
    font-size: var(--fs-body-sm);
  }
}

/* -- Small Mobile: max-width 480px -- */
@media (max-width: 480px) {
  .container {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }

  h1, .h1 {
    font-size: clamp(1.75rem, 8vw, 2.5rem);
  }

  h2, .h2 {
    font-size: clamp(1.5rem, 6vw, 2rem);
  }
}

/* iOS Safari: background-attachment: fixed causes rendering glitches */
@supports (-webkit-touch-callout: none) {
  body {
    background-attachment: scroll;
  }
}
