/* ==========================================================================
   BASE — Reset, Typography, Global Styles
   ========================================================================== */

/* ── Modern Reset ──────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--navbar-height);
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color var(--duration-slow) var(--ease-smooth),
              color var(--duration-slow) var(--ease-smooth);
}

body.nav-open {
  overflow: hidden;
}

/* ── Links ─────────────────────────────────────────────────────────────── */
a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-smooth);
}

a:hover {
  color: var(--text-link-hover);
}

a:focus-visible {
  outline: 2px solid var(--brand-400);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Images ────────────────────────────────────────────────────────────── */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── Form Elements ─────────────────────────────────────────────────────── */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--brand-400);
  outline-offset: 2px;
}

/* ── Lists ─────────────────────────────────────────────────────────────── */
ul, ol {
  list-style: none;
}

/* ── Tables ────────────────────────────────────────────────────────────── */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* ── Typography ────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl);  }
h5 { font-size: var(--fs-lg);  }
h6 { font-size: var(--fs-md);  }

p {
  color: var(--text-secondary);
  line-height: var(--lh-normal);
  max-width: 72ch;
}

strong, b {
  font-weight: var(--fw-semibold);
}

small {
  font-size: var(--fs-sm);
}

/* ── Selection ─────────────────────────────────────────────────────────── */
::selection {
  background-color: var(--brand-200);
  color: var(--brand-900);
}

[data-theme="dark"] ::selection {
  background-color: var(--brand-700);
  color: var(--brand-100);
}

/* ── Scrollbar (Premium Design) ────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--brand-400), var(--brand-600));
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--brand-500), var(--brand-700));
}

/* ── Utility Classes (Enhanced) ────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-inline: auto;
  padding-inline: var(--sp-6);
  position: relative;
  z-index: 1;
}

.container--wide {
  max-width: var(--container-2xl);
}

.container--narrow {
  max-width: var(--container-md);
}

.container--full {
  max-width: none;
  padding-inline: 0;
}

.text-center  { text-align: center; }
.text-balance { text-wrap: balance; }
.text-pretty { text-wrap: pretty; }

/* Premium background utilities */
.bg-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
}

.bg-noise {
  position: relative;
}

.bg-noise::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--noise-texture);
  opacity: 1;
  pointer-events: none;
  z-index: 1;
}

/* ── Section Spacing ───────────────────────────────────────────────────── */
.section {
  padding-block: var(--sp-24);
  position: relative;
}

.section--sm {
  padding-block: var(--sp-16);
}

.section--lg {
  padding-block: var(--sp-32);
}

.section__header {
  text-align: center;
  margin-bottom: var(--sp-16);
  max-width: 720px;
  margin-inline: auto;
}

.section__label {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--brand-500);
  margin-bottom: var(--sp-4);
}

.section__label::before {
  content: '';
  display: block;
  width: 32px;
  height: 2px;
  background: var(--gradient-brand);
  border-radius: var(--radius-full);
}

.section__title {
  margin-bottom: var(--sp-4);
}

.section__subtitle {
  font-size: var(--fs-md);
  color: var(--text-secondary);
  max-width: 600px;
  margin-inline: auto;
}

/* ── Background Variants ───────────────────────────────────────────────── */
.bg-primary   { background-color: var(--bg-primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-brand     { background: var(--gradient-hero); color: var(--text-inverse); }
.bg-subtle    { background: var(--gradient-subtle); }

.bg-brand .section__label { color: var(--brand-200); }
.bg-brand .section__title { color: #ffffff; }
.bg-brand .section__subtitle { color: rgba(255,255,255,0.75); }
.bg-brand p { color: rgba(255,255,255,0.8); }

/* ── Decorative Elements ───────────────────────────────────────────────── */
.section__decoration {
  position: absolute;
  pointer-events: none;
  opacity: 0.04;
}

.grid-pattern {
  background-image: radial-gradient(var(--brand-500) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ── Skip Link ─────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-4);
  padding: var(--sp-3) var(--sp-6);
  background: var(--brand-500);
  color: #fff;
  border-radius: var(--radius-md);
  font-weight: var(--fw-semibold);
  z-index: var(--z-tooltip);
  transition: top var(--duration-fast);
}

.skip-link:focus {
  top: var(--sp-4);
}
