/* Fonts are loaded via a parallel <link rel="stylesheet" href="/fonts/fonts.css">
   in each page <head> (not @import) to avoid a render-blocking request chain. */

/* =====================================================================
   Mosque Template — Modern Design System
   Token-driven green/gold/cream. Each mosque overrides --color-primary /
   --color-primary-dark / --color-primary-contrast in /styles/theme-*.css.
   ===================================================================== */

:root {
  /* Brand (overridable per mosque) */
  --color-primary: #0d4d3c;
  --color-primary-dark: #082e23;
  --color-primary-contrast: #fbf7ee;

  /* Gold accent (shared default) */
  --color-accent: #c9a24b;
  --color-accent-hover: #d8b258;
  --color-accent-soft: #e2c887;
  --color-accent-label: #7d6019; /* darkened for WCAG AA as text on light/cream */

  /* Surfaces */
  --color-bg: #ffffff;
  --color-surface: #faf7f0;
  --color-surface-2: #f6efdd;
  --color-border: #ece6d8;
  --color-border-strong: #e7ddc6;

  /* Text */
  --color-text: #1c2620;
  --color-text-muted: #5a6258;
  --color-text-soft: #6f685a;
  --color-text-faint: #6f6650; /* darkened for WCAG AA on light backgrounds */
  --color-on-dark: #faf7f0;
  --color-hero-text: #fbf7ee;

  /* Type */
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Mulish", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-arabic: "Amiri", "Cormorant Garamond", serif;

  --maxw: 1200px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-card: 0 18px 44px -28px rgba(10, 58, 45, 0.4);
  --shadow-float: 0 28px 64px -30px rgba(10, 58, 45, 0.5);

  /* legacy alias (older rules / components reference this) */
  --color-primary-light: var(--color-surface);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  text-align: left;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: opacity 0.2s ease;
}

img { max-width: 100%; }

/* For mosques whose logo art is white/light (set logoClass: "invert-to-black"):
   render it dark so it's visible on the light header. */
.invert-to-black { filter: brightness(0); }

/* The layout body is a flex column; by default its items won't shrink below
   their content's min-width, so a wide table or long line forces the whole page
   wider than the screen (and body's overflow-x:hidden then clips it). Allow the
   items to shrink so scrollable tables and wrapping text stay within the viewport. */
body > * { min-width: 0; }

/* These centered page wrappers are flex items of the column body. Auto side
   margins disable flex `stretch`, so on a phone they size to their content and
   overflow the screen. An explicit full width fixes it; max-width still caps and
   margin:auto still centers them on desktop. */
.prayer-page, .container-main, .main-content, .section,
.container-dress-code, .container-house-rules, .container-ramadan { width: 100%; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-primary);
  line-height: 1.12;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2.2rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h3 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
p { margin: 0 0 1rem; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-accent-label); }
hr { border: none; border-top: 1px solid var(--color-border); }
::selection { background: var(--color-accent-soft); color: var(--color-primary-dark); }

/* Skip link — keyboard users bypass the repeated header/nav (WCAG 2.4.1). */
.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 2000;
  padding: 0.65rem 1.1rem;
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  border-radius: 0 0 8px 8px;
  font-weight: 600;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 0;
  color: var(--color-primary-contrast);
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.kicker {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--color-accent-label);
  margin-bottom: 0.85rem;
}

/* Reusable diamond brand mark */
.brand-mark { position: relative; width: 26px; height: 26px; flex: none; display: inline-block; }
.brand-mark::before { content: ""; position: absolute; inset: 0; border: 1.5px solid var(--color-primary); transform: rotate(45deg); border-radius: 3px; }
.brand-mark::after { content: ""; position: absolute; inset: 8px; background: var(--color-accent); transform: rotate(45deg); border-radius: 1px; }

/* ---------------- Buttons (also overrides Bootstrap .btn) ---------------- */
.btn, .download-btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  border: none;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  text-decoration: none;
  display: inline-block;
}
.btn-primary, .download-btn {
  background: var(--color-primary) !important;
  color: var(--color-primary-contrast) !important;
  border: none !important;
}
.btn-primary:hover, .download-btn:hover { background: var(--color-primary-dark) !important; color: #fff !important; transform: translateY(-1px); }
.btn-accent { background: var(--color-accent); color: var(--color-primary-dark); }
.btn-accent:hover { background: var(--color-accent-hover); color: var(--color-primary-dark); }
.btn-outline-dark {
  background: transparent !important;
  color: var(--color-primary) !important;
  border: 1px solid var(--color-border-strong) !important;
}
.btn-outline-dark:hover { border-color: var(--color-primary) !important; background: var(--color-surface) !important; color: var(--color-primary) !important; }

/* ---------------- Generic content sections (Bismillah, QuranVerse) ---------------- */
.section { max-width: 820px; margin: 0 auto; padding: 3.5rem 1.5rem; text-align: center; }
.section h2 { font-size: clamp(2rem, 4vw, 3rem); background: none; color: var(--color-primary); margin: 0 0 0.6rem; }
.section h3 { color: var(--color-accent-label); font-size: 0.78rem; letter-spacing: 0.2em; text-transform: uppercase; font-weight: 700; font-family: var(--font-body); margin-bottom: 1rem; }
.section p { font-size: 1.15rem; line-height: 1.8; color: var(--color-text-muted); }

/* ---------------- Alternating image/text content blocks ---------------- */
.container-main { display: flex; flex-direction: column; align-items: center; gap: 28px; max-width: var(--maxw); margin: 0 auto; padding: 3.5rem 1.5rem; }
.block {
  display: flex; width: 100%; max-width: 980px; min-height: 280px;
  background: var(--color-bg); border: 1px solid var(--color-border);
  border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.block:hover { transform: translateY(-4px); box-shadow: 0 26px 56px -30px rgba(10, 58, 45, 0.5); }
.block .image-container { width: 45%; }
.block img { width: 100%; height: 100%; object-fit: cover; display: block; }
.text-content { width: 55%; padding: 2.2rem; display: flex; flex-direction: column; justify-content: center; text-align: left; }
.text-content h2 { font-size: 1.7rem; color: var(--color-primary); margin-bottom: 0.6rem; }
.text-content p { font-size: 1.02rem; color: var(--color-text-muted); line-height: 1.7; margin: 0; }

/* ---------------- Page header image band (way-to-mosque) ---------------- */
.header { position: relative; width: 100%; text-align: center; overflow: hidden; }
.header img, .header-img { width: 100%; height: 42vh; min-height: 280px; object-fit: cover; display: block; }
.header::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 46, 35, 0.25), rgba(8, 46, 35, 0.7)); }
.header-text {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 2; width: 90%;
  font-family: var(--font-display); font-size: clamp(1.8rem, 5vw, 3.2rem); font-weight: 600; color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}

/* ---------------- Map + text (way-to-mosque) ---------------- */
.main-content { max-width: var(--maxw); margin-left: auto; margin-right: auto; }
.map { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-card); }
.map iframe { width: 100%; height: 440px; border: 0; display: block; }
.text { text-align: left; }
.text h1 { color: var(--color-primary); }
.text p { color: var(--color-text-muted); }

/* ---------------- PDF embeds ---------------- */
.pdf-container { width: 100%; max-width: 860px; height: 760px; margin: 0 auto 2rem; padding: 14px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.pdf-container iframe { width: 100%; height: 100%; border: none; border-radius: var(--radius-sm); background: #fff; }

/* ---------------- Prayer page wrappers ---------------- */
.prayer-page { display: block; max-width: 1120px; margin: 0 auto; padding: 3rem 1rem 4rem; }
.prayer-home { display: block; padding: 1rem 1rem 2rem; }
.prayer-page .display-5 { font-family: var(--font-display); color: var(--color-primary); }

/* ---------------- Countdown (legacy component) ---------------- */
.countdown { text-align: center; padding: 3rem 1rem; }
.countdown-header h2 { color: var(--color-primary); }
.countdown-box { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; max-width: 760px; margin: 1.5rem auto 0; }
.time-box { background: var(--color-primary); color: var(--color-primary-contrast); padding: 1.4rem 1rem; width: 130px; border-radius: var(--radius); box-shadow: var(--shadow-card); }
.time-box span { font-family: var(--font-display); font-size: 2.8rem; font-weight: 600; line-height: 1; }
.time-box .unit { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 0.5rem; color: var(--color-accent-soft); }

/* ---------------- Cards & collapsible accordions (kontakt) ---------------- */
.card { border: 1px solid var(--color-border); border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden; background: var(--color-bg); }
.card-header { display: flex; justify-content: space-between; align-items: center; background: var(--color-surface); color: var(--color-primary); font-family: var(--font-body); font-weight: 700; border: none; cursor: pointer; padding: 1rem 1.25rem; transition: background-color 0.2s ease; }
.card-header:hover { background: var(--color-surface-2); color: var(--color-primary); }
.card-header .bi { color: var(--color-accent-label); }
.collapse-content { padding: 1.25rem; background: var(--color-bg); border-top: 1px solid var(--color-border); color: var(--color-text-muted); white-space: pre-line; }

/* ---------------- YouTube feed (hutba) ---------------- */
.video-item { display: flex; gap: 22px; margin-bottom: 1.75rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--color-border); }
.video-thumbnail { flex-shrink: 0; width: 460px; max-width: 55%; aspect-ratio: 16 / 9; height: auto; border-radius: var(--radius); border: 1px solid var(--color-border); }
.video-info { flex-grow: 1; min-width: 0; }
.video-title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; color: var(--color-primary); overflow-wrap: anywhere; }
.video-date { font-size: 0.85rem; color: var(--color-text-faint); letter-spacing: 0.04em; }

/* ---------------- Bootstrap helpers used on inner pages ---------------- */
.display-4, .display-5 { font-family: var(--font-display); font-weight: 600; color: var(--color-primary); }
.lead { font-size: 1.15rem; color: var(--color-text-muted); }
.text-muted { color: var(--color-text-faint) !important; }
.blockquote { font-family: var(--font-display); font-size: 1.3rem; line-height: 1.6; color: var(--color-text); background: var(--color-surface); border: 1px solid var(--color-border); border-left: 3px solid var(--color-accent); border-radius: var(--radius); padding: 1.75rem !important; }
.bg-light { background: var(--color-surface) !important; }
main.bg-light, section.bg-light { border: 1px solid var(--color-border); border-radius: var(--radius); }
.list-group { border-radius: var(--radius); overflow: hidden; }
.list-group-item { border: none; border-bottom: 1px solid var(--color-border); padding: 0.95rem 1.15rem; color: var(--color-text); background: transparent; }
.list-group-item:last-child { border-bottom: none; }
.container-dress-code, .container-house-rules, .container-ramadan { max-width: var(--maxw); margin-left: auto; margin-right: auto; padding-left: 1rem; padding-right: 1rem; padding-bottom: 3.5rem; }
.textSize { width: 100%; max-width: 820px; margin: 0 auto; padding: 1.75rem; font-size: 1.08rem; line-height: 1.8; color: var(--color-text-muted); background: var(--color-surface); border: 1px solid var(--color-border) !important; border-radius: var(--radius); }

/* GDPR map consent box → on-brand */
.map-consent { background: var(--color-surface) !important; border: 1px solid var(--color-border); border-radius: var(--radius); }

@media (max-width: 820px) {
  .block { flex-direction: column; }
  .block .image-container, .text-content { width: 100%; }
  .block img { height: 240px; }
  .text-content { padding: 1.5rem; }
  .video-item { flex-direction: column; }
  .video-thumbnail { width: 100%; max-width: 100%; }
  .pdf-container { height: 78vh; padding: 8px; }
  .time-box { width: 44%; }
}
