/* ==========================================================================
   Panchang: the header menu and the Panchang pages. Seven festive colours —
   saffron, marigold, kumkum rose, lotus, peacock, leaf and sky — each in light
   shades behind dark text, so every word stays easy to read.
   ========================================================================== */
:root {
    --tp-ink: #1C1917;
    --tp-ink-2: #3D3630;
    --tp-paper: #FFFDF9;
}

/* Colour families: --c (strong), --c50/--c100/--c200 (light shades), --cink (dark text of that hue). */
.tp-c-saffron, .tp-t-saffron   { --c: #F28C28; --c50: #FFF6EC; --c100: #FFE7CF; --c200: #FFD1A3; --cink: #6E3300; }
.tp-c-marigold, .tp-t-marigold { --c: #E3A008; --c50: #FFFBEA; --c100: #FFF1C2; --c200: #FDE08A; --cink: #5A4000; }
.tp-c-rose, .tp-t-rose         { --c: #D2335C; --c50: #FFF1F5; --c100: #FFDDE6; --c200: #FDB9CB; --cink: #73102C; }
.tp-c-lotus, .tp-t-lotus       { --c: #A24FC4; --c50: #FBF4FF; --c100: #F1E0FA; --c200: #E1C0F3; --cink: #4A1763; }
.tp-c-peacock, .tp-t-peacock   { --c: #0E9384; --c50: #EEFBF8; --c100: #CFF2EB; --c200: #9EE3D6; --cink: #04443D; }
.tp-c-leaf, .tp-t-leaf         { --c: #3E9C46; --c50: #F2FAF2; --c100: #D9F0DB; --c200: #B2DFB6; --cink: #1A4B1F; }
.tp-c-sky, .tp-t-sky           { --c: #2F7BE5; --c50: #F1F6FF; --c100: #DCE9FF; --c200: #B6D0FA; --cink: #12376F; }
.tp-c-note, .tp-t-note         { --c: #9C8F80; --c50: #FAF8F5; --c100: #F0ECE5; --c200: #DDD5C9; --cink: #3F372E; }

/* ---------- The menu button and its dropdown ---------- */
.tp-menu { display: contents; }
.trac-header .tp-menu-btn .tp-caret { font-size: 0.7rem; margin-left: -0.1rem; opacity: 0.8; transition: transform 0.15s ease; }
.tp-menu.is-open .tp-menu-btn .tp-caret { transform: rotate(180deg); }

.tp-mega {
    position: fixed; left: 50%; transform: translateX(-50%); z-index: 200;
    width: min(1080px, calc(100vw - 24px)); max-height: calc(100vh - 90px);
    display: grid; grid-template-columns: 220px minmax(0, 1fr);
    background: #FFFFFF; border-radius: 18px; overflow: hidden;
    border: 1px solid #F0E2CC;
    box-shadow: 0 24px 60px rgba(60, 30, 0, 0.18), 0 4px 14px rgba(60, 30, 0, 0.08);
    color: var(--tp-ink);
}
.tp-mega[hidden] { display: none; }
.tp-mega::before {
    content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px;
    background: linear-gradient(90deg, #F28C28, #E3A008, #D2335C, #A24FC4, #0E9384, #3E9C46, #2F7BE5);
}
.tp-mega-groups {
    display: flex; flex-direction: column; gap: 4px; padding: 16px 10px 12px;
    background: linear-gradient(180deg, #FFF8EE, #FFF3F6);
    border-right: 1px solid #F3E6D4; overflow-y: auto;
}
.tp-mega-group {
    display: flex; align-items: center; gap: 0.6rem; width: 100%;
    padding: 0.62rem 0.8rem; border: 0; border-radius: 11px; background: transparent;
    font: inherit; font-size: 0.95rem; font-weight: 600; color: var(--tp-ink); text-align: left; cursor: pointer;
    transition: background 0.12s ease;
}
.tp-mega-group .tp-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px var(--c100); flex: 0 0 auto; }
.tp-mega-group:hover { background: var(--c50); }
.tp-mega-group.is-on { background: var(--c100); color: var(--cink); box-shadow: inset 4px 0 0 var(--c); }

.tp-mega-items { overflow-y: auto; padding: 18px 18px 16px; }
.tp-mega-panel[hidden] { display: none; }
.tp-mega-title {
    font-family: "IBM Plex Serif", Georgia, serif; font-size: 1.15rem; font-weight: 500; color: var(--cink);
    margin: 0 0 0.75rem; padding-bottom: 0.45rem; border-bottom: 2px solid var(--c200);
}
.tp-mega-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 7px; }
.tp-tile {
    display: flex; align-items: center; justify-content: space-between; gap: 0.4rem;
    padding: 0.6rem 0.8rem; border-radius: 10px; text-decoration: none;
    background: var(--c50); border: 1px solid var(--c200); color: var(--tp-ink);
    font-size: 0.92rem; font-weight: 500; line-height: 1.25;
    transition: background 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}
.tp-tile:hover { background: var(--c100); color: var(--cink); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(60, 30, 0, 0.08); }
.tp-tile.is-on { background: var(--c100); border-color: var(--c); color: var(--cink); font-weight: 700; }
.tp-tile.is-soon { color: var(--tp-ink-2); background: #FAF8F5; border-style: dashed; }
.tp-tile em { font-style: normal; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
              padding: 0.1rem 0.4rem; border-radius: 6px; background: #EFE9DF; color: #3F372E; }

@media (max-width: 720px) {
    .tp-mega { grid-template-columns: 1fr; }
    .tp-mega-groups { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid #F3E6D4; padding: 12px 8px 8px; }
    .tp-mega-group { width: auto; padding: 0.45rem 0.7rem; font-size: 0.88rem; }
    .tp-mega-tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ---------- The Panchang page ---------- */
body:has(.tp-page) { margin: 0; }
.tp-page *, .tp-page *::before, .tp-page *::after, .tp-mega, .tp-mega * { box-sizing: border-box; }
.tp-page { overflow-x: hidden; }
.tp-page {
    min-height: 100vh; display: flex; flex-direction: column; color: var(--tp-ink);
    font-family: "IBM Plex Sans", system-ui, sans-serif;
    background:
        radial-gradient(900px 420px at 0% 0%, rgba(255, 209, 163, 0.35), transparent 60%),
        radial-gradient(800px 420px at 100% 10%, rgba(225, 192, 243, 0.30), transparent 60%),
        radial-gradient(900px 500px at 50% 100%, rgba(158, 227, 214, 0.22), transparent 60%),
        var(--tp-paper);
}
.tp-header a.trac-system { text-decoration: none; }
.tp-header a.trac-header-btn { text-decoration: none; }
.tp-main { flex: 1 1 auto; width: min(1320px, 100%); margin: 0 auto; padding: 1.1rem 1.2rem 2rem; }

.tp-hero {
    position: relative; overflow: hidden; border-radius: 20px; padding: 1.2rem 1.4rem 1.1rem;
    background: linear-gradient(120deg, var(--c100) 0%, #FFFFFF 55%, var(--c50) 100%);
    border: 1px solid var(--c200);
    box-shadow: 0 1px 2px rgba(60, 30, 0, 0.04), 0 10px 26px rgba(60, 30, 0, 0.06);
}
.tp-hero::after {
    content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
    background: radial-gradient(circle, var(--c200) 0%, transparent 70%); opacity: 0.7; pointer-events: none;
}
.tp-crumb { font-size: 0.82rem; color: var(--cink); font-weight: 600; letter-spacing: 0.02em; }
.tp-crumb a { color: var(--cink); text-decoration: none; }
.tp-crumb a:hover { text-decoration: underline; }
.tp-crumb span { margin: 0 0.15rem; }
.tp-hero h1 { margin: 0.25rem 0 0.35rem; font-family: "IBM Plex Serif", Georgia, serif; font-weight: 500; font-size: 1.85rem; color: var(--tp-ink); }
.tp-hero-lead { margin: 0; max-width: 980px; color: var(--tp-ink-2); line-height: 1.55; position: relative; z-index: 1; }

.tp-controls {
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.8rem 1rem;
    margin-top: 0.9rem; padding: 0.85rem 1rem; border-radius: 16px;
    background: #FFFFFF; border: 1px solid #F0E3CF; box-shadow: 0 1px 2px rgba(60, 30, 0, 0.04);
}
.tp-field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.tp-field > label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--cink); }
.tp-field input, .tp-field select {
    height: 40px; padding: 0 0.7rem; border: 1px solid #E5D9C6; border-radius: 10px; background: #FFFFFF;
    font: inherit; font-size: 0.95rem; color: var(--tp-ink);
}
.tp-field input:focus, .tp-field select:focus { outline: none; border-color: var(--c); box-shadow: 0 0 0 3px var(--c100); }
.tp-place { flex: 1 1 280px; }
.tp-place input { width: 100%; }
.tp-year { width: 6.2rem; }
.tp-step { display: flex; align-items: center; gap: 0.35rem; }
.tp-stepbtn {
    display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 40px;
    border-radius: 10px; border: 1px solid var(--c200); background: var(--c50); color: var(--cink);
    font-size: 1.3rem; font-weight: 700; text-decoration: none;
}
.tp-stepbtn:hover { background: var(--c100); }
.tp-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.tp-go {
    height: 40px; padding: 0 1.4rem; border: 0; border-radius: 10px; cursor: pointer;
    background: linear-gradient(90deg, #FFC37A, #FFAE8F); color: #3A1A00; font: inherit; font-weight: 700; font-size: 0.95rem;
    box-shadow: 0 3px 10px rgba(242, 140, 40, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.tp-go:hover { filter: brightness(1.03); }
.tp-today { height: 40px; display: inline-flex; align-items: center; padding: 0 1rem; border-radius: 10px; border: 1px solid #E5D9C6; color: var(--tp-ink); text-decoration: none; font-weight: 600; background: #FFFFFF; }
.tp-today:hover { background: #FFF8EE; }
.tp-person { display: flex; flex-wrap: wrap; gap: 0.6rem 0.8rem; align-items: flex-end; border: 1px solid var(--c200); border-radius: 12px; padding: 0.5rem 0.8rem 0.75rem; margin: 0; background: var(--c50); }
.tp-person legend { padding: 0 0.4rem; font-weight: 700; color: var(--cink); }

.tp-citybox { position: relative; }
.tp-citylist {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50; margin: 0; padding: 4px; list-style: none;
    background: #FFFFFF; border: 1px solid #E5D9C6; border-radius: 12px; box-shadow: 0 14px 30px rgba(60, 30, 0, 0.14);
    max-height: 320px; overflow-y: auto;
}
.tp-citylist li { display: flex; flex-direction: column; padding: 0.45rem 0.6rem; border-radius: 8px; cursor: pointer; color: var(--tp-ink); }
.tp-citylist li small { color: var(--tp-ink-2); font-size: 0.76rem; }
.tp-citylist li.is-active, .tp-citylist li:hover { background: #FFF3E3; }
.tp-citylist li.is-none { cursor: default; color: var(--tp-ink-2); }

.tp-error { margin-top: 0.9rem; padding: 0.8rem 1rem; border-radius: 12px; background: #FFF1F5; border: 1px solid #FDB9CB; color: #73102C; font-weight: 600; }

/* Cards */
.tp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; align-items: start; }
.tp-card {
    min-width: 0; background: #FFFFFF; border-radius: 16px; padding: 0.95rem 1.1rem 1.05rem;
    border: 1px solid var(--c200); border-top: 4px solid var(--c);
    box-shadow: 0 1px 2px rgba(60, 30, 0, 0.04), 0 8px 22px rgba(60, 30, 0, 0.05);
}
.tp-card.is-wide { grid-column: 1 / -1; }
.tp-card h2 {
    display: flex; align-items: center; gap: 0.55rem; margin: 0 0 0.55rem;
    font-family: "IBM Plex Serif", Georgia, serif; font-weight: 500; font-size: 1.18rem; color: var(--cink);
}
.tp-card h2::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); transform: rotate(45deg); flex: 0 0 auto; }
.tp-lead { margin: 0 0 0.7rem; color: var(--tp-ink-2); line-height: 1.55; font-size: 0.94rem; }

.tp-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.5rem; margin: 0; }
.tp-fact { margin: 0; padding: 0.55rem 0.7rem; border-radius: 10px; background: var(--c50); border: 1px solid var(--c100); }
.tp-fact dt { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--cink); margin-bottom: 0.15rem; }
.tp-fact dd { margin: 0; color: var(--tp-ink); line-height: 1.45; font-size: 0.95rem; }
.tp-fact.tp-c-strong dd { font-weight: 700; }
.tp-fact.tp-c-good { background: #F2FAF2; border-color: #B2DFB6; }
.tp-fact.tp-c-good dt { color: #1A4B1F; }
.tp-fact.tp-c-bad { background: #FFF1F5; border-color: #FDB9CB; }
.tp-fact.tp-c-bad dt { color: #73102C; }

/* Tables */
.tp-tablewrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--c100); }
.tp-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; color: var(--tp-ink); }
.tp-table th {
    position: sticky; top: 0; text-align: left; white-space: nowrap; padding: 0.55rem 0.7rem;
    background: var(--c100); color: var(--cink); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
    border-bottom: 2px solid var(--c200);
}
.tp-table td { padding: 0.5rem 0.7rem; border-bottom: 1px solid #F3EEE6; vertical-align: top; line-height: 1.45; }
.tp-table tbody tr:nth-child(even) td { background: #FFFDF9; }
.tp-table tbody tr:hover td { background: var(--c50); }
.tp-table tbody tr:last-child td { border-bottom: 0; }
.tp-table td small { display: block; color: var(--tp-ink-2); font-size: 0.78rem; }
.tp-table td a { color: var(--cink); font-weight: 600; text-decoration: none; }
.tp-table td a:hover { text-decoration: underline; }
.tp-table td.tp-c-strong { font-weight: 700; }
.tp-table td.tp-c-good { color: #1A4B1F; font-weight: 600; }
.tp-table td.tp-c-bad { color: #73102C; font-weight: 600; }
.tp-table tr.tp-r-good td:first-child { box-shadow: inset 4px 0 0 #3E9C46; }
.tp-table tr.tp-r-good td { background: #F5FBF5; }
.tp-table tr.tp-r-bad td:first-child { box-shadow: inset 4px 0 0 #D2335C; }
.tp-table tr.tp-r-bad td { background: #FFF6F8; }
.tp-table tr.tp-r-mixed td:first-child { box-shadow: inset 4px 0 0 #E3A008; }
.tp-table tr.tp-r-mixed td { background: #FFFCF0; }
.tp-table tr.tp-r-current td { background: #DCE9FF !important; font-weight: 600; }
.tp-table tr.tp-r-current td:first-child { box-shadow: inset 4px 0 0 #2F7BE5; }
.tp-table tr.tp-r-past td { color: #5A524A; }
.tp-table tr.tp-r-purnima td { background: #FFFBEA; }
.tp-table tr.tp-r-amavasya td { background: #F3F1F7; }

.tp-rules { margin: 0; padding-left: 1.15rem; color: var(--tp-ink); line-height: 1.6; }
.tp-rules li { margin: 0.2rem 0; }

/* Calendar grid */
.tp-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.tp-cal-head { padding: 0.4rem 0.5rem; text-align: center; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--cink); background: var(--c100); border-radius: 8px; }
.tp-cal-blank { min-height: 110px; }
.tp-cal-day {
    display: flex; flex-direction: column; gap: 2px; min-height: 118px; padding: 0.45rem 0.5rem; border-radius: 10px;
    background: #FFFFFF; border: 1px solid #EFE7DA; color: var(--tp-ink); text-decoration: none; overflow: hidden;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.tp-cal-day:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(60, 30, 0, 0.08); border-color: var(--c200); }
.tp-cal-num { font-family: "IBM Plex Serif", Georgia, serif; font-size: 1.35rem; line-height: 1; color: var(--tp-ink); }
.tp-cal-day.is-sun .tp-cal-num { color: #A3122E; }
.tp-cal-top { font-size: 0.74rem; font-weight: 700; color: var(--cink); }
.tp-cal-line { font-size: 0.74rem; color: var(--tp-ink-2); line-height: 1.25; }
.tp-cal-day.is-purnima { background: linear-gradient(160deg, #FFF6CC, #FFFFFF 70%); border-color: #FDE08A; }
.tp-cal-day.is-amavasya { background: linear-gradient(160deg, #ECE8F4, #FFFFFF 70%); border-color: #D6CFE6; }
.tp-cal-day.is-ekadashi { background: linear-gradient(160deg, #E4F5E6, #FFFFFF 70%); border-color: #B2DFB6; }
.tp-cal-day.is-today { box-shadow: 0 0 0 2px var(--c); }
.tp-chip { display: inline-block; margin-top: 2px; padding: 0.1rem 0.4rem; border-radius: 6px; font-size: 0.72rem; font-weight: 600; line-height: 1.3; color: var(--tp-ink); }
.tp-chip.is-festival { background: #FFDDE6; color: #73102C; }
.tp-chip.is-vrat { background: #D9F0DB; color: #1A4B1F; }
.tp-chip.is-sankranti { background: #FFE7CF; color: #6E3300; }
.tp-cal-key { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.7rem; align-items: center; font-size: 0.8rem; }
.tp-key { padding: 0.15rem 0.55rem; border-radius: 6px; border: 1px solid #E5D9C6; color: var(--tp-ink); }
.tp-key.is-purnima { background: #FFF6CC; }
.tp-key.is-amavasya { background: #ECE8F4; }
.tp-key.is-ekadashi { background: #E4F5E6; }

.tp-foot { margin: 1.4rem 0 0; color: var(--tp-ink-2); font-size: 0.85rem; text-align: center; }

@media (max-width: 980px) {
    .tp-grid { grid-template-columns: minmax(0, 1fr); }
    .tp-cal-day { min-height: 92px; }
    .tp-cal-line { display: none; }
}
@media (max-width: 640px) {
    .tp-main { padding: 0.8rem 0.6rem 1.5rem; }
    .tp-hero h1 { font-size: 1.45rem; }
    .tp-cal { gap: 3px; }
    .tp-cal-day { min-height: 64px; padding: 0.3rem; }
    .tp-cal-top { display: none; }
    .tp-chip { font-size: 0.6rem; padding: 0.05rem 0.2rem; overflow-wrap: anywhere; }
    .tp-cal-head { font-size: 0.66rem; padding: 0.3rem 0.1rem; letter-spacing: 0; }
    .tp-actions { margin-left: 0; }
}
