/* Global stylesheet for Wellume design system */

/* Universal box-sizing & defensive responsive foundation */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  /* ---- Site layout (3-tier semantic width system: Step 162) ---- */
  --site-max-width: 1400px;       /* 1400px — outermost public page boundary, matching Header */
  --editorial-max-width: 1360px;  /* 1360px — listing grids, heroes, cards, matching Footer */
  --reading-max-width: 48rem;     /* 768px  — long-form prose only (65-75 CPL) */
  --site-gutter: clamp(1rem, 2.5vw, 2rem);  /* responsive horizontal padding matching Header lg:px-8 */
  
  /* ---- Colors ---- */
  --color-primary: #176B4D;               /* Wellume Green */
  --color-primary-dark: #0F4A36;          /* Deep Green */
  --color-secondary: #5F8F78;            /* Sage */
  --color-background: #FFFFFF;           /* White */
  --color-surface: #F7F5EF;              /* Cream */
  --color-border: #DDE5DF;               /* Border */
  --color-accent: #C89B3C;               /* Gold */
  --color-mint: #EAF4EE;                 /* Mint */
  --color-navy: #17213C;                 /* Navy */
  --color-success: #28a745;              /* success green */
  --color-warning: #ffc107;              /* warning amber */
  --color-error: #dc3545;                /* error red */

  /* ---- Typography ---- */
  --font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-size-base: 1rem;               /* 16px */
  --font-size-sm: 0.875rem;             /* 14px */
  --font-size-lg: 1.125rem;             /* 18px */
  --font-size-xl: 1.5rem;               /* 24px */
  --font-size-xxl: 2rem;                /* 32px */
  --line-height-base: 1.5;

  /* ---- Spacing ---- */
  --space-0: 0;
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.5rem;    /* 24px */
  --space-6: 2rem;      /* 32px */

  /* ---- Radii ---- */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;

  /* ---- Shadows ---- */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 2px 4px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 8px rgba(0,0,0,0.15);

  /* ---- Motion ---- */
  --duration-fast: 150ms;
  --duration-medium: 250ms;
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base element styles */
html {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  background-color: var(--color-background);
  color: #17213C; /* default text color from palette */
  scroll-behavior: smooth;
  max-width: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  overflow-x: clip;
}

/* Responsive media constraint */
img,
picture,
video,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Prevent long words, URLs, and code blocks from breaking container bounds */
p, h1, h2, h3, h4, h5, h6, a, span, li, blockquote {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Constrain tables */
table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
}

/* Ensure flex children and grid items can shrink */
.grid, [class*="grid"] {
  min-width: 0;
}
.flex > *, [class*="flex"] > * {
  min-width: 0;
}

/* ---- Heading typography ---- */
h1 { font-size: var(--font-size-xxl); line-height: 1.2; margin-top: var(--space-6); margin-bottom: var(--space-3); font-weight: 700; }
h2 { font-size: var(--font-size-xl); line-height: 1.3; margin-top: var(--space-5); margin-bottom: var(--space-3); font-weight: 600; }
h3 { font-size: var(--font-size-lg); line-height: 1.4; margin-top: var(--space-4); margin-bottom: var(--space-2); font-weight: 600; }
h4 { font-size: var(--font-size-base); line-height: 1.5; margin-top: var(--space-3); margin-bottom: var(--space-2); font-weight: 500; }

/* ---- Semantic Layout Shells ---- */

/* Site shell: outermost page boundary (1280px) */
.site-shell {
  max-width: var(--site-max-width);
  width: 100%;
  margin: 0 auto;
  padding-left: var(--site-gutter);
  padding-right: var(--site-gutter);
  box-sizing: border-box;
}

/* Editorial shell: listing grids, heroes, taxonomy hubs (1216px) */
.editorial-shell {
  max-width: var(--editorial-max-width);
  width: 100%;
  margin: 0 auto;
  padding-left: var(--site-gutter);
  padding-right: var(--site-gutter);
  box-sizing: border-box;
}

/* Reading shell: long-form prose, article body, disclosures (768px) */
.reading-shell {
  max-width: var(--reading-max-width);
  width: 100%;
  margin: 0 auto;
  padding-left: var(--site-gutter);
  padding-right: var(--site-gutter);
  box-sizing: border-box;
}

/* Focus outline – visible for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Utility classes for layout */
.container {
  width: 100%;
  max-width: var(--editorial-max-width, 1360px);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
  box-sizing: border-box;
}

section {
  margin-top: var(--space-6);
  margin-bottom: var(--space-6);
  max-width: 100%;
}

hr.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-5) 0;
}

/* Accessibility: prefers-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;
  }
}

/* Button styles */
.btn { display: inline-block; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); font-weight: 600; text-decoration: none; cursor: pointer; transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
.btn-primary { background-color: var(--color-primary); color: var(--color-surface); }
.btn-primary:hover, .btn-primary:focus-visible { background-color: var(--color-primary-dark); }
.btn-secondary { background-color: var(--color-secondary); color: var(--color-surface); }
.btn-secondary:hover, .btn-secondary:focus-visible { background-color: var(--color-primary); }

/* Image utilities */
.responsive-image { width: 100%; height: auto; display: block; border-radius: var(--radius-sm); }
.placeholder-image { background: var(--color-mint); aspect-ratio: 16 / 9; border-radius: var(--radius-sm); }
