/* =============================================================
   CCHCL Website — Base Styles
   Reset, typography, utilities, accessibility, animations
   ============================================================= */

/* ── Google Fonts (2-font system) ── */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Manrope:wght@400;500;600;700&display=swap');

/* ── Design Tokens ── */
@import url('./variables.css');

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  font-size: clamp(15px, 1vw + 12px, 17px);
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

a {
  color: var(--color-purple);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-purple-dark); }

ul, ol { list-style: none; }

/* ── Selection Styling (anti-slop detail) ── */
::selection {
  background: var(--color-gold);
  color: #FFF;
}

/* ── Custom Scrollbar (webkit — progressive enhancement) ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--color-cream); }
::-webkit-scrollbar-thumb {
  background: var(--color-navy);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--color-purple); }

/* ── Typography ── */

/* H1: Cormorant Garamond — hero headlines, page titles */
h1, .h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 600;
  line-height: 1.15;
  color: var(--color-purple);
  letter-spacing: -0.02em;
}

/* H2: Cormorant Garamond — section titles */
h2, .h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.5vw, 36px);
  font-weight: 600;
  line-height: 1.25;
  color: var(--color-purple);
}

/* H3: Cormorant Garamond — sub-section headings */
h3, .h3 {
  font-family: var(--font-heading);
  font-size: clamp(20px, 2.5vw, 24px);
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
}

/* H4: Cormorant Garamond — card titles, smaller headings */
h4, .h4 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text);
}

.text-lg { font-size: 18px; line-height: 1.7; }
.text-sm { font-size: 14px; line-height: 1.5; }
.text-xs { font-size: 12px; line-height: 1.4; }

/* ── Layout Utilities ── */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}
.container--narrow {
  max-width: var(--container-narrow);
}

.section {
  padding: var(--space-4xl) 0;
}
.section--alt {
  padding: 80px 0;
}

.section--cream { background-color: var(--color-cream); }
.section--purple { background: var(--gradient-purple); color: #fff; }
.section--navy { background-color: var(--color-deep-navy); color: #fff; }

/* ── Section Title Pattern ── */
.section-label {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2.6px;
  color: var(--color-gold);
  display: block;
  margin-bottom: var(--space-sm);
}

.section-title {
  margin-bottom: var(--space-md);
}

.section-title--center { text-align: center; }
.section-title--white { color: #fff; }

.section-subtitle {
  font-size: 17px;
  line-height: 1.7;
  color: var(--color-text-secondary);
  max-width: 640px;
}
.section-subtitle--center {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

.gold-line {
  display: block;
  width: 48px;
  height: 3px;
  background: var(--gradient-gold);
  border: none;
  border-radius: 2px;
  margin: var(--space-md) 0 var(--space-lg);
}
.gold-line--center {
  margin-left: auto;
  margin-right: auto;
}

/* ── Grid Utilities ── */
.grid { display: grid; gap: var(--space-lg); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

/* Asymmetric two-column — never 50/50 */
.two-col {
  display: grid;
  grid-template-columns: 55fr 45fr;
  gap: var(--space-3xl);
  align-items: center;
}
.two-col--reverse {
  grid-template-columns: 45fr 55fr;
}

/* ── Accessibility ── */
.skip-link {
  position: absolute;
  top: -50px;
  left: 0;
  background: var(--color-navy);
  color: #fff;
  padding: 8px 16px;
  z-index: 10000;
  font-size: 14px;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; color: #fff; }

/* Screen reader only */
.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;
}

*:focus-visible {
  outline: 3px solid var(--color-navy);
  outline-offset: 2px;
}

/* ── Page Load Animation ── */
body {
  animation: fadeIn 0.4s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Scroll Progress Bar ── */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--gradient-gold);
  z-index: 9999;
  width: 0%;
  transition: width 0.1s linear;
}

/* ── Noise Texture (anti-slop: apply to gradient sections) ── */
.noise-texture::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ── 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;
  }
}
