/* ============================================================
   Red Hill Advisors — Shared Component Stylesheet
   Implements the component library and layout system.
   Every value comes from tokens.css. Link tokens.css first,
   then this file. Mobile-first; enhanced up with min-width.
   ============================================================ */

/* ── RESET / BASE ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--text-accent); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

/* Skip link for keyboard users */
.skip-link {
  position: absolute; left: var(--space-2); top: -100px;
  background: var(--bg-surface); color: var(--text-primary);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); z-index: 1000;
}
.skip-link:focus { top: var(--space-2); }

/* ── TYPOGRAPHY ─────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text-primary);
  margin: 0 0 var(--space-4);
  font-weight: var(--weight-semibold);
}
h1 { font-size: var(--text-h1); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); }
h2 { font-size: var(--text-h2); line-height: var(--leading-snug); letter-spacing: var(--tracking-tight); }
h3 { font-size: var(--text-h3); line-height: var(--leading-snug); }

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

.lead { font-size: var(--text-h3); color: var(--text-secondary); line-height: var(--leading-normal); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); font-size: var(--text-small); }

ul, ol { margin: 0 0 var(--space-4); padding-left: var(--space-5); }
li { margin-bottom: var(--space-2); }

/* Eyebrow / kicker label */
.eyebrow {
  display: inline-block;
  font-size: var(--text-label);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--rh-red);
  margin: 0 0 var(--space-3);
}
.eyebrow--muted { color: var(--text-muted); }

/* ── LAYOUT: containers & sections ──────────────────────── */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.prose { max-width: var(--prose-max); }
.prose--center { margin-inline: auto; text-align: center; }

.section { padding-block: var(--space-16); }

.section--alt   { background: var(--bg-alt); }
.section--inset { background: var(--bg-inset); }
.section--dark  { background: var(--bg-dark); color: var(--text-inverse); }
.section--dark-alt { background: var(--bg-dark-alt); color: var(--text-inverse); }
.section--dark h1, .section--dark h2, .section--dark h3,
.section--dark-alt h1, .section--dark-alt h2, .section--dark-alt h3 { color: var(--text-inverse); }
.section--dark .text-secondary, .section--dark-alt .text-secondary { color: var(--text-inverse-muted); }

@media (min-width: 1024px) {
  .container { padding-inline: var(--gutter-lg); }
  .section { padding-block: var(--space-24); }
}

/* ── HEADER / NAV ───────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}
.site-header.is-scrolled { box-shadow: var(--shadow-sm); }

.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: var(--header-height);
}
.site-header__logo { display: inline-flex; align-items: center; }
.site-header__logo img { height: 48px; width: auto; }

.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0;
  background: none; border: none; cursor: pointer; color: var(--text-primary);
}
.nav-toggle svg { width: 24px; height: 24px; }

.site-nav { display: none; }
.site-nav.is-open {
  display: block;
  position: absolute; left: 0; right: 0; top: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  padding: var(--space-4) var(--gutter) var(--space-6);
}
.site-nav__list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: var(--space-2);
}
.site-nav__link {
  display: block; padding: var(--space-3) 0;
  color: var(--text-primary); font-weight: var(--weight-medium); font-size: var(--text-small);
}
.site-nav__link:hover { color: var(--rh-red); text-decoration: none; }
.site-nav__cta .btn { font-size: var(--text-small); padding: var(--space-2) var(--space-5); }
.site-nav__link[aria-current="page"] {
  color: var(--rh-red);
  box-shadow: inset 0 -2px 0 var(--rh-red);
}
.site-nav__cta { margin-top: var(--space-3); }

@media (min-width: 768px) {
  .nav-toggle { display: none; }
  .site-nav { display: block; }
  .site-nav__list { flex-direction: row; align-items: center; gap: var(--space-6); }
  .site-nav__link { padding: var(--space-2) 0; }
  .site-nav__cta { margin-top: 0; margin-left: var(--space-4); }
}

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-body);
  font-size: var(--text-body); font-weight: var(--weight-medium);
  line-height: 1; text-align: center; cursor: pointer;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: background-color var(--duration) var(--ease),
              color var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
}
.btn:hover, .btn:focus-visible { text-decoration: none; }

.btn--primary { background: var(--rh-red); color: var(--text-inverse); }
.btn--primary:hover { background: var(--rh-red-dark); color: var(--text-inverse); }

.btn--secondary { background: transparent; color: var(--text-primary); border-color: var(--border); }
.btn--secondary:hover { background: var(--bg-alt); }
.section--dark .btn--secondary, .section--dark-alt .btn--secondary { color: var(--text-inverse); border-color: rgba(255,255,255,0.4); }
.section--dark .btn--secondary:hover, .section--dark-alt .btn--secondary:hover { background: rgba(255,255,255,0.1); }

.btn--text { padding-inline: 0; background: none; color: var(--text-accent); }
.btn--text:hover { text-decoration: underline; }

/* ── HERO ───────────────────────────────────────────────── */
.hero { padding-block: var(--space-20); }
.hero--home {
  background-image:
    linear-gradient(to right, rgba(19,21,23,0.88) 0%, rgba(19,21,23,0.62) 55%, rgba(19,21,23,0.42) 100%),
    url('../assets/redhill-hero.jpg');
  background-size: cover;
  background-position: center;
}

.hero--intelligence {
  background-image:
    linear-gradient(to right, rgba(19,21,23,0.88) 0%, rgba(19,21,23,0.66) 55%, rgba(19,21,23,0.5) 100%),
    url('../assets/redhill-texture-5.jpg');
  background-size: cover;
  background-position: center;
}

/* Texture background sections (abstract material study behind text) */
.section--texture { background-size: cover; background-position: center; background-repeat: no-repeat; }
.bg-texture-1 { background-image: linear-gradient(rgba(19,21,23,0.82), rgba(19,21,23,0.82)), url('../assets/redhill-texture-1.jpg'); }
.bg-texture-2 { background-image: linear-gradient(rgba(19,21,23,0.82), rgba(19,21,23,0.82)), url('../assets/redhill-texture-2.jpg'); }
.bg-texture-3 { background-image: linear-gradient(rgba(19,21,23,0.65), rgba(19,21,23,0.65)), url('../assets/redhill-texture-3.jpg'); }
.bg-texture-4 { background-image: linear-gradient(rgba(19,21,23,0.8), rgba(19,21,23,0.8)), url('../assets/redhill-texture-4.jpg'); }
.bg-texture-5 { background-image: linear-gradient(rgba(19,21,23,0.78), rgba(19,21,23,0.78)), url('../assets/redhill-texture-5.jpg'); }
.bg-texture-6 { background-image: linear-gradient(rgba(19,21,23,0.74), rgba(19,21,23,0.74)), url('../assets/redhill-texture-6.jpg'); }
.bg-texture-7 { background-image: linear-gradient(rgba(19,21,23,0.78), rgba(19,21,23,0.78)), url('../assets/redhill-texture-7.jpg'); }
.bg-texture-8 { background-image: linear-gradient(rgba(19,21,23,0.8), rgba(19,21,23,0.8)), url('../assets/redhill-texture-8.jpg'); }
.bg-texture-9 { background-image: linear-gradient(rgba(19,21,23,0.74), rgba(19,21,23,0.74)), url('../assets/redhill-texture-9.jpg'); }
.hero__inner { max-width: 52rem; }
.hero__title { font-size: var(--text-hero); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); margin-bottom: var(--space-5); }
.hero__lead { font-size: var(--text-h3); color: var(--text-secondary); max-width: 40rem; margin-bottom: var(--space-8); }
.section--dark .hero__lead { color: var(--text-inverse-muted); }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-4); }

@media (min-width: 768px) { .hero { padding-block: var(--space-32); } }

/* ── GRID (cards) ───────────────────────────────────────── */
.grid { display: grid; gap: var(--space-6); grid-template-columns: 1fr; }
@media (min-width: 768px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) { .grid--4 { grid-template-columns: repeat(4, 1fr); } }

.card {
  display: flex; flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); }
.card__icon { width: 40px; height: 40px; color: var(--rh-red); margin-bottom: var(--space-4); stroke-width: 1.5px; }
.card__title { margin-bottom: var(--space-2); }
.card__text { color: var(--text-secondary); margin-bottom: var(--space-4); }
.card__link { margin-top: auto; font-weight: var(--weight-semibold); }
.card:has(.card__icon) .card__icon { margin-inline: auto; }

/* Ghost cards on dark sections: transparent with a white outline */
.section--dark .card { background: transparent; border-color: rgba(255,255,255,0.28); box-shadow: none; }
.section--dark .card:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.45); box-shadow: none; }
.section--dark .card__icon { color: var(--text-inverse); }
.section--dark .card__title { color: var(--text-inverse); }
.section--dark .card__text { color: var(--text-inverse-muted); }
.section--dark .card__link { color: var(--text-inverse); }

/* ── SPLIT (50/50) ──────────────────────────────────────── */
.split { display: grid; gap: var(--space-8); align-items: center; grid-template-columns: 1fr; }
.split__media img { width: 100%; border-radius: var(--radius-lg); }
.media-shot { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.card__shot { display: block; width: 100%; height: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); margin-bottom: var(--space-5); }
.split__bullets { list-style: none; padding: 0; margin: var(--space-4) 0 0; }
.split__bullets li { position: relative; padding-left: var(--space-6); margin-bottom: var(--space-3); }
.split__bullets li::before {
  content: ""; position: absolute; left: 0; top: 0.6em;
  width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--rh-red);
}
@media (min-width: 768px) {
  .split { grid-template-columns: 1fr 1fr; gap: var(--space-16); }
  .split--reverse .split__media { order: -1; }
}

/* ── STAT / PROOF ROW ───────────────────────────────────── */
.stats { display: grid; gap: var(--space-8); grid-template-columns: repeat(2, 1fr); text-align: center; }
@media (min-width: 768px) { .stats--4 { grid-template-columns: repeat(4, 1fr); } .stats--3 { grid-template-columns: repeat(3, 1fr); } }
.stat__num { font-family: var(--font-display); font-size: var(--text-h1); font-weight: var(--weight-bold); color: var(--rh-red); line-height: 1; }
.stat__label { display: block; margin-top: var(--space-2); font-size: var(--text-small); color: var(--text-muted); }
.section--dark .stat__label { color: var(--text-inverse-muted); }

/* ── QUOTE / TESTIMONIAL ────────────────────────────────── */
.quote { max-width: 48rem; margin-inline: auto; text-align: center; }
.quote__text { font-family: var(--font-display); font-size: var(--text-h2); line-height: var(--leading-snug); font-weight: var(--weight-medium); margin-bottom: var(--space-4); }
.quote__cite { font-size: var(--text-small); color: var(--text-muted); font-style: normal; }

/* ── CTA BAND ───────────────────────────────────────────── */
.cta-band { text-align: center; background: var(--bg-inset); border-top: 1px solid var(--border-subtle); }
.cta-band__title { font-size: var(--text-h2); margin-bottom: var(--space-4); }
.cta-band__text { color: var(--text-secondary); max-width: 40rem; margin: 0 auto var(--space-8); }
.section--dark .cta-band__text, .section--dark-alt .cta-band__text { color: var(--text-inverse-muted); }
.cta-band__actions { display: flex; flex-wrap: wrap; gap: var(--space-4); justify-content: center; }

/* ── FORM ───────────────────────────────────────────────── */
.form { max-width: var(--prose-max); }
.form__row { margin-bottom: var(--space-5); }
.form__label { display: block; font-weight: var(--weight-medium); font-size: var(--text-small); margin-bottom: var(--space-2); }
.form__input, .form__textarea, .form__select {
  width: 100%; font-family: var(--font-body); font-size: var(--text-body);
  color: var(--text-primary); background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}
.form__textarea { min-height: 8rem; resize: vertical; }
.form__input:focus-visible, .form__textarea:focus-visible, .form__select:focus-visible { border-color: var(--rh-red); }
.form__note { font-size: var(--text-small); color: var(--text-muted); margin-top: var(--space-3); }

/* ── FOOTER ─────────────────────────────────────────────── */
.site-footer { background: var(--bg-dark); color: var(--text-inverse); padding-block: var(--space-16); }
.site-footer a { color: var(--text-inverse); }
.site-footer__top { display: grid; gap: var(--space-10); grid-template-columns: 1fr; }
.site-footer__logo img { height: 48px; width: auto; }
.site-footer__tagline { margin: var(--space-4) 0 0; max-width: 24rem; color: var(--text-inverse-muted); font-size: var(--text-small); }
.site-footer__cols { display: grid; gap: var(--space-8); grid-template-columns: 1fr 1fr; }
.site-footer__heading { margin: 0 0 var(--space-4); font-size: var(--text-label); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-inverse-muted); }
.site-footer__nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.site-footer__nav a { font-size: var(--text-small); }
.site-footer__bottom { margin-top: var(--space-12); padding-top: var(--space-6); border-top: 1px solid rgba(255,255,255,0.12); }
.site-footer__meta { margin: 0; color: var(--text-inverse-muted); font-size: var(--text-small); }
@media (min-width: 768px) {
  .site-footer__top { grid-template-columns: 1.6fr 2fr; gap: var(--space-16); align-items: start; }
}

/* ── UTILITIES ──────────────────────────────────────────── */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.mt-0 { margin-top: 0; }
.center { text-align: center; }
.stack > * + * { margin-top: var(--space-4); }

/* Image placeholder (used until real imagery lands in the Phase 7 pass) */
.media-placeholder {
  aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: var(--bg-inset);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted); font-size: var(--text-small);
  padding: var(--space-4);
}
.media-placeholder--wide { aspect-ratio: 16 / 9; }
