/*
  True Friend Matrimony — Shared Component Styles
  ------------------------------------------------
  Reusable, page-agnostic components only. Everything here is built from
  assets/css/tokens.css custom properties — no hardcoded hex/px values that
  should be tokens. Load order in every page <head>:
    1. Google Fonts <link> (see tokens.css header comment)
    2. tokens.css
    3. style.css
    4. optional page-level <style> block for section-specific layout

  Reveal-on-scroll contract (JS lives in assets/js/ui.js, not here):
    Mark any element `class="reveal"` (optionally `reveal--left` /
    `reveal--right` / `reveal--scale` for the entry direction, and
    `data-reveal-delay="1|2|3"` to stagger children). ui.js registers a single
    IntersectionObserver, and adds the `is-visible` class to a `.reveal`
    element the first time it crosses ~15% into the viewport; that class
    triggers the transition below. Respect prefers-reduced-motion by skipping
    the observer entirely and leaving elements visible (handled in ui.js);
    the CSS fallback below also neutralizes the animation for that setting.
*/

/* ============================================================
   Reset / base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

/* Safety net, not the fix itself: the actual horizontal-scroll bug (a
   width:100vw hero ignoring scrollbar width) is fixed at its source in
   index.html. This just guards against the same class of mistake creeping
   back in on a future page — it hides symptoms, so don't rely on it
   instead of finding the real cause if a horizontal scrollbar reappears. */
html, body { overflow-x: hidden; max-width: 100%; }

body {
  margin: 0;
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 var(--space-2);
  color: var(--color-text);
  text-wrap: pretty;
}

p { text-wrap: pretty; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* Visible keyboard-focus ring for every interactive element. Uses
   currentColor so it reads correctly whether the element sits on the
   dark hero/footer (white text) or the light surface (brand-text). */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 4px;
}

/* Cormorant Garamond is reserved for pull-quotes / testimonials only */
.quote-font {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 500;
}

/* ============================================================
   Layout utilities
   ============================================================ */
.container {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: var(--space-3);
}

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

.section--tight { padding-block: var(--space-5); }
.section--alt { background: var(--color-surface-alt); }

.section-head {
  max-width: 640px;
  margin-bottom: var(--space-5);
}

.section-head--center {
  max-width: 640px;
  margin-inline: auto;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

.grid {
  display: grid;
  gap: var(--space-4);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ============================================================
   Nav bar — sticky, transparent-over-hero to solid-on-scroll
   ============================================================
   Markup pattern:
     <header class="nav">
       <div class="container nav__inner"> ... </div>
     </header>
   ui.js toggles the `nav--solid` modifier once the page scrolls past the
   hero (e.g. window.scrollY > 40) so the bar starts transparent over a dark
   hero image and becomes the surface color with a shadow once content
   scrolls underneath it. On pages with no dark hero, ship the nav already
   solid by including `nav--solid` in the markup from the start.
*/
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: transparent;
  transition: background-color var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out),
              backdrop-filter var(--duration-base) var(--ease-out);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-3);
}

.nav--solid {
  background: rgba(250, 246, 239, 0.92); /* = --color-surface at 92% */
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-2);
}

.nav--solid .nav__inner { padding-block: var(--space-2); }

.nav__logo { display: flex; align-items: center; gap: var(--space-1); }
.nav__logo img { height: 40px; width: auto; }

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__links a {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text);
  opacity: 0.85;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.nav__links a:hover { opacity: 1; color: var(--color-primary); }

.nav__actions { display: flex; align-items: center; gap: var(--space-2); }

.nav__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1);
}

@media (max-width: 860px) {
  .nav__links { display: none; }
  .nav__toggle { display: block; }
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  background: var(--color-primary);
  color: var(--color-text-on-dark);
  padding-block: var(--space-6) var(--space-4);
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--space-4);
  padding-bottom: var(--space-5);
}

@media (max-width: 860px) {
  .footer__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .footer__grid { grid-template-columns: 1fr; }
}

.footer__heading {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-white);
  margin-bottom: var(--space-2);
  opacity: 0.9;
}

.footer__links { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }

.footer__links a {
  font-size: var(--text-sm);
  color: var(--color-text-on-dark);
  opacity: 0.75;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.footer__links a:hover { opacity: 1; }

.footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: var(--text-xs);
  opacity: 0.7;
  flex-wrap: wrap;
}

/* ============================================================
   Buttons — filled pill / outline pill / ghost text
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-sm);
  line-height: 1;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              background-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--color-primary);
  color: var(--color-white);
  box-shadow: var(--shadow-2);
}
.btn-primary:hover { background: var(--color-primary-hover); box-shadow: var(--shadow-3); }
.btn-primary:active { background: var(--color-primary-active); }

.btn-accent {
  background: var(--color-accent);
  color: var(--color-white);
  box-shadow: var(--shadow-2);
}
.btn-accent:hover { background: var(--color-accent-hover); box-shadow: var(--shadow-3); }
.btn-accent:active { background: var(--color-accent-active); }

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
  padding: calc(var(--space-2) - 1.5px) calc(var(--space-4) - 1.5px);
}
.btn-secondary:hover { background: var(--color-primary-tint); }

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-sm);
}
.btn-ghost:hover { background: var(--color-surface-alt); transform: none; }

.btn-gold {
  background: var(--gradient-gold);
  color: var(--color-text);
  box-shadow: var(--shadow-2);
}
.btn-gold:hover { box-shadow: var(--shadow-3); }

.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-3) var(--space-5); font-size: var(--text-base); }
.btn-block { width: 100%; }

/* ============================================================
   Cards — one flexible base family
   ============================================================
   Base `.card` + modifiers for context. Use `.card-profile`,
   `.card-feature`, or `.card-testimonial` alongside `.card` for
   type-specific inner layout; all share the same elevation/hover physics.
*/
.card {
  background: var(--color-surface-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-4);
}

.card__media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--color-surface-alt);
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}

.card:hover .card__media img { transform: scale(1.05); }

.card__body { padding: var(--space-3); }

.card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-md);
  margin: 0 0 var(--space-1);
}

.card__meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-2);
}

.card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

/* Feature card: icon-led, no media */
.card-feature { padding: var(--space-4); text-align: left; }
.card-feature .card__icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--color-primary-tint);
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}

/* Testimonial card: quote-led */
.card-testimonial { padding: var(--space-4); }
.card-testimonial .card__quote {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 500;
  font-size: var(--text-lg);
  color: var(--color-text);
  margin: 0 0 var(--space-3);
}
.card-testimonial .card__person {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.card-testimonial .card__person img {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-pill);
  object-fit: cover;
}

/* ============================================================
   Badges / pills
   ============================================================ */
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--color-primary-tint);
  color: var(--color-primary);
}

.badge-pill--accent { background: var(--color-accent-tint); color: var(--color-accent); }
.badge-pill--gold { background: var(--gradient-gold); color: var(--color-text); }
.badge-pill--outline {
  background: transparent;
  border: 1px solid var(--color-border-strong);
  color: var(--color-text);
}
.badge-pill--dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ============================================================
   Forms — text input / select / phone-code group
   ============================================================ */
.field { display: grid; gap: var(--space-1); margin-bottom: var(--space-3); }

.field__label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text);
}

.input,
.select {
  appearance: none;
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-2);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.select {
  background-image: linear-gradient(45deg, transparent 50%, var(--color-text) 50%),
                     linear-gradient(135deg, var(--color-text) 50%, transparent 50%);
  background-position: calc(100% - 20px) center, calc(100% - 15px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: var(--space-5);
}

.input:focus,
.select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-tint);
}

.input::placeholder { color: var(--color-text-subtle); }

/* Phone code input group: [select country code][text number] as one control */
.phone-group {
  display: flex;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-white);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.phone-group:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-tint);
}

.phone-group .select {
  width: auto;
  flex: 0 0 auto;
  border: none;
  border-right: 1.5px solid var(--color-border);
  border-radius: 0;
  background-color: var(--color-surface-alt);
}

.phone-group .input {
  flex: 1 1 auto;
  border: none;
  border-radius: 0;
}

.phone-group .input:focus,
.phone-group .select:focus { box-shadow: none; }

/* ============================================================
   Reveal-on-scroll utility
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.reveal--left { transform: translateX(-24px); }
.reveal--right { transform: translateX(24px); }
.reveal--scale { transform: scale(0.96); }

.reveal.is-visible {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

.reveal[data-reveal-delay="1"] { transition-delay: 80ms; }
.reveal[data-reveal-delay="2"] { transition-delay: 160ms; }
.reveal[data-reveal-delay="3"] { transition-delay: 240ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .btn:hover,
  .card:hover {
    transform: none;
  }
}
