/* ==========================================================================
   SAiPH Bakes — Base: reset, typography, layout primitives, utilities
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 8rem;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--leading);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100vh;
}
body.is-locked { overflow: hidden; }

img, picture, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
ul, ol { list-style: none; padding: 0; }
table { border-collapse: collapse; width: 100%; }
address { font-style: normal; }
hr { border: 0; border-top: 1px solid var(--line); }

::selection { background: var(--accent); color: var(--on-accent); }

/* ------------------------------- Type ---------------------------------- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  color: var(--heading);
  font-weight: 500;
  line-height: var(--leading-tight);
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); line-height: var(--leading-snug); }
h5 { font-size: var(--fs-md); line-height: var(--leading-snug); }

p { text-wrap: pretty; }
strong, b { font-weight: 600; }

a { color: inherit; text-decoration: none; }
a:not([class]) {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--dur-fast) var(--ease);
}
a:not([class]):hover { color: var(--accent); }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

.eyebrow {
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--accent);
  display: block;
}
.eyebrow--muted { color: var(--text-faint); }

/* Brand names keep their own lettering inside uppercased labels —
   the master brand is "SAiPH", never "SAIPH". */
.brandname {
  text-transform: none;
  letter-spacing: 0.04em;
}

.display {
  font-family: var(--font-editorial);
  font-weight: 300;
  letter-spacing: -0.01em;
}
.lede {
  font-size: var(--fs-md);
  color: var(--text-muted);
  max-width: 56ch;
  line-height: 1.65;
}
.prose { max-width: var(--prose-max); }
.prose > * + * { margin-top: 1.1em; }
.prose h2, .prose h3 { margin-top: 2em; }
.prose ul { list-style: none; }
.prose ul li {
  position: relative;
  padding-left: 1.35rem;
  margin-top: 0.5em;
}
.prose ul li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.62em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.nowrap { white-space: nowrap; }

/* --------------------------- Layout shells ------------------------------ */
.shell {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.shell--narrow { max-width: 980px; }
.shell--tight { max-width: 720px; }
.shell--wide { max-width: 1680px; }

.section { padding-block: var(--section-y); }
.section--tight { padding-block: clamp(2.25rem, 1.5rem + 3vw, 4rem); }
.section--flush-top { padding-top: 0; }
.section--flush-bottom { padding-bottom: 0; }
.section--tinted { background: var(--bg-alt); }
.section--sunken { background: var(--bg-sunken); }
.section--surface { background: var(--surface); }
.section--dark {
  background: var(--contrast);
  color: var(--on-contrast);
}
.section--dark h1, .section--dark h2, .section--dark h3, .section--dark h4 { color: inherit; }

.stack { display: grid; gap: 1rem; align-content: start; }
.stack--xs { gap: 0.4rem; }
.stack--sm { gap: 0.7rem; }
.stack--lg { gap: 1.75rem; }
.stack--xl { gap: 2.75rem; }

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.row--center { justify-content: center; }
.row--top { align-items: flex-start; }
.row--tight { gap: 0.4rem; }
.row--loose { gap: 1.5rem; }
.row--nowrap { flex-wrap: nowrap; }
.spacer { flex: 1 1 auto; }

.grid { display: grid; gap: clamp(1rem, 0.6rem + 1.2vw, 2rem); }
.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)); }
.grid--6 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); }

/* Section heading block */
.section-head {
  display: grid;
  gap: 0.75rem;
  margin-bottom: clamp(1.75rem, 1rem + 2vw, 3rem);
  max-width: 62ch;
}
.section-head--center {
  justify-items: center;
  text-align: center;
  margin-inline: auto;
}
.section-head--split {
  max-width: none;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1.25rem 2rem;
}
.section-head--split .section-head__copy { display: grid; gap: 0.6rem; max-width: 58ch; }
@media (max-width: 720px) {
  .section-head--split { grid-template-columns: 1fr; align-items: start; }
}

.rule {
  width: 68px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  border: 0;
}
.rule--center { background: linear-gradient(90deg, transparent, var(--accent), transparent); }

/* Ornamental divider echoing the logo filigree */
.ornament {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--accent);
}
.ornament::before, .ornament::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, currentColor);
}
.ornament::after { background: linear-gradient(270deg, transparent, currentColor); }
.ornament span { font-size: 0.7rem; letter-spacing: 0.3em; text-transform: uppercase; }

/* ------------------------------ Utilities ------------------------------- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  top: 0.6rem; left: 0.6rem;
  z-index: 999;
  padding: 0.7rem 1.1rem;
  background: var(--navy-900);
  color: var(--cream-50);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  letter-spacing: var(--tracking-wide);
  transform: translateY(-160%);
  transition: transform var(--dur) var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }

.text-center { text-align: center; }
.hide { display: none !important; }
@media (max-width: 900px) { .hide-md { display: none !important; } }
@media (min-width: 901px) { .show-md { display: none !important; } }
@media (max-width: 640px) { .hide-sm { display: none !important; } }

/* Scroll reveal — opt-in, disabled for reduced motion */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal].is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; }
}
.no-js [data-reveal] { opacity: 1; transform: none; }

/* Thin, brand-tinted scrollbar for scroll rails */
.scroll-rail {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
  -webkit-overflow-scrolling: touch;
}
.scroll-rail > * { scroll-snap-align: start; flex: 0 0 auto; }
.scroll-rail::-webkit-scrollbar { height: 4px; }
.scroll-rail::-webkit-scrollbar-track { background: var(--line); border-radius: 99px; }
.scroll-rail::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 99px; }

/* --------------------------- Inline icon default ------------------------
   Icons are emitted as class-less <svg viewBox> with no width/height, so an
   unstyled one falls back to the browser's 300x150 replaced-element default.
   Size them to the text they sit in; component rules in components.css and
   pages.css load later and override at equal specificity.
   ---------------------------------------------------------------------- */
svg:not([class]) {
  width: 1.15em;
  height: 1.15em;
  flex: none;
}
