/* ============================================================
   Dictionary (Lewis & Short) — lexis app
   Uses design tokens from custom.css (:root vars)
   All classes prefixed dict-* to avoid collisions
   ============================================================ */

/* ---- Layout ---- */

.dict-home {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.dict-home-inner {
    text-align: center;
    max-width: 600px;
    width: 100%;
}

.dict-home-title {
    font-size: 2.4rem;
    font-weight: 300;
    letter-spacing: 0.02em;
    margin-bottom: 0.25rem;
    color: var(--text, #e8e8ec);
}

.dict-home-subtitle {
    color: var(--text3, #5e5e6e);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.dict-home-help {
    margin-top: 1rem;
    color: var(--text3, #5e5e6e);
    font-size: 0.85rem;
}

.dict-home-help a {
    color: var(--cyan, #5bc0de);
    text-decoration: none;
}

.dict-home-help a:hover {
    text-decoration: underline;
}

.dict-home-browse {
    margin-top: 1.5rem;
}

.dict-browse-link {
    color: var(--text2, #9a9aa8);
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
    padding-bottom: 2px;
}

.dict-browse-link:hover {
    color: var(--text, #e8e8ec);
}

/* ---- Search box ---- */

.dict-search-form {
    width: 100%;
}

.dict-search-form-inline {
    max-width: 500px;
}

.dict-search-box {
    display: flex;
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg2, #242428);
    transition: border-color 0.2s;
}

.dict-search-box:focus-within {
    border-color: var(--cyan, #5bc0de);
}

.dict-search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--text, #e8e8ec);
    font-size: 1.1rem;
    outline: none;
}

.dict-search-input::placeholder {
    color: var(--text3, #5e5e6e);
}

.dict-search-btn {
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    color: var(--text2, #9a9aa8);
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.2s;
}

.dict-search-btn:hover {
    color: var(--cyan, #5bc0de);
}

/* ---- Results page ---- */

.dict-results-page,
.dict-browse-page,
.dict-entry-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.dict-results-header,
.dict-browse-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dict-results-nav {
    font-size: 0.85rem;
    color: var(--text3, #5e5e6e);
}

.dict-results-nav a {
    color: var(--text2, #9a9aa8);
    text-decoration: none;
}

.dict-results-nav a:hover {
    color: var(--text, #e8e8ec);
}

.dict-nav-sep {
    margin: 0 0.35rem;
    color: var(--text3, #5e5e6e);
}

.dict-nav-current {
    color: var(--text, #e8e8ec);
}

.dict-results-count {
    color: var(--text3, #5e5e6e);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.dict-results-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dict-result-card {
    display: block;
    padding: 0.75rem 1rem;
    background: var(--bg2, #242428);
    border: 0.5px solid var(--border, rgba(255,255,255,0.08));
    border-radius: 6px;
    text-decoration: none;
    color: var(--text, #e8e8ec);
    transition: background 0.15s, border-color 0.15s;
}

.dict-result-card:hover {
    background: var(--bg3, #2e2e33);
    border-color: rgba(255,255,255,0.15);
    color: var(--text, #e8e8ec);
}

.dict-result-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.dict-result-orth {
    font-size: 1.15rem;
    font-weight: 600;
}

.dict-result-pos {
    color: var(--text2, #9a9aa8);
    font-size: 0.8rem;
    font-style: italic;
}

.dict-result-gloss {
    color: var(--text2, #9a9aa8);
    font-size: 0.85rem;
    margin-top: 0.25rem;
    line-height: 1.4;
}

/* Match type badges */
.dict-match-badge {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
}

.dict-match-lemma {
    background: rgba(76, 175, 80, 0.15);
    color: #81c784;
}

.dict-match-prefix {
    background: rgba(100, 181, 246, 0.15);
    color: #90caf9;
}

.dict-match-fuzzy {
    background: rgba(255, 183, 77, 0.15);
    color: #ffcc80;
}

.dict-match-english {
    background: rgba(186, 104, 200, 0.15);
    color: #ce93d8;
}

/* No results */
.dict-no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text2, #9a9aa8);
}

.dict-no-results-hint {
    font-size: 0.85rem;
    color: var(--text3, #5e5e6e);
}

.dict-no-results-hint a {
    color: var(--cyan, #5bc0de);
}

/* ---- Entry page ---- */

.dict-entry-nav {
    font-size: 0.85rem;
    color: var(--text3, #5e5e6e);
    margin-bottom: 1.5rem;
}

.dict-entry-nav a {
    color: var(--text2, #9a9aa8);
    text-decoration: none;
}

.dict-entry-nav a:hover {
    color: var(--text, #e8e8ec);
}

/* ---- Entry header (intro card style) ---- */

.dict-entry-header {
    margin-bottom: 2rem;
    padding: 1.25rem 1.5rem;
    background: var(--bg2, #242428);
    border: 0.5px solid var(--border, rgba(255,255,255,0.08));
    border-radius: 10px;
}

.dict-badge-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.dict-pos-badge {
    background: var(--bg3, #2e2e33);
    color: var(--text2, #9a9aa8);
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    text-transform: lowercase;
}

.dict-flag-badge {
    background: rgba(186, 104, 200, 0.15);
    color: #ce93d8;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.7rem;
    text-transform: lowercase;
    letter-spacing: 0.03em;
}

.dict-entry-type-badge {
    background: rgba(255, 183, 77, 0.15);
    color: #ffcc80;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dict-freq-badge {
    background: rgba(91, 192, 222, 0.12);
    color: var(--cyan, #5bc0de);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    margin-left: auto;
    cursor: default;
}

.dict-entry-headword {
    font-size: 2rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: var(--text, #e8e8ec);
}

/* Forms line — dot-separated chunks with labels (matches intro card) */
.dict-forms-line {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.dict-forms-dot {
    color: var(--text3, #5e5e6e);
    font-size: 1.1rem;
    line-height: 2.2;
}

.dict-form-chunk {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.dict-form-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text3, #5e5e6e);
    line-height: 1;
    margin-bottom: 2px;
}

.dict-form-text {
    font-size: 1.05rem;
    color: var(--text, #e8e8ec);
    line-height: 1.3;
}

.dict-presense {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text2, #9a9aa8);
    margin-top: 0.5rem;
}

.dict-entry-divider {
    height: 1px;
    background: var(--border, rgba(255,255,255,0.08));
    margin: 0.75rem 0;
}

.dict-entry-short-gloss {
    color: var(--text, #e8e8ec);
    font-size: 1.05rem;
    line-height: 1.5;
    margin: 0;
}

.dict-section-heading {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text3, #5e5e6e);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
}

.dict-entry-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border, rgba(255,255,255,0.08));
}

.dict-entry-ids {
    display: flex;
    gap: 1.5rem;
    font-size: 0.75rem;
    color: var(--text3, #5e5e6e);
}

.dict-entry-ids code {
    color: var(--text2, #9a9aa8);
    font-size: 0.75rem;
}

/* ---- TEI rendered body ---- */

.dict-tei-body {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text, #e8e8ec);
}

/* Headword in article body */
.dict-orth {
    font-weight: 700;
    font-size: 1.1em;
}

.dict-orth-alt {
    font-weight: 600;
    color: var(--text2, #9a9aa8);
}

/* Senses — indented by level */
.dict-sense {
    margin-top: 0.75rem;
    padding-left: 0;
}

.dict-sense-1 { margin-left: 0; }
.dict-sense-2 { margin-left: 1.5rem; }
.dict-sense-3 { margin-left: 3rem; }
.dict-sense-4 { margin-left: 4rem; }
.dict-sense-5 { margin-left: 4.5rem; }

.dict-sense-label {
    font-weight: 700;
    color: var(--cyan, #5bc0de);
    margin-right: 0.25rem;
    font-size: 0.9em;
}

/* Glosses (italic text = definitions) */
.dict-gloss {
    color: #a8d8ea;
    font-style: italic;
}

/* Citations */
.dict-cit {
    /* Inline, no special styling beyond children */
}

.dict-quote {
    color: var(--text2, #9a9aa8);
    font-style: italic;
}

/* Bibliography */
.dict-bibl {
    font-size: 0.85em;
    color: var(--text3, #5e5e6e);
}

.dict-author {
    font-weight: 600;
    color: var(--text2, #9a9aa8);
}

/* Etymology */
.dict-etym {
    color: #ce93d8;
    font-style: italic;
}

/* Foreign text (Greek) */
.dict-foreign {
    font-style: normal;
}

.dict-foreign-greek {
    font-family: 'GFS Didot', 'Noto Serif', 'Times New Roman', serif;
    color: #80cbc4;
}

/* Part of speech, gender, inflectional type in article body */
.dict-pos {
    font-style: italic;
    color: var(--text2, #9a9aa8);
}

.dict-gen {
    color: var(--text2, #9a9aa8);
}

.dict-itype {
    font-style: italic;
    color: var(--text2, #9a9aa8);
}

/* Usage labels */
.dict-usg {
    font-size: 0.85em;
    color: #ffcc80;
    font-style: italic;
}

/* Cross-references */
.dict-xr {
    color: var(--cyan, #5bc0de);
}

/* Translation within citation */
.dict-tr {
    color: #a8d8ea;
    font-style: italic;
}

/* Grammatical labels */
.dict-case,
.dict-mood,
.dict-number {
    font-size: 0.85em;
    color: var(--text3, #5e5e6e);
    font-style: italic;
}

/* Notes */
.dict-note {
    font-size: 0.85em;
    color: var(--text3, #5e5e6e);
}

/* Labels */
.dict-lbl {
    font-weight: 600;
    color: var(--text2, #9a9aa8);
}

/* Sic markers */
.dict-sic {
    text-decoration: underline dotted var(--text3, #5e5e6e);
}

/* Figure placeholder */
.dict-figure {
    font-size: 0.8em;
    color: var(--text3, #5e5e6e);
    font-style: italic;
}

/* Inline quoted text */
.dict-q {
    quotes: "\201C" "\201D";
}

/* Raw fallback */
.dict-raw-fallback pre {
    white-space: pre-wrap;
    font-size: 0.8rem;
    color: var(--text3, #5e5e6e);
}

/* ---- Browse page ---- */

.dict-alphabet {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 1.5rem;
}

.dict-alpha-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--bg2, #242428);
    border: 0.5px solid var(--border, rgba(255,255,255,0.08));
    color: var(--text2, #9a9aa8);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.dict-alpha-link:hover {
    background: var(--bg3, #2e2e33);
    color: var(--text, #e8e8ec);
}

.dict-alpha-active {
    background: var(--cyan, #5bc0de);
    color: #111;
    font-weight: 700;
}

.dict-alpha-active:hover {
    background: var(--cyan, #5bc0de);
    color: #111;
}

.dict-browse-title {
    font-size: 1.3rem;
    font-weight: 400;
    margin-bottom: 1rem;
    color: var(--text, #e8e8ec);
}

.dict-browse-count {
    font-size: 0.85rem;
    color: var(--text3, #5e5e6e);
    font-weight: 300;
}

.dict-browse-list {
    display: flex;
    flex-direction: column;
}

.dict-browse-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.4rem 0.75rem;
    text-decoration: none;
    color: var(--text, #e8e8ec);
    border-radius: 4px;
    transition: background 0.1s;
}

.dict-browse-row:hover {
    background: var(--bg2, #242428);
    color: var(--text, #e8e8ec);
}

.dict-browse-orth {
    font-weight: 600;
    min-width: 140px;
    flex-shrink: 0;
}

.dict-browse-pos {
    color: var(--text3, #5e5e6e);
    font-size: 0.8rem;
    font-style: italic;
    min-width: 60px;
    flex-shrink: 0;
}

.dict-browse-gloss {
    color: var(--text2, #9a9aa8);
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Pagination */
.dict-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding-top: 1rem;
}

.dict-page-link {
    color: var(--cyan, #5bc0de);
    text-decoration: none;
    font-size: 0.9rem;
}

.dict-page-link:hover {
    text-decoration: underline;
}

.dict-page-info {
    color: var(--text3, #5e5e6e);
    font-size: 0.85rem;
}

/* ---- Attribution footer ---- */

.dict-attribution {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border, rgba(255,255,255,0.08));
    font-size: 0.75rem;
    color: var(--text3, #5e5e6e);
    text-align: center;
}

.dict-attribution a {
    color: var(--text2, #9a9aa8);
}

/* ---- Sense tree (collapsible definitions) ---- */

.dict-senses-section {
    margin-bottom: 2rem;
}

.dict-sense-tree {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dict-sense-item {
    border-left: 2px solid var(--border, rgba(255,255,255,0.08));
    padding-left: 1rem;
    margin-left: 0;
}

.dict-sense-depth-0 {
    border-left-color: var(--cyan, #5bc0de);
    margin-left: 0;
}

.dict-sense-depth-1 { margin-left: 1rem; }
.dict-sense-depth-2 { margin-left: 1.5rem; }
.dict-sense-depth-3 { margin-left: 2rem; }
.dict-sense-depth-4 { margin-left: 2.5rem; }

.dict-sense-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.4rem 0;
}

.dict-sense-toggle {
    background: none;
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    color: var(--cyan, #5bc0de);
    width: 22px;
    height: 22px;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    padding: 0;
    line-height: 1;
}

.dict-sense-toggle:hover {
    background: rgba(91, 192, 222, 0.12);
}

.dict-sense-summary {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-height: 1.4em;
}

.dict-sense-gloss {
    color: var(--text, #e8e8ec);
    font-size: 0.95rem;
}

.dict-sense-preview {
    color: var(--text3, #5e5e6e);
    font-size: 0.85rem;
    font-style: italic;
}

.dict-sense-usage {
    color: #ffcc80;
    font-size: 0.8rem;
    font-style: italic;
}

.dict-sense-density {
    color: var(--text3, #5e5e6e);
    font-size: 0.7rem;
    letter-spacing: 2px;
    cursor: default;
}

.dict-dot {
    color: var(--cyan, #5bc0de);
    opacity: 0.6;
}

.dict-sense-label-only {
    color: var(--text3, #5e5e6e);
    font-size: 0.8rem;
    font-style: italic;
}

.dict-sense-body {
    display: none;
    padding: 0.5rem 0 0.75rem;
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text2, #9a9aa8);
    border-top: 1px solid var(--border, rgba(255,255,255,0.08));
    margin-top: 0.25rem;
}

.dict-sense-body.dict-sense-expanded {
    display: block;
}

.dict-sense-children {
    margin-top: 0.25rem;
}

/* ---- Mobile ---- */

@media (max-width: 599px) {
    .dict-home-title {
        font-size: 1.8rem;
    }

    .dict-search-input {
        font-size: 1rem;
        padding: 0.6rem 0.75rem;
    }

    .dict-entry-header {
        padding: 1rem;
    }

    .dict-entry-headword {
        font-size: 1.5rem;
    }

    .dict-form-text {
        font-size: 0.95rem;
    }

    .dict-browse-orth {
        min-width: 100px;
    }

    .dict-browse-gloss {
        display: none;
    }

    .dict-sense-2 { margin-left: 1rem; }
    .dict-sense-3 { margin-left: 1.5rem; }
    .dict-sense-4 { margin-left: 2rem; }
    .dict-sense-5 { margin-left: 2.5rem; }

    .dict-entry-ids {
        flex-direction: column;
        gap: 0.25rem;
    }

    .dict-sense-depth-1 { margin-left: 0.5rem; }
    .dict-sense-depth-2 { margin-left: 1rem; }
    .dict-sense-depth-3 { margin-left: 1.25rem; }
    .dict-sense-depth-4 { margin-left: 1.5rem; }
}
