/* Grammar Reference Pages */

.grammar-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.grammar-page-header {
    text-align: center;
    margin-bottom: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.grammar-page-header h1 {
    font-size: 2.5rem;
    color: var(--color-navy);
    margin: 0 0 0.75rem 0;
}

.grammar-subtitle {
    font-size: 1.1rem;
    color: #666;
    max-width: 600px;
    margin: 0;
    text-align: center;
    line-height: 1.6;
}

/* Category sections */
.grammar-categories {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.grammar-category {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e8e2d6;
}

.category-name {
    font-size: 1.4rem;
    color: var(--color-navy);
    margin: 0 0 0.5rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-gold);
}

.category-desc {
    color: #666;
    margin: 0 0 1rem 0;
    font-size: 0.95rem;
}

/* Topic cards grid */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.topic-card {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: var(--color-parchment);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 1px solid #e8e2d6;
}

.topic-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: var(--color-gold);
}

.topic-name {
    font-weight: 600;
    color: var(--color-navy);
    margin-bottom: 0.25rem;
}

.topic-summary {
    font-size: 0.85rem;
    color: #666;
}

/* Grammar footer tips */
.grammar-footer {
    margin-top: 3rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f6f0, #fff);
    border-radius: 12px;
    border: 1px solid #e8e2d6;
}

.grammar-footer h3 {
    color: var(--color-navy);
    margin: 0 0 1rem 0;
}

.grammar-tips {
    margin: 0;
    padding-left: 1.25rem;
}

.grammar-tips li {
    margin-bottom: 0.75rem;
    color: #444;
    line-height: 1.5;
}

.grammar-tips li strong {
    color: var(--color-navy);
}

/* Quick Reference Tables */
.quick-reference {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--color-gold);
}

.quick-reference h2 {
    font-size: 1.8rem;
    color: var(--color-navy);
    text-align: center;
    margin-bottom: 2rem;
}

.reference-section {
    margin-bottom: 2rem;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e8e2d6;
}

.reference-section h3 {
    font-size: 1.15rem;
    color: var(--color-navy);
    margin: 0 0 0.5rem 0;
}

.table-example {
    font-size: 0.9rem;
    color: #666;
    margin: 0 0 1rem 0;
    font-style: italic;
}

.table-wrapper {
    overflow-x: auto;
}

.paradigm-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-greek);
    font-size: 1rem;
}

.paradigm-table th,
.paradigm-table td {
    padding: 0.6rem 0.8rem;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.paradigm-table thead th {
    background: var(--color-parchment);
    color: var(--color-navy);
    font-weight: 600;
    font-family: var(--font-serif);
}

.paradigm-table tbody td {
    background: white;
}

.paradigm-table .row-label {
    text-align: left;
    font-weight: 600;
    color: var(--color-navy);
    font-family: var(--font-serif);
    background: #fafafa;
}

.paradigm-table .greek-cell {
    font-family: var(--font-greek);
    font-size: 1.05rem;
}

.preposition-table td:first-child {
    font-family: var(--font-greek);
    font-size: 1.1rem;
    font-weight: 500;
}

.preposition-table td:last-child {
    text-align: left;
    font-family: var(--font-serif);
}

/* Topic page styles */
.grammar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    color: #666;
}

.grammar-breadcrumb a {
    color: var(--color-navy);
    text-decoration: none;
}

.grammar-breadcrumb a:hover {
    text-decoration: underline;
}

.grammar-breadcrumb .separator {
    color: #ccc;
}

.grammar-breadcrumb .current {
    color: #999;
}

.grammar-article {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e8e2d6;
}

.article-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--color-gold);
}

.article-header h1 {
    font-size: 2rem;
    color: var(--color-navy);
    margin: 0 0 0.5rem 0;
}

.article-summary {
    font-size: 1.15rem;
    color: var(--color-burgundy);
    margin: 0;
    font-weight: 500;
}

.article-content {
    margin-bottom: 2rem;
}

.explanation p {
    line-height: 1.7;
    color: #333;
    margin-bottom: 1rem;
    white-space: pre-line;
}

.article-tips {
    margin-bottom: 2rem;
    padding: 1.25rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--color-gold);
}

.article-tips h2 {
    font-size: 1.1rem;
    color: var(--color-navy);
    margin: 0 0 0.75rem 0;
}

.tips-list {
    margin: 0;
    padding-left: 1.25rem;
}

.tips-list li {
    margin-bottom: 0.5rem;
    color: #444;
    line-height: 1.5;
}

/* Examples section */
.article-examples {
    margin-bottom: 2rem;
}

.article-examples h2 {
    font-size: 1.2rem;
    color: var(--color-navy);
    margin: 0 0 0.5rem 0;
}

.examples-intro {
    color: #666;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

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

.example-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
    background: var(--color-parchment);
    border-radius: 8px;
    border: 1px solid #e8e2d6;
}

.example-form {
    font-family: var(--font-greek);
    font-size: 1.3rem;
    color: var(--color-navy);
}

.example-lemma {
    font-family: var(--font-greek);
    font-size: 0.9rem;
    color: #888;
}

.example-def {
    font-size: 0.85rem;
    color: #555;
    margin-top: 0.25rem;
    line-height: 1.4;
}

.example-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.example-tags .morph-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    background: #e8e2d6;
    color: #555;
    cursor: default;
    position: relative;
    font-weight: 600;
}

/* POS tags */
.example-tags .morph-tag.pos-tag { color: #333; }
.example-tags .morph-tag.pos-tag.noun { background-color: #ffccbc; }
.example-tags .morph-tag.pos-tag.verb { background-color: #ffe082; }
.example-tags .morph-tag.pos-tag.participle { background-color: #ffab91; }
.example-tags .morph-tag.pos-tag.adj,
.example-tags .morph-tag.pos-tag.adjective { background-color: #c5e1a5; }
.example-tags .morph-tag.pos-tag.adv,
.example-tags .morph-tag.pos-tag.adverb { background-color: #e1bee7; }
.example-tags .morph-tag.pos-tag.pron { background-color: #ffcc80; }
.example-tags .morph-tag.pos-tag.prep { background-color: #80deea; }
.example-tags .morph-tag.pos-tag.conj { background-color: #dce775; }
.example-tags .morph-tag.pos-tag.particle { background-color: #fff59d; }
.example-tags .morph-tag.pos-tag.article { background-color: #cfd8dc; }

/* Case tags */
.example-tags .morph-tag.case-nom { background: #e0f2f1; color: #00695c; }
.example-tags .morph-tag.case-gen { background: #ffebee; color: #c62828; }
.example-tags .morph-tag.case-dat { background: #e8f5e9; color: #2e7d32; }
.example-tags .morph-tag.case-acc { background: #fff3e0; color: #e65100; }
.example-tags .morph-tag.case-voc { background: #f3e5f5; color: #7b1fa2; }

/* Tense tags */
.example-tags .morph-tag.tense-pres { background: #f1f8e9; color: #558b2f; }
.example-tags .morph-tag.tense-impf { background: #ede7f6; color: #5e35b1; }
.example-tags .morph-tag.tense-fut { background: #e0f7fa; color: #00838f; }
.example-tags .morph-tag.tense-aor { background: #ffebee; color: #c62828; }
.example-tags .morph-tag.tense-perf { background: #e8f5e9; color: #2e7d32; }
.example-tags .morph-tag.tense-plup { background: #efebe9; color: #4e342e; }

/* Gender tags */
.example-tags .morph-tag.gender-masc { background: #e3f2fd; color: #1565c0; }
.example-tags .morph-tag.gender-fem { background: #fce4ec; color: #c2185b; }
.example-tags .morph-tag.gender-neut { background: #eceff1; color: #546e7a; }

/* Voice tags */
.example-tags .morph-tag.voice-act { background: #fff8e1; color: #f57f17; }
.example-tags .morph-tag.voice-mid { background: #e8eaf6; color: #3f51b5; }
.example-tags .morph-tag.voice-pass { background: #fce4ec; color: #ad1457; }
.example-tags .morph-tag.voice-mp { background: #f3e5f5; color: #7b1fa2; }

/* Mood tags */
.example-tags .morph-tag.mood-ind { background: #e3f2fd; color: #1976d2; }
.example-tags .morph-tag.mood-subj { background: #f3e5f5; color: #8e24aa; }
.example-tags .morph-tag.mood-opt { background: #e8f5e9; color: #43a047; }
.example-tags .morph-tag.mood-imp { background: #ffebee; color: #d32f2f; }
.example-tags .morph-tag.mood-inf { background: #fff3e0; color: #ef6c00; }
.example-tags .morph-tag.mood-part { background: #e0f2f1; color: #00897b; }

/* Number tags */
.example-tags .morph-tag.num-sg { background: #e1f5fe; color: #0277bd; }
.example-tags .morph-tag.num-dual { background: #fff8e1; color: #ff8f00; }
.example-tags .morph-tag.num-pl { background: #f1f8e9; color: #689f38; }

/* Source reference link */
.example-source {
    margin-top: 0.5rem;
    font-size: 0.8rem;
}

.source-link {
    color: var(--color-navy);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.source-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Tooltip */
.morph-tooltip {
    position: absolute;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1000;
}

/* Related topics */
.article-related {
    margin-bottom: 2rem;
}

.article-related h2 {
    font-size: 1.2rem;
    color: var(--color-navy);
    margin: 0 0 1rem 0;
}

.related-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.related-link {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    text-decoration: none;
    color: var(--color-navy);
    font-weight: 500;
    transition: background 0.15s;
    border: 1px solid #e8e2d6;
}

.related-link:hover {
    background: #e8e2d6;
}

.related-summary {
    font-size: 0.8rem;
    color: #888;
    font-weight: normal;
}

/* Navigation */
.article-nav {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e8e2d6;
}

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

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

/* Dark mode */
[data-theme="dark"] .grammar-page-header h1 {
    color: var(--color-gold);
}

[data-theme="dark"] .grammar-subtitle {
    color: #aaa;
}

[data-theme="dark"] .quick-reference {
    border-top-color: var(--color-gold);
}

[data-theme="dark"] .quick-reference h2 {
    color: var(--color-gold);
}

[data-theme="dark"] .reference-section {
    background: #1a2a3e;
    border-color: #2d4560;
}

[data-theme="dark"] .reference-section h3 {
    color: var(--color-gold);
}

[data-theme="dark"] .table-example {
    color: #888;
}

[data-theme="dark"] .paradigm-table th,
[data-theme="dark"] .paradigm-table td {
    border-color: #2d4560;
}

[data-theme="dark"] .paradigm-table thead th {
    background: #0d1a2d;
    color: var(--color-gold);
}

[data-theme="dark"] .paradigm-table tbody td {
    background: #1a2a3e;
    color: #e8e2d6;
}

[data-theme="dark"] .paradigm-table .row-label {
    background: #0d1a2d;
    color: #e8e2d6;
}

[data-theme="dark"] .grammar-category {
    background: #1a2a3e;
    border-color: #2d4560;
}

[data-theme="dark"] .category-name {
    color: var(--color-gold);
}

[data-theme="dark"] .category-desc {
    color: #aaa;
}

[data-theme="dark"] .topic-card {
    background: #0d1a2d;
    border-color: #2d4560;
}

[data-theme="dark"] .topic-card:hover {
    border-color: var(--color-gold);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

[data-theme="dark"] .topic-name {
    color: #e8e2d6;
}

[data-theme="dark"] .topic-summary {
    color: #888;
}

[data-theme="dark"] .grammar-footer {
    background: linear-gradient(135deg, #1a2a3e, #0d1a2d);
    border-color: #2d4560;
}

[data-theme="dark"] .grammar-footer h3 {
    color: var(--color-gold);
}

[data-theme="dark"] .grammar-tips li {
    color: #ccc;
}

[data-theme="dark"] .grammar-tips li strong {
    color: var(--color-gold);
}

[data-theme="dark"] .grammar-breadcrumb a {
    color: #6db3f2;
}

[data-theme="dark"] .grammar-article {
    background: #1a2a3e;
    border-color: #2d4560;
}

[data-theme="dark"] .article-header h1 {
    color: var(--color-gold);
}

[data-theme="dark"] .article-summary {
    color: #d4a84c;
}

[data-theme="dark"] .explanation p {
    color: #e8e2d6;
}

[data-theme="dark"] .article-tips {
    background: #0d1a2d;
    border-left-color: var(--color-gold);
}

[data-theme="dark"] .article-tips h2 {
    color: var(--color-gold);
}

[data-theme="dark"] .tips-list li {
    color: #ccc;
}

[data-theme="dark"] .article-examples h2,
[data-theme="dark"] .article-related h2 {
    color: var(--color-gold);
}

[data-theme="dark"] .examples-intro {
    color: #aaa;
}

[data-theme="dark"] .example-card {
    background: #0d1a2d;
    border-color: #2d4560;
}

[data-theme="dark"] .example-form {
    color: #e8e2d6;
}

[data-theme="dark"] .example-lemma {
    color: #888;
}

[data-theme="dark"] .example-def {
    color: #aaa;
}

[data-theme="dark"] .example-tags .morph-tag {
    background: #2d4560;
    color: #ccc;
}

/* Dark mode: POS tags */
[data-theme="dark"] .example-tags .morph-tag.pos-tag { color: #ddd; }
[data-theme="dark"] .example-tags .morph-tag.pos-tag.noun { background: #3a2010; color: #e0855a; }
[data-theme="dark"] .example-tags .morph-tag.pos-tag.verb { background: #3a3010; color: #e0b840; }
[data-theme="dark"] .example-tags .morph-tag.pos-tag.participle { background: #3a2515; color: #e09060; }
[data-theme="dark"] .example-tags .morph-tag.pos-tag.adj,
[data-theme="dark"] .example-tags .morph-tag.pos-tag.adjective { background: #203010; color: #90c060; }
[data-theme="dark"] .example-tags .morph-tag.pos-tag.adv,
[data-theme="dark"] .example-tags .morph-tag.pos-tag.adverb { background: #2a1a30; color: #c080d0; }
[data-theme="dark"] .example-tags .morph-tag.pos-tag.pron { background: #3a2810; color: #d0a060; }
[data-theme="dark"] .example-tags .morph-tag.pos-tag.prep { background: #102830; color: #60c0d0; }
[data-theme="dark"] .example-tags .morph-tag.pos-tag.conj { background: #2a3010; color: #b0c050; }
[data-theme="dark"] .example-tags .morph-tag.pos-tag.particle { background: #3a3510; color: #d0c050; }
[data-theme="dark"] .example-tags .morph-tag.pos-tag.article { background: #1a2530; color: #8898a8; }

/* Dark mode: Case tags */
[data-theme="dark"] .example-tags .morph-tag.case-nom { background: #0a2520; color: #40b0a0; }
[data-theme="dark"] .example-tags .morph-tag.case-gen { background: #2a1015; color: #d06070; }
[data-theme="dark"] .example-tags .morph-tag.case-dat { background: #0a2510; color: #40a050; }
[data-theme="dark"] .example-tags .morph-tag.case-acc { background: #2a1a0a; color: #d09040; }
[data-theme="dark"] .example-tags .morph-tag.case-voc { background: #200a25; color: #a060c0; }

/* Dark mode: Tense tags */
[data-theme="dark"] .example-tags .morph-tag.tense-pres { background: #1a2a10; color: #80b050; }
[data-theme="dark"] .example-tags .morph-tag.tense-impf { background: #1a1530; color: #8070c0; }
[data-theme="dark"] .example-tags .morph-tag.tense-fut { background: #0a2530; color: #40a8b0; }
[data-theme="dark"] .example-tags .morph-tag.tense-aor { background: #2a1015; color: #d06070; }
[data-theme="dark"] .example-tags .morph-tag.tense-perf { background: #0a2510; color: #40a050; }
[data-theme="dark"] .example-tags .morph-tag.tense-plup { background: #1a1510; color: #907060; }

/* Dark mode: Gender tags */
[data-theme="dark"] .example-tags .morph-tag.gender-masc { background: #0a1a30; color: #5080c0; }
[data-theme="dark"] .example-tags .morph-tag.gender-fem { background: #2a0a1a; color: #c05080; }
[data-theme="dark"] .example-tags .morph-tag.gender-neut { background: #1a2025; color: #8090a0; }

/* Dark mode: Voice tags */
[data-theme="dark"] .example-tags .morph-tag.voice-act { background: #2a2510; color: #c0a030; }
[data-theme="dark"] .example-tags .morph-tag.voice-mid { background: #151a30; color: #7080c0; }
[data-theme="dark"] .example-tags .morph-tag.voice-pass { background: #2a0a1a; color: #c05080; }
[data-theme="dark"] .example-tags .morph-tag.voice-mp { background: #200a25; color: #a060c0; }

/* Dark mode: Mood tags */
[data-theme="dark"] .example-tags .morph-tag.mood-ind { background: #0a1a30; color: #5080c0; }
[data-theme="dark"] .example-tags .morph-tag.mood-subj { background: #200a25; color: #a060c0; }
[data-theme="dark"] .example-tags .morph-tag.mood-opt { background: #0a2510; color: #40a050; }
[data-theme="dark"] .example-tags .morph-tag.mood-imp { background: #2a1015; color: #d06070; }
[data-theme="dark"] .example-tags .morph-tag.mood-inf { background: #2a1a0a; color: #d09040; }
[data-theme="dark"] .example-tags .morph-tag.mood-part { background: #0a2520; color: #40b0a0; }

/* Dark mode: Number tags */
[data-theme="dark"] .example-tags .morph-tag.num-sg { background: #0a1a2a; color: #4090c0; }
[data-theme="dark"] .example-tags .morph-tag.num-dual { background: #2a2510; color: #c0a030; }
[data-theme="dark"] .example-tags .morph-tag.num-pl { background: #1a2a10; color: #80b050; }

/* Dark mode: Source link */
[data-theme="dark"] .source-link {
    color: #6db3f2;
}

/* Dark mode: Tooltip */
[data-theme="dark"] .morph-tooltip {
    background: #e8e2d6;
    color: #1a2a3e;
}

[data-theme="dark"] .related-link {
    background: #0d1a2d;
    border-color: #2d4560;
    color: #e8e2d6;
}

[data-theme="dark"] .related-link:hover {
    background: #2d4560;
}

[data-theme="dark"] .related-summary {
    color: #888;
}

[data-theme="dark"] .article-nav {
    border-top-color: #2d4560;
}

[data-theme="dark"] .back-link {
    color: #6db3f2;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .grammar-container {
        padding: 1rem;
    }

    .grammar-header h1 {
        font-size: 1.8rem;
    }

    .topic-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .grammar-article {
        padding: 1.25rem;
    }

    .article-header h1 {
        font-size: 1.5rem;
    }

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