/* ══════════════════════════════════════════════════════════
   Islamic Calendar — page styles on top of the shared sakina.css
   Theming: data-theme="light" | "dark" (shared across projects)
   Direction: dir="ltr" (English) | "rtl" (Arabic)
   ══════════════════════════════════════════════════════════ */

/* Occasion colours, drawn from the Sakīna family */
:root, [data-theme="light"] {
  --eid: #C2455A; --night: #7048C8; --fasting: #0E7C72; --blessed: #D9A441; --historical: #3456C8; --weekly: #B54A30;
}
[data-theme="dark"] {
  --eid: #F291A5; --night: #BDA6FF; --fasting: #5DD6C6; --blessed: #EBC46F; --historical: #97ADFF; --weekly: #F5A487;
}
.cat-eid { background: var(--eid); } .cat-night { background: var(--night); } .cat-fasting { background: var(--fasting); }
.cat-blessed { background: var(--blessed); } .cat-historical { background: var(--historical); } .cat-weekly { background: var(--weekly); }
.cat-soft-eid { background: var(--rose-soft); color: var(--rose); }
.cat-soft-night { background: var(--jinn-soft); color: var(--jinn); }
.cat-soft-fasting { background: var(--primary-soft); color: var(--primary); }
.cat-soft-blessed { background: var(--gold-soft); color: var(--gold); }
.cat-soft-historical { background: var(--cal-soft); color: var(--cal); }
.cat-soft-weekly { background: var(--adhan-soft); color: var(--adhan); }

.ar-label { display: block; }

.cal-page { display: flex; flex-direction: column; gap: 28px; padding-top: clamp(16px, 3vw, 28px); }

/* ── Notice ─────────────────────────────────────────────── */
.notice-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 16px; background: var(--gold-soft); color: var(--gold); font-size: 14.5px; font-weight: 500; }

/* ── Header controls ───────────────────────────────────── */
.view-switch { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--sunk); }
.seg-btn { min-height: 36px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); font: 600 14px/1 var(--font-ui); transition: background-color .2s, color .2s, box-shadow .2s; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
[dir="rtl"] .seg-btn { font-family: var(--font-ar-ui); }
.lang-btn #langLabel { font-family: var(--font-ar-ui); font-size: 15px; font-weight: 600; }
[dir="rtl"] .lang-btn #langLabel { font-family: var(--font-ui); font-size: 14px; }

/* ── Today ─────────────────────────────────────────────── */
.today { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px 40px; flex-wrap: wrap; min-height: 176px; }
.today__main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.today__title { font-size: clamp(42px, 6vw, 76px); }
.today__title em { color: var(--accent); }
.today__sub { align-self: flex-start; font-family: var(--font-ar-ui); font-weight: 600; font-size: clamp(18px, 2vw, 24px); color: var(--gold); }
.today__sub[lang="en"] { font-family: var(--font-display); }
.today__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.today-chip { border: 0; cursor: pointer; min-height: 30px; }
.today__side { display: flex; align-items: stretch; gap: 16px; }
.ramadan { display: flex; flex-direction: column; justify-content: space-between; gap: 12px; width: 250px; padding: 18px 20px; }
.ramadan__top { display: flex; align-items: center; justify-content: space-between; color: var(--gold); }
.ramadan__top .sk-eyebrow { font-size: 11.5px; }
.ramadan__count { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ramadan__count .sk-display { font-size: 46px; line-height: 1; }
.ramadan__count > span:last-child { font-size: 15px; font-weight: 500; color: var(--text-2); }
.ramadan__date { font-size: 13px; color: var(--text-3); }
.today__moon {
  position: relative; overflow: hidden; flex: none;
  width: 150px; min-height: 172px; padding-bottom: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 12px;
  background: linear-gradient(180deg, #0B1D38 0%, #173A5E 100%);
}
.today__moon i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #FFF6DC; }
.today__moon-disc { width: 60px; height: 60px; --moon-lit: #F7EDCB; --moon-dark: rgba(6, 14, 28, .5); box-shadow: inset var(--x, 0) 0 0 0 var(--moon-lit), 0 0 26px rgba(247, 237, 203, .4); }
.today__moon-name { font-size: 12.5px; font-weight: 600; color: #DDE6EF; text-align: center; padding-inline: 8px; }

/* ── Layout ────────────────────────────────────────────── */
.app-main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.app-main.year-mode { grid-template-columns: minmax(0, 1fr); }
.app-main.year-mode .sidebar { display: none; }

/* ── Month card ───────────────────────────────────────── */
.calendar-section { padding: clamp(14px, 2.2vw, 24px); border-radius: 28px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.cal-nav { display: flex; align-items: center; gap: 12px; }
.nav-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-hijri { font-size: clamp(26px, 3vw, 36px); }
.nav-gregorian { font-size: 14px; font-weight: 500; color: var(--text-3); }
.cal-nav .nav-btn:first-child { order: 0; }
.cal-nav .nav-info { order: 1; }
.cal-nav #nextMonth { order: 2; }
.cal-nav .btn-today { order: 3; margin-inline-start: auto; }
.cal-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.leg-dot { width: 9px; height: 9px; border-radius: 50%; }
.legend-moon { margin-inline-start: auto; color: var(--text-3); }
.legend-moon .sk-moon { width: 12px; height: 12px; }

.calendar-grid { display: flex; flex-direction: column; gap: 8px; }
.cal-weekdays, .cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.wd { padding: 4px 12px; font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.wd.fri { color: var(--weekly); }
[dir="rtl"] .wd { letter-spacing: 0; text-transform: none; font-family: var(--font-ar-ui); font-size: 13.5px; }

.day-cell {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
  min-height: 100px; padding: 11px 12px 10px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--surface);
  transition: transform .35s var(--spring), border-color .2s, box-shadow .2s;
}
.day-cell.empty { border-color: transparent; background: transparent; }
.day-cell:not(.empty):hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.day-cell.is-friday { background: var(--surface-2); }
.day-cell.is-special { cursor: pointer; }
.day-cell.is-special:active { transform: scale(.97); }
.day-cell.is-today { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.day-cell.is-today .day-hijri { color: var(--primary); }
.day-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.day-hijri { font-size: 22px; font-weight: 700; line-height: 1; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
[dir="rtl"] .day-hijri { font-family: var(--font-ar-ui); font-weight: 700; }
.day-moon { width: 14px; height: 14px; margin-top: 2px; }
.day-label { align-self: flex-start; max-width: 100%; padding: 3px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-bottom { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.day-gregorian { font-size: 12.5px; font-weight: 500; color: var(--text-3); font-variant-numeric: tabular-nums; }
.day-dots { display: flex; gap: 3px; }
.day-dot { width: 6px; height: 6px; border-radius: 50%; }
.cal-disclaimer { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text-3); }
.cal-disclaimer em { color: var(--text-2); }

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.sidebar-card { padding: 22px; border-radius: 28px; display: flex; flex-direction: column; gap: 12px; }
.sidebar-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 17px; font-weight: 700; }
.sidebar-title > span:first-child, .sidebar-title .ar-label { display: inline; }
.sidebar-title { font-family: var(--font-ar-ui); font-weight: 500; font-size: 14px; color: var(--text-3); }
.sidebar-title .ar-label { font-family: var(--font-ui); font-weight: 700; font-size: 17px; color: var(--text); }
[dir="rtl"] .sidebar-title { font-family: var(--font-ui); font-weight: 500; }
[dir="rtl"] .sidebar-title .ar-label { font-family: var(--font-ar-ui); font-weight: 700; }
.upcoming-list { display: flex; flex-direction: column; gap: 2px; margin-inline: -10px; }
.upcoming-empty { margin: 0; padding: 0 10px; font-size: 14px; color: var(--text-3); }
.upcoming-item { display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: 16px; cursor: pointer; transition: background-color .2s; }
.upcoming-item:hover { background: var(--sunk); }
.upcoming-dot { width: 36px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 999px 999px 10px 10px; }
.upcoming-dot > span { width: 12px; height: 12px; border-radius: 50%; }
.upcoming-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.upcoming-ar { font-family: var(--font-ar-ui); font-weight: 600; font-size: 15px; line-height: 1.6; color: var(--gold); }
.upcoming-name { font-size: 15px; font-weight: 600; line-height: 1.35; }
.upcoming-date { font-size: 12.5px; color: var(--text-3); }
.upcoming-countdown { flex: none; padding: 4px 10px; border-radius: 999px; background: var(--sunk); font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.weekly-info { display: flex; flex-direction: column; gap: 14px; }
.weekly-item { display: flex; gap: 12px; align-items: flex-start; }
.weekly-icon { width: 9px; height: 9px; margin-top: 8px; flex: none; border-radius: 50%; }
.weekly-item strong { display: block; font-size: 15px; }
.weekly-item span { display: block; font-size: 14px; line-height: 1.55; color: var(--text-2); }
.month-title { margin: 0; font-family: var(--font-display); font-size: 26px; line-height: 1.1; }
[dir="rtl"] .month-title { font-family: var(--font-ar-ui); font-weight: 700; font-size: 22px; line-height: 1.4; }
.month-body { margin: 0; font-size: 14px; color: var(--text-2); }
.month-highlights { display: flex; flex-wrap: wrap; gap: 8px; }
.month-tag { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; background: var(--sunk); font-size: 13px; font-weight: 600; }
.month-tag-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ── Year view ─────────────────────────────────────────── */
.year-section { padding: clamp(14px, 2.2vw, 24px); border-radius: 28px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.year-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.year-title { font-size: clamp(28px, 3vw, 36px); min-width: 5ch; text-align: center; }
.year-nav .legend { flex: 1 1 100%; }
.year-hint { font-size: 13px; color: var(--text-3); }
.year-track { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 12px; max-height: calc(100dvh - 240px); scroll-snap-type: x proximity; scrollbar-width: thin; }
.year-col { flex: 0 0 auto; width: 150px; scroll-snap-align: start; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-2); overflow: hidden; }
.year-col.is-current-month { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.yc-head { position: sticky; top: 0; z-index: 1; padding: 12px 12px 10px; background: var(--surface-2); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; }
.yc-month-ar { font-family: var(--font-display); font-size: 21px; line-height: 1.15; }
[dir="rtl"] .yc-month-ar { font-family: var(--font-ar-ui); font-weight: 700; font-size: 17px; line-height: 1.4; }
.yc-month-en { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.yc-month-en.yc-sec-ar { font-family: var(--font-ar-ui); font-weight: 600; color: var(--gold); }
.yc-greg { font-size: 11.5px; color: var(--text-3); }
.yc-days { display: flex; flex-direction: column; gap: 2px; padding: 6px; overflow-y: auto; }
.yc-day { display: grid; grid-template-columns: 2.6ch 1fr auto; align-items: center; gap: 4px; min-height: 26px; padding: 3px 6px; border-radius: 8px; font-size: 12.5px; border: 1px solid transparent; }
.yc-dow { color: var(--text-3); font-size: 11px; }
.yc-num { font-weight: 700; font-variant-numeric: tabular-nums; }
.yc-gnum { color: var(--text-3); font-size: 11px; }
.yc-day .yc-dot { width: 7px; height: 7px; border-radius: 50%; }
.yc-day.is-fri .yc-num { color: var(--weekly); }
.yc-day.is-today { border-color: var(--primary); background: var(--primary-soft); }
.yc-day.is-today .yc-num { color: var(--primary); }
.yc-day.is-special { cursor: pointer; }
.yc-day.is-special:hover { background: var(--sunk); }

/* ── Modal (dialog on desktop, sheet on phones) ────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(6, 12, 20, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .25s var(--ease);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-box {
  position: relative; width: min(680px, 100%); max-height: min(86vh, 900px); overflow-y: auto;
  padding: 36px clamp(22px, 4vw, 40px) 32px; border-radius: 28px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transform: translateY(24px) scale(.98); transition: transform .45s var(--spring);
  overscroll-behavior: contain;
}
.modal-overlay.open .modal-box { transform: none; }
.modal-close { position: absolute; top: 16px; inset-inline-end: 16px; }
#modalContent { display: flex; flex-direction: column; gap: 22px; }
.mc-header { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.mc-emoji { display: grid; place-items: center; width: 56px; height: 68px; background: var(--sunk); margin-bottom: 4px; }
.mc-arabic-name { font-family: var(--font-naskh); font-size: 30px; line-height: 1.6; color: var(--gold); }
.mc-name { font-family: var(--font-display); font-size: clamp(26px, 3.4vw, 34px); line-height: 1.1; }
.mc-date-line { font-size: 14px; color: var(--text-3); }
.mc-badge { margin-top: 4px; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.mc-events-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.mc-event-chip { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 13.5px; }
.mc-event-chip:hover, .mc-event-chip.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.mc-event-panel { display: flex; flex-direction: column; gap: 22px; }
.mc-section { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.mc-section-title { display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.mc-section-title::before {
  content: ""; width: 12px; height: 12px; flex: none; background: var(--gold-bright);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-12 -12 24 24'%3E%3Cpath d='M11 0L7.78 3.22L7.78 7.78L3.22 7.78L0 11L-3.22 7.78L-7.78 7.78L-7.78 3.22L-11 0L-7.78 -3.22L-7.78 -7.78L-3.22 -7.78L0 -11L3.22 -7.78L7.78 -7.78L7.78 -3.22Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-12 -12 24 24'%3E%3Cpath d='M11 0L7.78 3.22L7.78 7.78L3.22 7.78L0 11L-3.22 7.78L-7.78 7.78L-7.78 3.22L-11 0L-7.78 -3.22L-7.78 -7.78L-3.22 -7.78L0 -11L3.22 -7.78L7.78 -7.78L7.78 -3.22Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.mc-section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
[dir="rtl"] .mc-section-title { letter-spacing: 0; font-family: var(--font-ar-ui); font-size: 14.5px; text-transform: none; }
.mc-desc { margin: 0; font-size: 16px; line-height: 1.75; color: var(--text-2); }
[dir="rtl"] .mc-desc { font-family: var(--font-ar-text); font-size: 18px; line-height: 1.95; }
.mc-virtues { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.mc-virtues li { position: relative; padding-inline-start: 22px; font-size: 15px; line-height: 1.6; color: var(--text-2); }
.mc-virtues li::before { content: ""; position: absolute; inset-inline-start: 2px; top: 9px; width: 7px; height: 7px; border-radius: 2px; transform: rotate(45deg); background: var(--gold-bright); }
.hadith-card, .ayah-card { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--line); }
.hadith-arabic, .ayah-arabic { display: block; font-family: var(--font-naskh); font-size: 22px; line-height: 2; color: var(--gold); text-align: right; direction: rtl; }
.hadith-text { font-family: var(--font-display); font-size: 21px; line-height: 1.35; color: var(--text); }
[dir="rtl"] .hadith-text { font-family: var(--font-naskh); font-size: 21px; line-height: 1.9; }
.hadith-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.source-tag, .narrator-tag { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.source-tag { background: var(--primary-soft); color: var(--primary); }
.narrator-tag { background: var(--sunk); color: var(--text-2); }
.ayah-translation { font-size: 15.5px; line-height: 1.65; color: var(--text-2); font-style: italic; }
.ayah-ref { font-size: 13px; font-weight: 600; color: var(--primary); }
.mc-recs { display: flex; flex-direction: column; gap: 8px; }
.mc-rec { padding: 10px 14px; border-radius: 14px; background: var(--primary-soft); color: var(--text); font-size: 14.5px; line-height: 1.55; }
.mc-note { padding: 12px 16px; border-radius: 14px; background: var(--gold-soft); color: var(--text); font-size: 14px; line-height: 1.6; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1100px) {
  .app-main { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar #monthCard { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .view-switch .seg-btn { padding: 0 12px; }
  .lang-btn svg { display: none; }
  .today { min-height: 0; align-items: flex-start; }
  .today__side { width: 100%; }
  .ramadan { flex: 1; width: auto; }
  .today__moon { width: 120px; min-height: 150px; }
  .today__moon-disc { width: 48px; height: 48px; }
  .sidebar { grid-template-columns: minmax(0, 1fr); }
  .legend-moon { margin-inline-start: 0; }
  .cal-weekdays, .cal-days { gap: 4px; }
  .wd { padding: 2px 0; text-align: center; font-size: 11px; letter-spacing: .02em; }
  .day-cell { min-height: 58px; padding: 7px 4px 6px; border-radius: 12px; align-items: center; gap: 3px; }
  .day-top { flex-direction: column; align-items: center; gap: 4px; }
  .day-hijri { font-size: 16px; }
  .day-moon { width: 9px; height: 9px; margin: 0; }
  .day-label { display: none; }
  .day-bottom { flex-direction: column; gap: 2px; }
  .day-gregorian { font-size: 10.5px; }
  .day-dots { gap: 2px; }
  .day-dot { width: 5px; height: 5px; }
  .cal-nav { flex-wrap: wrap; }
  .cal-nav .btn-today { order: 4; margin-inline-start: 0; }
  .calendar-section { padding: 14px 10px; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box { width: 100%; max-height: 90vh; border-radius: 28px 28px 0 0; padding-bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateY(40px); }
  .year-col { width: 128px; }
}
@media (max-width: 560px) {
  .sk-project-cal .sk-brand__text { display: none; }
}
@media (max-width: 480px) {
  #projectsLink { display: none; }
  .lang-btn { padding: 0 10px; }
}

[dir="rtl"] .mc-virtues li, [dir="rtl"] .mc-rec, [dir="rtl"] .mc-note, [dir="rtl"] .weekly-item span, [dir="rtl"] .month-body, [dir="rtl"] .cal-disclaimer { font-family: var(--font-ar-text); line-height: 1.9; }
[dir="rtl"] .mc-name, [dir="rtl"] .month-title, [dir="rtl"] .yc-month-ar { font-family: var(--font-ar-text); }
