@font-face {
    font-family: "KJino";
    src: url("/assets/fonts/KJino.TTF") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: block;
}

@font-face {
    font-family: "KChimen";
    src: url("/assets/fonts/KChimen.ttf") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: block;
}

@font-face {
    font-family: "KGoran";
    src: url("/assets/fonts/KGoran.ttf") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: block;
}

.word-page {
    min-height: calc(100vh - 140px);
    padding: 38px 0 80px;

    background:
        linear-gradient(
            180deg,
            #f8faff 0%,
            #f5f7fb 100%
        );
}

.word-page > .site-container {
    max-width: 1120px;
}

.word-page .search-box {
    max-width: 720px;
    margin: 0 auto 32px;

    background: #ffffff;

    box-shadow:
        0 6px 22px rgba(16, 24, 40, 0.05);
}

/* Keep KurdDict logo left-to-right */

.kurdish-site .site-logo {
    direction: ltr;
    unicode-bidi: isolate;
}

/* Main grid */

.dictionary-table {
    display: grid;

    grid-template-columns:
        138px
        repeat(3, minmax(0, 1fr));

    gap: 10px;
}

/* Cells */

.dictionary-cell {
    min-width: 0;
    min-height: 94px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 18px;

    text-align: center;

    background:
        linear-gradient(
            180deg,
            #ffffff 0%,
            #fcfdff 100%
        );

    border: 1px solid #e7ebf2;

    border-radius: 13px;

    box-shadow:
        0 2px 4px rgba(16, 24, 40, 0.02),
        0 8px 24px rgba(16, 24, 40, 0.035);

    transition:
        transform 0.16s ease,
        box-shadow 0.16s ease,
        border-color 0.16s ease;
}

.dictionary-cell:hover {
    border-color: #d6deec;

    box-shadow:
        0 3px 8px rgba(16, 24, 40, 0.035),
        0 12px 30px rgba(16, 24, 40, 0.05);
}

/* Language headers */

.dictionary-header {
    min-height: 58px;

    padding: 12px 16px;

    background:
        linear-gradient(
            180deg,
            #f4f7fc 0%,
            #eef3f9 100%
        );

    border-color: #e0e6ef;

    color: #475467;

    font-size: 12px;
    font-weight: 750;

    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.dictionary-header:first-child {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

/* Row labels */

.dictionary-row-label {
    min-height: 94px;

    background:
        linear-gradient(
            180deg,
            #f7f9fc 0%,
            #f1f5fa 100%
        );

    border-color: #e1e7ef;

    color: #475467;

    font-size: 12px;
    font-weight: 750;

    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Kurdish page headers */

.kurdish-site .dictionary-header {
    font-family:
        "KGoran",
        Tahoma,
        Arial,
        sans-serif;

    font-size: 18px;
    font-weight: 400;
    line-height: 1.6;

    text-transform: none;
    letter-spacing: 0;

    color: #344054;

    font-synthesis: none;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.kurdish-site .dictionary-row-label {
    font-family:
        "KGoran",
        Tahoma,
        Arial,
        sans-serif;

    font-size: 18px;
    font-weight: 400;
    line-height: 1.6;

    text-transform: none;
    letter-spacing: 0;

    color: #344054;

    font-synthesis: none;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Values */

.dictionary-value {
    flex-direction: column;

    color: #273142;

    font-size: 16px;
    font-weight: 450;

    line-height: 1.75;

    overflow-wrap: anywhere;
}

.dictionary-value.main {
    color: #101828;

    font-size: 20px;
    font-weight: 700;
}

/* Main Kurdish word */

.dictionary-value.kurdish {
    direction: rtl;

    text-align: center;

    font-family:
        "KJino",
        Tahoma,
        Arial,
        sans-serif;

    color: #101828;

    font-size: 28px;
    font-weight: 400;
    line-height: 1.6;

    font-synthesis: none;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    text-rendering: optimizeLegibility;
}

/* Kurdish content */

.dictionary-value[lang="ckb"]:not(.kurdish) {
    direction: rtl;

    text-align: center;

    font-family:
        "KChimen",
        Tahoma,
        Arial,
        sans-serif;

    color: #273142;

    font-size: 18px;
    font-weight: 400;
    line-height: 2;

    font-synthesis: none;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    text-rendering: optimizeLegibility;
}

/* Latin content on Kurdish page */

.kurdish-site .dictionary-value[dir="ltr"] {
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    font-synthesis: auto;
}

.kurdish-site .dictionary-value.main[dir="ltr"] {
    color: #101828;

    font-size: 20px;
    font-weight: 700;
}

/* Part of speech */

.word-class {
    display: block;

    margin-top: 5px;

    color: #98a2b3;

    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;

    letter-spacing: 0;
}

.word-class[lang="ckb"] {
    font-family:
        "KChimen",
        Tahoma,
        Arial,
        sans-serif;

    font-size: 15px;
    font-weight: 400;

    direction: rtl;

    font-synthesis: none;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Empty values */

.dictionary-empty {
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    color: #b0b7c3;

    font-size: 17px;
    font-weight: 400;
}

/* Relations */

.dictionary-relations {
    grid-column: 2 / -1;

    min-height: 96px;

    flex-direction: column;

    text-align: center;
}

.relation-group {
    width: 100%;

    display: flex;
    flex-direction: column;
    align-items: center;
}

.relation-group + .relation-group {
    margin-top: 18px;
}

.relation-title {
    margin-bottom: 9px;

    color: #667085;

    font-size: 11px;
    font-weight: 750;

    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.kurdish-site .relation-title {
    font-family:
        "KGoran",
        Tahoma,
        Arial,
        sans-serif;

    margin-bottom: 10px;

    color: #475467;

    font-size: 17px;
    font-weight: 400;
    line-height: 1.6;

    text-transform: none;
    letter-spacing: 0;

    font-synthesis: none;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.relation-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;

    gap: 8px;
}

.relation-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 38px;

    padding: 7px 13px;

    background:
        linear-gradient(
            180deg,
            #f1f6ff 0%,
            #eaf2ff 100%
        );

    border: 1px solid #dbe8ff;

    border-radius: 8px;

    color: #175cd3;

    font-size: 14px;

    transition:
        background 0.15s ease,
        transform 0.15s ease;
}

.relation-link[lang="ckb"] {
    font-family:
        "KJino",
        Tahoma,
        Arial,
        sans-serif;

    font-size: 19px;
    font-weight: 400;
    line-height: 1.4;

    font-synthesis: none;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.relation-link:hover {
    background: #dfeaff;

    transform: translateY(-1px);
}

/* Tablet */

@media (max-width: 850px) {
    .dictionary-table {
        grid-template-columns:
            115px
            repeat(3, minmax(0, 1fr));

        gap: 7px;
    }

    .dictionary-cell {
        padding: 14px 10px;
    }

    .dictionary-value {
        font-size: 14px;
    }

    .dictionary-value.main {
        font-size: 17px;
    }

    .dictionary-value.kurdish {
        font-size: 24px;
    }

    .dictionary-value[lang="ckb"]:not(.kurdish) {
        font-size: 16px;
    }

    .kurdish-site .dictionary-header {
        font-size: 16px;
    }

    .kurdish-site .dictionary-row-label {
        font-size: 16px;
    }

    .kurdish-site .relation-title {
        font-size: 16px;
    }
}

/* Mobile */

@media (max-width: 680px) {
    .word-page {
        padding: 22px 0 56px;
    }

    .word-page .search-box {
        margin-bottom: 26px;
    }

    .dictionary-table {
        display: block;
    }

    /* Desktop language headers are replaced by labels in each card */

    .dictionary-header {
        display: none;
    }

    /* Section title: Word, Pronunciation, Definition, Example */

    .dictionary-row-label {
        min-height: 0;

        margin: 23px 0 8px;

        padding: 10px 14px;

        border: 1px solid #e1e7ef;

        border-radius: 9px;

        background:
            linear-gradient(
                180deg,
                #f3f6fa 0%,
                #edf2f7 100%
            );

        box-shadow: none;

        font-size: 11px;

        justify-content: flex-start;

        text-align: left;
    }

    .kurdish-site .dictionary-row-label {
        justify-content: flex-start;

        text-align: right;

        font-size: 19px;
        line-height: 1.5;
    }

    /* Language cards */

    .dictionary-value {
        position: relative;

        min-height: 88px;

        margin-bottom: 8px;

        padding:
            31px
            18px
            15px;

        border-radius: 12px;

        background:
            linear-gradient(
                180deg,
                #ffffff 0%,
                #fcfdff 100%
            );

        box-shadow:
            0 2px 5px rgba(16, 24, 40, 0.025),
            0 8px 20px rgba(16, 24, 40, 0.035);
    }

    /* Small language name above each mobile card */

    .dictionary-value::before {
        position: absolute;

        top: 8px;
        left: 12px;
        right: 12px;

        display: block;

        color: #98a2b3;

        font-family:
            Inter,
            system-ui,
            -apple-system,
            BlinkMacSystemFont,
            "Segoe UI",
            Arial,
            sans-serif;

        font-size: 10px;
        font-weight: 750;
        line-height: 1.3;

        text-align: center;

        text-transform: uppercase;
        letter-spacing: 0.07em;
    }

    /*
     * First value in every group is the primary
     * interface language on all three pages.
     */

    .dictionary-table
    > .dictionary-value:nth-child(4n + 2) {
        border-color: #d8e4f5;

        background:
            linear-gradient(
                180deg,
                #ffffff 0%,
                #f7faff 100%
            );
    }

    /* Norwegian interface */

    html[lang="no"]
    .dictionary-table
    > .dictionary-value:nth-child(4n + 2)::before {
        content: "Norsk";
    }

    html[lang="no"]
    .dictionary-table
    > .dictionary-value:nth-child(4n + 3)::before {
        content: "English";
    }

    html[lang="no"]
    .dictionary-table
    > .dictionary-value:nth-child(4n)::before {
        content: "Kurdisk";
    }

    /* English interface */

    html[lang="en"]
    .dictionary-table
    > .dictionary-value:nth-child(4n + 2)::before {
        content: "English";
    }

    html[lang="en"]
    .dictionary-table
    > .dictionary-value:nth-child(4n + 3)::before {
        content: "Norwegian";
    }

    html[lang="en"]
    .dictionary-table
    > .dictionary-value:nth-child(4n)::before {
        content: "Kurdish";
    }

    /* Kurdish interface */

    html[lang="ckb"]
    .dictionary-table
    > .dictionary-value::before {
        font-family:
            "KGoran",
            Tahoma,
            Arial,
            sans-serif;

        font-size: 14px;
        font-weight: 400;

        text-transform: none;
        letter-spacing: 0;

        direction: rtl;

        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    html[lang="ckb"]
    .dictionary-table
    > .dictionary-value:nth-child(4n + 2)::before {
        content: "\06A9\0648\0631\062F\06CC";
    }

    html[lang="ckb"]
    .dictionary-table
    > .dictionary-value:nth-child(4n + 3)::before {
        content: "\0626\06CC\0646\06AF\0644\06CC\0632\06CC";
    }

    html[lang="ckb"]
    .dictionary-table
    > .dictionary-value:nth-child(4n)::before {
        content: "\0646\06D5\0631\0648\0698\06CC";
    }

    /* Mobile values */

    .dictionary-value.main {
        font-size: 20px;
    }

    .dictionary-value.kurdish {
        font-size: 24px;
    }

    .dictionary-value[lang="ckb"]:not(.kurdish) {
        font-size: 17px;
        line-height: 1.9;
    }

    .word-class {
        margin-top: 4px;
    }

    /* Relations */

    .dictionary-relations {
        min-height: 86px;

        margin-bottom: 8px;

        padding: 17px;

        grid-column: auto;
    }

    .relation-link[lang="ckb"] {
        font-size: 18px;
    }

    .kurdish-site .relation-title {
        font-size: 17px;
    }
}