
:root {
  --bg: #F6F4EE;
  --ink: #17150F;
  --muted: #6B6559;
  --faint: #9A9388;
  --fainter: #B5AFA3;
  --rule: #E3DFD5;
  --field: #C9C4B8;
  --accent: #1F5C45;
  --gold: #C9A24D;
  --gold-light: #E3C273;
  --cream: #F6F4EE;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: Geist, system-ui, -apple-system, sans-serif;
  --arabic: Amiri, "Noto Naskh Arabic", serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: 64px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
a:hover { color: var(--accent); }
h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; }
p { margin: 0; }
code, pre { font-family: var(--mono); }
[hidden] { display: none !important; }
.ar { font-family: var(--arabic); }
.num { font-variant-numeric: tabular-nums; }
.star { width: 12px; height: 12px; flex-shrink: 0; }
.wrap { position: relative; min-height: 100vh; display: flex; flex-direction: column; }
.page { padding: 0 var(--gutter); max-width: 1440px; margin: 0 auto; width: 100%; }

/* background lattice */
.lattice { position: absolute; top: 72px; left: 0; width: 100%; height: 420px; pointer-events: none; }

/* header */
.site-header {
  position: relative; height: 72px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: baseline; gap: 14px; text-decoration: none; }
.brand .en { font-family: var(--serif); font-size: 26px; }
.brand .ar { font-size: 20px; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 36px; font-size: 15px; font-weight: 500; }
.nav a { text-decoration: none; color: var(--muted); padding-bottom: 4px; border-bottom: 2px solid transparent; }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.menu { position: relative; }
.menu summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px;
  color: var(--muted); padding-bottom: 4px; border-bottom: 2px solid transparent;
}
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary, .menu summary:hover { color: var(--ink); }
.menu.current summary { color: var(--ink); border-bottom-color: var(--accent); }
.menu summary svg { transition: transform .15s; }
.menu[open] summary svg { transform: rotate(180deg); }
.menu-panel {
  position: absolute; top: 40px; right: 0; width: 560px; padding: 20px; z-index: 10;
  background: #fff; border: 1px solid var(--rule); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(23,21,15,.10);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
}
.menu-panel a { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 8px; text-decoration: none; }
.menu-panel a:hover { background: var(--bg); color: var(--ink); }
.menu-panel .t { font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.menu-panel .d { font-size: 13px; line-height: 1.45; color: var(--muted); font-weight: 400; }
.mnav { display: none; }

/* home hero */
.dateline { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding-top: 56px; font-size: 15px; color: var(--muted); position: relative; }
.dateline .loc { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dateline .loc strong { color: var(--ink); font-weight: 500; }
.dateline .loc a { color: var(--muted); text-underline-offset: 3px; }
.dateline .hijri { display: flex; align-items: baseline; gap: 14px; }
.dateline .hijri .ar { font-size: 22px; color: var(--ink); }
.hero { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 96px; align-items: start; padding-top: 40px; position: relative; }

.arch { position: relative; width: 560px; max-width: 100%; aspect-ratio: 560 / 640; }
.arch > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.arch-body { position: relative; height: 100%; padding: 31% 10% 8%; display: flex; flex-direction: column; color: var(--cream); }
.eyebrow { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.arch .eyebrow { color: var(--gold-light); }
.arch .name { display: flex; align-items: baseline; gap: 24px; margin-top: 16px; }
.arch .name .en { font-family: var(--serif); font-size: clamp(56px, 7vw, 104px); line-height: 1; letter-spacing: -.02em; }
.arch .name .ar { font-size: clamp(28px, 3.6vw, 52px); line-height: 1; opacity: .7; }
.arch .time { font-family: var(--serif); font-size: clamp(44px, 5vw, 72px); line-height: 1; letter-spacing: -.02em; margin-top: 12px; }
.arch .until { font-size: 18px; margin-top: 20px; opacity: .85; }
.arch .bar { margin-top: auto; height: 3px; background: rgba(246,244,238,.22); border-radius: 2px; overflow: hidden; }
.arch .bar > div { height: 3px; width: 0; background: var(--gold-light); transition: width .4s; }
.arch .span { display: flex; justify-content: space-between; font-size: 13px; margin-top: 10px; opacity: .8; }
.arch .msg { margin-top: 24px; font-size: 16px; line-height: 1.5; opacity: .9; }

.today .head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 16px; border-bottom: 1px solid var(--ink); }
.today .head span:last-child { font-size: 13px; color: var(--muted); }
.row { position: relative; display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--rule); font-size: 20px; }
.row:last-child { border-bottom: 0; }
.row .n { display: flex; align-items: baseline; gap: 12px; }
.row .ar { font-size: 20px; color: var(--faint); }
.row.past { color: var(--faint); }
.row.past .ar { color: var(--fainter); }
.row.next { font-weight: 600; }
.row.next .ar { color: var(--accent); font-weight: 400; }
/* marker sits in the gutter so prayer names stay aligned */
.dot { display: none; position: absolute; left: -20px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 4px; background: var(--accent); }
.row.next .dot { display: block; }

/* controls */
.controls { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--rule); display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 13px; font-weight: 500; color: var(--muted); }
.field input, .field select {
  height: 44px; padding: 0 14px; border: 1px solid var(--field); border-radius: 6px; background: #fff;
  font: inherit; font-size: 15px; color: var(--ink); min-width: 0;
}
.field input:focus, .field select:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.f-city { flex: 1 1 280px; }
.f-date { width: 200px; }
.f-method { width: 260px; }
.f-school { width: 160px; }
.btn {
  height: 44px; padding: 0 18px; border: 1px solid var(--ink); border-radius: 6px; background: var(--ink); color: #fff;
  font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.btn:disabled { opacity: .5; cursor: default; }
.error { margin-top: 16px; font-size: 14px; color: #8A2E2E; }

/* week */
.week { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--rule); }
.week table { width: 100%; border-collapse: collapse; font-size: 15px; margin-top: 20px; }
.week th { padding: 8px 0; font-weight: 500; color: var(--muted); text-align: right; }
.week th:first-child, .week td:first-child { text-align: left; }
.week td { padding: 12px 0; text-align: right; border-top: 1px solid var(--rule); }
.week tr.today td { font-weight: 600; }

/* dev strip + footer */
.devstrip { margin-top: 56px; padding-top: 40px; border-top: 1px solid var(--ink); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 96px; }
.devstrip h2 { font-size: 36px; line-height: 1.1; }
.devstrip p { margin-top: 16px; color: var(--muted); max-width: 480px; }
.more { margin-top: 16px; font-size: 15px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; color: var(--accent); }
.codes { display: flex; flex-direction: column; gap: 12px; }
pre.code {
  margin: 0; padding: 20px 22px; border-radius: 8px; font-size: 13.5px; line-height: 1.6; overflow-x: auto;
  background: var(--ink); color: var(--cream);
}
pre.code.light { background: #fff; color: var(--ink); border: 1px solid var(--rule); }
.site-footer { margin-top: 56px; padding: 24px 0 32px; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.site-footer nav { display: flex; gap: 24px; }
.site-footer a { color: var(--muted); text-decoration: none; }

/* developers page */
.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 80px; padding-top: 56px; position: relative; }
.toc { position: sticky; top: 24px; align-self: start; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.toc .h { font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 12px 10px; }
.toc a { text-decoration: none; padding: 8px 12px; border-radius: 6px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.toc a:hover { background: #ECE8DF; color: var(--ink); }
.toc hr { border: 0; border-top: 1px solid var(--rule); margin: 12px; width: auto; }
.doc { max-width: 880px; display: flex; flex-direction: column; gap: 64px; }
.doc h1 { font-size: 56px; line-height: 1.05; letter-spacing: -.02em; }
.doc .lede { margin-top: 16px; font-size: 18px; color: var(--muted); max-width: 640px; }
.doc section { display: flex; flex-direction: column; gap: 20px; padding-top: 32px; border-top: 1px solid var(--ink); }
.doc section:last-child { padding-bottom: 48px; }
.doc .sh { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.doc h2 { font-size: 32px; }
.doc h3 { font-family: var(--sans); font-size: 16px; font-weight: 600; margin-top: 8px; }
.doc .sh code { font-size: 14px; color: var(--muted); }
.doc p { color: var(--muted); }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc th { text-align: left; padding: 8px 0; font-weight: 500; color: var(--muted); }
.doc td { padding: 10px 0; border-top: 1px solid var(--rule); vertical-align: top; }
.doc td:first-child { font-family: var(--mono); white-space: nowrap; padding-right: 16px; }
.doc td.d { color: var(--muted); white-space: nowrap; padding-right: 16px; }
.doc .grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; font-size: 14px; color: var(--muted); }
.doc .grid3 div { padding-top: 12px; border-top: 1px solid var(--rule); }
.doc .grid3 strong { display: block; color: var(--ink); font-weight: 500; margin-bottom: 4px; }
.methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; font-size: 14px; }
.methods div { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rule); }
.methods code { color: var(--accent); width: 112px; flex-shrink: 0; }
.methods span { color: var(--muted); }

@media (max-width: 960px) {
  :root { --gutter: 24px; }
  .nav { display: none; }
  .mnav { display: block; position: relative; }
  .mnav summary { list-style: none; cursor: pointer; width: 44px; height: 44px; margin-right: -12px; display: flex; align-items: center; justify-content: center; }
  .mnav summary::-webkit-details-marker { display: none; }
  .mnav-panel { position: absolute; right: 0; top: 52px; z-index: 10; width: 240px; padding: 8px; background: #fff; border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 12px 32px rgba(23,21,15,.10); display: flex; flex-direction: column; }
  .mnav-panel a { text-decoration: none; padding: 12px; border-radius: 6px; font-size: 15px; font-weight: 500; }
  .mnav-panel a:hover { background: var(--bg); }
  .mnav-panel hr { border: 0; border-top: 1px solid var(--rule); margin: 4px 0; }
  .hero, .devstrip { grid-template-columns: 1fr; gap: 32px; }
  .dateline { flex-direction: column; align-items: flex-start; gap: 6px; padding-top: 24px; }
  .arch { width: 100%; }
  .arch-body { padding: 33% 8% 7%; }
  .row { font-size: 17px; padding: 12px 0; }
  .dot { left: -16px; width: 7px; height: 7px; margin-top: -3.5px; }
  .f-date, .f-method, .f-school { width: calc(50% - 10px); }
  .btn { width: 100%; justify-content: center; }
  .week { overflow-x: auto; }
  .week table { min-width: 560px; font-size: 14px; }
  .docs { grid-template-columns: 1fr; gap: 32px; padding-top: 32px; }
  .toc { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .toc .h, .toc hr { display: none; }
  .doc h1 { font-size: 40px; }
  .doc .grid3, .methods { grid-template-columns: 1fr; }
  .doc td, .doc td.d { white-space: normal; }
  .site-header { height: 60px; }
  .brand .en { font-size: 24px; }
  .brand .ar { font-size: 17px; }
  .lattice { top: 60px; height: 300px; }
}
