/* Root variables for quick theming */
:root {
  --color-primary: #7f3aa9; /* can be overridden by config */
  --color-primary-soft: #e9d7f2;
  --color-bg: #ffffff;
  --color-text: #1f1f1f;
  --color-muted: #5b5b5b;
  --radius: 12px;
  --space: 16px;
  --space2: 48px;
  --maxw: 960px;
}

/* Reset-like minimal base */
* {
  box-sizing: border-box;
}
html:focus-within {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Helvetica Neue", Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

.container {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 0 var(--space);
}
.section {
  padding: calc(var(--space) * 2) 0;
}
.section-hero {
  padding: calc(var(--space) * 2) 0 calc(var(--space) * 3);
  background: var(--color-primary-soft);
}

.site-header,
.site-footer {
  background: #faf7fc;
  border-top: 4px solid var(--color-primary);
}
.site-header {
  border-bottom: 1px solid #eee;
  padding-top: 24px;
}
.site-footer {
  padding: var(--space) 0 calc(var(--space) * 2);
}

/* Header layout: title left, language nav right */
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space);
}

#lang-nav {
  display: flex;
  gap: 8px;
  position: fixed;
  top: 8px;
  right: 8px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #eee;
  border-radius: 8px;
  z-index: 1000;
}

/* Respect notches/safe-areas when available */
@supports (padding: max(0px)) {
  #lang-nav {
    top: max(8px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right));
  }
}

/* Ensure content doesn't sit under the fixed control on small screens */
@media (max-width: 640px) {
  .site-header {
    padding-top: 64px;
  }
}

/* Minimal language toggle button */
.lang-toggle {
  background: transparent;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 4px 8px;
  color: var(--color-text);
  font-weight: 600;
  cursor: pointer;
}
.lang-toggle:hover,
.lang-toggle:focus-visible {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

h1,
h2,
h3 {
  line-height: 1.25;
}
.lead {
  font-size: 1.125rem;
}
.muted {
  color: var(--color-muted);
}

.grid-hero {
  display: grid;
  gap: var(--space);
  align-items: center;
}
@media (min-width: 768px) {
  .grid-hero {
    grid-template-columns: 1fr 1.3fr;
  }
}
.hero-media img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
}

.btn {
  display: inline-block;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 2px solid transparent;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  min-height: 44px; /* touch target */
  line-height: 1.2;
  flex: 0 0 auto; /* prevent shrinking in flex rows */
}
.btn:focus {
  outline: 3px solid #000;
  outline-offset: 2px;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover,
.btn-primary:focus-visible {
  background: #6c3291;
}
.btn-secondary {
  background: #fff;
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn-ghost {
  background: transparent;
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn-ghost:hover,
.btn-ghost:focus-visible {
  background: rgba(127, 58, 169, 0.08);
}

/* CTA row layout for hero buttons */
.cta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: var(--space);
}
@media (max-width: 520px) {
  .cta-row {
    flex-direction: column;
    align-items: stretch;
  }
  .cta-row .btn {
    width: 100%;
    text-align: center;
  }
}

.quotes {
  list-style: none;
  padding: 0;
  margin: var(--space) 0 0;
  display: grid;
  gap: var(--space);
}
.quotes li {
  padding: var(--space);
  border-left: 4px solid var(--color-primary);
  background: #faf7fc;
  border-radius: 6px;
}

/* Preserve line breaks in poems/quotes coming from JSON */
.quotes blockquote {
  white-space: pre-line;
  margin: 0;
}

/* Preserve line breaks in about text coming from JSON */
#about-text {
  white-space: pre-line;
  margin-bottom: var(--space2);
}

/* Global scroll lock when overlays are open */
html.no-scroll {
  overflow: hidden;
}

.gallery {
  /* Masonry-style layout using CSS columns for mixed portrait/landscape */
  column-count: 1;
  column-gap: var(--space);
}
@media (min-width: 560px) {
  .gallery {
    column-count: 2;
  }
}
@media (min-width: 900px) {
  .gallery {
    column-count: 3;
  }
}
.gallery figure {
  /* Prevent items from being split across columns */
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  margin: 0 0 var(--space);
}
.gallery img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}
.gallery figcaption {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-top: 6px;
}

/* Clickable gallery items (buttons) */
.gallery .gallery-item-btn {
  display: block;
  width: 100%;
  background: none;
  border: 0;
  padding: 0;
}
.gallery .gallery-item-btn:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Lightbox overlay */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none; /* toggled to flex when open */
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.lightbox[aria-hidden="false"] {
  display: flex;
}
.lightbox__dialog {
  position: relative;
  max-width: min(92vw, var(--maxw));
  max-height: 90vh;
  outline: none;
}
.lightbox__img {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  display: block;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.lightbox__caption {
  color: #fff;
  text-align: center;
  margin-top: 8px;
}
.lightbox__close,
.lightbox__nav {
  position: absolute;
  top: 8px;
  background: rgba(0,0,0,0.4);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 44px;
  min-height: 44px; /* mobile touch target */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
}
.lightbox__close {
  right: 8px;
}
.lightbox__nav--prev,
.lightbox__nav--next {
  top: 50%;
  transform: translateY(-50%);
}
.lightbox__nav--prev { left: calc(-44px - var(--space)); }
.lightbox__nav--next { right: calc(-44px - var(--space)); }
@media (max-width: 640px) {
  .lightbox__nav--prev { left: 8px; }
  .lightbox__nav--next { right: 8px; }
}

.testimonials {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--space);
  margin-top: var(--space);
}
.testimonials li {
  background: #fff;
  border: 1px solid #eee;
  border-radius: var(--radius);
  padding: var(--space);
}

.breakdown {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 6px;
}
.breakdown li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed #ddd;
  padding: 6px 0;
}

.donate-options {
  display: grid;
  gap: var(--space);
  margin-top: var(--space);
}
.donate-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: var(--radius);
  padding: var(--space);
}

.events {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--space);
}
.events li {
  background: #fff;
  border: 1px solid #eee;
  border-radius: var(--radius);
  padding: var(--space);
}

.faq details {
  border: 1px solid #eee;
  border-radius: var(--radius);
  padding: var(--space);
  margin-bottom: var(--space);
}
.faq summary {
  font-weight: 600;
  cursor: pointer;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: static;
  width: auto;
  height: auto;
  padding: 6px 10px;
  background: #000;
  color: #fff;
}

.lang-btn {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 6px 8px;
  margin-left: 0;
}
.lang-btn[aria-pressed="true"] {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.noscript {
  background: #fff3cd;
  border: 1px solid #ffeeba;
  padding: var(--space);
  border-radius: 8px;
  margin: var(--space) auto;
}

/* Optional subtle rainbow accent (FLINTA*) */
.accent-rainbow {
  height: 4px;
  background: linear-gradient(
    90deg,
    #7f3aa9,
    #d946ef,
    #f59e0b,
    #10b981,
    #3b82f6
  );
  border-radius: 999px;
}
