/* ==========================================================================
   Mishaal Golden — Design tokens, reset, base
   Edit any token in :root and the entire theme re-skins.
   ========================================================================== */

:root {
  /* Color */
  --mg-color-primary:    #0E2A47;
  --mg-color-accent:     #2563EB;
  --mg-color-gold:       #D9A441;
  --mg-color-bg:         #FFFFFF;
  --mg-color-surface:    #F8FAFC;
  --mg-color-text:       #0F172A;
  --mg-color-text-muted: #475569;
  --mg-color-border:     #E2E8F0;
  --mg-color-success:    #16A34A;
  --mg-color-success-on-dark: #6EE7A8; /* success green lifted to read on navy */
  --mg-color-error:      #DC2626;
  /* Deepened from WhatsApp's badge green #25D366, which gives white text only
     1.98:1. At #1EA952 white clears the 3:1 a glyph needs. Chosen deliberately
     over the label's 4.5:1 — see PROJECT-PLAN.md §15. */
  --mg-color-whatsapp:   #1EA952;
  --mg-color-on-dark:    #FFFFFF;

  /* Semantic aliases */
  --mg-bg:         var(--mg-color-bg);
  --mg-fg:         var(--mg-color-text);
  --mg-fg-muted:   var(--mg-color-text-muted);
  --mg-link:       var(--mg-color-accent);
  --mg-link-hover: var(--mg-color-primary);

  /* Overlay tints (for dark sections) */
  --mg-on-dark-strong: rgba(255, 255, 255, 0.85);
  --mg-on-dark-medium: rgba(255, 255, 255, 0.65);
  --mg-on-dark-faint:  rgba(255, 255, 255, 0.15);

  /* Typography */
  --mg-font-heading: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mg-font-body:    "Inter",  system-ui, -apple-system, "Segoe UI", sans-serif;

  --mg-text-xs:  0.875rem;
  --mg-text-sm:  1rem;
  --mg-text-md:  1.125rem;
  --mg-text-lg:  1.25rem;
  --mg-text-xl:  1.5rem;
  --mg-text-2xl: 1.875rem;
  --mg-text-3xl: 2.25rem;
  --mg-text-4xl: 3rem;
  --mg-text-5xl: 3.75rem;

  --mg-leading-body:    1.6;
  --mg-leading-heading: 1.2;
  --mg-tracking-heading: -0.01em;
  --mg-tracking-eyebrow: 0.08em;

  --mg-weight-regular:  400;
  --mg-weight-medium:   500;
  --mg-weight-semibold: 600;
  --mg-weight-bold:     700;

  /* Spacing — 4-pt scale */
  --mg-space-1: 0.25rem;
  --mg-space-2: 0.5rem;
  --mg-space-3: 0.75rem;
  --mg-space-4: 1rem;
  --mg-space-5: 1.5rem;
  --mg-space-6: 2rem;
  --mg-space-7: 3rem;
  --mg-space-8: 4rem;
  --mg-space-9: 6rem;

  /* Radii */
  --mg-radius-sm:   4px;
  --mg-radius-md:   8px;
  --mg-radius-lg:   12px;
  --mg-radius-pill: 9999px;

  /* Shadows */
  --mg-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --mg-shadow-md: 0 4px 8px rgba(15, 23, 42, 0.08);
  --mg-shadow-lg: 0 12px 24px rgba(15, 23, 42, 0.10);

  /* Layout */
  --mg-container:        min(1200px, 92vw);
  --mg-container-narrow: min(800px, 92vw);
  --mg-header-height:    80px;

  /* Motion */
  --mg-ease:            cubic-bezier(0.2, 0.7, 0.3, 1);
  --mg-transition:      200ms var(--mg-ease);
  --mg-transition-slow: 600ms var(--mg-ease);
  --mg-fade-duration:   400ms;
  --mg-fade-distance:   12px;

  /* Z-index */
  --mg-z-dropdown: 50;
  --mg-z-sticky:   100;
  --mg-z-modal:    1000;
  --mg-z-fab:      9999;
}

/* === Reset (modern, minimal) === */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; tab-size: 4; color-scheme: light; }
body { margin: 0; min-height: 100vh; }
img, svg, video, picture { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
ul, ol { padding: 0; margin: 0; list-style: none; }
[hidden] { display: none !important; }

/* === Base === */
body {
  font-family: var(--mg-font-body);
  font-size: var(--mg-text-sm);
  line-height: var(--mg-leading-body);
  color: var(--mg-fg);
  background: var(--mg-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--mg-font-heading);
  font-weight: var(--mg-weight-bold);
  line-height: var(--mg-leading-heading);
  letter-spacing: var(--mg-tracking-heading);
  margin: 0 0 var(--mg-space-4);
  color: var(--mg-color-primary);
}
h1 { font-size: clamp(var(--mg-text-3xl), 4vw + 1rem, var(--mg-text-5xl)); }
h2 { font-size: clamp(var(--mg-text-2xl), 3vw + 0.5rem, var(--mg-text-4xl)); }
h3 { font-size: var(--mg-text-3xl); font-weight: var(--mg-weight-semibold); }
h4 { font-size: var(--mg-text-2xl); font-weight: var(--mg-weight-semibold); }
h5 { font-size: var(--mg-text-xl);  font-weight: var(--mg-weight-semibold); }
h6 { font-size: var(--mg-text-lg);  font-weight: var(--mg-weight-semibold); }

p { margin: 0 0 var(--mg-space-4); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--mg-link);
  transition: color var(--mg-transition);
}
a:hover, a:focus-visible { color: var(--mg-link-hover); }

:focus-visible { outline: 2px solid var(--mg-color-accent); outline-offset: 2px; }
::selection { background: var(--mg-color-accent); color: var(--mg-color-on-dark); }

/* === Layout primitives === */
.mg-container        { width: var(--mg-container);        margin-inline: auto; }
.mg-container-narrow { width: var(--mg-container-narrow); margin-inline: auto; }

.mg-section       { padding-block: var(--mg-space-9); }
.mg-section-tight { padding-block: var(--mg-space-7); }
.mg-text-center   { text-align: center; }
.mg-bg-surface    { background: var(--mg-color-surface); }
.mg-bg-primary    { background: var(--mg-color-primary); color: var(--mg-color-on-dark); }

/* === Block content layout ===
   The wrapper itself is full width and each child is centred on the container
   instead. That way a theme section block (hero, brands, team…) can stay
   edge to edge without the 100vw break-out trick, which overflows by the
   width of the scrollbar. */
.mg-block-content > * {
  width: var(--mg-container);
  margin-inline: auto;
}
/* Theme sections are full-bleed by nature and carry their own container */
.mg-block-content > [class*="wp-block-mg-"],
.mg-block-content > .alignfull {
  width: auto;
  max-width: none;
  margin-inline: 0;
}
.mg-block-content > .alignwide {
  width: min(1440px, 96vw);
  max-width: none;
}
/* Sections bring their own padding, so drop the doubled gap at the edges */
.mg-block-content > [class*="wp-block-mg-"]:first-child { margin-top: calc(var(--mg-space-9) * -1); }
.mg-block-content > [class*="wp-block-mg-"]:last-child  { margin-bottom: calc(var(--mg-space-9) * -1); }

/* Small gold kicker above a section heading */
.mg-eyebrow {
  font-family: var(--mg-font-heading);
  font-weight: var(--mg-weight-semibold);
  letter-spacing: var(--mg-tracking-eyebrow);
  text-transform: uppercase;
  font-size: var(--mg-text-xs);
  color: var(--mg-color-gold);
  margin-bottom: var(--mg-space-4);
}

/* === Breadcrumb (shared by archive headers) === */
.mg-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--mg-space-2);
  font-size: var(--mg-text-xs);
  color: var(--mg-fg-muted);
  margin-bottom: var(--mg-space-3);
}
.mg-breadcrumb a { color: var(--mg-fg-muted); }
.mg-breadcrumb a:hover { color: var(--mg-color-accent); }
.mg-breadcrumb [aria-current] {
  color: var(--mg-color-primary);
  font-weight: var(--mg-weight-medium);
}
/* Brand archives lead with the logo next to the name */
.mg-archive-header__brand {
  display: flex;
  align-items: center;
  gap: var(--mg-space-5);
  flex-wrap: wrap;
}

.mg-archive-header__brand h1 { margin: 0; }
.mg-archive-header__brand .mg-eyebrow { margin-bottom: var(--mg-space-2); }

.mg-archive-header__logo {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  flex: none;
  padding: var(--mg-space-3);
  background: var(--mg-color-bg);
  border: 1px solid var(--mg-color-border);
  border-radius: var(--mg-radius-lg);
}

.mg-archive-header__logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

@media (max-width: 520px) {
  .mg-archive-header__logo { width: 72px; height: 72px; }
}

.mg-archive-header__lede {
  color: var(--mg-fg-muted);
  font-size: var(--mg-text-md);
  max-width: 70ch;
  margin-top: var(--mg-space-3);
}

/* === Buttons === */
.mg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--mg-space-2);
  padding: var(--mg-space-3) var(--mg-space-5);
  border-radius: var(--mg-radius-md);
  font-family: var(--mg-font-heading);
  font-weight: var(--mg-weight-semibold);
  font-size: var(--mg-text-sm);
  background: var(--mg-color-accent);
  color: var(--mg-color-on-dark);
  transition: background var(--mg-transition), transform var(--mg-transition), box-shadow var(--mg-transition);
}
.mg-btn:hover { background: color-mix(in srgb, var(--mg-color-accent) 85%, black); color: var(--mg-color-on-dark); box-shadow: var(--mg-shadow-md); }
.mg-btn:active { transform: translateY(1px); }

.mg-btn-gold { background: var(--mg-color-gold); color: var(--mg-color-primary); }
.mg-btn-gold:hover { background: color-mix(in srgb, var(--mg-color-gold) 85%, black); color: var(--mg-color-primary); }

.mg-btn-ghost {
  background: transparent;
  color: var(--mg-color-on-dark);
  border: 1px solid var(--mg-on-dark-faint);
}
.mg-btn-ghost:hover { background: var(--mg-on-dark-faint); color: var(--mg-color-on-dark); }

.mg-btn-outline {
  background: transparent;
  color: var(--mg-color-primary);
  border: 1px solid var(--mg-color-border);
}
.mg-btn-outline:hover { background: var(--mg-color-surface); color: var(--mg-color-primary); }

/* === Skip link === */
.skip-link {
  position: absolute;
  left: -10000px;
  top: var(--mg-space-2);
  background: var(--mg-color-primary);
  color: var(--mg-color-on-dark);
  padding: var(--mg-space-3) var(--mg-space-4);
  border-radius: var(--mg-radius-md);
  z-index: var(--mg-z-modal);
}
.skip-link:focus { left: var(--mg-space-2); color: var(--mg-color-on-dark); }

.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important;
}

.mg-no-scroll { overflow: hidden; }

/* === Scroll fade-in (only when JS is available) === */
.mg-js [data-fade] {
  opacity: 0;
  transform: translateY(var(--mg-fade-distance));
  transition: opacity var(--mg-fade-duration) var(--mg-ease),
              transform var(--mg-fade-duration) var(--mg-ease);
  will-change: opacity, transform;
}
.mg-js [data-fade].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* === About page pattern === */
.mg-about-pillars { margin-block: var(--mg-space-8); }
.mg-about-pillars h2 { margin-bottom: var(--mg-space-2); }
.mg-about-pillars__lede {
  color: var(--mg-fg-muted);
  margin-bottom: var(--mg-space-7);
}
.mg-pillar h3 {
  font-size: var(--mg-text-xl);
  margin-bottom: var(--mg-space-3);
}
.mg-pillar p { color: var(--mg-fg-muted); }

.mg-about-cta { margin-block: var(--mg-space-9); }
.mg-about-cta h2,
.mg-about-cta h2.has-text-align-center { color: var(--mg-color-on-dark); margin-bottom: var(--mg-space-3); }
.mg-about-cta p { color: var(--mg-on-dark-strong); margin-bottom: var(--mg-space-5); }

/* === 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;
  }
  .mg-js [data-fade] { opacity: 1; transform: none; }
}
