/*
 * An organization's own page on Baab: openbaab.com/org/<handle>.
 * The same hand as a masjid's page (masjid/assets/masjid.css): teal on a cool
 * pale ground, hairline cards, rounded figures, one accent. Dark mode is a
 * tinted teal night, never black. The tokens below are that file's, value for
 * value; change them there and here together.
 */
:root {
  --ground: #F3F8F8;
  --card: #FFFFFF;
  --chip: #E6F0F1;
  --ink: #0D2428;
  --ink-soft: #4B6B70;
  --line: rgba(13, 36, 40, 0.10);
  --line-strong: rgba(13, 36, 40, 0.18);
  --teal: #157987;
  --teal-hover: #106673;
  --teal-wash: rgba(21, 121, 135, 0.08);
  --on-teal: #FFFFFF;
  --round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --text: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0B2024;
    --card: #122D32;
    --chip: #1B3F45;
    --ink: #EEF6F6;
    --ink-soft: #A9C3C7;
    --line: rgba(238, 246, 246, 0.09);
    --line-strong: rgba(238, 246, 246, 0.18);
    --teal: #3CB8C9;
    --teal-hover: #5CC6D4;
    --teal-wash: rgba(60, 184, 201, 0.12);
    --on-teal: #06262B;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0B2024; --card: #122D32; --chip: #1B3F45; --ink: #EEF6F6; --ink-soft: #A9C3C7;
  --line: rgba(238, 246, 246, 0.09); --line-strong: rgba(238, 246, 246, 0.18);
  --teal: #3CB8C9; --teal-hover: #5CC6D4; --teal-wash: rgba(60, 184, 201, 0.12); --on-teal: #06262B;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
p { text-wrap: pretty; }

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 40px max(16px, env(safe-area-inset-right)) max(64px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.status { padding-top: 24vh; text-align: center; color: var(--ink-soft); }
.status-block { padding-top: 20vh; text-align: center; }
.status-block .muted { margin-top: 10px; color: var(--ink-soft); }

/* ── Name ─────────────────────────────────────────────────────────── */
.logo {
  display: block; width: 64px; height: 64px; margin-bottom: 16px;
  border-radius: 16px; border: 1px solid var(--line);
  background: var(--chip); object-fit: cover;
}
.title {
  font-family: var(--round);
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.kind { margin-top: 8px; font-size: 15px; color: var(--ink-soft); }
.place { margin-top: 4px; font-size: 15px; color: var(--ink-soft); overflow-wrap: anywhere; }
.place .maps { white-space: nowrap; }
/* A 44px touch target without moving the line. */
.place .maps a { display: inline-block; padding: 12px 0; margin: -12px 0; }
.place .maps a + a::before { content: "·"; margin: 0 6px; color: var(--ink-soft); }

/* The wide picture. Its box is sized before the file arrives, so nothing moves when it does. */
.photo {
  margin-top: 24px; aspect-ratio: 16 / 9;
  border-radius: 18px; border: 1px solid var(--line);
  background: var(--chip); overflow: hidden;
}
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ── In its own words, and where else to find it ──────────────────── */
.about {
  margin-top: 24px; max-width: 36em;
  font-size: 17px; line-height: 1.6;
  white-space: pre-line; overflow-wrap: anywhere;
}
.links { list-style: none; margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px; }
.links li { min-width: 0; max-width: 100%; }
.links a {
  display: block; max-width: 100%; min-height: 44px; padding: 10px 16px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  font-size: 15px; font-weight: 600; line-height: 22px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.links a:hover { text-decoration: none; border-color: var(--line-strong); }
.group-note { margin-top: 14px; font-size: 14px; line-height: 20px; color: var(--ink-soft); }

/* ── Sections ─────────────────────────────────────────────────────── */
section { margin-top: 56px; }
h2 {
  font-family: var(--round);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

/* ── Give ─────────────────────────────────────────────────────────── */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 12px 22px; border-radius: 14px; border: 0;
  background: var(--teal); color: var(--on-teal);
  font: inherit; font-size: 17px; font-weight: 650; cursor: pointer;
  max-width: 100%; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.button:hover { background: var(--teal-hover); text-decoration: none; }
.give { margin-top: 32px; }
.give .button { width: 100%; }
.give .fine { margin-top: 10px; font-size: 13px; color: var(--ink-soft); text-align: center; }

/* ── Events and announcements (a masjid page's cards) ─────────────── */
.events, .notes { list-style: none; margin-top: 16px; display: grid; gap: 12px; }
.event, .note { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; min-width: 0; }
.event-when { font-size: 14px; font-weight: 600; color: var(--teal); }
.event h3, .note h3 { margin-top: 4px; font-family: var(--round); font-size: 18px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; text-wrap: balance; }
.event-where, .event-who { margin-top: 2px; font-size: 14px; color: var(--ink-soft); overflow-wrap: anywhere; }
.event-line {
  margin-top: 8px; font-size: 15px; color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.event-actions { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
/* The darker teal: the accent on the chip ground is under 4.5:1 in light. */
.event-actions button {
  font: inherit; font-size: 14px; font-weight: 600; color: var(--teal-hover);
  background: var(--chip); border: 0; border-radius: 10px; padding: 8px 14px; min-height: 44px; cursor: pointer;
  white-space: nowrap;
}
.event-register {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border-radius: 10px;
  background: var(--teal); color: var(--on-teal); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.event-register:hover { background: var(--teal-hover); text-decoration: none; }
.note-date { font-size: 13px; color: var(--ink-soft); }
.note-body { margin-top: 6px; font-size: 15px; color: var(--ink-soft); white-space: pre-line; overflow-wrap: anywhere; }

/* Nothing posted yet. */
.nothing { margin-top: 40px; max-width: 32em; font-size: 16px; color: var(--ink-soft); }

/* ── The masjid it belongs with ───────────────────────────────────── */
.linked {
  display: block; min-width: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px;
}
.linked:hover { text-decoration: none; border-color: var(--line-strong); }
.linked-label { display: block; font-size: 13px; color: var(--ink-soft); }
.linked-name { display: block; margin-top: 2px; font-family: var(--round); font-size: 18px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.linked-place { display: block; margin-top: 2px; font-size: 14px; color: var(--ink-soft); }

/* ── Footer ───────────────────────────────────────────────────────── */
.foot { margin-top: 64px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-soft); }
.foot-links { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px 20px; }
.foot-links a { display: inline-block; padding: 12px 0; margin: -12px 0; }

@media (min-width: 720px) {
  .page { padding-top: 64px; }
  .title { font-size: 42px; }
  .logo { width: 72px; height: 72px; border-radius: 18px; }
}
@media (max-width: 360px) {
  .event, .note, .linked { padding: 16px; }
  .event-actions button, .event-register { padding: 8px 12px; }
}
@media (prefers-reduced-motion: no-preference) {
  .button, .event-actions button, .event-register { transition: background-color 200ms ease; }
  .links a, .linked { transition: border-color 200ms ease; }
}

@media print {
  :root, :root:not([data-theme="light"]) {
    --ground: #FFFFFF; --card: #FFFFFF; --chip: #FFFFFF; --ink: #000000; --ink-soft: #333333;
    --line: #999999; --line-strong: #666666; --teal: #000000; --on-teal: #FFFFFF;
    color-scheme: light;
  }
  html, body { background: #FFFFFF !important; }
  .page { max-width: none; padding: 0; }
  .event-actions, .give, .foot-links { display: none !important; }
  .event, .note { break-inside: avoid; }
}

/* ── Open in Baab (assets/open-in-app.js, iPhone and iPad only) ─────── */
.app-cta { margin-top: 24px; }
.app-cta .button { width: 100%; }
.app-cta .fine { margin-top: 8px; font-size: 13px; color: var(--ink-soft); text-align: center; }
