/* ==========================================================================
   Base Layout & Components — La Habra Historical Museum
   Reusable component classes per SOW §6.3/§6.4. Every later page template
   composes from these classes rather than redefining shapes/spacing.
   ========================================================================== */

/* Every approved comp resets margin/padding to 0 on every element (its own
   *{margin:0;padding:0;box-sizing:border-box}); this theme only ever zeroed
   box-sizing, so headings/lists/etc. with no explicit margin override were
   quietly picking up browser-default spacing (e.g. the footer h4 columns
   sitting ~18.6px lower than the logo next to them). Matching the comps'
   reset here fixes that at the source instead of patching each element. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  overflow-x: hidden;
}

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

/* Every approved comp resets links to inherit the surrounding text color
   (near-white in the footer, harbor-blue in body copy, etc.) rather than a
   single hardcoded link color — sections that want a distinct link color
   (.legal-body a, .info-cards .card-body a, ...) already set it explicitly. */
a { color: inherit; }

.site-footer a { color: var(--cream); }

/* Generic fallback spacing for index.php/page.php/the legacy header.php —
   pages with no approved design comp of their own. Not used by any real
   content page; those all use .pad below instead. */
.section-pad {
  padding: clamp(70px, 9vw, 120px) clamp(22px, 6vw, 72px);
}

/* .pad — the section padding used verbatim by every approved comp: the
   mosaic homepage (home-option-b-media-mosaic.html), about-us.html,
   contact.html, privacy-policy.html, terms.html. */
.pad {
  padding: clamp(56px, 7.5vw, 100px) clamp(22px, 6vw, 72px);
}

.section-cream { background: var(--cream); color: var(--ink); }
.section-deep-sage { background: var(--deep-sage); color: var(--cream); }
.section-sage-tint { background: var(--sage-tint); color: var(--ink); }

/* Buttons — §6.3, M-04 hover */
.btn-primary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 14px 32px;
  font-family: var(--font-text);
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease, border-color .25s ease, color .25s ease;
}

.btn-primary {
  background: var(--sage);
  color: var(--cream);
  border: none;
  box-shadow: 0 8px 20px rgba(107, 140, 83, 0.25);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--deep-sage);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 2px solid rgba(30, 36, 32, 0.22);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  border-color: var(--harbor);
  color: var(--harbor);
  transform: translateY(-2px);
}

/* Blob card grid — §6.3, M-05 hover. Corner sequence is non-clockwise —
   do not "simplify" to a rotating pattern. */
.blob-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(20px, 3vw, 32px);
}

.blob-card {
  background: #fff;
  padding: clamp(28px, 3vw, 40px);
  transition: transform .3s ease, box-shadow .3s ease;
}

.blob-card:hover,
.blob-card:focus-within {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(30, 36, 32, 0.12);
}

.blob-card:nth-child(4n+1) { border-radius: 120px 26px 26px 26px; }
.blob-card:nth-child(4n+2) { border-radius: 26px 120px 26px 26px; }
.blob-card:nth-child(4n+3) { border-radius: 26px 26px 26px 120px; }
.blob-card:nth-child(4n+4) { border-radius: 26px 26px 120px 26px; }

.blob-card__icon { color: var(--sage); width: 24px; height: 24px; }
.blob-card h3 { font-family: var(--font-display); margin-top: 16px; }
.blob-card p { font-family: var(--font-text); }

@media (max-width: 560px) {
  .blob-card:nth-child(4n+1) { border-radius: 80px 22px 22px 22px; }
  .blob-card:nth-child(4n+2) { border-radius: 22px 80px 22px 22px; }
  .blob-card:nth-child(4n+3) { border-radius: 22px 22px 22px 80px; }
  .blob-card:nth-child(4n+4) { border-radius: 22px 22px 80px 22px; }
}

/* 5th card in a grid repeats position 1's shape rather than a new
   asymmetry (§6.3) — e.g. the future Admin Dashboard's 5 summary cards. */
.blob-grid--five .blob-card:nth-child(5) { border-radius: 120px 26px 26px 26px; }
@media (max-width: 560px) {
  .blob-grid--five .blob-card:nth-child(5) { border-radius: 80px 22px 22px 22px; }
}

/* Arch shape — §6.3, quotes/testimonials only. Do not use harbor-tint as
   a full section background anywhere else. */
.arch {
  background: var(--harbor-tint);
  border-radius: 999px 999px 34px 34px;
  padding: clamp(40px, 6vw, 72px) clamp(28px, 6vw, 64px);
  max-width: 820px;
  margin: 0 auto;
  text-align: center;
}

/* Badge plate — §6.3, logo frame. No fixed width/height: the logo PNG is
   portrait (191×295), so the plate sizes to content via padding instead. */
.badge-plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 26px 30px 20px;
  border-radius: 999px 999px 28px 28px;
  background: #F7F3E8;
  box-shadow: 0 24px 60px -30px rgba(30, 36, 32, 0.35), 0 2px 0 rgba(30, 36, 32, 0.04);
}

.badge-plate img { width: 118px; height: auto; }

@media (max-width: 560px) {
  .badge-plate img { width: 92px; }
}

/* Skip link — accessibility baseline */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--cream);
  padding: 12px 20px;
  z-index: 9999;
  border-radius: 0 0 8px 0;
}

.skip-link:focus {
  left: 0;
}

/* Visible focus states — inherited by every interactive element site-wide */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--harbor);
  outline-offset: 2px;
}

/* Header / nav layout */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.primary-nav__list {
  display: flex;
  gap: clamp(16px, 2vw, 32px);
  list-style: none;
  padding: 0;
  margin: 0;
}

.primary-nav__list a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

/* Base rule must come before its ≤860px override below — same
   specificity (one class), so source order decides the winner. This was
   previously defined after the media query, which meant the unconditional
   4-column rule always won regardless of viewport width (confirmed bug:
   the footer's 3rd column overflowed at 320px because the intended
   2-column mobile layout never actually applied). */
.site-footer__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}

/* Structural breakpoint — §6.4 */
@media (max-width: 860px) {
  .site-footer__grid { grid-template-columns: repeat(2, 1fr); }
  .primary-nav__list { display: none; }
  .nav-toggle { display: inline-flex; }

  /* Mobile nav toggle — paired with assets/js/nav.js, which toggles
     `is-open` on #primary-nav. Simple stacked dropdown; an animated
     drawer is polish for a later phase. */
  #primary-nav.is-open .primary-nav__list {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--cream);
    padding: 16px clamp(22px, 6vw, 72px);
    gap: 16px;
    box-shadow: 0 12px 24px rgba(30, 36, 32, 0.12);
    z-index: 10;
  }
}

.primary-nav {
  position: relative;
}

@media (min-width: 861px) {
  .nav-toggle { display: none; }
}

.footer-social {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 16px;
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--cream);
  text-decoration: none;
}

.footer-social a:hover {
  text-decoration: underline;
}

.footer-motto {
  font-family: var(--font-heritage);
  font-style: italic;
}

/* Scroll-reveal — M-01, paired with assets/js/motion.js. The hidden state
   only applies once `.js` is confirmed on <html> (see header.php's no-js
   inline script) — if JS fails to load, content stays visible by default
   instead of being permanently opacity:0. */
.js .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .8s ease, transform .8s ease;
}

.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  /* Must match .js .reveal's specificity (0,0,2,0) exactly — a bare
     .reveal here (0,0,1,0) loses to .js .reveal whenever JS has loaded
     successfully, silently reintroducing the animation for users who
     asked for none. */
  .reveal,
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* Legal page template (Terms & Conditions, Privacy Policy) — Phase 1.
   .legal-body p uses var(--ink) here, not the design comp's literal
   #3E4740 — that hex isn't a defined token, and reusing --ink keeps one
   canonical body-text color instead of adding a one-off value. */
.legal-hero {
  background: linear-gradient(135deg, var(--sage-tint), var(--harbor-tint));
  text-align: center;
}

.legal-hero-inner {
  max-width: 720px;
  margin: 0 auto;
}

.legal-hero .updated {
  font-size: 14px;
  color: var(--stone);
  margin-top: 6px;
}

.legal-tabs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

.legal-tabs a {
  font-family: var(--font-text);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 22px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink);
  border: 1.5px solid rgba(30, 36, 32, .16);
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}

.legal-tabs a:hover {
  border-color: var(--harbor);
  color: var(--harbor);
}

.legal-tabs a.active {
  background: var(--deep-sage);
  color: var(--cream);
  border-color: var(--deep-sage);
}

.legal-body {
  max-width: 720px;
  margin: 0 auto;
}

.legal-body h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  margin: 38px 0 10px;
}

.legal-body > h2:first-child {
  margin-top: 0;
}

.legal-body p {
  font-size: 18.5px;
  line-height: 1.75;
  color: var(--ink);
  margin-bottom: 16px;
}

.legal-body a {
  color: var(--harbor);
  text-decoration: underline;
}

.legal-body a:hover {
  color: var(--deep-sage);
}
