/* ============================================================
   Arthshastra — Mesa Fama / Literary Substack Theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600&family=Spectral:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500&family=Inter:wght@400;500;600&display=swap');

:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'Lora', Georgia, serif;
    --font-body: 'Spectral', Georgia, serif;
    --bg: #ffffff;
    --bg-warm: #faf9f7;
    --bg-hero: #0c4a5e;
    --bg-hero-light: #f0f8fa;
    --fg: #363737;
    --fg-dark: #1a1a1a;
    --fg-secondary: #6b6b6b;
    --fg-muted: #868787;
    --fg-light: #b7b7b7;
    --accent: #0891b2;
    --accent-hover: #0e7490;
    --accent-deep: #0c4a5e;
    --accent-glow: rgba(8, 145, 178, 0.12);
    --accent-glow-hover: rgba(8, 145, 178, 0.25);
    --border: #e8e8e8;
    --border-light: #f0f0f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-card: 0 1px 4px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
    --shadow-card-hover: 0 2px 8px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.06);
    --radius: 6px;
    --radius-lg: 12px;
    --max-width: 680px;
    --grid-width: 1080px;
    --header-max-width: 1200px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--fg);
    line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

/* ---- Site Header ---- */
.site-header {
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(255,255,255,0.92);
}
.header-inner {
    max-width: var(--header-max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 32px;
}
.site-logo {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--fg-dark);
    letter-spacing: -0.01em;
}
.site-logo:hover { color: var(--accent); }
.header-nav {
    display: flex;
    align-items: center;
    gap: 28px;
    font-size: 0.88rem;
    font-weight: 500;
}
.header-nav a {
    color: var(--fg-secondary);
    transition: color 0.2s;
    position: relative;
}
.header-nav a:hover { color: var(--fg-dark); }
.header-nav a.active {
    color: var(--accent);
}
.header-nav a.active::after {
    content: '';
    position: absolute;
    bottom: -16px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

/* ---- Masthead (clean centered text, like Mesa Fama) ---- */
.masthead {
    text-align: center;
    padding: 40px 32px 28px;
    border-bottom: 1px solid var(--border);
}
.masthead h1 {
    font-family: var(--font-heading);
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
    color: var(--fg-dark);
    line-height: 1.15;
}
.masthead .tagline {
    font-family: var(--font-body);
    font-size: 1.05rem;
    color: var(--fg-secondary);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.55;
    font-style: italic;
    font-weight: 400;
}

/* ---- Category Pills (filter bar) ---- */
.filter-bar {
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.filter-bar-inner {
    max-width: var(--grid-width);
    margin: 0 auto;
    padding: 14px 32px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.filter-bar-inner::-webkit-scrollbar { display: none; }
.pill {
    display: inline-block;
    padding: 7px 18px;
    border-radius: 100px;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    background: transparent;
    color: var(--fg-secondary);
    border: 1px solid var(--border);
    transition: all 0.2s;
    cursor: pointer;
}
.pill:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}
.pill.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ---- 3-Column Magazine Hero ---- */
.magazine-hero {
    max-width: var(--grid-width);
    margin: 0 auto;
    padding: 32px 32px 0;
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    gap: 28px;
    min-height: 520px;
}

/* Left column: 2 stacked cards with optional images */
.mag-left {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.mag-left-card {
    display: block;
    flex: 1;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--bg);
    transition: transform 0.2s, box-shadow 0.2s;
}
.mag-left-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}
.mag-left-card .card-img {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
    display: block;
    background: var(--bg-warm);
}
.mag-left-card .card-img-placeholder {
    width: 100%;
    aspect-ratio: 16/10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    background: var(--bg-warm);
}
.mag-left-card .card-body {
    padding: 16px 20px 20px;
}
.mag-left-card h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--fg-dark);
    margin-bottom: 4px;
}
.mag-left-card .card-sub {
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: var(--fg-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.mag-left-card .card-meta-sm {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--fg-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Center: large hero card with image or gradient */
.mag-center {
    position: relative;
    display: flex;
    flex-direction: column;
}
.mag-center-card {
    display: flex;
    flex-direction: column;
    flex: 1;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg);
    transition: transform 0.2s, box-shadow 0.2s;
}
.mag-center-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}
.mag-center-card .hero-visual {
    flex: 1;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-deep) 0%, #0d6680 50%, var(--accent) 100%);
    text-align: center;
    position: relative;
    overflow: hidden;
}
.mag-center-card .hero-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0; left: 0;
}
.mag-center-card .hero-visual .hero-quote {
    font-family: var(--font-body);
    font-size: 1.5rem;
    font-style: italic;
    font-weight: 400;
    line-height: 1.4;
    max-width: 380px;
    opacity: 0.9;
    color: #fff;
    padding: 40px;
    position: relative;
    z-index: 1;
}
.mag-center-card .hero-body {
    padding: 24px 28px 28px;
    background: #fff;
    color: var(--fg-dark);
}
.mag-center-card .hero-body h2 {
    font-family: var(--font-heading);
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}
.mag-center-card .hero-body .hero-sub {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--fg-secondary);
    line-height: 1.5;
    margin-bottom: 10px;
}
.mag-center-card .hero-body .hero-meta {
    font-size: 0.78rem;
    color: var(--fg-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Right: sidebar list */
.mag-right {
    border-left: 1px solid var(--border);
    padding-left: 28px;
}
.mag-right .sidebar-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--fg-dark);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.mag-right .sidebar-title a {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--fg-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.mag-right .sidebar-title a:hover { color: var(--accent); }
.sidebar-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s;
}
.sidebar-item:hover { background: var(--bg-warm); margin: 0 -8px; padding: 12px 8px; border-radius: var(--radius); }
.sidebar-item .sidebar-text { flex: 1; min-width: 0; }
.sidebar-item h4 {
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--fg-dark);
    margin-bottom: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sidebar-item .sidebar-meta {
    font-size: 0.72rem;
    color: var(--fg-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.sidebar-item .sidebar-thumb {
    width: 64px;
    height: 64px;
    border-radius: var(--radius);
    background: var(--bg-warm);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--fg-light);
}

/* ---- Post Feed (below the hero) ---- */
.feed {
    max-width: var(--grid-width);
    margin: 0 auto;
    padding: 0 32px;
}
.feed-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.year-divider {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 48px 0 8px;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--fg-dark);
}
.year-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.post-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    transition: all 0.25s ease;
    background: var(--bg);
    overflow: hidden;
}
.post-card:hover {
    border-color: transparent;
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}
.post-card .card-color-top {
    height: 5px;
}
.post-card .card-inner {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.post-card .card-category {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 8px;
}
.post-card h2 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 8px;
    color: var(--fg-dark);
    letter-spacing: -0.01em;
}
.post-card .card-excerpt {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--fg-secondary);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}
.post-card .card-footer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--fg-muted);
}
.post-card .card-date { font-weight: 500; }
.post-card .card-reading-time { color: var(--fg-light); }

/* ---- Single Post ---- */
.post-header {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 64px 24px 0;
}
.post-header .post-category {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 20px;
    padding: 4px 12px;
    background: var(--accent-glow);
    border-radius: 100px;
}
.post-header h1 {
    font-family: var(--font-heading);
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -0.025em;
    margin-bottom: 20px;
    color: var(--fg-dark);
}
.post-header .post-subtitle {
    font-family: var(--font-body);
    font-size: 1.25rem;
    color: var(--fg-secondary);
    line-height: 1.55;
    font-style: italic;
    font-weight: 300;
    margin-bottom: 28px;
}
.post-header .post-meta-line {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
    color: var(--fg-secondary);
}
.post-header .author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}
.post-header .author-info { display: flex; flex-direction: column; gap: 2px; }
.post-header .author-name { font-weight: 600; color: var(--fg-dark); font-size: 0.9rem; display: flex; align-items: center; gap: 6px; }
.guest-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: var(--font-ui);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    padding: 2px 8px;
    border-radius: 3px;
}
.post-header .meta-details { font-size: 0.82rem; color: var(--fg-muted); }
.post-header .meta-dot { color: var(--fg-light); }

/* ---- Post Body ---- */
.post-body {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 44px 24px 56px;
    font-family: var(--font-body);
    font-size: 1.18rem;
    line-height: 1.9;
    color: var(--fg);
}
.post-body p { margin-bottom: 1.5em; }
.post-body h2, .post-body h3, .post-body h4 {
    font-family: var(--font-heading);
    font-weight: 600;
    margin-top: 2.2em;
    margin-bottom: 0.6em;
    color: var(--fg-dark);
}
.post-body h2 { font-size: 1.5rem; }
.post-body h3 { font-size: 1.25rem; }
.post-body a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: rgba(8, 145, 178, 0.3);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s;
}
.post-body a:hover { text-decoration-color: var(--accent); }
.post-body img {
    border-radius: var(--radius);
    margin: 2em 0;
}
.post-body figure {
    margin: 2em 0;
    padding: 0;
}
.post-body figure.alignleft {
    float: left;
    margin: 0.5em 1.5em 1em 0;
    max-width: 40%;
}
.post-body figure.alignright {
    float: right;
    margin: 0.5em 0 1em 1.5em;
    max-width: 40%;
}
.post-body figure.aligncenter {
    text-align: center;
}
.post-body figure img {
    margin: 0;
    max-width: 100%;
    height: auto;
}
.post-body figcaption {
    font-size: 0.82rem;
    color: var(--fg-muted);
    font-style: italic;
    margin-top: 0.5em;
    text-align: center;
    line-height: 1.4;
}
.post-body blockquote {
    border-left: 3px solid var(--accent);
    margin: 2em 0;
    padding: 1em 1.5em;
    font-style: italic;
    color: var(--fg-secondary);
    background: var(--bg-warm);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.post-body ul, .post-body ol {
    margin-bottom: 1.5em;
    padding-left: 1.6em;
}
.post-body li { margin-bottom: 0.4em; }
.post-body pre, .post-body code {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.88em;
    background: var(--bg-warm);
    border-radius: 4px;
}
.post-body code { padding: 2px 6px; }
.post-body pre { padding: 1em 1.2em; overflow-x: auto; margin: 1.5em 0; }
.post-body hr {
    border: none;
    text-align: center;
    margin: 2.5em 0;
}
.post-body hr::after {
    content: '\2767';
    color: var(--accent);
    font-size: 1.4rem;
}
.post-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.5em 0;
    font-family: var(--font-sans);
    font-size: 0.9rem;
}
.post-body th, .post-body td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    text-align: left;
}
.post-body th { background: var(--bg-warm); font-weight: 600; }

/* ---- Post Footer / Navigation ---- */
.post-footer-section {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px 72px;
}
.post-divider {
    height: 1px;
    background: var(--border);
    margin-bottom: 40px;
}
.post-nav-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.nav-card {
    padding: 20px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all 0.2s;
}
.nav-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.nav-card .nav-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 6px;
}
.nav-card .nav-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--fg-dark);
}
.nav-card.next { text-align: right; }

/* ---- Category Page ---- */
.category-header {
    max-width: var(--grid-width);
    margin: 0 auto;
    padding: 52px 32px 0;
}
.category-header h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
    color: var(--fg-dark);
}
.category-header .count {
    font-size: 0.9rem;
    color: var(--fg-muted);
}

/* ---- Guest Author Section ---- */
.guest-author-section {
    max-width: var(--grid-width);
    margin: 0 auto;
    padding: 0 32px;
}
.guest-author-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 24px 0 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.guest-author-header .author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.guest-author-header .author-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.guest-author-header .author-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--fg-dark);
}
.guest-author-header .meta-details {
    font-size: 0.85rem;
    color: var(--fg-muted);
}
.card-cat {
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-ui);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ---- Footer ---- */
.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 80px;
    background: var(--bg-warm);
}
.footer-inner {
    max-width: var(--grid-width);
    margin: 0 auto;
    padding: 48px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.footer-brand .footer-logo {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--fg-dark);
}
.footer-brand .footer-desc {
    font-size: 0.82rem;
    color: var(--fg-muted);
}
.footer-right {
    font-size: 0.8rem;
    color: var(--fg-light);
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .magazine-hero { grid-template-columns: 1fr 1fr; }
    .mag-right { border-left: none; border-top: 1px solid var(--border); padding-left: 0; padding-top: 24px; grid-column: 1 / -1; }
    .feed-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .magazine-hero { grid-template-columns: 1fr; padding: 20px 16px 0; gap: 20px; min-height: auto; }
    .mag-left { flex-direction: row; } .mag-left-card { flex: 1; }
    .mag-right { padding-top: 16px; }
    .feed-grid { grid-template-columns: 1fr; }
    .masthead h1 { font-size: 1.8rem; }
    .masthead { padding: 28px 16px 20px; }
    .post-header { padding-top: 40px; }
    .post-header h1 { font-size: 2rem; }
    .post-body { font-size: 1.08rem; padding: 32px 20px 40px; }
    .header-inner { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
    .header-nav { gap: 12px 16px; font-size: 0.82rem; flex-wrap: wrap; }
    .filter-bar-inner { padding: 12px 16px; }
    .feed { padding: 0 16px; }
    .post-nav-grid { grid-template-columns: 1fr; }
    .footer-inner { flex-direction: column; gap: 12px; text-align: center; }
}
@media (max-width: 480px) {
    .masthead h1 { font-size: 1.5rem; }
    .header-nav { gap: 8px 12px; }
    .post-header h1 { font-size: 1.6rem; }
    .mag-left { flex-direction: column; }
    .mag-center-card .hero-visual .hero-quote { font-size: 1.2rem; }
}
