/* ============================================================
   GLOBAL.CSS — Legacy Line Auto
   Reset, Custom Properties, Typography, Layout, Utilities
   ============================================================ */

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

html {
  -moz-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  min-height: 100vh;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeSpeed;
}

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

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

ul,
ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  text-wrap: balance;
}

p {
  overflow-wrap: break-word;
  text-wrap: pretty;
  max-width: 70ch;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

fieldset {
  border: none;
}

/* Remove animations for users who prefer reduced motion */
@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;
  }
}


/* ----- Custom Properties ----- */
:root {
  /* Brand Colors — Dark Premium */
  --color-primary: #0F1923;
  --color-primary-light: #1A2B3D;
  --color-primary-mid: #243447;
  --color-accent: #4A7C9B;
  --color-accent-light: #5E9AB8;
  --color-accent-glow: rgba(74, 124, 155, 0.12);

  /* Backgrounds */
  --color-bg: #0A0F14;
  --color-bg-elevated: #111921;
  --color-bg-card: #151D27;
  --color-bg-card-hover: #1A2535;
  --color-bg-white: #FFFFFF;
  --color-bg-light: #F8F9FA;
  --color-bg-section: #0D1219;

  /* Text */
  --color-text: #E8ECF1;
  --color-text-muted: #8B95A3;
  --color-text-dim: #5A6577;
  --color-text-bright: #FFFFFF;
  --color-text-dark: #1A1A2E;

  /* Borders */
  --color-border: rgba(255, 255, 255, 0.06);
  --color-border-light: rgba(255, 255, 255, 0.1);
  --color-border-accent: rgba(74, 124, 155, 0.3);

  /* Feedback */
  --color-success: #34D399;
  --color-error: #EF4444;

  /* Typography */
  --font-heading: "Barlow Condensed", system-ui, -apple-system, sans-serif;
  --font-body: "Work Sans", system-ui, -apple-system, sans-serif;

  /* Fluid Type Scale */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 0.775rem + 0.25vw, 0.875rem);
  --text-base: clamp(0.9375rem, 0.875rem + 0.3125vw, 1.0625rem);
  --text-lg: clamp(1.0625rem, 0.975rem + 0.4375vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.25rem + 1.25vw, 2rem);
  --text-3xl: clamp(1.875rem, 1.5rem + 1.875vw, 2.5rem);
  --text-4xl: clamp(2.25rem, 1.75rem + 2.5vw, 3.25rem);
  --text-5xl: clamp(2.75rem, 2rem + 3.75vw, 4rem);

  /* Spacing */
  --space-xs: clamp(0.25rem, 0.2rem + 0.25vw, 0.5rem);
  --space-sm: clamp(0.5rem, 0.4rem + 0.5vw, 0.75rem);
  --space-md: clamp(1rem, 0.85rem + 0.75vw, 1.5rem);
  --space-lg: clamp(1.5rem, 1.25rem + 1.25vw, 2.5rem);
  --space-xl: clamp(2rem, 1.5rem + 2.5vw, 3.5rem);
  --space-2xl: clamp(3rem, 2rem + 5vw, 5rem);
  --section-gap: clamp(4rem, 3rem + 6vw, 7rem);

  /* Layout */
  --container-max: 1200px;
  --container-padding: clamp(1rem, 0.5rem + 2.5vw, 2rem);

  /* Borders & Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 40px rgba(74, 124, 155, 0.08);

  /* Transitions */
  --transition-fast: 200ms ease;
  --transition-base: 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-slow: 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94);

  /* Z-index scale */
  --z-header: 100;
  --z-overlay: 200;
  --z-modal: 300;
  --z-tooltip: 400;
}


/* ----- Base Typography ----- */
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-text-bright);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h1 {
  font-size: var(--text-5xl);
  font-weight: 700;
  text-transform: uppercase;
}

h2 {
  font-size: var(--text-4xl);
  font-weight: 700;
  text-transform: uppercase;
}

h3 {
  font-size: var(--text-2xl);
  font-weight: 600;
}

h4 {
  font-size: var(--text-xl);
  font-weight: 600;
}

h5 {
  font-size: var(--text-lg);
  font-weight: 600;
}

h6 {
  font-size: var(--text-base);
  font-weight: 600;
}

p {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.75;
}

p + p {
  margin-top: 1em;
}

strong, b {
  font-weight: 600;
}

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

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

a:hover {
  color: var(--color-accent-light);
}

::selection {
  background-color: var(--color-accent);
  color: var(--color-bg);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}


/* ----- Layout Utilities ----- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.container--narrow {
  max-width: 800px;
}

.container--wide {
  max-width: 1400px;
}

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

.section--bg {
  background: linear-gradient(180deg, var(--color-bg-elevated) 0%, var(--color-bg) 100%);
}

.section--dark {
  background-color: var(--color-bg-section);
}

.section--light {
  background: var(--color-bg-light);
  color: var(--color-text-dark);
}

.section--light h2, .section--light h3, .section--light h4 {
  color: var(--color-primary);
}

.section--light p {
  color: var(--color-text-dim);
}

/* Flexbox utilities */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm {
  gap: var(--space-sm);
}

.gap-md {
  gap: var(--space-md);
}

.gap-lg {
  gap: var(--space-lg);
}

.gap-xl {
  gap: var(--space-xl);
}

/* Grid utilities */
.grid {
  display: grid;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

.grid-2,
.grid-3,
.grid-4 {
  justify-items: stretch;
}

/* Text utilities */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.text-uppercase {
  text-transform: uppercase;
}

.text-accent {
  color: var(--color-accent);
}

.text-primary {
  color: var(--color-text-bright);
}

.text-white {
  color: var(--color-bg-white);
}

.text-muted {
  color: var(--color-text-muted);
}

/* Spacing utilities */
.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); }
.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); }

.mx-auto {
  margin-inline: auto;
}

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

.hidden {
  display: none !important;
}

/* Skip-to-content accessibility link */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: calc(var(--z-tooltip) + 1);
  padding: 0.75rem 1.5rem;
  background-color: var(--color-accent);
  color: var(--color-bg-white);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  transition: top var(--transition-fast);
}

.skip-to-content:focus {
  top: 0;
  outline: none;
}


/* Animation prep */
.will-animate {
  will-change: transform, opacity;
}


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

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-bg-card);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}

/* ----- Responsive Breakpoints ----- */
/*
  Mobile-first breakpoints:
  - Base:  320px+ (default styles)
  - sm:    576px
  - md:    768px  (tablet / hamburger breakpoint)
  - lg:    1024px (desktop)
  - xl:    1440px (wide)
*/

/* ----- Light Mode Overrides ----- */
html[data-theme="light"] {
  --color-bg: #F5F6F8;
  --color-bg-elevated: #EDEEF1;
  --color-bg-card: #FFFFFF;
  --color-bg-card-hover: #F0F1F4;
  --color-bg-section: #E8E9EC;
  --color-text: #2A2E35;
  --color-text-muted: #5A6170;
  --color-text-dim: #7C8290;
  --color-text-bright: #111318;
  --color-text-dark: #1A1A2E;
  --color-border: rgba(0, 0, 0, 0.08);
  --color-border-light: rgba(0, 0, 0, 0.12);
  --color-border-accent: rgba(74, 124, 155, 0.25);
  --color-accent-glow: rgba(74, 124, 155, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 40px rgba(74, 124, 155, 0.06);
}

/* Scrollbar in light mode */
html[data-theme="light"] ::-webkit-scrollbar-track { background: var(--color-bg); }
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: #C4C8CF; }
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: var(--color-accent); }
