/* ==========================================================================
   Kami Design System & Styling Rules
   Warm Parchment Canvas, Deep Ink-Blue Accent, Serif Typography
   No Cool Grays, Antique Editorial Layout
   ========================================================================== */

:root {
    /* Color Palette */
    --paper: #faf6eb;         /* Warm parchment base */
    --paper-warm: #f5eedc;    /* Deeper parchment shadow */
    --paper-dark: #ebe2ce;    /* Deep aging paper color */
    
    --ink: #10141e;           /* Deep ink-blue text */
    --ink-soft: #283042;      /* Lighter ink-blue */
    --ink-mute: #4e596e;      /* Muted secondary text */
    --ink-faint: #818e9f;     /* Very light labeling text */
    
    --saffron: #cf7e29;       /* Saffron/Gold accent */
    --saffron-soft: #e59a49;  /* Bright saffron */
    --saffron-tint: rgba(207, 126, 41, 0.08); /* Highlight bg */
    
    --bone: #ffffff;
    --line: rgba(16, 20, 30, 0.12);       /* Thin ink divider */
    --line-soft: rgba(16, 20, 30, 0.06);  /* Faint divider */
    
    /* Typography */
    --font-heading: "Cinzel", Georgia, serif;
    --font-serif-pali: "EB Garamond", "Noto Serif Devanagari", serif;
    --font-sans-ui: "Albert Sans", system-ui, sans-serif;
    
    /* Spacing */
    --side-rail-width: 50px;
    --shadow-soft: 0 16px 36px rgba(16, 20, 30, 0.05);
}

/* Helper Utilities */
.hidden {
    display: none !important;
}

/* Reset and Core Layout */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    background-color: var(--paper-dark);
}

body {
    background-color: var(--paper);
    color: var(--ink);
    font-family: var(--font-sans-ui);
    font-size: 16px;
    line-height: 1.6;
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle Paper Grain Effect & Aging Glow overlay */
.paper-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
    opacity: 0.04;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='noise'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='matrix' values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.4 0'/></filter><rect width='100%' height='100%' filter='url(%23noise)'/></svg>");
}

.radial-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(circle at 50% 20%, transparent 20%, rgba(26, 22, 17, 0.05) 80%);
}

/* Side Rails - Vertical Text columns */
.side-rail {
    position: fixed;
    top: 0;
    bottom: 0;
    width: var(--side-rail-width);
    z-index: 10;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-color: var(--line-soft);
    border-style: solid;
    border-width: 0;
}

.side-rail.left {
    left: 0;
    border-right-width: 1px;
}

.side-rail.right {
    right: 0;
    border-left-width: 1px;
}

.side-rail .rail-text {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--ink-mute);
    white-space: nowrap;
    opacity: 0.5;
}

.side-rail.left .rail-text {
    transform: rotate(-90deg);
}

.side-rail.right .rail-text {
    transform: rotate(90deg);
}

/* Base Wrapper Shell */
.shell {
    position: relative;
    z-index: 2;
    padding-left: var(--side-rail-width);
    padding-right: var(--side-rail-width);
    max-width: 1400px;
    margin: 0 auto;
    border-left: 1px solid var(--line-soft);
    border-right: 1px solid var(--line-soft);
    background-color: var(--paper);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header & Brand Layout */
.site-header {
    width: 100%;
    padding: 1.5rem 3rem;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    background-color: rgba(250, 246, 235, 0.9);
    backdrop-filter: blur(8px);
    z-index: 50;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.brand {
    text-decoration: none;
    color: var(--ink);
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.1em;
    line-height: 1.1;
    color: var(--ink);
}

.brand-subtitle {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4em;
    color: var(--saffron);
    font-weight: 700;
    margin-top: 2px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 2rem;
}

/* Bilingual Script Selector (Stamps Style) */
.script-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.selector-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-mute);
}

.selector-buttons {
    display: flex;
    border: 1px solid var(--line);
    padding: 3px;
    background-color: var(--paper-warm);
}

.selector-btn {
    border: none;
    background: transparent;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.selector-btn:hover {
    color: var(--saffron);
}

.selector-btn.active {
    background-color: var(--ink);
    color: var(--paper);
}

/* Quick Search Input */
.search-box {
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    background-color: var(--paper-warm);
    padding-left: 0.75rem;
    width: 300px;
    transition: border-color 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--saffron);
}

.search-icon {
    color: var(--ink-mute);
    font-size: 16px;
}

.search-box input {
    border: none;
    background: transparent;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--ink);
    width: 100%;
    outline: none;
}

.search-box input::placeholder {
    color: var(--ink-faint);
}

.search-btn {
    border: none;
    background: var(--ink);
    color: var(--paper);
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-btn:hover {
    background-color: var(--saffron);
}

/* Majestic Hero Section */
.hero-section {
    padding: 4rem 3rem;
    border-bottom: 1px solid var(--line);
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 4rem;
    align-items: center;
}

.hero-frame {
    position: relative;
    padding: 1.5rem;
    border: 1px solid var(--line);
    background-color: var(--paper-warm);
}

.frame-corner {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid var(--saffron);
}

.frame-corner.tl { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.frame-corner.tr { top: -2px; right: -2px; border-left: none; border-bottom: none; }
.frame-corner.bl { bottom: -2px; left: -2px; border-right: none; border-top: none; }
.frame-corner.br { bottom: -2px; right: -2px; border-left: none; border-top: none; }

.hero-graphic-container {
    line-height: 0;
    overflow: hidden;
    border: 1px solid var(--line-soft);
}

.hero-graphic {
    width: 100%;
    height: auto;
    filter: sepia(0.15) contrast(0.95);
    transition: transform 0.5s ease;
}

.hero-graphic:hover {
    transform: scale(1.02);
}

.hero-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.hero-kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--saffron);
    margin-bottom: 1.5rem;
}

.hero-title {
    margin-bottom: 2rem;
}

.title-primary {
    display: block;
    font-family: var(--font-heading);
    font-size: clamp(32px, 3.5vw, 54px);
    font-weight: 800;
    line-height: 1.1;
    color: var(--ink);
    letter-spacing: 0.05em;
}

.title-secondary {
    display: block;
    font-size: clamp(16px, 1.8vw, 24px);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: var(--ink-soft);
    margin-top: 0.5rem;
    border-bottom: 2px solid var(--saffron);
    padding-bottom: 8px;
    width: fit-content;
}

.hero-lead {
    font-size: 15px;
    line-height: 1.7;
    color: var(--ink-soft);
    margin-bottom: 2.5rem;
    max-width: 48ch;
}

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

/* Elegant Editorial Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    border-radius: 0;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-primary {
    background-color: var(--ink);
    color: var(--paper);
    border: 1px solid var(--ink);
}

.btn-primary:hover {
    background-color: var(--saffron);
    border-color: var(--saffron);
}

.btn-ghost {
    background-color: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
}

.btn-ghost:hover {
    background-color: var(--paper-warm);
    border-color: var(--ink);
}

.btn-sm {
    padding: 8px 18px;
    font-size: 11px;
}

/* Section Rule (Kami Aesthetics) */
.sec-rule {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 3rem;
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.sec-rule .roman {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    color: var(--saffron);
}

.sec-rule .meta-grp {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
}

.sec-rule .dot-mark {
    color: var(--saffron);
}

/* Directory Section */
.library-section {
    padding: 5rem 3rem;
    border-bottom: 1px solid var(--line);
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    margin-top: 2rem;
    align-items: start;
}

.index-overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-top: 2rem;
    align-items: center;
}

.section-header {
    margin-bottom: 3.5rem;
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: clamp(28px, 3vw, 42px);
    margin-bottom: 1rem;
}

.section-header .lead {
    font-size: 15px;
    color: var(--ink-soft);
    max-width: 60ch;
}

/* Sutta Pitaka Tabs (Kami Document Style) */
.tabs-container {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.tab-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1px;
    background-color: var(--line);
    border: 1px solid var(--line);
}

.tab-btn {
    border: none;
    background-color: var(--paper-warm);
    padding: 1.25rem 1rem;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.tab-btn:hover {
    background-color: var(--paper-dark);
}

.tab-btn.active {
    background-color: var(--paper);
    position: relative;
}

.tab-btn.active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--saffron);
}

.tab-num {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--saffron);
}

.tab-name {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--ink);
}

/* Sutta Cards Grid */
.tab-panels {
    position: relative;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.sutta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.sutta-card {
    border: 1px solid var(--line);
    padding: 2rem;
    background-color: var(--paper-warm);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.sutta-card:hover {
    transform: translateY(-4px);
    border-color: var(--saffron);
    box-shadow: var(--shadow-soft);
}

.card-meta {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--saffron);
    margin-bottom: 1rem;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.card-desc {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--ink-soft);
    margin-bottom: 2rem;
    flex-grow: 1;
}

.card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink);
}

.sutta-card:hover .card-footer {
    color: var(--saffron);
}

.sutta-card .card-footer i {
    transition: transform 0.2s ease;
}

.sutta-card:hover .card-footer i {
    transform: translateX(4px);
}

/* Sutta Reader Modal Overlay */
.reader-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(16, 20, 30, 0.75);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    transition: opacity 0.3s ease;
}

.reader-modal-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

/* Sutta Reader Modal Card (Parchment scroll style) */
.reader-modal-card {
    background-color: var(--paper);
    border: 2px solid var(--saffron);
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), var(--shadow-paper);
    animation: modalIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
    position: relative;
    border-radius: 4px;
}

.reader-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 3rem 4rem;
}

/* Close overlay btn (extra quick access top right corner) */
.reader-modal-close-overlay-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    border: none;
    background: transparent;
    font-size: 26px;
    cursor: pointer;
    color: var(--ink-mute);
    transition: color 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

.reader-modal-close-overlay-btn:hover {
    color: var(--saffron);
    transform: rotate(90deg);
}

.reader-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 3rem;
    margin-bottom: 4rem;
}

.reader-header .title-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.reader-header h2 {
    font-family: var(--font-heading);
    font-size: clamp(26px, 2.5vw, 36px);
    line-height: 1.2;
}

.reader-header h3 {
    font-family: var(--font-serif-pali);
    font-size: 20px;
    font-style: italic;
    font-weight: 400;
    color: var(--saffron);
}

.reader-actions {
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
}

/* Loading & Error States */
.reader-loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6rem 0;
    gap: 1.5rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--line);
    border-top-color: var(--saffron);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.reader-loading-spinner p {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-soft);
    letter-spacing: 0.05em;
}

.reader-error-state {
    text-align: center;
    padding: 5rem 2rem;
    background-color: var(--paper-warm);
    border: 1px dashed var(--line);
}

.error-icon {
    font-size: 42px;
    color: var(--saffron);
    margin-bottom: 1rem;
    display: inline-block;
}

.reader-error-state h4 {
    font-family: var(--font-heading);
    font-size: 18px;
    margin-bottom: 0.5rem;
}

.reader-error-state p {
    font-size: 14px;
    color: var(--ink-soft);
    margin-bottom: 2rem;
}

/* Bilingual Segmented Reader Grid */
.reader-grid {
    width: 100%;
}

.grid-column-header {
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--ink-faint);
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 1.5rem;
}

.reader-rows {
    display: flex;
    flex-direction: column;
}

/* Sutta Segment Row */
.sutta-row {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 3rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--line-soft);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.sutta-row:hover {
    background-color: var(--saffron-tint);
    border-bottom-color: rgba(207, 126, 41, 0.25);
}

/* Segment Identifier */
.seg-id {
    display: block;
    font-size: 9px;
    font-weight: 700;
    color: var(--ink-faint);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

/* Pali Column */
.pali-col {
    font-family: var(--font-serif-pali);
    font-size: clamp(17px, 1.2vw, 20px);
    line-height: 1.5;
    color: var(--ink-soft);
    padding-right: 1rem;
}

/* Devnagari specific styles for smoother rendering */
.pali-col.devanagari {
    font-family: "Noto Serif Devanagari", var(--font-serif-pali);
    font-weight: 500;
}

/* English Column */
.trans-col {
    font-family: var(--font-sans-ui);
    font-size: clamp(14px, 1vw, 15.5px);
    line-height: 1.6;
    color: var(--ink-soft);
}

/* Bold / Title highlight styling within segments (e.g. Sutta titles, headers) */
.sutta-row.row-heading {
    border-bottom: 2px solid var(--line);
    background-color: var(--paper-warm);
    padding: 2rem 1rem;
    margin: 1.5rem 0;
}

.sutta-row.row-heading .pali-col {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--saffron);
}

.sutta-row.row-heading .trans-col {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
}

/* Footer layout */
.site-footer {
    margin-top: auto;
    padding: 4rem 3rem;
    background-color: var(--paper);
    border-top: 1px solid var(--line-soft);
}

.footer-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.footer-rule {
    width: 100%;
    height: 1px;
    background-color: var(--line);
}

.footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 3rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.footer-brand .mark {
    width: 38px;
    height: 38px;
    border: 1px solid var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 20px;
}

.footer-brand .stamp {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.footer-brand .stamp span:first-child {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--ink);
}

.footer-brand .stamp span:last-child {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.25em;
    color: var(--saffron);
}

.footer-meta {
    font-size: 12.5px;
    color: var(--ink-mute);
    text-align: right;
    line-height: 1.5;
}

.footer-link {
    color: var(--saffron);
    text-decoration: none;
    font-weight: 500;
}

.footer-link:hover {
    text-decoration: underline;
}

/* LLM Prompt Modal Stylings */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(16, 20, 30, 0.65);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-card {
    background-color: var(--paper);
    border: 1px solid var(--saffron);
    max-width: 680px;
    width: 100%;
    padding: 2.5rem;
    box-shadow: var(--shadow-paper);
    animation: modalIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes modalIn {
    from { transform: scale(0.95) translateY(12px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
}

.modal-close-btn {
    border: none;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
    color: var(--ink-mute);
    transition: color 0.2s ease;
}

.modal-close-btn:hover {
    color: var(--saffron);
}

.modal-body p {
    font-size: 13.5px;
    color: var(--ink-soft);
    margin-bottom: 1.5rem;
}

.prompt-textarea-container {
    border: 1px solid var(--line);
    background-color: var(--paper-warm);
    padding: 10px;
    margin-bottom: 2rem;
}

.prompt-textarea-container textarea {
    width: 100%;
    height: 300px;
    border: none;
    background: transparent;
    font-family: monospace;
    font-size: 12px;
    color: var(--ink-soft);
    resize: none;
    outline: none;
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1.5rem;
}

.copy-success-toast {
    font-size: 12px;
    font-weight: 600;
    color: #10b981; /* Green */
    animation: toastIn 0.3s ease;
}

.copy-success-toast.hidden {
    display: none;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-4px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ==========================================================================
   Directory Breadcrumbs & Related Suttas Styling
   ========================================================================== */

.breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-mute);
    margin-bottom: 2.5rem;
    background-color: var(--paper-warm);
    padding: 10px 18px;
    border: 1px solid var(--line);
    max-width: 100%;
    box-sizing: border-box;
}

.breadcrumb-item {
    cursor: pointer;
    transition: color 0.2s ease;
    color: var(--ink-soft);
}

.breadcrumb-item:hover {
    color: var(--saffron);
}

.breadcrumb-item.active {
    color: var(--ink-faint);
    cursor: default;
    pointer-events: none;
}

.breadcrumb-separator {
    color: var(--line);
    font-weight: normal;
    font-size: 9px;
}

/* Related Suttas */
.related-suttas-section {
    width: 100%;
}

.related-suttas-section.hidden {
    display: none;
}

/* ==========================================================================
   Responsive Styling Adjustments
   ========================================================================== */

@media (max-width: 1024px) {
    :root {
        --side-rail-width: 0px;
    }
    
    .side-rail {
        display: none;
    }
    
    .about-grid {
        gap: 2.5rem;
    }
    
    .index-overview-grid {
        gap: 2rem;
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .hero-copy {
        align-items: center;
        text-align: center;
    }
    
    .hero-lead {
        margin-left: auto;
        margin-right: auto;
    }
    
    .hero-actions {
        justify-content: center;
    }
    
    .tab-list {
        grid-template-columns: 1fr;
    }
    
    .tab-btn {
        flex-direction: row;
        justify-content: space-between;
        padding: 1rem 1.5rem;
    }
    
    .tab-btn.active::after {
        bottom: 0;
        top: 0;
        left: 0;
        width: 4px;
        height: auto;
    }
    
    .sutta-row {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        padding: 2rem 0;
    }
    
    .pali-col {
        padding-right: 0;
        border-bottom: 1px dashed var(--line-soft);
        padding-bottom: 1rem;
    }
    
    .grid-column-header.pali,
    .grid-column-header.trans {
        display: none;
    }
    
    .site-header {
        padding: 1.25rem 2rem;
    }
    
    .hero-section,
    .library-section,
    .reader-modal-body {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

@media (max-width: 768px) {
    .about-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
    
    .index-overview-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .hero-section,
    .library-section {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }

    .sutta-grid {
        grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)) !important;
        gap: 1.25rem !important;
    }
    
    .sutta-card {
        padding: 1.5rem !important;
    }

    .reader-modal-overlay {
        padding: 0;
    }

    .reader-modal-card {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }

    .reader-modal-body {
        padding: 2rem 1.5rem;
    }

    .reader-modal-close-overlay-btn {
        top: 1rem;
        right: 1rem;
        font-size: 22px;
    }

    .header-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
    }
    
    .header-controls {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .script-selector {
        justify-content: space-between;
    }
    
    .search-box {
        width: 100%;
    }
    
    #btn-header-index {
        margin-left: 0 !important;
        width: 100% !important;
        justify-content: center !important;
    }
    
    .reader-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
        margin-bottom: 2.5rem;
    }
    
    .reader-actions {
        width: 100%;
        justify-content: flex-start;
        flex-direction: column;
        gap: 0.75rem;
    }

    .reader-actions button {
        width: 100%;
        justify-content: center;
    }
    
    .footer-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }
    
    .footer-meta {
        text-align: left;
    }
}

/* Reader Tabs styling */
.reader-tabs-container {
    display: flex;
    gap: 1.5rem;
    border-bottom: 1px solid rgba(139, 105, 52, 0.25);
    margin-bottom: 3rem;
    padding-bottom: 0.5rem;
}

.reader-tab {
    background: none;
    border: none;
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    color: var(--ink-mute);
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.25s ease;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.reader-tab:hover {
    color: var(--saffron);
    background-color: rgba(139, 105, 52, 0.05);
}

.reader-tab.active {
    color: var(--saffron);
}

.reader-tab.active::after {
    content: '';
    position: absolute;
    bottom: -0.6rem;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--saffron);
    border-radius: 2px;
}

/* Study Summary View */
.reader-summary-container {
    max-width: 850px;
    margin: 0 auto;
    padding: 1rem 0;
    line-height: 1.8;
}

.parchment-summary-card {
    background-color: var(--paper-light);
    border-radius: 8px;
    padding: 3rem;
    box-shadow: inset 0 0 20px rgba(139, 105, 52, 0.05);
    border: 1px dashed rgba(139, 105, 52, 0.2);
}

.summary-markdown-content h1,
.summary-markdown-content h2,
.summary-markdown-content h3 {
    font-family: var(--font-heading);
    color: var(--ink);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.summary-markdown-content h1 {
    font-size: 24px;
    border-bottom: 2px solid rgba(139, 105, 52, 0.15);
    padding-bottom: 0.5rem;
}

.summary-markdown-content h2 {
    font-size: 20px;
    border-bottom: 1px solid rgba(139, 105, 52, 0.15);
    padding-bottom: 0.3rem;
}

.summary-markdown-content h3 {
    font-size: 18px;
}

.summary-markdown-content p {
    font-size: 17px;
    color: var(--ink);
    margin-bottom: 1.5rem;
}

.summary-markdown-content ul {
    margin-bottom: 2rem;
    padding-left: 2rem;
}

.summary-markdown-content li {
    font-size: 16.5px;
    margin-bottom: 0.8rem;
    position: relative;
    list-style-type: square;
    color: var(--ink);
}

.summary-markdown-content strong {
    color: var(--saffron-dark);
}

.summary-fallback-prompt-box {
    margin-top: 2rem;
    padding: 2rem;
    background-color: rgba(139, 105, 52, 0.05);
    border-left: 4px solid var(--saffron);
    border-radius: 0 8px 8px 0;
}

/* Summary Table styling */
.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 15px;
    background-color: rgba(139, 105, 52, 0.015);
    border: 1px solid rgba(139, 105, 52, 0.15);
    border-radius: 4px;
    table-layout: auto;
}

.summary-table th,
.summary-table td {
    padding: 0.8rem 1.1rem;
    text-align: left;
    border-bottom: 1px solid rgba(139, 105, 52, 0.1);
    vertical-align: top;
}

.summary-table th:not(:last-child),
.summary-table td:not(:last-child) {
    border-right: 1px solid rgba(139, 105, 52, 0.1);
}

.summary-table th {
    background-color: rgba(139, 105, 52, 0.08);
    font-family: var(--font-heading);
    color: var(--saffron-dark);
    font-weight: 600;
    border-bottom: 2px solid rgba(139, 105, 52, 0.2);
}

.summary-table tr:last-child td {
    border-bottom: none;
}

.summary-table tr:nth-child(even) td {
    background-color: rgba(139, 105, 52, 0.03);
}

.summary-markdown-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}



