/* Palette: ihram white / Madinah night, the green dome, kiswah gold, desert sand. */
:root {
  --bg: #fbfbf8;
  --ink: #1d2433;
  --muted: #6b7280;
  --dome: #1f7a5a;
  --gold: #b8901c;
  --sand: #e6d9bd;
  --line: #e7e4dc;
  --kaaba: #1d2433;
  --radius-lg: 22px;
  --radius-sm: 10px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #121a2b;
  --ink: #eef0f4;
  --muted: #9aa3b5;
  --dome: #38b48b;
  --gold: #e2bd4c;
  --sand: #2c3650;
  --line: #24304a;
  --kaaba: #05070c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.5 "Plus Jakarta Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 520px; margin: 0 auto; padding: 20px 16px 40px; }

h2 {
  font: 700 1.05rem/1.3 "Plus Jakarta Sans", system-ui, sans-serif;
  margin: 0 0 12px;
}
section { padding: 22px 0; border-top: 1px solid var(--line); }
.muted { color: var(--muted); }
.small { font-size: .85rem; margin: -6px 0 14px; }

/* Countdown: the number is set in Kufi, the one display face on the page. */
.countdown { padding: 8px 0 18px; }
.countdown-num {
  font-family: "Reem Kufi", "Plus Jakarta Sans", sans-serif;
  font-weight: 700; font-size: clamp(3.4rem, 18vw, 4.6rem); line-height: 1;
  margin: 0; color: var(--dome); display: flex; align-items: baseline; gap: 10px;
}
.countdown-num small { font: 500 1.1rem/1 "Plus Jakarta Sans", sans-serif; color: var(--ink); }
.countdown-sub { margin: 10px 0 0; color: var(--muted); max-width: 40ch; }

/* Route — the memorable element. */
.route { border-top: 0; padding-top: 6px; }
#route-svg { width: 100%; height: auto; display: block; overflow: visible; }
#route-svg text { font: 600 11px "Plus Jakarta Sans", sans-serif; fill: var(--muted); }
.dome { fill: var(--dome); stroke: var(--dome); stroke-width: 2; }
.kaaba { fill: var(--kaaba); }
.kaaba-band { fill: var(--gold); }
.marker circle { stroke: var(--bg); stroke-width: 3; }
.checkpoint { fill: var(--bg); }
.marker text { font: 700 11px "Plus Jakarta Sans", sans-serif; fill: #fff !important; }
.marker.me circle { fill: var(--dome); }
.marker.spouse circle { fill: var(--gold); }
.route-legend { margin: 6px 0 0; }
.route-legend b { font-weight: 700; }

/* Today */
.today-grid { display: grid; grid-template-columns: 120px 1fr; gap: 18px; align-items: center; }
.ring { width: 120px; height: 120px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring-bg { stroke: var(--sand); }
.ring-fg { stroke: var(--dome); stroke-linecap: round; transition: stroke-dashoffset 900ms cubic-bezier(.2,.7,.2,1); }
.ring-fg.over { stroke: var(--gold); }
.today-text p { margin: 0; }
.today-text .big { font: 700 1.6rem/1.2 "Plus Jakarta Sans", sans-serif; }

/* Plan: one row per week, a timeline down the left edge ending at the Kaaba. */
.plan-weeks { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.plan-week { position: relative; margin: 0 0 6px; }
.plan-week::before {
  content: ""; position: absolute; left: -21px; top: 17px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--line);
}
.plan-week.past::before { background: var(--sand); border-color: var(--sand); }
.plan-week.current::before { background: var(--dome); border-color: var(--dome); }
.plan-week.taper::before { border-color: var(--gold); }
.plan-week details { border-radius: var(--radius-sm); }
.plan-week.current details { background: color-mix(in srgb, var(--dome) 8%, transparent); }
.plan-week summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
}
.plan-week summary::-webkit-details-marker { display: none; }
.plan-week summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.pw-title { font-weight: 700; }
.pw-title .tag { font: 600 .72rem/1 "Plus Jakarta Sans", sans-serif; color: var(--gold); margin-left: 6px; }
.pw-title .tag.now { color: var(--dome); }
.pw-dates { color: var(--muted); font-size: .85rem; text-align: right; white-space: nowrap; }
.pw-line { grid-column: 1 / -1; color: var(--muted); font-size: .88rem; }
.plan-week.past .pw-title { color: var(--muted); }
.pw-days { margin: 2px 0 8px; padding: 0 10px; display: grid; gap: 1px; }
.pw-day { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; padding: 7px 0; border-top: 1px dashed var(--line); align-items: start; }
.pw-day.is-today .pw-wd { color: var(--dome); }
.pw-wd { font-weight: 700; font-size: .85rem; line-height: 1.3; }
.pw-wd small { display: block; font-weight: 500; color: var(--muted); }
.pw-what { font-size: .92rem; line-height: 1.35; }
.pw-what small { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.pw-status { display: flex; gap: 4px; font-size: .8rem; white-space: nowrap; }
.pw-chip { min-width: 30px; text-align: center; padding: 2px 5px; border-radius: 999px; background: var(--sand); }
.pw-chip.done { background: color-mix(in srgb, var(--dome) 22%, transparent); }
.pw-notes { grid-column: 1 / -1; margin: 0; padding: 0; list-style: none; font-size: .85rem; }
.pw-notes li::before { content: "✦ "; color: var(--gold); }
.plan-end { position: relative; margin-top: 10px; padding: 6px 10px; font-weight: 700; }
.plan-end::before {
  content: ""; position: absolute; left: -22px; top: 9px; width: 14px; height: 14px; border-radius: 2px;
  background: var(--kaaba); box-shadow: inset 0 4px 0 -1px var(--kaaba), inset 0 -9px 0 -6px var(--gold);
}

/* Together */
.person { padding: 10px 0; }
.person + .person { border-top: 1px dashed var(--line); }
.person-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.person-name { font-weight: 700; }
.person-stats { color: var(--muted); font-size: .9rem; text-align: right; }
.dots { display: grid; grid-template-columns: repeat(14, 1fr); gap: 7px; }
.dot { aspect-ratio: 1; border-radius: 50%; background: var(--sand); position: relative; }
.dot.logged { background: var(--dome); }
.person.spouse .dot.logged { background: var(--gold); }
.dot.workout { box-shadow: 0 0 0 1.5px var(--bg), 0 0 0 3px var(--gold); }
.person.spouse .dot.workout { box-shadow: 0 0 0 1.5px var(--bg), 0 0 0 3px var(--dome); }
.dot.today { outline: 1.5px solid var(--ink); outline-offset: 2px; }

/* Weight */
#weight-svg { width: 100%; height: auto; display: block; }
#weight-svg .w-line { fill: none; stroke: var(--dome); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
#weight-svg .w-pt { fill: var(--bg); stroke: var(--dome); stroke-width: 2; }
#weight-svg .w-target { stroke: var(--gold); stroke-dasharray: 4 5; stroke-width: 1.5; }
#weight-svg text { font: 500 10px "Plus Jakarta Sans", sans-serif; fill: var(--muted); }
#weight-summary { margin: 8px 0 0; }

/* Milestones */
#milestone-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
#milestone-list li {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: .9rem;
}
#milestone-list li.mine { border-color: var(--dome); }
#milestone-list .who { color: var(--muted); }
#milestone-list li.empty { border-style: dashed; color: var(--muted); }

.note { color: var(--muted); font-size: .85rem; text-align: center; margin-top: 18px; }

/* Celebration overlay */
.celebrate { position: fixed; inset: 0; display: grid; place-items: center; z-index: 10;
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(3px); }
.celebrate[hidden] { display: none; }
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.celebrate-card {
  position: relative; background: var(--bg); border: 2px solid var(--gold); border-radius: var(--radius-lg);
  padding: 26px 24px 20px; width: min(320px, calc(100% - 32px)); text-align: center;
  animation: pop 520ms cubic-bezier(.2,1.4,.4,1) both;
}
.celebrate-kicker { font: 700 2rem/1 "Reem Kufi", sans-serif; color: var(--gold); margin: 0 0 8px; }
#celebrate-text { font-size: 1.1rem; margin: 0 0 18px; }
#celebrate-close {
  font: 700 1rem "Plus Jakarta Sans", sans-serif; border: 0; border-radius: var(--radius-sm);
  background: var(--dome); color: #fff; padding: 12px 20px; width: 100%; cursor: pointer;
}
#celebrate-close:focus-visible, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .ring-fg { transition: none; }
  .celebrate-card { animation: none; }
}
