/* Islamic calendar pages (calendar.php): today card with the live Moon, month cards, occasion tooltips */

/* ── today + Moon ── */
.cg-hero {
    position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 26px;
    margin: 6px 0 34px; padding: 24px 28px; border-radius: 24px; border: 1px solid rgba(var(--t-accent-rgb), .2);
    background: radial-gradient(90% 140% at 0% 0%, rgba(var(--t-accent-rgb), .15), transparent 55%), var(--t-card);
}
.cg-moon { position: relative; display: block; width: 116px; height: 116px; border-radius: 50%; outline: none; cursor: zoom-in; }
.cg-moon:hover svg { transform: scale(1.04); }
.cg-moon svg { transition: transform .3s; }
.cg-moon svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 10px 26px rgba(217, 181, 106, .45)); animation: cg-float 7s ease-in-out infinite; }
.cg-moon:focus-visible { box-shadow: 0 0 0 3px rgba(var(--t-accent-rgb), .5); }
.moon-dark { fill: rgba(var(--t-accent-rgb), .16); }
.moon-rim { fill: none; stroke: rgba(var(--t-accent-rgb), .35); stroke-width: 1; }
@keyframes cg-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.cg-moon-tip {
    position: absolute; top: calc(100% + 12px); left: 0; z-index: 30; display: grid; gap: 3px; width: max-content; max-width: 260px;
    padding: 12px 14px; border-radius: 14px; background: var(--t-text); color: var(--t-bg); font-size: 12.5px; line-height: 1.4;
    box-shadow: 0 14px 34px -12px rgba(0, 0, 0, .45); opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity .18s, transform .18s;
}
.cg-moon-tip strong { font-size: 13.5px; }
.cg-moon-tip em { margin-top: 4px; font-style: normal; font-weight: 700; color: #f2b45a; }
.cg-moon-tip::before { content: ''; position: absolute; top: -6px; left: 50px; width: 12px; height: 12px; background: inherit; transform: rotate(45deg); border-radius: 2px; }
.cg-moon:hover .cg-moon-tip, .cg-moon:focus .cg-moon-tip { opacity: 1; transform: none; }
.cg-hero-main { min-width: 0; }
.cg-hero-k { margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--t-text-secondary); font-family: inherit; }
.cg-today { font-family: "Space Grotesk", sans-serif; font-size: clamp(1.6rem, 4vw, 2.6rem); font-weight: 700; line-height: 1.08; margin: 0; }
.cg-today-ar { font-family: "Amiri", serif; font-size: clamp(1.3rem, 3vw, 1.9rem); color: var(--t-accent); margin: 6px 0 0; text-align: start; }
.cg-hero-sub { margin: 4px 0 0; font-size: 14.5px; color: var(--t-text-secondary); }
.cg-moonline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 0; font-size: 12.5px; color: var(--t-text-secondary); }
.cg-moonline strong { color: var(--t-text); font-weight: 600; }
.cg-moon-dot { width: 8px; height: 8px; border-radius: 50%; background: #d9b56a; box-shadow: 0 0 0 3px rgba(217, 181, 106, .25); }
.cg-hero-cta { align-self: end; padding: 9px 14px; border-radius: 999px; background: rgba(var(--t-accent-rgb), .12); color: var(--t-accent); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; transition: background .2s; }
.cg-hero-cta:hover { background: rgba(var(--t-accent-rgb), .2); }

/* ── month cards ── */
.cg-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin-top: 16px; }
.cg-card { padding: 14px 12px 12px; border-radius: 20px; background: var(--t-card); border: 1px solid transparent; min-width: 0; }
.cg-card.is-cur { border-color: rgba(var(--t-accent-rgb), .45); }
.cg-table { width: 100%; border-collapse: separate; border-spacing: 3px; table-layout: fixed; font-variant-numeric: tabular-nums; }
.cg-table caption { caption-side: top; text-align: start; padding: 0 5px 10px; }
.cg-cap { display: flex; align-items: center; gap: 8px; font-family: "Space Grotesk", sans-serif; font-size: 16px; font-weight: 700; color: var(--t-text); }
.cg-sub { display: block; margin-top: 1px; font-size: 12px; font-weight: 600; color: var(--t-accent); }
.cg-now { padding: 2px 8px; border-radius: 999px; background: var(--t-accent); color: #fff; font-family: Inter, sans-serif; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; }
.cg-table th { padding: 2px 0 6px; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--t-text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cg-table th.is-fri { color: var(--t-accent); }
.cg-table td {
    position: relative; height: 44px; padding: 5px 1px 4px; border-radius: 10px; text-align: center; vertical-align: middle;
    background: var(--t-bg); transition: background .15s;
}
.cg-table td.cg-pad { background: transparent; }
.cg-big { display: block; font-size: 14px; font-weight: 700; line-height: 1.15; }
.cg-small { display: block; font-size: 10px; line-height: 1.2; color: var(--t-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cg-table td.is-fri { background: color-mix(in srgb, var(--t-bg) 92%, var(--t-accent) 8%); }
.cg-table td.is-holiday { background: rgba(217, 119, 6, .16); cursor: help; outline: none; }
.cg-table td.is-holiday::after { content: ''; position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: #d97706; }
.cg-table td.is-holiday:hover, .cg-table td.is-holiday:focus { background: rgba(217, 119, 6, .28); }
.cg-table td.is-today { background: var(--t-accent); color: #fff; cursor: help; outline: none; }
.cg-table td.is-today:focus-visible { box-shadow: 0 0 0 3px rgba(var(--t-accent-rgb), .4); }
.cg-table td.is-today .cg-small { color: rgba(255, 255, 255, .85); }
.cg-table td.is-today.is-holiday::after { background: #fff; }

/* occasion tooltip — hover, keyboard focus or tap */
.cg-tip {
    position: absolute; bottom: calc(100% + 9px); left: 50%; z-index: 30; display: grid; gap: 2px; width: max-content; max-width: 230px;
    padding: 10px 12px; border-radius: 12px; background: var(--t-text); color: var(--t-bg); text-align: start; font-size: 12px; line-height: 1.4; font-weight: 400;
    box-shadow: 0 14px 34px -12px rgba(0, 0, 0, .45); opacity: 0; transform: translate(-50%, 4px); pointer-events: none; transition: opacity .16s, transform .16s;
}
.cg-tip strong { font-size: 13px; font-weight: 700; }
.cg-tip em { font-style: normal; font-weight: 700; color: #f2b45a; }
.cg-tip em.is-past { color: inherit; opacity: .65; }
.cg-tip::after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--t-text); }
.cg-table td:hover .cg-tip, .cg-table td:focus .cg-tip { opacity: 1; transform: translate(-50%, 0); }
/* first and last columns: keep the tooltip inside the card */
.cg-table td:nth-child(-n+2) .cg-tip { left: 0; transform: translate(0, 4px); }
.cg-table td:nth-child(-n+2):hover .cg-tip, .cg-table td:nth-child(-n+2):focus .cg-tip { transform: none; }
.cg-table td:nth-child(-n+2) .cg-tip::after { left: 20px; }
.cg-table td:nth-last-child(-n+2) .cg-tip { left: auto; right: 0; transform: translate(0, 4px); }
.cg-table td:nth-last-child(-n+2):hover .cg-tip, .cg-table td:nth-last-child(-n+2):focus .cg-tip { transform: none; }
.cg-table td:nth-last-child(-n+2) .cg-tip::after { left: auto; right: 14px; }

[data-theme="midnight"] .cg-table td.is-holiday::after, [data-theme="slate"] .cg-table td.is-holiday::after { background: #fbbf24; }

/* ── links & pager (year pages) ── */
.cg-pager { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 36px 0 0; font-weight: 600; }
.cg-pager a, .cg-links a { color: var(--t-accent); }

@media (max-width: 760px) {
    .cg-hero { grid-template-columns: 1fr; gap: 14px; padding: 20px 18px; }
    .cg-moon { position: absolute; top: 16px; inset-inline-end: 16px; width: 66px; height: 66px; }
    .cg-moon-tip { left: auto; right: 0; }
    .cg-moon-tip::before { left: auto; right: 26px; }
    .cg-hero-main { padding-inline-end: 76px; }
    .cg-hero-cta { justify-self: start; }
    .cg-wrap { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .cg-moon svg { animation: none; } }
.cg-link { display: block; color: inherit; text-decoration: none; outline: none; }
.cg-table td.is-holiday.has-link { cursor: pointer; }
.cg-table td.has-link:focus-within .cg-tip { opacity: 1; transform: translate(-50%, 0); }
