/* Design System */

/* Fallback font for combining diacritics (U+0332 macron below) */
@font-face {
    font-family: 'NotoFallback';
    src: local('Noto Sans');
    unicode-range: U+0330-033F;
}

:root {
    --bg-cream: #faf8f3;
    --text-dark: #1a1a1a;
    --gold: #C9952A;
    --gold-light: #e8d4a8;
    --border: #e0ddd5;
    --bg-card: #ffffff;
    --text-muted: #666;
    --font-serif: 'Charis SIL', 'Doulos SIL', 'Noto Sans', 'NotoFallback', system-ui, sans-serif;
    --font-sans: system-ui, -apple-system, sans-serif;
}

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

body {
    background-color: var(--bg-cream);
    color: var(--text-dark);
    font-family: var(--font-serif);
    line-height: 1.6;
}

/* Sticky Navigation */
.sticky-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 1rem 2rem;
    background-color: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gold);
    text-decoration: none;
    letter-spacing: 0.05em;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: #ffffff;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s, color 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.nav-links a:hover {
    opacity: 1;
    color: var(--gold);
}

/* Header */
.site-header {
    background: var(--text-dark);
    color: white;
    padding: 5rem 2rem 2rem;
    text-align: center;
}

.site-header h1 {
    font-size: 2.5rem;
    font-weight: normal;
    color: var(--gold);
    margin-bottom: 0.25rem;
}

.site-header .subtitle {
    font-size: 1rem;
    opacity: 0.8;
}

/* Controls */
.controls {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    width: fit-content;
}

.mode-tab {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    padding: 0.5rem 1.25rem;
    border: none;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-tab:not(:last-child) {
    border-right: 1px solid var(--border);
}

.mode-tab.active {
    background: var(--gold);
    color: white;
}

.mode-tab:hover:not(.active) {
    background: var(--bg-cream);
}

.search-container {
    margin-bottom: 1rem;
}

#search {
    width: 100%;
    max-width: 400px;
    padding: 0.75rem 1rem;
    font-family: var(--font-sans);
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
}

#search:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-light);
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.filter-label {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn.active {
    background: var(--text-dark);
    color: white;
    border-color: var(--text-dark);
}

.filter-btn:hover:not(.active) {
    background: var(--bg-cream);
}

.alpha-index {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.alpha-btn {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.alpha-btn:hover {
    background: var(--gold);
    color: white;
    border-color: var(--gold);
}

.alpha-btn.disabled {
    opacity: 0.3;
    cursor: default;
}

.entry-count {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

/* Wordlist */
.wordlist {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

/* Word Cards */
.word-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.word-card.amp-only {
    border-left: 3px solid var(--gold);
}

.word-card.highlighted {
    animation: highlight-fade 2s ease-out;
}

@keyframes highlight-fade {
    0% { background-color: rgba(201, 149, 42, 0.2); }
    100% { background-color: var(--bg-card); }
}

.card-header {
    margin-bottom: 1rem;
    position: relative;
}

.entry-anchor {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    color: var(--border);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
}

.word-card:hover .entry-anchor {
    opacity: 1;
}

.entry-anchor:hover {
    color: var(--gold);
}

.entry-anchor.copied {
    color: var(--gold);
    opacity: 1;
}

.headword {
    font-family: 'Charis SIL', 'Doulos SIL', 'Noto Sans', 'NotoFallback', system-ui, sans-serif;
    font-size: 1.75rem;
    font-weight: normal;
    margin-bottom: 0.25rem;
}

.miluk-form {
    font-family: 'Charis SIL', 'Doulos SIL', 'Noto Sans', 'NotoFallback', system-ui, sans-serif;
    font-size: 1.35rem;
    color: var(--gold);
    font-weight: 600;
}

.headword.miluk-primary {
    color: var(--gold);
}

.english-form {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.amp-only-label {
    display: inline-block;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-cream);
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    margin-top: 0.5rem;
}

/* Audio */
.audio-section {
    margin: 1rem 0;
}

.audio-embed {
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.audio-embed iframe {
    display: block;
    width: 100%;
    height: 166px;
    border: none;
}

.audio-label {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.35rem;
}

/* Pronunciation Table */
.pronunciation-table-section {
    margin: 1.25rem 0;
}

.pronunciation-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.pronunciation-table th,
.pronunciation-table td {
    border: 1px solid var(--border);
    padding: 0.6rem 0.75rem;
    vertical-align: top;
    text-align: left;
}

.pronunciation-table th {
    background: var(--bg-cream);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.pronunciation-table .speaker-header {
    background: var(--text-dark);
    color: var(--gold);
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.85rem;
}

.pronunciation-table td {
    font-family: 'Charis SIL', 'Doulos SIL', 'Noto Sans', 'NotoFallback', system-ui, sans-serif;
    white-space: pre-line;
}

/* Expandable sections */
.expandable {
    border-top: 1px solid var(--border);
    margin-top: 1rem;
    padding-top: 0.75rem;
}

.expand-toggle {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.expand-toggle:hover {
    color: var(--gold);
}

.expand-toggle .arrow {
    transition: transform 0.2s;
}

.expand-toggle.open .arrow {
    transform: rotate(180deg);
}

.expand-content {
    display: none;
    margin-top: 0.75rem;
    padding: 1rem;
    background: var(--bg-cream);
    border-radius: 6px;
    font-size: 0.95rem;
    line-height: 1.7;
}

.expand-content.open {
    display: block;
}

.expand-content p {
    margin-bottom: 0.75rem;
}

.expand-content p:last-child {
    margin-bottom: 0;
}

/* Footer */
.footer {
    padding: 4rem 2rem;
    text-align: center;
    border-top: 1px solid var(--border);
    background: var(--text-dark);
}

.footer-links {
    margin-bottom: 2rem;
}

.footer-links a {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: #ffffff;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s, color 0.2s;
}

.footer-links a:hover {
    opacity: 1;
    color: var(--gold);
}

.footer-links .divider {
    color: rgba(255, 255, 255, 0.3);
    margin: 0 1rem;
}

.copyright {
    font-size: 0.85rem;
    color: #888;
}

.copyright-link {
    color: var(--gold);
    font-style: italic;
    text-decoration: none;
    transition: color 0.2s;
}

.copyright-link:hover {
    color: var(--gold-light);
}

/* Letter dividers */
.letter-divider {
    font-family: var(--font-sans);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gold);
    padding: 1rem 0 0.5rem;
    margin-top: 1rem;
    border-bottom: 2px solid var(--gold);
}

/* No results */
.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sticky-nav {
        padding: 0.75rem 1rem;
    }

    .nav-logo {
        font-size: 1.25rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .nav-links a {
        font-size: 0.75rem;
    }

    .footer-links .divider {
        display: none;
    }

    .footer-links {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 600px) {
    .controls {
        padding: 1rem;
    }

    .wordlist {
        padding: 1rem;
    }

    .word-card {
        padding: 1rem;
    }

    .headword {
        font-size: 1.5rem;
    }

    .miluk-form {
        font-size: 1.15rem;
    }

    .pronunciation-table {
        font-size: 0.85rem;
    }

    .pronunciation-table th,
    .pronunciation-table td {
        padding: 0.4rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .nav-links {
        gap: 0.75rem;
    }

    .nav-links a {
        font-size: 0.7rem;
        letter-spacing: 0.05em;
    }
}
