/* ===================================================
   Shabdarutu — Frontend Stylesheet
   Color: Deep Crimson #8B0000 on Cream #FFFDF5
   Fonts: Tiro Devanagari Marathi (headings), Mukta (body)
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Tiro+Devanagari+Marathi:ital@0;1&family=Mukta:wght@300;400;600;700&display=swap');

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Mukta', 'Noto Sans Devanagari', sans-serif;
    background-color: #FFFDF5;
    color: #1A1A1A;
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: #8B0000; text-decoration: none; }
a:hover { color: #6B0000; text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ── Utility ── */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.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;
}

/* ── Header ── */
.site-header {
    background-color: #8B0000;
    color: #FFFDF5;
    border-bottom: 4px solid #6B0000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    max-width: 1200px;
    margin: 0 auto;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.site-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    background: #FFFDF5;
    border-radius: 50%;
    padding: 4px;
    border: 2px solid rgba(255,253,245,0.4);
}

.site-title-block { display: flex; flex-direction: column; }

.site-name {
    font-family: 'Tiro Devanagari Marathi', serif;
    font-size: 2rem;
    font-weight: 700;
    color: #FFFDF5;
    line-height: 1.1;
    letter-spacing: 0.02em;
}

.site-tagline {
    font-size: 0.8rem;
    color: rgba(255,253,245,0.75);
    font-weight: 300;
    margin-top: 2px;
}

/* Header date display */
.header-date {
    font-size: 0.85rem;
    color: rgba(255,253,245,0.85);
    text-align: right;
    line-height: 1.4;
}

.header-date .day-name {
    font-size: 1rem;
    font-weight: 600;
    color: #FFFDF5;
}

/* Meta column: today's date + language switcher stacked at the right */
.header-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
}

/* Language switcher (मराठी | English) */
.lang-switcher {
    font-size: 0.82rem;
    line-height: 1;
    white-space: nowrap;
}
.lang-switcher a {
    color: rgba(255,253,245,0.65);
    text-decoration: none;
    padding: 0 0.4rem;
    transition: color 0.15s ease;
}
.lang-switcher a:hover {
    color: #FFFDF5;
}
.lang-switcher a.active {
    color: #FFFDF5;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.lang-switcher span {
    color: rgba(255,253,245,0.35);
}

/* Decorative divider line under header */
.header-rule {
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, transparent, #FFFDF5, transparent);
    opacity: 0.2;
}

/* ── Navigation Bar ── */
.site-nav {
    background-color: #6B0000;
    border-bottom: 1px solid rgba(255,253,245,0.15);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex;
    gap: 0;
}

.nav-inner a {
    color: rgba(255,253,245,0.9);
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 600;
    display: inline-block;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.nav-inner a:hover,
.nav-inner a.active {
    color: #FFFDF5;
    border-bottom-color: #FFFDF5;
    text-decoration: none;
    background-color: rgba(255,253,245,0.08);
}

/* ── Main Content ── */
.main-content { flex: 1; padding: 2rem 0; }

/* ── Section Headings ── */
.section-heading {
    font-family: 'Tiro Devanagari Marathi', serif;
    font-size: 1.6rem;
    color: #8B0000;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #8B0000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-heading::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 1.4em;
    background: #8B0000;
    border-radius: 2px;
}

/* ── Hero — Latest Edition ── */
.hero-section {
    background: linear-gradient(135deg, #8B0000 0%, #6B0000 100%);
    color: #FFFDF5;
    padding: 2.5rem 0;
    margin-bottom: 2.5rem;
}

.hero-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.hero-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255,253,245,0.7);
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.hero-title {
    font-family: 'Tiro Devanagari Marathi', serif;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.hero-date {
    font-size: 1rem;
    color: rgba(255,253,245,0.8);
    margin-bottom: 1.5rem;
}

.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.5rem;
    border-radius: 4px;
    font-family: 'Mukta', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: #FFFDF5;
    color: #8B0000;
    border-color: #FFFDF5;
}

.btn-primary:hover {
    background: transparent;
    color: #FFFDF5;
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    color: #FFFDF5;
    border-color: rgba(255,253,245,0.6);
}

.btn-outline:hover {
    background: rgba(255,253,245,0.1);
    border-color: #FFFDF5;
    text-decoration: none;
    color: #FFFDF5;
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
}

.btn-crimson {
    background: #8B0000;
    color: #FFFDF5;
    border-color: #8B0000;
}

.btn-crimson:hover {
    background: #6B0000;
    border-color: #6B0000;
    text-decoration: none;
    color: #FFFDF5;
}

/* Hero thumbnail */
.hero-thumbnail {
    flex-shrink: 0;
    width: 180px;
    height: 240px;
    object-fit: cover;
    border: 3px solid rgba(255,253,245,0.3);
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.hero-thumbnail-placeholder {
    flex-shrink: 0;
    width: 180px;
    height: 240px;
    background: rgba(255,253,245,0.1);
    border: 2px dashed rgba(255,253,245,0.3);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

/* ── Edition Cards Grid ── */
.editions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.edition-card {
    background: #FFFFFF;
    border: 1px solid #E8E0D0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}

.edition-card:hover {
    box-shadow: 0 6px 18px rgba(139,0,0,0.15);
    transform: translateY(-2px);
}

.card-thumbnail {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

/* PDF.js-rendered thumbnails: loading shimmer until rendered */
canvas.pdf-thumb:not(.loaded) {
    background: linear-gradient(110deg, #f5ede8 30%, #ede0d0 50%, #f5ede8 70%);
    background-size: 200% 100%;
    animation: pdfThumbShimmer 1.4s ease-in-out infinite;
}

@keyframes pdfThumbShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.card-thumbnail-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #f5ede8, #ede0d0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    color: #C0A090;
}

.card-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-date {
    font-size: 0.78rem;
    color: #8B0000;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.3rem;
}

.card-title {
    font-family: 'Tiro Devanagari Marathi', serif;
    font-size: 1.05rem;
    color: #1A1A1A;
    margin-bottom: 0.75rem;
    line-height: 1.3;
    flex: 1;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

/* ── Pagination ── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 0.75rem;
    border: 1px solid #D0C0B0;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #8B0000;
    transition: all 0.2s;
}

.pagination a:hover { background: #8B0000; color: #FFFDF5; border-color: #8B0000; text-decoration: none; }
.pagination .current { background: #8B0000; color: #FFFDF5; border-color: #8B0000; font-weight: 700; }
.pagination .disabled { color: #AAA; cursor: not-allowed; }

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: #888;
}
.empty-state .empty-icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-state p { font-size: 1.1rem; }

/* ── Footer ── */
.site-footer {
    background-color: #1A0000;
    color: rgba(255,253,245,0.7);
    padding: 1.75rem 1.25rem;
    margin-top: auto;
    border-top: 3px solid #8B0000;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-name {
    font-family: 'Tiro Devanagari Marathi', serif;
    font-size: 1.2rem;
    color: #FFFDF5;
    font-weight: 600;
}

.footer-copy { font-size: 0.82rem; }

.footer-admin-link {
    font-size: 0.82rem;
    color: rgba(255,253,245,0.45);
}

.footer-admin-link:hover { color: rgba(255,253,245,0.8); }

/* ── View Page (PDF Reader) ── */
.reader-toolbar {
    background: #8B0000;
    color: #FFFDF5;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.reader-info { flex: 1; min-width: 200px; }
.reader-title {
    font-family: 'Tiro Devanagari Marathi', serif;
    font-size: 1.15rem;
    font-weight: 700;
}
.reader-date { font-size: 0.82rem; color: rgba(255,253,245,0.75); }

.reader-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

.pdf-embed-wrap {
    width: 100%;
    background: #3A3A3A;
}

.pdf-embed {
    width: 100%;
    height: 90vh;
    border: none;
    display: block;
}

.pdf-fallback {
    padding: 3rem 1.25rem;
    text-align: center;
    color: #FFFDF5;
}

/* ── Alert / Flash Messages ── */
.alert {
    padding: 0.85rem 1.25rem;
    border-radius: 4px;
    margin-bottom: 1.25rem;
    font-weight: 500;
    border-left: 4px solid;
}

.alert-success { background: #f0faf0; color: #1a5c1a; border-color: #2d862d; }
.alert-error   { background: #fff0f0; color: #8B0000; border-color: #8B0000; }
.alert-info    { background: #f0f6ff; color: #1a3d70; border-color: #2b5fad; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .site-name { font-size: 1.5rem; }
    .hero-inner { flex-direction: column-reverse; text-align: center; }
    .hero-thumbnail, .hero-thumbnail-placeholder { width: 140px; height: 185px; margin: 0 auto; }
    .hero-title { font-size: 1.4rem; }
    .hero-actions { justify-content: center; }
    .editions-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
    .footer-inner { flex-direction: column; text-align: center; }
    .reader-toolbar { flex-direction: column; align-items: flex-start; }
    .pdf-embed { height: 75vh; }
    .header-date { display: none; }
}

@media (max-width: 480px) {
    .site-logo { width: 48px; height: 48px; }
    .site-name { font-size: 1.3rem; }
    .editions-grid { grid-template-columns: 1fr; }
    .hero-section { padding: 1.5rem 0; }
}
