/*
 * GOOBER FRAMEWORK — core.css
 * Version: 1.0.0
 *
 * Base stylesheet: reset, tokens, typography, layout utilities.
 * This file NEVER changes between projects.
 * Brand customisation lives exclusively in /css/tokens.css
 */

/* ============================================================
   1. CSS RESET (Eric Meyer + modern additions)
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text, #1E293B);
  background: var(--color-bg, #FFFFFF);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.75em;
  font-family: var(--font-heading, system-ui, sans-serif);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text, #1E293B);
}

p {
  margin: 0 0 1em;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--color-primary, #2563EB);
  text-decoration: none;
  transition: color var(--transition, 200ms ease);
}

a:hover {
  color: var(--color-secondary, #1d4ed8);
}

strong, b {
  font-weight: 700;
}

em, i {
  font-style: italic;
}

ul, ol {
  margin: 0 0 1em;
  padding: 0 0 0 1.5em;
}

li {
  margin-bottom: 0.25em;
}

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

button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  padding: 0;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

blockquote {
  margin: 0 0 1em;
  padding: 0 0 0 1.5em;
  border-left: 4px solid var(--color-primary, #2563EB);
  color: var(--color-text-muted, #475569);
  font-style: italic;
}

hr {
  border: none;
  border-top: 1px solid var(--color-border, #E2E8F0);
  margin: var(--space-xl, 48px) 0;
}

address {
  font-style: normal;
}

figure {
  margin: 0;
}

/* ============================================================
   2. CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ============================================================ */

:root {
  /* --- Brand tokens (overridden per project by tokens.css) --- */
  --color-primary:   #2563EB;
  --color-secondary: #1d4ed8;
  --color-cta:       #F97316;

  /* --- Fixed UI colours (never change between projects) --- */
  --color-text:       #1E293B;
  --color-text-muted: #475569;
  --color-text-light: #94A3B8;
  --color-bg:         #FFFFFF;
  --color-bg-alt:     #F8FAFC;
  --color-border:     #E2E8F0;

  /* --- Typography (overridden per project by tokens.css) --- */
  --font-heading: system-ui, -apple-system, sans-serif;
  --font-body:    system-ui, -apple-system, sans-serif;

  /* --- Shape --- */
  --radius:      8px;
  --radius-sm:   calc(var(--radius) * 0.5);
  --radius-lg:   calc(var(--radius) * 2);
  --radius-full: 9999px;

  /* --- Layout --- */
  --nav-height:        72px;
  --container-max:     1200px;
  --container-padding: clamp(16px, 5vw, 48px);

  /* --- Spacing scale --- */
  --space-xs:  8px;
  --space-sm:  16px;
  --space-md:  24px;
  --space-lg:  32px;
  --space-xl:  48px;
  --space-2xl: 80px;
  --space-3xl: 160px;

  /* --- Shadows --- */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);

  /* --- Motion --- */
  --transition:      200ms ease;
  --transition-slow: 400ms ease;

  /* --- Derived tokens (filled in by tokens.css per project) --- */
  --hero-overlay:       rgba(15, 23, 42, 0.55);
  --section-dark-bg:    #0F172A;
  --color-accent-light: #EFF6FF;
  --shadow-brand:       rgba(37, 99, 235, 0.25);
}

/* ============================================================
   3. TYPOGRAPHY SCALE
   ============================================================ */

h1 { font-size: clamp(2.25rem, 5vw, 3.75rem); }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.625rem); }
h4 { font-size: clamp(1.1rem, 1.5vw, 1.25rem); }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

/* ============================================================
   4. LAYOUT — CONTAINER
   ============================================================ */

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

/* ============================================================
   5. SECTION PADDING UTILITIES
   ============================================================ */

.section {
  padding-block: var(--space-2xl);
}

.section-sm {
  padding-block: var(--space-xl);
}

.section-lg {
  padding-block: var(--space-3xl);
}

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

.section-dark {
  background: var(--section-dark-bg, #0F172A);
  color: #FFFFFF;
}

.section-dark h1,
.section-dark h2,
.section-dark h3,
.section-dark h4,
.section-dark p {
  color: #FFFFFF;
}

.section-primary {
  background: var(--color-primary);
  color: #FFFFFF;
}

.section-primary h1,
.section-primary h2,
.section-primary h3,
.section-primary h4,
.section-primary p {
  color: #FFFFFF;
}

/* ============================================================
   6. SPACING UTILITIES
   ============================================================ */

.mt-xs  { margin-top: var(--space-xs); }
.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); }
.mt-2xl { margin-top: var(--space-2xl); }

.mb-xs  { margin-bottom: var(--space-xs); }
.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); }
.mb-2xl { margin-bottom: var(--space-2xl); }

/* ============================================================
   7. FLEX & GRID UTILITIES
   ============================================================ */

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

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

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

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: var(--space-lg);
}

.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }

/* ============================================================
   8. TEXT UTILITIES
   ============================================================ */

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

.text-muted   { color: var(--color-text-muted); }
.text-light   { color: var(--color-text-light); }
.text-primary { color: var(--color-primary); }
.text-white   { color: #FFFFFF; }

.text-sm      { font-size: 0.875rem; }
.text-lg      { font-size: 1.125rem; }
.text-xl      { font-size: 1.25rem; }

.font-bold    { font-weight: 700; }
.font-medium  { font-weight: 500; }

/* ============================================================
   9. LABEL + SECTION TITLE (eyebrow + heading combo)
   ============================================================ */

.label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-xs);
}

.section-title {
  position: relative;
  display: inline-block;
  margin-bottom: var(--space-md);
}

.section-title::after {
  content: '';
  display: block;
  width: 48px;
  height: 4px;
  background: var(--color-cta, #F97316);
  border-radius: var(--radius-full);
  margin-top: 12px;
}

.text-center .section-title::after {
  margin-inline: auto;
}

.section-header {
  margin-bottom: var(--space-xl);
}

.section-header.text-center {
  max-width: 640px;
  margin-inline: auto;
}

/* ============================================================
   10. ACCESSIBILITY 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-width: 0;
}

:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   11. RESPONSIVE BREAKPOINTS — Grid
   ============================================================ */

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

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

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

/* ============================================================
   12. 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;
  }
}

/* ============================================================
   13. PRINT
   ============================================================ */

@media print {
  *, *::before, *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
  }
  a { text-decoration: underline; }
  img { max-width: 100% !important; }
  @page { margin: 2cm; }
  h1, h2, h3 { page-break-after: avoid; }
  p { orphans: 3; widows: 3; }
}
