/* ============================================================
   PANCHANG-BASE.CSS — Foundation for all pages
   Version: 1.0 | May 2026

   This file provides:
   - CSS custom properties (colors, typography, spacing)
   - Zoom-proof fluid type scale
   - Container utilities
   - @font-face declarations
   - Global element resets
   - Semantic color classes
   - Card and section styles
   - Responsive breakpoints
   - Print styles
   ============================================================ */

/* ── 1. CUSTOM PROPERTIES ── */
:root {
    /* ── Brand Colors ── */
    --bg-page:          #FDF3E4;
    --bg-card:          #FFFBF3;
    --bg-card-hover:    #FFF8EC;
    --bg-nav:           #854F0B;
    --bg-nav-active:    rgba(255,255,255,0.2);

    /* ── Text Colors ── */
    --text-heading:     #3A2A18;
    --text-body:        #4A3828;
    --text-muted:       #7A6A58;
    --text-link:        #854F0B;
    --text-link-hover:  #6B3D08;
    --text-on-dark:     #FAEEDA;
    --text-on-dark-muted: rgba(255,255,255,0.75);

    /* ── Border Colors ── */
    --border-subtle:    #E0C9A8;
    --border-strong:    #C4A265;
    --border-card:      #E0C9A8;

    /* ── Semantic Colors ── */
    --color-good:       #2E7D32;
    --color-good-bg:    #E8F5E9;
    --color-neutral:    #E65100;
    --color-neutral-bg: #FFF3E0;
    --color-avoid:      #C62828;
    --color-avoid-bg:   #FFEBEE;
    --color-accent:     #A52842;
    --color-accent-bg:  #FDF0F4;

    /* ── Category Hero Colors ── */
    --hero-ekadashi-start:    #854F0B;
    --hero-ekadashi-end:      #C8932A;
    --hero-pradosh-start:     #1D4E7C;
    --hero-pradosh-end:       #2A6FA8;
    --hero-navratri-start:    #7A1B2D;
    --hero-navratri-end:      #B32E4A;
    --hero-sankashti-start:   #085041;
    --hero-sankashti-end:     #0F6E56;
    --hero-purnima-start:     #633806;
    --hero-purnima-end:       #EF9F27;
    --hero-amavasya-start:    #26215C;
    --hero-amavasya-end:      #534AB7;
    --hero-festival-start:    #8B2500;
    --hero-festival-end:      #D85A30;
    --hero-muhurat-start:     #6B1B2E;
    --hero-muhurat-end:       #A52842;

    /* ── Fluid Typography ── */
    --text-xs:    clamp(0.7rem,  1.5vw, 0.8rem);
    --text-sm:    clamp(0.8rem,  1.8vw, 0.875rem);
    --text-base:  clamp(0.875rem, 2vw, 1rem);
    --text-lg:    clamp(1rem,    2.5vw, 1.125rem);
    --text-xl:    clamp(1.125rem, 3vw, 1.375rem);
    --text-2xl:   clamp(1.375rem, 4vw, 1.75rem);
    --text-3xl:   clamp(1.75rem, 5vw, 2.25rem);

    --text-devanagari: clamp(1rem, 2.5vw, 1.15rem);

    /* ── Spacing ── */
    --space-xs:  0.25rem;
    --space-sm:  0.5rem;
    --space-md:  1rem;
    --space-lg:  1.5rem;
    --space-xl:  2rem;
    --space-2xl: 3rem;

    /* ── Layout ── */
    --content-max-width: 1100px;
    --content-padding: clamp(0.75rem, 3vw, 1.5rem);
    --card-radius: 8px;
    --card-radius-lg: 12px;

    /* ── Fonts ── */
    --font-heading: 'Poppins', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --font-devanagari: 'Noto Serif Devanagari', 'Tiro Devanagari Hindi', serif;

    /* ── Transitions ── */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* ── 2. FONT FACES ── */

/* Noto Serif Devanagari — for Sanskrit shlokas, Hindi text
   If files not downloaded yet, get from:
   https://fonts.google.com/noto/specimen/Noto+Serif+Devanagari
   Regular: https://fonts.gstatic.com/s/notoserifdevanagari/v28/x3dYcl3IZKmUqiMk48ZHXJ5jwU-DZGRSCQodB68.woff2
   Bold:    https://fonts.gstatic.com/s/notoserifdevanagari/v28/x3dYcl3IZKmUqiMk48ZHXJ5jwU-DZGRSCQodH6g.woff2
*/
@font-face {
    font-family: 'Noto Serif Devanagari';
    src: url('/static/fonts/NotoSerifDevanagari-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0900-097F, U+1CD0-1CFF, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FF;
}

@font-face {
    font-family: 'Noto Serif Devanagari';
    src: url('/static/fonts/NotoSerifDevanagari-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0900-097F, U+1CD0-1CFF, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FF;
}

/* Poppins + Inter via Google Fonts CDN (cached globally, fast)
   These are loaded via <link> in base.html, not @font-face here */

/* ── 3. GLOBAL RESETS ── */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    background-color: #C58128;
    color: var(--text-body);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── 4. TYPOGRAPHY ── */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-heading);
    line-height: 1.3;
    font-weight: 500;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

p { margin-bottom: var(--space-sm); }

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--text-link-hover); }

.text-devanagari,
.shloka,
.mantra {
    font-family: var(--font-devanagari);
    font-size: var(--text-devanagari);
    line-height: 1.8;
    letter-spacing: 0.02em;
}

.shloka {
    font-style: italic;
    color: var(--text-heading);
    padding: var(--space-sm) var(--space-md);
    border-left: 3px solid var(--border-strong);
    background: rgba(196, 162, 101, 0.06);
    border-radius: 0 var(--card-radius) var(--card-radius) 0;
    margin: var(--space-md) 0;
}

/* ── 5. LAYOUT CONTAINERS ── */

.page-container {
    width: min(95%, var(--content-max-width));
    margin-inline: auto;
    padding-inline: var(--content-padding);
}

.layout-data {
    --section-gap: var(--space-sm);
    --card-padding: clamp(0.625rem, 2vw, 0.875rem);
}

.layout-content {
    --section-gap: var(--space-lg);
    --card-padding: clamp(1rem, 3vw, 1.25rem);
}

/* ── 6. CARD SYSTEM ── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--card-radius);
    padding: var(--card-padding, var(--space-md));
    transition: border-color var(--transition-fast);
}

.card:hover {
    border-color: var(--border-strong);
}

.card--metric {
    border-width: 2px;
    border-color: var(--border-strong);
}

.card--accent {
    border-width: 2px;
    border-color: var(--color-accent);
}

.card--clickable {
    cursor: pointer;
}
.card--clickable:hover {
    background: var(--bg-card-hover);
}

.card--selected {
    border-color: var(--color-accent);
    background: var(--color-accent-bg);
}

/* ── 7. SECTION STYLES ── */

.section {
    margin-bottom: var(--section-gap, var(--space-lg));
}

.section-title {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    font-weight: 500;
    color: var(--text-heading);
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border-subtle);
}

.section-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.section-label {
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-accent);
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border-subtle);
}

/* ── 8. SEMANTIC BADGES & TAGS ── */

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: var(--text-xs);
    font-weight: 500;
}

.badge--good    { background: var(--color-good-bg); color: var(--color-good); }
.badge--neutral { background: var(--color-neutral-bg); color: var(--color-neutral); }
.badge--avoid   { background: var(--color-avoid-bg); color: var(--color-avoid); }
.badge--accent  { background: var(--color-accent); color: var(--text-on-dark); }

.text-good    { color: var(--color-good); }
.text-neutral { color: var(--color-neutral); }
.text-avoid   { color: var(--color-avoid); }
.text-accent  { color: var(--color-accent); }
.text-muted   { color: var(--text-muted); }

/* ── Pan-India reference marker (FU-52) ── */
.pan-india-tag {
    display: inline-block;
    padding: 1px 6px;
    margin-left: 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
    vertical-align: middle;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(122,106,88,0.30);
}
.pan-india-tag--hero {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.85);
    border: 1px solid rgba(255,255,255,0.25);
}

.pan-india-mark {
    margin-left: 4px;
    font-size: 11px;
    color: var(--text-muted);
    vertical-align: middle;
}
.pan-india-mark--hero { color: rgba(255,255,255,0.70); }

.pan-india-note {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-muted);
}
.pan-india-note--hero { color: rgba(255,255,255,0.60); }

/* ── 9. TABLE STYLES ── */

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--border-subtle);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    font-family: var(--font-heading);
    font-weight: 500;
    color: var(--text-heading);
    background: rgba(196, 162, 101, 0.08);
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── 10. GRID UTILITIES ── */

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-sm);
}

.grid-2-1 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

/* ── 11. HERO SECTION (content pages only) ── */

.hero {
    border-radius: var(--card-radius-lg);
    padding: clamp(1.25rem, 4vw, 2rem) clamp(1rem, 3vw, 1.75rem);
    color: var(--text-on-dark);
    text-align: center;
    margin-bottom: var(--space-md);
    position: relative;
    overflow: hidden;
}

.hero__category {
    font-size: var(--text-xs);
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.8;
}

.hero__title {
    font-family: var(--font-heading);
    font-size: var(--text-2xl);
    font-weight: 600;
    margin: var(--space-xs) 0;
    color: var(--text-on-dark);
}

.hero__subtitle {
    font-size: var(--text-sm);
    opacity: 0.85;
}

.hero__badges {
    margin-top: var(--space-sm);
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.hero-badge {
    background: rgba(255,255,255,0.15);
    color: var(--text-on-dark);
    font-size: var(--text-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--card-radius);
}

/* ── 12. BREADCRUMBS ── */

.breadcrumb {
    font-size: 12px;
    color: #9C7828;
    padding: 5px 0 8px;
    border-bottom: 0.5px solid rgba(200,147,42,0.2);
    margin-bottom: 8px;
}

.breadcrumb a {
    color: #9C7828;
    text-decoration: none;
}

.breadcrumb a:hover {
    color: #C8932A;
    text-decoration: underline;
}

/* ── 13. FAQ SECTION ── */

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--card-radius);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-sm);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-base);
    color: var(--text-heading);
    transition: background var(--transition-fast);
}

.faq-item:hover {
    background: var(--bg-card-hover);
}

.faq-answer {
    display: none;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm);
    color: var(--text-body);
    line-height: 1.7;
}

.faq-item.open + .faq-answer {
    display: block;
}

/* ── 14. SVG GLOBAL RULES ── */

svg {
    max-width: 100%;
    height: auto;
}

svg.icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
}

/* ── 15. RESPONSIVE BREAKPOINTS ── */

@media (max-width: 768px) {
    .grid-2, .grid-2-1 {
        grid-template-columns: 1fr;
    }

    .grid-3 {
        grid-template-columns: 1fr 1fr;
    }

    .hero__title {
        font-size: var(--text-xl);
    }
}

@media (max-width: 480px) {
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: var(--space-md);
    }

    .hero__badges {
        flex-direction: column;
        align-items: center;
    }
}

/* Side decorative columns + border frame in decorations.css */

/* ── 16. PRINT STYLES ── */

@media print {
    body {
        background: white;
        color: black;
        font-size: 12pt;
    }

    .top-bar,
    .settings-bar,
    .hero,
    .breadcrumb,
    .faq-section,
    .related-section,
    .footer,
    .side-decoration,
    .no-print {
        display: none !important;
    }

    .card {
        border: 1px solid #ccc;
        break-inside: avoid;
    }

    .page-container {
        width: 100%;
        max-width: 100%;
        padding: 0;
    }

    a { color: black; text-decoration: none; }

    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        color: #666;
    }
}

/* ── 17. UTILITY CLASSES ── */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.no-print { }

.text-center { text-align: center; }
.text-right { text-align: right; }

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
