/* ═══════════════════════════════════════════════════════════════
   Meridian — Structured Corporate Template
   Standardized Pipeline B CSS per §2.9 of DamPhi session log.
   Palettes and typography are injected by template_modifier.py
   via apply_palette() (rewrites :root) and apply_style()
   (rewrites typography vars + Google Fonts link in HTML).
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Palette: Graphite */
  --bg: #fafaf9;
  --bg-surface: #f4f4f2;
  --bg-card: #ffffff;
  --primary: #3f3f46;
  --accent: #b45309;
  --text: #18181b;
  --text-sub: #3f3f46;
  --text-muted: #71717a;
  --border: #e4e4e7;
  --border-hi: #a1a1aa;

  /* Typography System */
  --font-display: 'Merriweather', Georgia, serif;
  --font-body: 'Source Sans 3', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Spacing & Layout */
  --nav-h:       72px;
  --section-pad: 6rem;
  --container:   1200px;
  --radius: 6px;
  --radius-lg: 10px;
  --transition:  .3s ease;
}

/* ── Reset & base ────────────────────────────────────────────── */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth;-webkit-font-smoothing:antialiased}
body{font-family:var(--font-body);background:var(--bg);color:var(--text);line-height:1.6;overflow-x:hidden;padding-top:var(--nav-h)}
a{text-decoration:none;color:inherit;transition:color var(--transition)}
img{max-width:100%;height:auto;display:block}
::selection{background:var(--primary);color:var(--bg)}

/* ── Typography ──────────────────────────────────────────────── */
h1,h2,h3,h4{font-family:var(--font-display);font-weight:800;line-height:1.15;letter-spacing:-.015em;color:var(--text)}
h1{font-size:clamp(2.25rem,4.8vw,4rem)}
h2{font-size:clamp(1.75rem,3.6vw,3rem)}
h3{font-size:1.25rem}
p{color:var(--text-sub);line-height:1.7}

/* ── Layout primitives ──────────────────────────────────────── */
.container{max-width:1180px;margin:0 auto;padding:0 2rem}
.section{padding:var(--section-pad) 0}

/* Reusable mono label — replaces the 15+ inline duplications of
   "font-family:var(--font-mono);font-size:.6rem;letter-spacing:.12em;
    text-transform:uppercase;color:var(--text-muted)" across HTML.
   New HTML and customer-edited HTML should use this class. */
.mono-label{font-family:var(--font-mono);font-size:.6rem;letter-spacing:.12em;text-transform:uppercase;color:var(--text-muted)}

/* ── Nav ─────────────────────────────────────────────────────── */
.nav{position:fixed;top:0;left:0;right:0;z-index:500;height:var(--nav-h);display:flex;align-items:center;justify-content:space-between;padding:0 2rem;background:var(--bg-card);border-bottom:1px solid var(--border);box-shadow:0 1px 0 var(--border)}
.nav-logo{display:flex;align-items:center;gap:.6rem;font-family:var(--font-display);font-size:1.05rem;font-weight:800;color:var(--text)}
.nav-links{display:flex;align-items:center;gap:2rem}
.nav-link{font-size:.85rem;font-weight:500;color:var(--text-sub);transition:color var(--transition)}
.nav-link:hover,.nav-link.active{color:var(--primary)}
.nav-cta{padding:.55rem 1.5rem;background:var(--primary);color:var(--bg-card);font-family:var(--font-display);font-size:.82rem;font-weight:700;border-radius:var(--radius);transition:background var(--transition)}
.nav-cta:hover{background:color-mix(in srgb,var(--primary) 85%,black)}
.nav-hamburger{display:none;flex-direction:column;gap:5px;background:transparent;border:none;cursor:pointer;padding:4px}
.nav-hamburger span{width:22px;height:2px;background:var(--text);display:block;border-radius:2px}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn{display:inline-block;padding:.75rem 1.75rem;font-family:var(--font-display);font-size:.85rem;font-weight:700;cursor:pointer;border-radius:var(--radius);border:1px solid transparent;transition:all var(--transition)}
.btn-primary{background:var(--primary);border-color:var(--primary);color:var(--bg-card)}
.btn-primary:hover{background:color-mix(in srgb,var(--primary) 85%,black);border-color:color-mix(in srgb,var(--primary) 85%,black)}
.btn-ghost{background:transparent;border-color:var(--border-hi);color:var(--text)}
.btn-ghost:hover{border-color:var(--primary);color:var(--primary)}
.btn-outline{background:transparent;border-color:var(--border-hi);color:var(--text-sub)}
.btn-outline:hover{border-color:var(--primary);color:var(--primary)}

/* ── Stats strip (used on index.html) ──────────────────────── */
.stats-grid{display:grid;grid-template-columns:repeat(4,1fr);text-align:center}

/* ── Reveal animation ───────────────────────────────────────── */
.reveal{opacity:0;transform:translateY(16px);transition:opacity .6s ease,transform .6s ease}
.reveal.visible{opacity:1;transform:translateY(0)}

/* ── Footer ──────────────────────────────────────────────────── */
.footer{background:var(--bg-surface);color:var(--text-sub);border-top:1px solid var(--border)}
.footer-inner a{color:var(--text-sub);transition:color var(--transition)}
.footer-inner a:hover{color:var(--primary)}

/* ── 404 page ────────────────────────────────────────────────── */
.error-page{min-height:70vh;display:flex;align-items:center;justify-content:center;text-align:center;padding:4rem 2rem}
.error-num{font-family:var(--font-display);font-size:clamp(5rem,14vw,9rem);font-weight:900;color:var(--primary);line-height:1;margin-bottom:1rem}

/* ── Mobile menu ─────────────────────────────────────────────── */
.mobile-menu{display:none;position:fixed;inset:0;z-index:490;background:var(--bg-card);flex-direction:column;align-items:center;justify-content:center;gap:2rem}
.mobile-menu.open{display:flex}
.mobile-menu .nav-link{font-family:var(--font-display);font-size:1.8rem;font-weight:800;color:var(--text)}

/* ── Cookie banner ───────────────────────────────────────────── */
.cookie-banner{position:fixed;bottom:0;left:0;right:0;z-index:9000;background:var(--bg-card);border-top:1px solid var(--border);padding:1rem 2rem;transform:translateY(100%);transition:transform .4s ease;box-shadow:0 -4px 20px color-mix(in srgb,var(--text) 6%,transparent)}
.cookie-banner.show{transform:translateY(0)}
.cookie-inner{max-width:1180px;margin:0 auto;display:flex;align-items:center;justify-content:space-between;gap:2rem}
.cookie-text{font-size:.82rem;color:var(--text-sub)}
.cookie-text a{color:var(--primary)}
.cookie-actions{display:flex;gap:.75rem;flex-shrink:0}
.cookie-btn{padding:.45rem 1.1rem;font-size:.78rem;cursor:pointer;border-radius:var(--radius);font-family:var(--font-display);font-weight:700;border:1px solid var(--border)}
.cookie-accept{background:var(--primary);color:var(--bg-card);border-color:var(--primary)}
.cookie-decline{background:transparent;color:var(--text-sub)}

/* ── Responsive ──────────────────────────────────────────────── */
@media(max-width:1024px){
  .stats-grid{grid-template-columns:1fr 1fr}
}
@media(max-width:768px){
  .nav{padding:0 1rem}
  .nav-links{display:none}
  .nav-cta{display:none}
  .nav-hamburger{display:flex}
  .container{padding:0 1rem}
  .section{padding:4rem 0}
  .stats-grid{grid-template-columns:1fr 1fr}
  .cookie-inner{flex-direction:column}
  .cookie-actions{width:100%}
  .cookie-btn{flex:1;text-align:center}
}
@supports(padding:env(safe-area-inset-bottom)){
  .cookie-banner{padding-bottom:calc(1rem + env(safe-area-inset-bottom))}
}

/* [slot-system] painted image slots — HERO_IMAGE on the About tile, CONTACT_IMAGE band.
   Sharp corners match Meridian's surface tiles. Painted by main.js ([data-img] loop, adds
   .has-image); an empty token leaves the original placeholder/pruned section untouched. */
.about-visual-text{position:relative;z-index:1}
.about-visual.has-image::after{content:'';position:absolute;inset:0;background:linear-gradient(160deg,rgba(0,0,0,.5),rgba(0,0,0,.15))}
.about-visual.has-image .about-visual-text{color:#fff}
.contact-image{width:100%;aspect-ratio:16/6;background:var(--bg-surface);border:1px solid var(--border);overflow:hidden;background-size:cover;background-position:center}


/* [hero_bg 20260712] HERO_IMAGE section-bg paint — dark scrim + forced-light copy keep the hero
   readable over any customer photo (light theme). Empty token → the gradient hero, unchanged.
   Uniform rule: hero.<ext> = hero background; about.<ext> = the About feature tile (ABOUT_IMAGE). */
.hero-canvas.has-image{box-shadow:inset 0 0 0 100vmax rgba(15,18,20,0.55)}
.hero-canvas.has-image .container{position:relative;z-index:1}
.hero-canvas.has-image h1,.hero-canvas.has-image p{color:#f6f1e6 !important}
.hero-canvas.has-image .btn-ghost{color:#f6f1e6 !important;border-color:rgba(246,241,230,0.5) !important}
/* eyebrow (inline-styled --primary, dark on light theme) — force light on the painted hero so it's legible over the scrim */
.hero-canvas.has-image .container > div > div:first-child{color:#e8dcc8 !important}

/* ══ DAMPHI MOBILE BASELINE v1 — GENERATED, DO NOT HAND-EDIT ══
   Source: templates/_shared/mobile/mobile_baseline.css
   Regenerate: python3 Tools/apply_mobile_baseline.py corporate-meridian
   Edit the baseline, never this block. ══ */
@media (max-width: 768px) {
  h1, h2, h3, p { overflow-wrap: break-word; hyphens: auto; max-width: 100%; }
  :is(h1, h2, h3, p) > * { overflow-wrap: inherit; hyphens: inherit; max-width: 100%; }
}
/* ══ END DAMPHI MOBILE BASELINE ══ */

/* ══ [audit 20261016] template audit fixes — kept OUTSIDE the generated mobile-baseline block on purpose ══
   Mobile menu: the fixed nav (z-index 500) sits above the menu (490) and its hamburger covered the X, so the X
   moves just below the bar; the menu scrolls inside itself (short landscape screens) and stays clear of the
   cookie banner. The form's error toast wraps and stays 16px inside the screen. */
@media (max-width: 768px) {
  .mobile-menu #mobile-close { top: calc(var(--nav-h, 64px) + .5rem) !important; }
  .mobile-menu { overflow-y: auto; box-sizing: border-box; padding-bottom: var(--cookie-h, 0px); }
  .dp-toast { white-space: normal !important; width: max-content !important; max-width: calc(100% - 32px) !important; box-sizing: border-box; text-align: center; overflow-wrap: anywhere; }
}
@media (max-width: 768px) and (max-height: 500px) {
  .mobile-menu { justify-content: flex-start !important; gap: 1rem !important; padding: calc(var(--nav-h, 64px) + 1rem) 0 calc(1rem + var(--cookie-h, 0px)); }
}
/* the banner is fixed to the bottom: keep the end of every page scrollable clear of it */
html.cookie-open body { padding-bottom: var(--cookie-h, 0px); }

/* ══ [audit 20261016] C2 sideways-overflow fix ══ */
/* Inline-style grids (stat strip, cards, two-column rows) never collapsed on phones: stack them.
   The attribute match is whitespace-proof: the reveal script rewrites the style attribute ("repeat(2, 1fr)"),
   which would defeat an exact-string match. */
@media (max-width: 768px) {
  [style*="repeat(4,"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; row-gap: 1.5rem; }
  [style*="repeat(4,"] > div { padding: 0 1rem !important; }
  [style*="repeat(4,"] > div > div:first-child { font-size: clamp(1.5rem, 8vw, 2.5rem) !important; overflow-wrap: anywhere; }
  [style*="repeat(3,"], [style*="repeat(2,"], [style*="1fr 1fr"] { grid-template-columns: minmax(0, 1fr) !important; }
  [style*="1fr 1fr"] { gap: 2.5rem !important; }
  footer ul { flex-wrap: wrap; }
}

/* [audit 20261016] The i18n runtime's floating language switch (z-index 2147483000, bottom-right) sat on top of the cookie
   banner's right-hand button. This page publishes the banner height (html.cookie-open + --cookie-h), so lift the switch above it. */
html.cookie-open .dm-i18n-switch--floating { bottom: calc(max(14px, env(safe-area-inset-bottom, 0px)) + var(--cookie-h, 0px)); }
