/* Masjid Abdullah. Simple and practical: a green page, white text, large type, no
   ornament. Built first for an older congregation reading prayer times on phones.
   Admin pages use a light theme of their own further down. */

/* Atkinson Hyperlegible Next (SIL OFL) — designed by the Braille Institute for
   low-vision readers. Self-hosted, variable weight 200–800. Amiri (SIL OFL) carries
   only the Arabic name. */
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/fonts/atkinson-next-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Amiri';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/amiri-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF;
}

:root {
  /* Public site. --bg is set per page from SHADES in src/html.ts. */
  --bg: #0f3428;
  --text: #ffffff;
  --text-soft: rgba(255, 255, 255, 0.78);   /* ≥ 6.5:1 on every shade */
  --line: rgba(255, 255, 255, 0.18);
  --raise: rgba(255, 255, 255, 0.09);        /* highlighted row, notice */
  --raise-2: rgba(255, 255, 255, 0.14);

  /* Admin (light). */
  --white: #ffffff;
  --stone-50: #f8f6f1;
  --stone-100: #f2eee5;
  --stone-200: #e5dfd2;
  --stone-300: #d3cbba;
  --ink: #15201a;
  --ink-2: #545d57;
  --green-950: #0b2a20;
  --green-900: #0f3a2c;
  --green-800: #155040;
  --green-700: #1d5a43;
  --green-600: #24704f;
  --green-100: #e2eee6;
  --green-50: #f0f6f2;
  --mint: #a8dcc0;
  --danger: #a3341f;

  --sans: 'Atkinson Hyperlegible Next', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --arabic: 'Amiri', 'Geeza Pro', 'Noto Naskh Arabic', serif;
  --radius: 12px;
  --radius-sm: 8px;
  --gutter: clamp(1.1rem, 5vw, 2rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.1875rem;   /* 19px: comfortable for older eyes on a phone */
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 700; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }
.prose p + p { margin-top: 0.75em; }

/* ---- public site ------------------------------------------------------------------- */

body.site { background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }
body.site a { color: var(--text); text-underline-offset: 4px; text-decoration-thickness: 1px; }
body.site :focus-visible { outline: 3px solid var(--text); outline-offset: 3px; border-radius: 4px; }
.wrap { width: 100%; max-width: 40rem; margin: 0 auto; padding: 0 var(--gutter); }

.site-header { padding: 1.5rem 0 0; }
.brand { display: inline-flex; align-items: baseline; gap: 0.75rem; text-decoration: none; }
.site .brand { color: var(--text); }
.brand-name { font-size: 1.5rem; font-weight: 700; }
.brand-ar { font-family: var(--arabic); font-size: 1.5rem; line-height: 1; color: var(--text-soft); }

.site-nav {
  display: flex; flex-wrap: wrap; gap: 0.25rem 1.4rem;
  margin-top: 1rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--line);
}
.site .site-nav a { color: var(--text-soft); text-decoration: none; font-size: 1.05rem; padding: 0.2rem 0; }
.site .site-nav a:hover { color: var(--text); }
.site .site-nav a[aria-current='page'] { color: var(--text); font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 8px; }

.page { padding-top: 2rem; padding-bottom: 4rem; flex: 1; }
.page h1 { font-size: 2rem; margin-bottom: 1.5rem; }
.soft { color: var(--text-soft); }
.lead { font-size: 1.2rem; color: var(--text-soft); margin: -0.75rem 0 2rem; }

/* Prayer times */
.date { color: var(--text-soft); font-size: 1.05rem; }
.next { margin: 1.5rem 0 1.75rem; }
.next-label { color: var(--text-soft); font-size: 1.05rem; }
.next-main { font-size: clamp(2.4rem, 11vw, 3.6rem); font-weight: 700; line-height: 1.1; margin-top: 0.15rem; }
.next-until { font-size: 1.25rem; margin-top: 0.3rem; }

.notice {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem;
  background: var(--raise); border-radius: var(--radius); padding: 1rem 1.15rem; margin-bottom: 1.75rem;
  text-decoration: none;
}
.notice span { color: var(--text-soft); text-decoration: underline; text-underline-offset: 4px; }
.notice:hover { background: var(--raise-2); }

.times { width: 100%; border-collapse: collapse; font-size: 1.3rem; }
.times thead th { font-size: 1rem; font-weight: 400; color: var(--text-soft); text-align: right; padding: 0 0.75rem 0.5rem; }
.times tbody th, .times td { padding: 0.8rem 0.75rem; border-top: 1px solid var(--line); }
.times tbody th { text-align: left; font-weight: 700; }
.times td { text-align: right; white-space: nowrap; color: var(--text-soft); }
.times td.iqamah { color: var(--text); font-weight: 700; }
.times .row-note { display: block; font-size: 0.95rem; font-weight: 400; color: var(--text-soft); }
.times tr.is-sunrise th, .times tr.is-sunrise td { font-weight: 400; color: var(--text-soft); font-size: 1.1rem; }
.times tr.is-next th, .times tr.is-next td { background: var(--raise-2); color: var(--text); border-top-color: transparent; }
.times tr.is-next + tr th, .times tr.is-next + tr td { border-top-color: transparent; }
.times tr.is-next th { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.times tr.is-next td:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.small-note { margin-top: 0.85rem; color: var(--text-soft); font-size: 1rem; }

.jumuah { margin-top: 2.5rem; padding-top: 1.75rem; border-top: 1px solid var(--line); }
.jumuah h2 { font-size: 1.4rem; margin-bottom: 0.75rem; }
.jumuah-row + .jumuah-row { margin-top: 1rem; }
.jumuah-name { font-weight: 700; }
.jumuah-times { font-size: 1.3rem; color: var(--text-soft); }
.jumuah-times strong { color: var(--text); }
.jumuah-times .gap { display: inline-block; width: 1.5rem; }

/* News, programs, donate, contact share one list style. */
.list { display: grid; }
.item { padding: 1.5rem 0; border-top: 1px solid var(--line); display: grid; gap: 0.5rem; }
.item:first-child { border-top: 0; padding-top: 0; }
.item h2 { font-size: 1.35rem; }
.item .prose { color: var(--text-soft); }
.meta { color: var(--text-soft); }
.big { font-size: 1.3rem; }

.raised { font-size: 1.15rem; color: var(--text-soft); margin-top: 0.5rem; }
.raised strong { color: var(--text); font-size: 1.5rem; }
.bar { height: 0.75rem; border-radius: 999px; background: var(--raise-2); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--text); }

.button {
  display: inline-block; margin-top: 0.5rem;
  background: var(--text); color: var(--bg) !important; text-decoration: none !important;
  font-weight: 700; font-size: 1.15rem; padding: 0.8rem 1.5rem; border-radius: var(--radius-sm);
}
.button:hover { background: rgba(255, 255, 255, 0.88); }

.site-footer { border-top: 1px solid var(--line); padding: 1.5rem 0 2.5rem; font-size: 0.95rem; color: var(--text-soft); }
.site-footer .wrap { display: grid; gap: 0.5rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.site .footer-links a { color: var(--text-soft); }

/* ---- buttons & forms --------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: inherit; font-weight: 600; font-size: 0.95rem;
  padding: 0.7rem 1.25rem; border-radius: var(--radius-sm);
  border: 1px solid var(--stone-300); background: var(--white); color: var(--ink);
  text-decoration: none; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--stone-50); color: var(--ink); }
.btn-primary { background: var(--green-700); border-color: transparent; color: var(--white); }
.btn-primary:hover { background: var(--green-800); color: var(--white); }
.btn-danger { color: var(--danger); border-color: #e7c4bb; }
.btn-danger:hover { background: #fbefec; color: var(--danger); }
.btn-block { width: 100%; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--green-700); cursor: pointer; }
.linklike:hover { text-decoration: underline; }
.linklike.danger { color: var(--danger); }

.stack { display: grid; gap: 1.1rem; }
.field { display: grid; gap: 0.35rem; }
.field > span { font-size: 0.85rem; font-weight: 600; }
.field small { font-size: 0.8rem; }
.field-short { max-width: 12rem; }
input[type='text'], input[type='email'], input[type='password'], input[type='url'], input[type='number'],
input[type='date'], input[type='time'], select, textarea {
  font: inherit; font-size: 1rem; color: var(--ink);
  width: 100%; padding: 0.65rem 0.8rem; border-radius: var(--radius-sm);
  border: 1px solid var(--stone-300); background: var(--white);
}
input[type='time'] { font-variant-numeric: tabular-nums; min-width: 8.5rem; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(36, 112, 79, 0.15); }
.check { display: flex; align-items: center; gap: 0.6rem; font-weight: 500; font-size: 0.95rem; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--green-700); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }

/* ---- admin ------------------------------------------------------------------------- */

body.is-admin { background: var(--stone-50); }
.admin-header { background: var(--white); border-bottom: 1px solid var(--stone-200); position: sticky; top: 0; z-index: 10; }
.admin-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.75rem; }
.admin-header .brand-mark { --star-hole: var(--white); }
.admin-who { display: flex; gap: 1.25rem; align-items: center; font-size: 0.9rem; }
.admin-who a { text-decoration: none; }
.admin-nav { display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; padding-bottom: 0.6rem; }
.admin-nav::-webkit-scrollbar { display: none; }
.admin-nav a {
  white-space: nowrap; text-decoration: none; color: var(--ink-2); font-size: 0.9rem; font-weight: 500;
  padding: 0.45rem 0.8rem; border-radius: 999px;
}
.admin-nav a:hover { background: var(--stone-100); color: var(--ink); }
.admin-nav a[aria-current='page'] { background: var(--green-700); color: var(--white); }
.admin-main > * { max-width: 52rem; }
.admin-main { padding-top: 2rem; padding-bottom: 5rem; display: grid; gap: 1.25rem; align-content: start; }
.admin-main h1 { font-size: 1.75rem; }
.admin-main .card { padding: 1.5rem; box-shadow: none; }
.h3 { font-size: 1.1rem; }
.flash { background: var(--green-100); color: var(--green-900); border-radius: var(--radius-sm); padding: 0.75rem 1rem; font-weight: 500; }
.flash-error { background: #fbefec; color: var(--danger); }
.back { text-decoration: none; font-size: 0.9rem; }
.empty { color: var(--ink-2); padding: 1.5rem; border: 1px dashed var(--stone-300); border-radius: var(--radius); text-align: center; }

.table-scroll { overflow-x: auto; background: var(--white); border: 1px solid var(--stone-200); border-radius: var(--radius); }
.edit-table { width: 100%; border-collapse: collapse; }
.edit-table th, .edit-table td { padding: 0.7rem 0.75rem; text-align: left; border-top: 1px solid var(--stone-100); vertical-align: middle; }
.edit-table thead th { border-top: 0; font-size: 0.85rem; font-weight: 600; color: var(--ink-2); }
.edit-table tbody th { font-weight: 600; white-space: nowrap; }
.edit-table input[type='text'] { min-width: 10rem; }

.jumuah-edit { border: 1px solid var(--stone-200); margin: 0; }
.jumuah-edit legend { font-weight: 600; padding: 0 0.4rem; }

.item-list { list-style: none; margin: 0; padding: 0; background: var(--white); border: 1px solid var(--stone-200); border-radius: var(--radius); overflow: hidden; }
.item-list li + li { border-top: 1px solid var(--stone-100); }
.item-list a, .item-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.95rem 1.15rem; text-decoration: none; color: var(--ink); }
.item-list a:hover { background: var(--stone-50); }
.item-list a span, .item-row span { font-size: 0.85rem; color: var(--ink-2); text-align: right; }
.item-row > div { display: grid; }
.item-row > div span { text-align: left; }
.pill { display: inline-block; font-size: 0.72rem; font-weight: 600; color: var(--green-800); background: var(--green-100); padding: 0.12rem 0.5rem; border-radius: 999px; }
.pill-muted { color: var(--ink-2); background: var(--stone-100); }
.add-card summary { cursor: pointer; font-weight: 600; color: var(--green-700); }
.add-card[open] summary { margin-bottom: 1.25rem; }
.danger-zone { padding-top: 0.5rem; }

.activity { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; background: var(--white); border: 1px solid var(--stone-200); border-radius: var(--radius); }
.activity li { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; padding: 0.75rem 1.15rem; font-size: 0.9rem; }
.activity li + li { border-top: 1px solid var(--stone-100); }
.activity time { color: var(--ink-2); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .activity li { grid-template-columns: 1fr; gap: 0.15rem; } }

.login-wrap { max-width: 24rem; margin: 0 auto; padding: 4.5rem var(--gutter); display: grid; gap: 1.1rem; }
.login-wrap .brand { margin-bottom: 1.5rem; }
.login-wrap .brand-mark { --star-hole: var(--stone-50); }
.login-wrap h1 { font-size: 1.6rem; }
.alt-login { margin-top: 1rem; font-size: 0.9rem; }
.alt-login summary { cursor: pointer; color: var(--ink-2); }
.alt-login form { margin-top: 1rem; }


.brand-mark { width: 1.6rem; height: 1.6rem; color: var(--green-700); flex: none; }
.is-admin .brand { color: var(--ink); align-items: center; }
.is-admin .brand-name { font-size: 1.05rem; }
.is-admin a { color: var(--green-700); }

/* ---- lobby display ----------------------------------------------------------------- */

body.is-display {
  background: var(--green-950); color: var(--white); min-height: 100vh; overflow: hidden;
  --star-hole: var(--green-950); --line: rgba(255, 255, 255, 0.1); --text: #fff; --text-soft: rgba(255, 255, 255, 0.72);
  --raise-2: rgba(168, 220, 192, 0.14);
}
.display { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; padding: 3vh 4vw; gap: 3vh; }
.display-head { display: flex; justify-content: space-between; align-items: flex-start; }
.display .brand { color: var(--white); align-items: center; }
.display .brand-mark { width: 3vw; height: 3vw; color: var(--mint); }
.display .brand-text { display: flex; align-items: baseline; gap: 1vw; }
.display .brand-name { font-size: 2vw; }
.display .brand-ar { font-size: 2.3vw; color: var(--mint); }
.display-clock { text-align: right; }
.display-clock span { font-size: 4.5vw; font-weight: 700; line-height: 1; }
.display-clock p { color: var(--text-soft); font-size: 1.3vw; margin-top: 0.6vh; }
.display-body { display: grid; grid-template-columns: 1fr 1.4fr; gap: 5vw; align-items: center; }
.display .next-label { color: var(--mint); font-size: 1.4vw; }
.display .next-main { font-size: 8vw; }
.display .next-meta { font-size: 1.8vw; color: var(--text-soft); margin-top: 1vh; }
.display .next-meta strong { color: var(--white); }
.display .next-until { display: inline; color: var(--mint); font-size: 1.8vw; margin-left: 0.6vw; }
.display .times { font-size: 2.4vw; }
.display .times thead th { font-size: 1.1vw; }
.display .times tbody th, .display .times td { padding: 1.6vh 1.2vw; }
.display .times tr.is-sunrise th, .display .times tr.is-sunrise td { font-size: 1.7vw; }
.display .times tr.is-next th, .display .times tr.is-next td { color: var(--mint); }
.display-foot { display: flex; gap: 3vw; font-size: 1.4vw; color: var(--text-soft); border-top: 1px solid var(--line); padding-top: 2vh; }
.display-foot strong { color: var(--white); }
.display-news { margin-left: auto; color: var(--mint); }
@media (orientation: portrait) { .display-body { grid-template-columns: 1fr; } }

.item-row > .row-actions { display: flex; align-items: center; gap: 1.25rem; }
.reset summary { list-style: none; font-size: 0.9rem; }
.reset summary::-webkit-details-marker { display: none; }
.reset[open] summary { margin-bottom: 0.5rem; }
.inline-form { display: flex; gap: 0.5rem; }
.inline-form input { min-width: 10rem; padding: 0.45rem 0.65rem; font-size: 0.9rem; }
.inline-form .btn { padding: 0.45rem 0.9rem; }
@media (max-width: 560px) { .item-row { flex-direction: column; align-items: flex-start; } }
body.is-admin { color: var(--ink); font-size: 1.0625rem; }
.is-admin .wrap { max-width: 60rem; }
