/* ==========================================================================
   BASE — reset, elements, typography, layout primitives, utilities
   ========================================================================== */

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

* { margin: 0; }

/* The [hidden] attribute is styled by the UA stylesheet, and author styles
   beat UA styles at any specificity — so any component that sets its own
   display (.bcard, .service-card, both display:flex) silently defeats
   element.hidden = true. The blog filter sets exactly that, which is why
   filtering marked cards hidden without ever hiding them. Restoring the
   attribute's meaning here keeps it working for every such component. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* Lenis drives scrolling; disable native smooth to avoid fighting it. */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  background: var(--bg);
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color var(--dur-base) var(--ease-out),
              color var(--dur-base) var(--ease-out);
}

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

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
h5 { font-size: var(--fs-md); }

p { text-wrap: pretty; }

a {
  color: var(--accent-text);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--accent-hover); }

ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection { background: var(--gold-100); color: var(--navy-900); }

/* ---- Accessibility helpers ---- */
.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: absolute;
  top: -100%;
  left: var(--sp-4);
  z-index: var(--z-toast);
  padding: var(--sp-3) var(--sp-5);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  border-radius: 0 0 var(--r-md) var(--r-md);
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: 0; color: var(--on-accent); }

/* ---- Layout primitives ---- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: var(--container-narrow); }

.section { padding-block: var(--section-y); }
.section--sunken { background: var(--bg-subtle); }
.section--ink {
  background: var(--color-primary);
  color: var(--navy-100);
}
.section--ink h1, .section--ink h2,
.section--ink h3, .section--ink h4 { color: var(--color-white); }

.grid { display: grid; gap: var(--sp-6); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }

.stack > * + * { margin-top: var(--flow, var(--sp-4)); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
}

/* ---- Section heading block ---- */
.section-head {
  max-width: 46rem;
  margin-bottom: clamp(2rem, 1rem + 3vw, 3.5rem);
}
.section-head--center { margin-inline: auto; text-align: center; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: var(--sp-4);
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--accent);
}
.section-head--center .eyebrow::after {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--accent);
}

.section-head p {
  margin-top: var(--sp-5);
  font-size: var(--fs-md);
  color: var(--text-muted);
}

/* ---- Buttons ---- */
.btn {
  --btn-bg: var(--accent);
  --btn-fg: var(--on-accent);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0.9375rem var(--sp-8);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  transition: transform var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}

.btn:hover {
  color: var(--btn-fg);
  transform: translateY(-1px);
  box-shadow: var(--sh-sm);
}
.btn:active { transform: translateY(0); }

.btn--primary { --btn-bg: var(--accent); --btn-fg: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); }

.btn--ink { --btn-bg: var(--color-primary); --btn-fg: var(--color-white); }
.btn--ink:hover { box-shadow: var(--sh-sm); }

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  border-color: var(--border-strong);
}
.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: none;
}

.btn--on-dark {
  --btn-bg: transparent;
  --btn-fg: var(--color-white);
  border-color: rgba(255, 255, 255, 0.3);
}
.btn--on-dark:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-white);
  color: var(--color-white);
  box-shadow: none;
}

.btn--sm { padding: 0.625rem var(--sp-5); font-size: var(--fs-xs); }
.btn--lg { padding: 1.125rem var(--sp-10); font-size: var(--fs-base); }
.btn--block { width: 100%; }

.btn i { font-size: 1.1em; }

/* Text link with animated underline */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--accent-text);
}
.link-arrow i { transition: transform var(--dur-base) var(--ease-out); }
.link-arrow:hover i { transform: translateX(4px); }

/* ---- Cards ---- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-8);
  transition: transform var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out);
}
.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--sh-md);
}

/* ---- Badge / chip ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--gold-700);
  border: 1px solid var(--gold-100);
}
:root[data-theme="dark"] .badge { color: var(--gold-300); border-color: transparent; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge { color: var(--gold-300); border-color: transparent; }
}

/* ---- Scroll reveal (JS adds .is-visible) ---- */
[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
[data-reveal].is-visible {
  opacity: 1;
  transform: none;
  will-change: auto;
}

/* ---- Reduced motion: strip all movement ---- */
@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;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}

/* ---- Print ---- */
@media print {
  .site-header, .site-footer, .back-to-top, .cookie-bar { display: none !important; }
  body { color: #000; background: #fff; }
}
