/* ==========================================================================
   SANMIGUEL HEALTH — BASE STYLES
   Fonts, design tokens, reset, typography, buttons and utilities.
   Shared by every section. Section-specific styles live in /css/sections/.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Self-hosted fonts (SIL Open Font License — see /assets/fonts/OFL-*.txt)
   Cormorant Garamond 500 + 500 italic (headings) and DM Sans variable
   (body, navigation, buttons — one file covers every weight we use).
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Italic accent used in section headlines (e.g. "Five paths to better care.") */
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/cormorant-garamond-latin-500-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("../fonts/dm-sans-latin-wght-normal.woff2") format("woff2-variations"),
       url("../fonts/dm-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --------------------------------------------------------------------------
   2. Design tokens
   -------------------------------------------------------------------------- */
:root {
  /* Brand palette (approved) */
  --color-ivory: #F5F1E9;
  --color-sand: #D7C2A7;
  --color-bronze: #A7835C;          /* brand accent: lines, icons, decorative details */
  --color-charcoal: #20201F;
  --color-white: #FFFFFF;

  /* Accessible functional colors derived from the palette */
  --color-bronze-button: #8E6F4E;   /* primary buttons with white text — 4.63:1 */
  --color-bronze-button-hover: #7A5F43;
  --color-bronze-ink: #76593C;      /* small bronze text on ivory — 5.71:1 */
  --color-text: var(--color-charcoal);
  --color-text-body: #4D4943;       /* body copy on ivory — 7.93:1 */
  --color-text-muted: #5E5952;      /* small labels on ivory — 6.16:1 */
  --color-card: #EFE8DE;            /* warm card background (service cards) */
  --color-focus: var(--color-charcoal);

  /* Typography */
  --font-serif: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --font-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  /* Layout */
  --container-max: 80rem;           /* 1280px content width */
  --gutter: clamp(1.25rem, 0.6rem + 2.8vw, 5rem);
  --header-h: 4.5rem;               /* updated for desktop in header.css */

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 220ms;
}

/* --------------------------------------------------------------------------
   3. Modern reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem); /* anchors don't hide under the fixed header */
}

body {
  min-height: 100vh;
  background-color: var(--color-ivory);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

img { height: auto; }

a { color: inherit; }

button { font: inherit; color: inherit; }

ul[class],
ol[class] { list-style: none; padding: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.05;
  text-wrap: balance;
}

p { text-wrap: pretty; }

/* --------------------------------------------------------------------------
   4. Focus — always visible for keyboard users
   -------------------------------------------------------------------------- */
:focus { outline: none; }

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

/* --------------------------------------------------------------------------
   5. Layout helpers
   -------------------------------------------------------------------------- */
.container {
  width: min(100% - (var(--gutter) * 2), var(--container-max));
  margin-inline: auto;
}

/* --------------------------------------------------------------------------
   6. Shared typography components
   -------------------------------------------------------------------------- */
.eyebrow {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--color-bronze-ink);
}

/* Eyebrow with thin bronze rules on both sides (centered section headers) */
.eyebrow--lined {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

.eyebrow--lined::before,
.eyebrow--lined::after {
  content: "";
  flex: none;
  width: 3rem;
  height: 1px;
  background-color: var(--color-bronze);
}

/* Left-aligned eyebrow followed by a thin bronze rule */
.eyebrow--trail {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.eyebrow--trail::after {
  content: "";
  flex: none;
  width: 4rem;
  height: 1px;
  background-color: var(--color-bronze);
}

/* Left-aligned eyebrow preceded by a thin bronze rule */
.eyebrow--lead {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.eyebrow--lead::before {
  content: "";
  flex: none;
  width: 3rem;
  height: 1px;
  background-color: var(--color-bronze);
}

/* Centered section header: eyebrow · headline · intro */
.section-head {
  max-width: 64rem;
  margin-inline: auto;
  text-align: center;
}

.section-title {
  margin-top: 1.25rem;
  font-size: clamp(2.125rem, 1.2rem + 2.6vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--color-charcoal);
}

.section-title em {
  font-style: italic;
  color: var(--color-bronze-ink);
}

.section-intro {
  max-width: 37rem;
  margin: 1.25rem auto 0;
  font-size: clamp(0.9375rem, 0.88rem + 0.2vw, 1.0625rem);
  line-height: 1.6;
  color: var(--color-text-body);
}

/* --------------------------------------------------------------------------
   7. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  min-height: 3rem;                 /* 48px touch target */
  padding: 0.8rem 1.6rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 450;
  line-height: 1.2;
  letter-spacing: 0.005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

.btn__arrow {
  flex: none;
  width: 1.25rem;
  height: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--dur) var(--ease);
}

.btn:hover .btn__arrow { transform: translateX(3px); }

.btn--primary {
  background-color: var(--color-bronze-button);
  color: var(--color-white);
}

.btn--primary:hover { background-color: var(--color-bronze-button-hover); }

.btn--outline {
  background-color: rgba(255, 255, 255, 0.22);
  border-color: var(--color-bronze);
  color: var(--color-charcoal);
}

.btn--outline:hover {
  background-color: rgba(255, 255, 255, 0.6);
  border-color: var(--color-bronze-button);
}

.btn--sm {
  min-height: 2.75rem;
  padding: 0.65rem 1.35rem;
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   8. Accessibility utilities
   -------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1000;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  background: var(--color-charcoal);
  color: var(--color-white);
  font-size: 0.875rem;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--dur) var(--ease);
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline-color: var(--color-bronze);
}

/* Respect users who prefer reduced motion */
@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;
  }
}
