:root {
  --terracotta: #CA6C40;
  --terracotta-deep: #A9532B;
  --ink: #1F2A33;
  --ink-2: #2B3945;
  --stone: #F4F2EE;
  --paper: #FFFFFF;
  --line: #E6E0D8;
  --muted: #69635D;
  --focus: #2F6FB2;
  --serif: 'Lora', Georgia, serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r-lg: 18px;
  --r: 12px;
  --shadow: 0 1px 2px rgb(31 42 51 / .06), 0 8px 24px rgb(31 42 51 / .08);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--stone); color: var(--ink);
  font: 400 16px/1.6 var(--sans); font-variant-numeric: tabular-nums;
}
img { max-width: 100%; display: block; }
a { color: var(--terracotta-deep); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--terracotta); color: #fff; border: 0; border-radius: 999px;
  padding: 12px 22px; font: 700 15px/1 var(--sans); text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--terracotta-deep); }
.btn--small { padding: 10px 18px; font-size: 14px; }

/* ---------- top navigation ---------- */
.nav { background: var(--paper); border-bottom: 1px solid var(--line); position: relative; z-index: 3; }
.nav__inner { display: flex; align-items: center; gap: 28px; min-height: 76px; }
.nav__brand img { height: 48px; width: auto; }
.nav__links { display: flex; gap: 26px; margin-right: auto; }
.nav__links a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav__links a:hover, .nav__links a[aria-current=page] { border-bottom-color: var(--terracotta); }
.nav__actions { display: flex; align-items: center; gap: 10px; }
.iconbtn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer;
}
.iconbtn:hover { border-color: var(--ink); }

/* ---------- hero ---------- */
.hero { position: relative; color: #fff; isolation: isolate; overflow: hidden; }
.hero__img { position: absolute; inset: 0; z-index: -2; }
.hero__img img { width: 100%; height: 100%; object-fit: cover; object-position: 30% 55%; }
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(90deg, rgb(20 28 36 / .92) 0%, rgb(20 28 36 / .78) 42%, rgb(20 28 36 / .35) 100%),
    linear-gradient(0deg, rgb(20 28 36 / .55) 0%, transparent 45%);
}
.hero__inner {
  display: grid; grid-template-columns: 1fr minmax(300px, 380px); gap: 40px; align-items: center;
  padding: 64px 0 120px;
}
.hero h1 { margin: 0; font: 600 clamp(32px, 4.4vw, 52px)/1.1 var(--serif); letter-spacing: -.01em; }
.hero__addr { margin: 10px 0 0; color: rgb(255 255 255 / .82); font-size: 16px; }

.datenav { display: flex; align-items: center; gap: 14px; margin-top: 34px; }
.datenav__btn {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgb(255 255 255 / .35); background: rgb(255 255 255 / .08); color: #fff; cursor: pointer;
}
.datenav__btn:hover { background: rgb(255 255 255 / .18); }
.datenav__text { min-width: 0; }
.datenav__date { margin: 0; font: 600 22px/1.3 var(--serif); }
.datenav__hijri { margin: 2px 0 0; color: #F2C9B3; font-weight: 600; font-size: 15px; }
.datenav__more { display: flex; gap: 10px; margin-top: 16px; padding-left: 58px; }
.pill {
  position: relative; display: inline-flex; align-items: center; border: 1px solid rgb(255 255 255 / .35);
  background: rgb(255 255 255 / .08); color: #fff; border-radius: 999px; padding: 7px 14px;
  font: 600 13.5px var(--sans); cursor: pointer;
}
.pill:hover { background: rgb(255 255 255 / .18); }
.datepick input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }

/* The one bold element: the next-jamaat card, coloured by the sky at this time of day. */
.next {
  --sky-a: #2A3654; --sky-b: #B4552F;
  border-radius: var(--r-lg); padding: 26px 26px 22px;
  background: linear-gradient(135deg, var(--sky-a), var(--sky-b));
  box-shadow: 0 20px 50px rgb(0 0 0 / .35); border: 1px solid rgb(255 255 255 / .14);
  transition: background 1.2s ease;
}
.next__label { margin: 0; font-weight: 600; font-size: 14px; color: rgb(255 255 255 / .85); }
.next__prayer { margin: 6px 0 0; font: 600 44px/1 var(--serif); }
.next__time { margin: 8px 0 0; font: 800 30px/1 var(--sans); }
.next__count { margin: 14px 0 0; font-weight: 600; font-size: 15px; min-height: 1.5em; color: rgb(255 255 255 / .92); }
.next__bar { height: 4px; border-radius: 4px; background: rgb(255 255 255 / .2); margin-top: 12px; overflow: hidden; }
.next__bar span { display: block; height: 100%; width: 0; background: #fff; border-radius: 4px; transition: width 1s linear; }
@media (prefers-reduced-motion: reduce) { .next, .next__bar span { transition: none; } }

/* ---------- prayer tiles ---------- */
.main { position: relative; z-index: 2; margin-top: -72px; }
.notice {
  margin: 0 0 14px; padding: 14px 18px; background: var(--paper); border-radius: var(--r);
  border-left: 5px solid var(--terracotta); box-shadow: var(--shadow); font-weight: 600;
}
.tiles {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden;
}
.tile { position: relative; padding: 22px 20px 20px; border-left: 1px solid var(--line); }
.tile:first-child { border-left: 0; }
.tile__name { margin: 0; font: 600 21px/1.2 var(--serif); }
.tile__jamaat { margin: 14px 0 0; font: 800 26px/1 var(--sans); letter-spacing: -.01em; }
.tile__jamaat small { display: block; font: 600 12.5px/1.4 var(--sans); color: var(--muted); letter-spacing: 0; margin-bottom: 4px; }
.tile__begin { margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.tile__begin b { color: var(--ink); font-weight: 700; }
.tile--sunrise { background: #FBFAF8; }
.tile--sunrise .tile__name { font-size: 17px; color: var(--muted); }
.tile--sunrise .tile__jamaat { font-size: 20px; color: var(--muted); }
.tile.is-past .tile__jamaat { color: #7A736C; }
.tile.is-past .tile__name { color: #4A545D; }
.tile.is-next { background: #FCF1EB; }
.tile.is-next::before { content: ''; position: absolute; inset: 0 0 auto; height: 4px; background: var(--terracotta); }
.tile__flag { display: inline-block; margin-top: 12px; font-size: 12.5px; font-weight: 700; color: var(--terracotta-deep); }
.empty { background: var(--paper); border-radius: var(--r-lg); padding: 28px; box-shadow: var(--shadow); margin: 0; }

/* ---------- lower content ---------- */
.cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; margin: 28px 0 56px; align-items: start; }
.side, .mainco { display: grid; gap: 24px; }
.block { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px 26px; }
.block h2 { margin: 0 0 12px; font: 600 22px/1.25 var(--serif); }
.block p { margin: 0 0 10px; }
.block p:last-child { margin-bottom: 0; }
.news__list { list-style: none; margin: 0; padding: 0; }
.news__list li { padding: 16px 0; border-top: 1px solid var(--line); }
.news__list li:first-child { border-top: 0; padding-top: 4px; }
.news__list h3 { margin: 0; font-size: 17px; line-height: 1.35; }
.news__list p { margin: 6px 0 0; color: var(--muted); white-space: pre-line; }
.news__list .pin { display: inline-block; font-size: 12.5px; font-weight: 700; color: var(--terracotta-deep); margin-bottom: 4px; }
.news__list .when { display: block; font-size: 13px; color: var(--muted); margin-top: 6px; }
.jumuah dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; }
.jumuah dt { color: var(--muted); font-weight: 600; }
.jumuah dd { margin: 0; font-weight: 800; font-size: 20px; text-align: right; }
.jumuah .is-today { color: var(--terracotta-deep); font-weight: 700; font-size: 14px; grid-column: 1 / -1; }

.foot { background: var(--ink); color: #D7D2CC; padding: 40px 0 calc(40px + env(safe-area-inset-bottom)); }
.foot__inner { display: flex; gap: 40px; align-items: center; flex-wrap: wrap; }
.foot__inner img { height: 58px; width: auto; }
.foot p { margin: 0 0 4px; font-size: 14.5px; }
.foot nav { display: flex; gap: 22px; margin-left: auto; }
.foot a { color: #fff; font-weight: 600; font-size: 14.5px; }

.sheet { border: 0; border-radius: var(--r-lg); padding: 24px; width: min(400px, 100% - 32px); background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.sheet::backdrop { background: rgb(0 0 0 / .45); }
.sheet h2 { margin: 0 0 12px; font: 600 21px var(--serif); }
.sheet fieldset { border: 0; padding: 0; margin: 0 0 18px; }
.sheet label { display: flex; gap: 10px; align-items: center; padding: 8px 0; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .tile:nth-child(4) { border-left: 0; }
  .tile:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .nav__links { display: none; }
  .nav__inner { justify-content: space-between; min-height: 64px; }
  .nav__brand img { height: 40px; }
  .hero__inner { grid-template-columns: 1fr; gap: 26px; padding: 34px 0 96px; }
  .cols { grid-template-columns: 1fr; }
  .foot nav { margin-left: 0; }
}
@media (max-width: 600px) {
  .wrap { width: calc(100% - 32px); }
  .datenav { margin-top: 22px; }
  .datenav__date { font-size: 19px; }
  .datenav__more { padding-left: 0; }
  .next { padding: 20px; }
  .next__prayer { font-size: 36px; }
  .next__time { font-size: 26px; }
  /* Tiles become a clean list: name | begins | jamaat */
  .tiles { grid-template-columns: 1fr; }
  .tile { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 14px; padding: 15px 18px; border-left: 0; border-top: 1px solid var(--line); }
  .tile:first-child { border-top: 0; }
  .tile.is-next::before { inset: 0 auto 0 0; width: 4px; height: auto; }
  .tile__name { font-size: 18px; }
  .tile__begin { margin: 0; order: 2; font-size: 14px; text-align: right; }
  .tile__begin b { display: block; font-size: 15px; }
  .tile__jamaat { margin: 0; order: 3; font-size: 19px; min-width: 88px; text-align: right; }
  .tile__jamaat small { font-size: 11.5px; margin-bottom: 1px; }
  .tile__flag { display: none; }
  .tile--sunrise { padding-block: 10px; }
  .tile--sunrise .tile__name, .tile--sunrise .tile__jamaat { font-size: 15px; }
  .block { padding: 20px; }
}

/* ---------- month page ---------- */
.month { width: min(1180px, 100% - 32px); margin: 28px auto 56px; }
.month__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.month__head h1 { font: 600 30px var(--serif); margin: 0; }
.month__scroll { overflow-x: auto; margin-top: 18px; background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.mtable { border-collapse: collapse; width: 100%; min-width: 860px; font-size: 14.5px; }
.mtable th, .mtable td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.mtable thead th { position: sticky; top: 0; background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 700; border-bottom-color: var(--ink-2); }
.mtable tbody th { text-align: left; font-weight: 700; }
.mtable td.j { font-weight: 800; }
.mtable tr.is-today { background: #FCF1EB; }
.mtable tr.is-today th { box-shadow: inset 4px 0 0 var(--terracotta); }
.mtable tr.is-fri th { color: var(--terracotta-deep); }
.mtable tbody tr:nth-child(even):not(.is-today) { background: #FBFAF8; }
@media print {
  .nav, .foot, .month__nav { display: none !important; }
  body { background: #fff; }
  .month { width: 100%; margin: 0; }
  .month__scroll { box-shadow: none; }
  .mtable thead th { background: #fff; color: #000; }
}
