/* ============================================================
   MRCO Advocates — Base Styles
   Source: Docs/02-design-tokens.md, Docs/01-brand-identity.md
   
   Reset, @font-face declarations, global typography, 
   and default element styles. Everything references tokens.
   ============================================================ */


/* =========================================================
   @FONT-FACE — Self-hosted, no CDN
   ========================================================= */

/* --- Cormorant Garamond (Display) --- */
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/assets/fonts/cormorant-garamond/CormorantGaramond-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/assets/fonts/cormorant-garamond/CormorantGaramond-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/assets/fonts/cormorant-garamond/CormorantGaramond-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/assets/fonts/cormorant-garamond/CormorantGaramond-MediumItalic.woff2') format('woff2');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

/* --- Inter (Body) --- */
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter/Inter-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter/Inter-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter/Inter-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter/Inter-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* --- JetBrains Mono (Monospace) --- */
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/assets/fonts/jetbrains-mono/JetBrainsMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/assets/fonts/jetbrains-mono/JetBrainsMono-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}


/* =========================================================
   CSS RESET — Modern, minimal
   ========================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: auto;
  overflow-x: clip;
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  color: var(--color-ink);
  background-color: var(--color-cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

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

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

ul,
ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* Remove default fieldset/legend styles */
fieldset {
  border: none;
}


/* =========================================================
   TYPOGRAPHY — Global heading & text styles
   ========================================================= */

/* --- Headings (Display font) --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  color: var(--color-navy);
  text-wrap: balance;
  letter-spacing: var(--ls-heading);
}

h1 {
  font-size: var(--text-h1);
  line-height: var(--lh-h1);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-display);
}

h2 {
  font-size: var(--text-h2);
  line-height: var(--lh-h2);
  font-weight: var(--fw-semibold);
}

h3 {
  font-size: var(--text-h3);
  line-height: var(--lh-h3);
}

h4 {
  font-size: var(--text-h4);
  line-height: var(--lh-h4);
}

@media (max-width: 767px) {
  :root {
    --text-display: 2.95rem;
    --text-h1: 2.35rem;
    --text-h2: 1.85rem;
    --text-h3: 1.35rem;
  }
}

/* --- Display text (hero only) --- */
.text-display {
  font-family: var(--font-display);
  font-size: var(--text-display);
  line-height: var(--lh-display);
  font-weight: var(--fw-bold);
}

/* --- Body text variants --- */
.text-body-lg {
  font-size: var(--text-body-lg);
  line-height: var(--lh-body-lg);
}

.text-small {
  font-size: var(--text-small);
  line-height: var(--lh-small);
}

.text-xs {
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
}

.text-mono {
  font-family: var(--font-mono);
}

/* --- Text colours --- */
.text-navy     { color: var(--color-navy); }
.text-slate    { color: var(--color-slate); }
.text-gold     { color: var(--color-gold); }
.text-cream    { color: var(--color-cream); }
.text-white    { color: var(--color-white); }
.text-error    { color: var(--color-error); }
.text-success  { color: var(--color-success); }

/* --- Eyebrow text (small caps, gold) --- */
.eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--color-gold);
  margin-bottom: var(--space-3);
}


/* =========================================================
   BODY TEXT — Paragraphs, lists, blockquotes
   ========================================================= */

p {
  margin-bottom: var(--space-4);
}

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

/* Prose context — articles, insights, about narrative */
.prose p {
  margin-bottom: var(--space-6);
  max-width: 70ch;
}

.prose h2 {
  margin-top: var(--space-12);
  margin-bottom: var(--space-6);
}

.prose h3 {
  margin-top: var(--space-10);
  margin-bottom: var(--space-4);
}

.prose ul,
.prose ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-6);
}

.prose ul {
  list-style: disc;
}

.prose ol {
  list-style: decimal;
}

.prose li {
  margin-bottom: var(--space-2);
}

.prose blockquote {
  border-left: 3px solid var(--color-gold);
  padding-left: var(--space-6);
  margin: var(--space-8) 0;
  font-style: italic;
  color: var(--color-slate);
}

.prose a {
  color: var(--color-navy-mid);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--ease-default);
}

.prose a:hover {
  color: var(--color-gold-dark);
}


/* =========================================================
   LINKS — Global styles
   ========================================================= */

a:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}


/* =========================================================
   GOLD RULE — Decorative divider
   ========================================================= */

.gold-rule {
  display: block;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--color-gold), var(--color-gold-light));
  border: none;
  margin: var(--space-5) 0;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.gold-rule--wide {
  width: 100px;
}

.gold-rule--center {
  margin-left: auto;
  margin-right: auto;
}


/* =========================================================
   VISUALLY HIDDEN — Accessible but invisible
   ========================================================= */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* =========================================================
   SKIP LINK — Accessibility
   ========================================================= */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 9999;
  padding: var(--space-3) var(--space-6);
  background-color: var(--color-navy);
  color: var(--color-white);
  font-weight: var(--fw-semibold);
  font-size: var(--text-small);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  transition: top var(--ease-default);
}

.skip-link:focus {
  top: 0;
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}


/* =========================================================
   SELECTION — Brand-aware text selection
   ========================================================= */

::selection {
  background-color: var(--color-navy-soft);
  color: var(--color-navy);
}


/* =========================================================
   SCROLL-REVEAL ANIMATIONS
   ========================================================= */

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(var(--reveal-distance));
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(calc(-1 * var(--reveal-distance)));
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes subtlePulse {
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 1; }
}

@keyframes heroGradient {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --- Reveal utility — content remains visible if motion scripts fail --- */
.reveal,
.reveal--left,
.reveal--fade,
.motion-reveal,
.reveal--visible,
.js-loaded .reveal--visible {
  opacity: 1;
  transform: none;
}

/* Stagger delays for grids */
.reveal-delay-1 { animation-delay: calc(var(--stagger-step) * 1); }
.reveal-delay-2 { animation-delay: calc(var(--stagger-step) * 2); }
.reveal-delay-3 { animation-delay: calc(var(--stagger-step) * 3); }
.reveal-delay-4 { animation-delay: calc(var(--stagger-step) * 4); }
.reveal-delay-5 { animation-delay: calc(var(--stagger-step) * 5); }
.reveal-delay-6 { animation-delay: calc(var(--stagger-step) * 6); }

/* --- Page entrance (JS sets .js-loaded on html) --- */
.js-loaded body {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal--left,
  .reveal--fade {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
