/* ============================================================
   BygMedAI Base CSS — Lag 1: Reset + Tokens + Utilities
   ============================================================
   Del af 4-lags CSS-arkitektur (Konsolideringsstrategi v3.1):
     Lag 1: base.css (dette fil) — 100% delt
     Lag 2: Partials (nav, footer, head)
     Lag 3: Layouts (article, landing, about)
     Lag 4: Skin (kundespecifik)

   Overrideable: Alle :root custom properties kan overrides
   i et kundespecifikt skin.css.
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  background: var(--black);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  display: block;
}

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

/* ---------- DESIGN TOKENS (shared defaults) ---------- */
/* These are safe fallbacks. The skin.css (Lag 4) overrides them
   with site-specific values. If skin.css fails to load, the site
   still renders with these defaults.
   Fonts are set from site.json via head.njk Google Fonts link. */
:root {
  /* Typografi */
  --font-display: 'Montserrat', system-ui, sans-serif;
  --font-body: 'Space Grotesk', system-ui, sans-serif;

  /* Farver (defaults — overridden af skin) */
  --black: #0A0C12;
  --black-light: #12151D;
  --pink: #C4A0A0;
  --pink-light: #D4B0B0;
  --orange: #D4956A;
  --orange-hover: #E0A57A;
  --gradient: linear-gradient(135deg, #C4A0A0, #D4956A);
  --gradient-subtle: linear-gradient(135deg, rgba(196,160,160,0.15), rgba(212,149,106,0.15));
  --text: #F0F2F5;
  --text-muted: #9CA8B7;
  --text-dim: #6B7580;
  --nav-border: rgba(219, 82, 39, 0.15);

  /* Layout */
  --radius: 12px;
  --max-w: 1100px;

  /* Compat aliases (deprecated — brug primære navne) */
  --bg: var(--black);
  --surface: var(--black-light);
  --accent: var(--orange);
  --accent-light: var(--orange-hover);
  --accent-bg: rgba(212,149,106,0.1);
  --navy: var(--black);
  --navy-light: var(--black-light);
  --warm: var(--orange);
  --white: #FFFFFF;
  --blue: var(--black-light);
  --green: #38A169;
  --grey: var(--text-dim);
  --red: #EF4444;

  /* ---------- SPACING TOKENS (WP1) ---------- */
  --space-2xs: 4px;
  --space-xs:  8px;
  --space-sm:  12px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;
  --space-3xl: 96px;

  /* ---------- TYPOGRAPHIC SCALE (WP1, clamp-based) ---------- */
  --type-caption: clamp(0.75rem, 1.5vw, 0.875rem);   /* 12–14px */
  --type-sm:      clamp(0.875rem, 1.5vw, 1rem);       /* 14–16px */
  --type-base:    clamp(1rem, 1.5vw, 1.0625rem);      /* 16–17px */
  --type-lg:      clamp(1.0625rem, 2vw, 1.25rem);     /* 17–20px */
  --type-xl:      clamp(1.25rem, 2.5vw, 1.5rem);      /* 20–24px */
  --type-2xl:     clamp(1.5rem, 3vw, 2rem);           /* 24–32px */
  --type-3xl:     clamp(1.8rem, 3.5vw, 3rem);         /* 29–48px */
  --type-hero:    clamp(2rem, 4vw, 3.2rem);           /* 32–51px */

  /* ---------- SURFACE ALIASES (WP1) ---------- */
  --surface-base:     var(--black);
  --surface-elevated: var(--black-light);
  --surface-accent:   var(--accent-bg);
  --surface-deep:     #06080E;

  /* ---------- SHADOW TOKENS (WP1) ---------- */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.50);

  /* ---------- RADIUS TOKENS (WP1) ---------- */
  --radius-sm:   6px;
  --radius-md:   12px;   /* = existing --radius */
  --radius-lg:   16px;
  --radius-full: 9999px;

  /* ---------- BORDER TOKENS (WP1) ---------- */
  --border-subtle: var(--accent-bg);  /* rgba(212,149,106,0.1) */
  --border-accent: var(--orange);     /* #D4956A */
}


/* ---------- NAV ACCENT LINK ---------- */
.nav-links a[href="/instrument-audit/"] {
  color: var(--orange);
  font-weight: 600;
}
.nav-links a[href="/instrument-audit/"]:hover {
  color: var(--orange-hover);
}
/* ---------- UTILITIES ---------- */

/* Font-weight utilities (WP1) */
.font-light     { font-weight: 300; }
.font-regular   { font-weight: 400; }
.font-medium    { font-weight: 500; }
.font-semibold  { font-weight: 600; }
.font-bold      { font-weight: 700; }
.font-extrabold { font-weight: 800; }

/* Layout container */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

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

/* Screen reader only — visually hidden but accessible */
.sr-only,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- SCROLL REVEAL ANIMATION BASE ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}

.stagger-item {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.stagger-item.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- RESPONSIVE BASE ---------- */

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  [data-reveal],
  .stagger-item {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ============================================================
   WP13 — Progressive Enhancement: Scroll-Driven Animations
   Chrome 115+. Graceful degradation via @supports guard.
   Firefox/Safari: static (no animation, fully functional).
   ============================================================ */
@supports (animation-timeline: scroll()) {
  /* Hero parallax — subtle background-position shift on scroll */
  .page-header {
    animation: wp13-hero-parallax linear both;
    animation-timeline: scroll(root block);
    animation-range: 0% 40%;
  }
  @keyframes wp13-hero-parallax {
    from { background-position-y: center; }
    to   { background-position-y: 20%;   }
  }

  /* Stats counter items — fade + lift as they enter the viewport */
  .sc-stats__item {
    animation: wp13-stat-reveal linear both;
    animation-timeline: view(block);
    animation-range: entry 0% entry 60%;
  }
  @keyframes wp13-stat-reveal {
    from { opacity: 0.2; transform: translateY(16px) scale(0.96); }
    to   { opacity: 1;   transform: translateY(0)    scale(1);    }
  }
}

/* Disable scroll-driven animations for reduced-motion users */
@media (prefers-reduced-motion: reduce) {
  @supports (animation-timeline: scroll()) {
    .page-header,
    .sc-stats__item {
      animation: none;
    }
  }
}

/* ============================================================
   WP13 — Progressive Enhancement: content-visibility
   Defers rendering of off-screen composition sections.
   Chrome 85+, Edge 85+. Graceful on Safari/Firefox (ignored).
   ============================================================ */
@supports (content-visibility: auto) {
  .sc-stats,
  .sc-testimonial,
  .sc-case,
  .sc-pullquote,
  .sc-cta {
    content-visibility: auto;
    /* 'auto' lets browser learn real size after first paint */
    contain-intrinsic-size: auto 400px;
  }
}
