/* ============================================================
   Idrani Dictionary Styles
   File: ./css/dictionary.css
   ============================================================ */


/* ------------------------------------------------------------
   Dictionary Page Container
   ------------------------------------------------------------ */

.dictionary-page {
    width: 100%;
}


/* ------------------------------------------------------------
   Search Controls
   ------------------------------------------------------------ */

.dictionary-controls {
    width: 100%;
    margin-bottom: 1.5rem;
}


.dictionary-search-bar {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    width: 100%;
}


.dictionary-search {
    flex: 1;
    min-width: 0;
    height: 3rem;
    box-sizing: border-box;
    padding: 0.75rem 1rem;
    background-color: ##fff;
    color: #777;
    border: 2px solid #777;
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 1.1rem;
    outline: none;
}


.dictionary-search:focus {
    border-color: #000;
}


/* ------------------------------------------------------------
   Search Direction Toggle
   ------------------------------------------------------------ */

.dictionary-toggle {
    display: flex;
    height: 3rem;
    border: 0;
    border-radius: 0.5rem;
    overflow: hidden;
    background-color: #E1E1E1;
    flex-shrink: 0;
}


.dictionary-toggle-button {
    height: 100%;
    padding: 0 1rem;
    background-color: #E1E1E1;
    color: #fff;
    border: none;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    white-space: nowrap;
    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}


.dictionary-toggle-button:hover {
    background-color: #E1E1E1;
}


.dictionary-toggle-button + .dictionary-toggle-button {
    border-left: 1px solid #6F2822;
}


.dictionary-toggle-button.active {
    background-color: #6F2822;
    font-weight: 600;
}


/* ------------------------------------------------------------
   Search Direction Toggle
   ------------------------------------------------------------ */

.dictionary-search-mode {
    display: flex;
    align-items: stretch;
    height: 3rem;
    border: 2px solid #777;
    border-radius: 0.5rem;
    overflow: hidden;
    background-color: #111;
}


.dictionary-toggle-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    cursor: pointer;
    font-size: 0.95rem;
    white-space: nowrap;
    transition: background-color 0.15s ease;
}


.dictionary-toggle-option input {
    display: none;
}


.dictionary-toggle-option:has(input:checked) {
    background-color: #333;
    font-weight: 600;
}


.dictionary-toggle-option + .dictionary-toggle-option {
    border-left: 1px solid #777;
}



/* ------------------------------------------------------------
   Results Container
   ------------------------------------------------------------ */

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


.dictionary-result-section {
    width: 100%;
}


.dictionary-result-header {
    border-bottom: 1px solid #666;
    margin-bottom: 1rem;
}


.dictionary-result-header h2 {
    margin: 0;
    font-size: 1.5rem;
}



/* ------------------------------------------------------------
   Dictionary Text Flow
   ------------------------------------------------------------ */

.dictionary-results {
    line-height: 1.8;
    text-align: left;
}


.dictionary-entry-group {
    display: block;
    margin-bottom: 1rem;
}


.dictionary-entry-header {
    display: block;
}


.dictionary-entry-primary {
    font-size: 1.25rem;
    font-weight: 700;
}


.dictionary-entry-pos {
    font-size: 0.95rem;
    opacity: 0.75;
    margin-left: 0.35rem;
}


.dictionary-entry-item {
    display: inline;
}


.dictionary-entry-number {
    margin-left: 0.75rem;
}


.dictionary-entry-secondary {
    font-size: 1.1rem;
    font-style: italic;
    opacity: 0.9;
    margin-left: 0.35rem;
}


.dictionary-entry-definition {
    margin-left: 0.35rem;
}


.dictionary-entry-etymology {
    margin-left: 0.35rem;
    opacity: 0.75;
}


.dictionary-entry-example {
    margin-left: 0.35rem;
}


.dictionary-entry-leipzig {
    margin-left: 0.35rem;
    font-family: monospace;
    opacity: 0.85;
}


.dictionary-entry-separator {
    margin-right: 0.75rem;
}



/* ------------------------------------------------------------
   No Match Messages
   ------------------------------------------------------------ */

.dictionary-message {
    opacity: 0.75;
    text-align: center;
    padding: 2rem;
}



/* ------------------------------------------------------------
   Scrollbar Support
   ------------------------------------------------------------ */

.dictionary-results::-webkit-scrollbar {
    width: 8px;
}


.dictionary-results::-webkit-scrollbar-track {
    background: #000;
}


.dictionary-results::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 10px;
}



/* ------------------------------------------------------------
   Existing Idrani Chrome Header Support
   ------------------------------------------------------------ */

.chrome {
    font-size: clamp(1.67rem, 5.33vw, 3.33rem);
}



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

@media screen and (max-width: 900px) {

    .dictionary-search-bar {
        flex-wrap: wrap;
    }


    .dictionary-search {
        flex: 1 1 100%;
    }


    .dictionary-toggle {
        width: 100%;
    }


    .dictionary-toggle-button {
        flex: 1;
    }

}


@media screen and (max-width: 600px) {

    .dictionary-toggle {
        flex-direction: column;
        height: auto;
    }


    .dictionary-toggle-button {
        width: 100%;
        min-height: 3rem;
    }


    .dictionary-toggle-button + .dictionary-toggle-button {
        border-left: none;
        border-top: 1px solid #777;
    }


    .dictionary-result-header h2 {
        font-size: 1.25rem;
    }


    .dictionary-entry-primary {
        font-size: 1.15rem;
    }


    .dictionary-entry-secondary {
        font-size: 1rem;
    }
}


/* =====================================================
   TIER 1 SLAB
===================================================== */

.tier1-slab {
    margin: 0 0 12px 0;
    display: flex;
    align-items: stretch;
}

/* =====================================================
   BACK ZONE (LEFT SEGMENT)
===================================================== */

.tier1-back {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 3.25rem;

    background: rgba(255, 255, 255, 0.12);

    border-radius: 18px 0 0 18px;

    text-decoration: none;
    color: inherit;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.tier1-back:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-2px);
}

.tier1-back:active {
    transform: translateY(0);
}

.tier1-back-arrow {
    font-size: clamp(1.5rem, 2vw, 2rem);
    opacity: 0.75;
    line-height: 1;
}

/* =====================================================
   MAIN SLAB LINK (RIGHT SEGMENT)
===================================================== */

.tier1-link {
    display: flex;
    justify-content: space-between;
    align-items: center;

    flex: 1;

    padding: 1.25rem 1.5rem;

    background: rgba(255, 255, 255, 0.2);

    border: none;
    border-radius: 0 18px 18px 0;

    color: inherit;
    text-decoration: none;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.tier1-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.tier1-link:active {
    transform: translateY(0);
}

/* =====================================================
   TEXT ELEMENTS
===================================================== */

.tier1-title {
    margin: 0;
    font-size: clamp(1.35rem, 2vw, 2rem);
    font-weight: 700;
    line-height: 1.2;
}

.tier1-arrow {
    flex-shrink: 0;
    margin-left: 1rem;
    font-size: clamp(1.5rem, 2vw, 2rem);
    opacity: 0.65;
}

/* =====================================================
   RESPONSIVE
===================================================== */

@media (max-width: 768px) {

    .tier1-back {
        width: 3rem;
        border-radius: 16px 0 0 16px;
    }

    .tier1-link {
        padding: 1.1rem 1.25rem;
        border-radius: 0 16px 16px 0;
    }

}

@media (max-width: 480px) {

    .tier1-back {
        width: 2.75rem;
        border-radius: 14px 0 0 14px;
    }

    .tier1-link {
        padding: 1rem 1.1rem;
        border-radius: 0 14px 14px 0;
    }

}


/* =========================
   TIER 2 SLAB
========================= */

.tier2-slab {
    max-width: 1000px;
    margin: 0 auto;
    background: #fff;
    border-radius: 18px;
    padding: 28px;
    color: #111;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.tier2-header {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* BACK LINK */
.tier2-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    text-decoration: none;
    color: #444;

    font-size: 0.95rem;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

    opacity: 0.8;

    transition: opacity 0.2s ease, transform 0.2s ease;
}

.tier2-back:hover {
    opacity: 1;
    transform: translateX(-2px);
}

.tier2-back-arrow {
    font-size: 1.2rem;
    line-height: 1;
}


.tier2-title {
    font-size: 1.9rem;
    font-family: 'Michroma';
    margin: 0;
    text-transform: uppercase;
}

.tier2-description {
    margin: 14px 0 18px;
    font-size: 1rem;
    line-height: 1.6;
    color: #222;
}

.example-gloss {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.95rem;
    color: #444;
    padding-left: 10px;
    border-left: 3px solid #e0e0e0;
    margin-bottom: 16px;
}

.tier2-examples-title {
    font-size: 1.2rem;
    margin: 10px 0 12px;
}

.tier2-example {
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid #eee;
}

.example-explanation {
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 10px;
}

.interlinear-block {
    padding-left: 12px;
    border-left: 3px solid #eaeaea;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* SURFACE */
.gloss-line.surface {
    font-family: "CormorantGaramond";
    font-size: 1.2rem;
    color: #111;
}

/* MORPHEMES */
.gloss-line.morphemes {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.95rem;
    color: #444;
}

/* LEIPZIG GLOSS */
.gloss-line.gloss {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.95rem;
    color: #666;
}

/* ENGLISH TRANSLATION */
.gloss-line.translation {
    font-family: "CormorantGaramond";
    font-style: italic;
    color: #333;
    font-size: 1.2rem;
}

.focus-morph {
    background: rgba(0, 0, 0, 0.12);
    padding: 2px 5px;
    border-radius: 5px;
    font-weight: 600;
}

.tier3-link-wrapper {
    margin-top: 18px;
}

.tier3-link {
    font-family: 'Oswald';
    display: inline-block;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #111;
    font-weight: 600;
}

.tier3-link:hover {
    background: #f6f6f6;
}




/* =========================
   TIER 3 SLAB
========================= */

.tier3-slab {
    max-width: 1200px;
    margin: 0;
    padding: 28px;

    background: #fff;
    border-radius: 18px;

    color: #111;

    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

    overflow: hidden;
}

/* HEADER */
.tier3-header {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* BACK LINK */
.tier3-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    text-decoration: none;
    color: #444;

    font-size: 0.95rem;

    opacity: 0.8;

    transition: opacity 0.2s ease, transform 0.2s ease;
}

.tier3-back:hover {
    opacity: 1;
    transform: translateX(-2px);
}

.tier2-back-arrow {
    font-size: 1.2rem;
    line-height: 1;
}

/* TITLE */
.tier3-title {
    font-size: 1.9rem;
    font-family: 'Michroma';
    margin: 0;
    text-transform: uppercase;
}

/* DESCRIPTION */
.tier3-description {
    margin-bottom: 24px;

    font-size: 1rem;
    line-height: 1.8;

    color: #222;

    max-width: 950px;
}

/* =========================
   TABLE WRAPPER
========================= */

.tier3-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e8e8e8;
    border-radius: 14px;
}

/* TABLE BASE */
.tier3-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: #fff;
}

.tier3-table thead {
    background: #f6f6f6;
}

.tier3-table th {
    text-align: left;

    padding: 16px 14px;

    font-size: 0.9rem;
    font-weight: 700;

    color: #222;

    border-bottom: 1px solid #e4e4e4;
}

/* SAFE TEXT WRAPPING FIX */
.tier3-table td {
    padding: 16px 14px;

    font-size: 0.95rem;
    line-height: 1.7;

    color: #333;

    border-bottom: 1px solid #efefef;

    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;

    min-width: 0;
}

/* COLUMN WIDTHS */
.tier3-table th:nth-child(1),
.tier3-table td:nth-child(1) {
    width: 90px;
    font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.tier3-table th:nth-child(2),
.tier3-table td:nth-child(2) {
    width: 120px;
    font-style: italic;
}

.tier3-table th:nth-child(3),
.tier3-table td:nth-child(3) {
    width: 180px;
}

.tier3-table th:nth-child(4),
.tier3-table td:nth-child(4) {
    width: 260px;
}

.tier3-table tbody tr:hover {
    background: #fafafa;
}



/* =========================
   DESKTOP MODE (821px and up)
========================= */

@media (min-width: 821px) {

    .tier3-table {
        display: table;
        table-layout: fixed;
    }

    .tier3-table thead {
        display: table-header-group;
    }

    .tier3-table tbody {
        display: table-row-group;
    }

    .tier3-table tr {
        display: table-row;
    }

    .tier3-table td,
    .tier3-table th {
        display: table-cell;
    }
}

/* =========================
   MOBILE CARD MODE (820px and below)
========================= */

@media (max-width: 820px) {

    .tier3-slab {
        padding: 20px;
    }

    .tier3-table thead {
        display: none;
    }

    .tier3-table tbody {
        display: block;
    }

    .tier3-table tr {
        display: flex;
        flex-direction: column;

        width: 100%;
        box-sizing: border-box;

        margin-bottom: 16px;
        border-bottom: 1px solid #ececec;
        background: #fff;
        border-radius: 12px;
    }

    .tier3-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;

        padding: 10px 12px;

        border: none;

        white-space: normal;
        overflow-wrap: break-word;
        word-break: normal;
    }

    .tier3-table td::before {
        content: attr(data-label);

        display: block;
        margin-bottom: 4px;

        font-weight: 700;
        color: #111;
    }
}

/* =========================
   SMALL MOBILE (560px and below)
========================= */

@media (max-width: 560px) {

    .tier3-slab {
        padding: 16px;
        border-radius: 14px;
    }

    .tier3-table tr {
        padding: 14px;
    }

    .tier3-table td {
        padding: 18px 0 10px 0;
    }
}