/* Hands of Mercy OC — shared styles */

:root {
  --bg: #ffffff;
  --bg-alt: #eef4fc;
  --card-bg: #f8fbff;
  --text: #16202b;
  --text-muted: #5c6b7a;
  --primary: #2e6fcf;
  --primary-dark: #1f4e99;
  --primary-contrast: #ffffff;
  --accent: #dd6b1f;
  --accent-dark: #b6551a;
  --accent-contrast: #ffffff;
  --border: #d9e3f1;
  --header-bg: #ffffff;
  --footer-bg: #16202b;
  --footer-text: #eef2f7;
  --footer-muted: #a9b5c2;
  --shadow: 0 2px 10px rgba(22, 32, 43, 0.08);
  --shadow-hover: 0 12px 28px rgba(22, 32, 43, 0.18);
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161d;
    --bg-alt: #161d26;
    --card-bg: #19212b;
    --text: #eef2f7;
    --text-muted: #a9b5c2;
    --primary: #5b9df5;
    --primary-dark: #3b7fe0;
    --primary-contrast: #0f172a;
    --accent: #f0824a;
    --accent-dark: #d96a2c;
    --accent-contrast: #1a140f;
    --border: #2a3542;
    --header-bg: #161d26;
    --footer-bg: #0b0f14;
    --footer-text: #eef2f7;
    --footer-muted: #93a1b0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
  --bg: #11161d;
  --bg-alt: #161d26;
  --card-bg: #19212b;
  --text: #eef2f7;
  --text-muted: #a9b5c2;
  --primary: #5b9df5;
  --primary-dark: #3b7fe0;
  --primary-contrast: #0f172a;
  --accent: #f0824a;
  --accent-dark: #d96a2c;
  --accent-contrast: #1a140f;
  --border: #2a3542;
  --header-bg: #161d26;
  --footer-bg: #0b0f14;
  --footer-text: #eef2f7;
  --footer-muted: #93a1b0;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  font-weight: 500;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Manrope", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  -webkit-text-stroke: 0.4px currentColor;
}

a {
  color: var(--primary-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

/* ---------- Scroll reveal ---------- */
/* JS adds .reveal on load (progressive enhancement — content stays visible
   with no JS) then .revealed once a section's observer fires. */

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

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

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header / Nav ---------- */

.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 20, 0.45);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.nav-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 20px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.15rem;
  white-space: nowrap;
}

.brand img {
  height: 34px;
  width: auto;
}

/* ---------- Theme-aware logo swapping ---------- */
/* Each logo spot has a light-bg (black) and dark-bg (white) SVG; CSS
   shows the right one based on the active theme, so it flips instantly
   alongside the theme toggle with no JS and no flash. */

.logo-dark {
  display: none;
}

.logo-light {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light {
    display: none;
  }
  :root:not([data-theme="light"]) .logo-dark {
    display: block;
  }
}

:root[data-theme="dark"] .logo-light {
  display: none;
}

:root[data-theme="dark"] .logo-dark {
  display: block;
}

.footer-logo {
  height: 34px;
  width: auto;
  margin-bottom: 10px;
}

.nav-toggle {
  display: none;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--text);
  font-size: 1.05rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.main-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
}

.main-nav a::after {
  content: "";
  width: 18px;
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0;
}

.main-nav a:hover {
  background: var(--bg-alt);
  text-decoration: none;
}

.main-nav a.active {
  color: var(--primary-dark);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .main-nav a.active {
    color: var(--primary);
  }
}

:root[data-theme="dark"] .main-nav a.active {
  color: var(--primary);
}

.main-nav a.active::after {
  opacity: 1;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 700;
  border: 2px solid var(--primary);
  cursor: pointer;
  font-size: 0.95rem;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-contrast);
}

.btn-primary {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  color: var(--primary-dark);
}

.btn-outline:hover {
  background: var(--bg-alt);
  text-decoration: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-outline {
    color: var(--text);
  }
}

:root[data-theme="dark"] .btn-outline {
  color: var(--text);
}

.theme-toggle,
.lang-toggle {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.05rem;
  color: var(--text);
}

.lang-toggle {
  font-size: 0.8rem;
  font-weight: 700;
}

.btn-donate {
  height: 40px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.btn-donate:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  text-decoration: none;
}

@media (max-width: 1080px) {
  .nav-toggle {
    display: inline-flex;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-hover);
    padding: 8px 20px 16px;
  }

  .main-nav.open {
    display: flex;
  }

  .nav-row {
    flex-wrap: wrap;
  }

  .main-nav a {
    width: 100%;
  }
}

/* ---------- Hero ---------- */

.hero {
  background: linear-gradient(180deg, var(--bg-alt), var(--bg));
  padding: 56px 0 48px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 36px;
  align-items: center;
}

@media (max-width: 800px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
}

.eyebrow {
  color: var(--primary-dark);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

h1 {
  font-size: 2.4rem;
  line-height: 1.15;
  margin: 10px 0 16px;
}

h2 {
  font-size: 1.8rem;
  margin: 0 0 14px;
}

h3 {
  font-size: 1.25rem;
  margin: 0 0 10px;
}

.lede {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Sections ---------- */

section {
  padding: 48px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-head {
  max-width: 680px;
  margin: 0 auto 32px;
  text-align: center;
}

.section-head .lede {
  margin-bottom: 0;
}

/* ---------- Stats ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 230px));
  justify-content: center;
  gap: 20px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: box-shadow 0.25s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-hover);
}

@media (max-width: 860px) {
  .stats-grid {
    grid-template-columns: minmax(0, 230px);
  }
}

.stat-number {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---------- Cards / Grid ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.card-grid-2col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 700px) {
  .card-grid-2col {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.25s ease;
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.card .btn {
  margin-top: auto;
  align-self: flex-start;
}

.icon-badge {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  /* Always the light-mode badge look (pale blue circle, dark blue icon) —
     intentionally not theme-linked, so the backdrop stays visible even
     in dark mode where var(--bg-alt) is too close to the card color. */
  background: #eef4fc;
  color: #1f4e99;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex: none;
}

.icon-badge svg {
  width: 24px;
  height: 24px;
}

/* ---------- Image placeholder (fallback when real photo isn't in /images yet) ---------- */

.img-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-alt);
  aspect-ratio: var(--ratio, 16/10);
}

.img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.img-fallback {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  border: 2px dashed var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.img-wrap.img-missing img {
  display: none;
}

.img-wrap.img-missing .img-fallback {
  display: flex;
}

/* ---------- Video embed (home hero) ---------- */

.video-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16/9;
  box-shadow: var(--shadow);
  background: var(--bg-alt);
}

.video-wrap iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

/* ---------- Logo ticker ---------- */

.logo-ticker-section {
  padding: 28px 0;
}

.logo-ticker {
  overflow: hidden;
  /* Vertical padding gives the cards' box-shadow room to render instead
     of being clipped flush against this box's top/bottom edge. */
  padding: 24px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.logo-ticker-track {
  display: flex;
  align-items: center;
  gap: 28px;
  width: max-content;
}

/* Animation only starts once JS has populated the track (class added after
   logos load). Starting it unconditionally in the base rule means some
   mobile browsers compute the scroll distance against the still-empty,
   zero-width track and never recompute it once logos are appended —
   the strip just sits still until something (like a rotation) forces a
   fresh layout pass. */
.logo-ticker-track.running {
  animation: logo-ticker-scroll 42s linear infinite;
}

.logo-ticker:hover .logo-ticker-track {
  animation-play-state: paused;
}

.logo-ticker-item {
  flex: none;
  width: 180px;
  height: 90px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  transition: box-shadow 0.25s ease;
}

.logo-ticker-item:hover {
  box-shadow: var(--shadow-hover);
}

.logo-ticker-item img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.logo-ticker-empty {
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
  padding: 14px 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.9rem;
}

@keyframes logo-ticker-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .logo-ticker-track.running {
    animation: none;
  }
}

/* ---------- Photo slideshow ---------- */

.slideshow {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
  aspect-ratio: 16/9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-alt);
  box-shadow: var(--shadow);
}

.slideshow-track {
  position: relative;
  width: 100%;
  height: 100%;
}

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.slide.active {
  opacity: 1;
  z-index: 1;
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slideshow-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  border: 2px dashed var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.slideshow-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: none;
  background: rgba(10, 14, 20, 0.45);
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.slideshow-arrow:hover {
  background: rgba(10, 14, 20, 0.7);
}

.slideshow-prev {
  left: 12px;
}

.slideshow-next {
  right: 12px;
}

.slideshow-dots {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 2;
}

.slideshow-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.slideshow-dot.active {
  background: #fff;
  transform: scale(1.3);
}

/* ---------- Pillars / list ---------- */

.pillar-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.pillar-list li {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow 0.25s ease;
}

.pillar-list li:hover {
  box-shadow: var(--shadow-hover);
}

.pillar-list h3 {
  color: var(--primary-dark);
}

/* ---------- Donate amounts ---------- */

.donate-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.donate-amount {
  flex: 0 1 150px;
}

@media (max-width: 860px) {
  .donate-amount {
    flex: 0 1 45%;
    max-width: 200px;
  }
}

.donate-amount {
  display: block;
  text-align: center;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 12px;
  font-weight: 700;
  color: var(--text);
  transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.25s ease;
}

.donate-amount:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  text-decoration: none;
  box-shadow: var(--shadow-hover);
}

.donate-amount .amount {
  display: block;
  font-size: 1.6rem;
  color: var(--primary-dark);
}

.donate-amount .meals {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.tab-btn {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 20px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
}

.tab-btn.active {
  background: var(--primary);
  color: var(--primary-contrast);
  border-color: var(--primary);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ---------- Info blocks (contact, hours) ---------- */

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.info-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: box-shadow 0.25s ease;
}

.info-card:hover {
  box-shadow: var(--shadow-hover);
}

table.hours {
  width: 100%;
  border-collapse: collapse;
}

table.hours td {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

table.hours td:last-child {
  text-align: right;
  color: var(--text-muted);
}

.callout {
  background: var(--bg-alt);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

/* ---------- CTA band ---------- */

.cta-band {
  background: var(--primary);
  /* Hardcoded white, not theme-linked: always-white text on the
     always-blue band, regardless of which shade --primary is. */
  color: #ffffff;
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
}

.cta-band h2 {
  color: #ffffff;
}

.cta-band .lede {
  color: #ffffff;
  opacity: 0.92;
}

.cta-band .btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

.cta-band .btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: var(--accent-contrast);
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 44px 0 24px;
  margin-top: 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 28px;
  margin-bottom: 28px;
}

.footer-grid h4 {
  margin: 0 0 12px;
  color: var(--footer-text);
}

.footer-grid a {
  color: var(--footer-muted);
  display: block;
  margin-bottom: 8px;
}

.footer-grid a:hover {
  color: var(--footer-text);
}

.social-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.social-row a {
  display: inline-block;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 18px;
  font-size: 0.85rem;
  color: var(--footer-muted);
  text-align: center;
}

@media (max-width: 600px) {
  h1 {
    font-size: 1.9rem;
  }
}
