/* ============================================================
   ensk.is — Falun Red / Ink / Parchment palette
   ============================================================ */

:root {
    --falun-700: #9a2520;
    --falun-600: #b02d27;
    --falun-400: #e88072;
    --falun-300: #f0a89e;
    --parchment-50: #faf9f7;
    --parchment-100: #f0efed;
    --parchment-200: #e5e3df;
    --ink-800: #2d2d2a;
    --ink-900: #1a1a1a;
    --ink-950: #0f0f0e;
}

body {
    font-size: 110%;
    font-family: -apple-system, BlinkMacSystemFont,
        "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
        "Fira Sans", "Droid Sans", "Helvetica Neue",
        sans-serif;
    background-color: var(--parchment-50);
    color: var(--ink-900);
}

.menu {
    background-color: var(--falun-700);
}

.menu a {
    color: white;
}

.button {
    background-color: var(--falun-700);
}

.button:hover,
.button:focus {
    background-color: var(--falun-600);
}

h1 {
    font-size: 1.5em;
    margin-bottom: 1.0em;
}

h1.item_title {
    font-size: 1.6em;
    margin-bottom: 0px;
    font-weight: 500
}

h2 {
    font-size: 1.15em;
    margin-bottom: 1.0em;
}

h1.heading {
    margin-bottom: 0.0em;
}

h2.english_subheading {
    font-size: 0.95em;
    margin-bottom: 1.1em;
    margin-left: 0.1em;
    color: #666;
}

a {
    color: var(--falun-700);
    text-decoration: underline;
}

a:hover {
    color: var(--falun-600);
}

input[name="q"] {
    margin-bottom: 2.0em;
}

/* Clear button styles */
.input-group {
    position: relative;
    margin-bottom: 2.0em;
}

.input-group .input-group-field {
    margin-bottom: 0;
    padding-right: 40px;
}

.input-group .clear-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin: 0;
    z-index: 1;
    display: none;
}

.input-group .clear-button svg {
    display: block;
    width: 24px;
    height: 24px;
}

.input-group .clear-button svg circle {
    transition: fill 0.15s ease;
}

.input-group .clear-button:hover svg circle {
    fill: rgba(128, 128, 128, 0.5);
}

.input-group .clear-button:active svg circle {
    fill: rgba(128, 128, 128, 0.6);
}

input[type="submit"] {
    width: 100%;
    border: none;
    background-color: var(--falun-700);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

input[type="submit"]:hover {
    background-color: var(--falun-600);
}

div.result {
    padding: 1.0em;
    padding-top: 0.7em;
    padding-bottom: 0.7em;
    background-color: #fdfcfb;
    border: 1px solid #e5e3df;
    margin-bottom: 0.7em;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

span.result_definition_text {
    cursor: default !important;
}

div.item {
    font-size: 1.05em;
}

div.item ul {
    margin-left: 1.6em;
}

div.ipa {
    margin-bottom: 1.0em;
    font-size: 0.9em;
}

div.syllables {
    font-size: 0.9em;
}

hr.separator {
    margin: 2.0em 0;
}

div.wordcat {
    font-weight: 600;
    margin-bottom: 0.5em;
}

div.result:hover {
    background-color: #f5f3f0;
    cursor: pointer;
    border: 1px solid #d4d1cc;
}

div.result a {
    text-decoration: none;
}

div.result p {
    margin-bottom: 0;
}

div.itemlinks {
    float: right;
    color: #aaa;
    height: 100%;
    margin-left: 5px;
}

div.itemslinks>svg {
    color: #aaa;
}

.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    stroke-width: 0;
    stroke: currentColor;
    fill: currentColor;
}

.pag_arrow {
    width: 30px;
    margin-bottom: 10px;
    color: var(--falun-700);
}

.pag_right {
    float: right;
}

.pag_left {
    float: left;
}

a.result_link {
    color: var(--ink-900);
}

.aboutimg {
    width: 25%;
    float: right;
    margin-left: 20px;
    margin-bottom: 20px;
}

.zoega-img {
    float: right;
    margin-left: 10px;
    width: 33%;
    filter: invert(0) !important;
}

#wordcats td a, #general_stats td a {
    text-decoration: none;
}

/* ============================================================
   Direction toggle pill
   ============================================================ */
.direction-toggle {
    display: flex;
    margin-bottom: 1.0em;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--parchment-200);
    width: fit-content;
}

.direction-toggle button {
    padding: 0.35em 1.0em;
    border: none;
    background: var(--parchment-50);
    color: var(--ink-900);
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.direction-toggle button:first-child {
    border-right: 1px solid var(--parchment-200);
}

.direction-toggle button.active {
    background-color: var(--falun-700);
    color: #fff;
}

.direction-toggle button:not(.active):hover {
    background-color: var(--parchment-200);
}

/* ============================================================
   IS→EN result badges
   ============================================================ */
.pos-badge {
    display: inline-block;
    font-size: 0.75em;
    font-weight: 600;
    padding: 0.15em 0.5em;
    border-radius: 3px;
    background-color: var(--parchment-200);
    color: var(--ink-800);
    margin-left: 0.4em;
    vertical-align: middle;
}

.match-type {
    font-size: 0.75em;
    color: #888;
    margin-left: 0.5em;
}

.result-translations {
    margin-top: 0.25em;
    color: #555;
}

/* ============================================================
   Autocompletion styles
   ============================================================ */
.autocomplete-suggestions {
    text-align: left;
    cursor: default;
    border: 1px solid #ccc;
    border-top: 0;
    background: #fff;
    box-shadow: -1px 1px 3px rgba(0, 0, 0, .1);
    position: absolute;
    display: none;
    z-index: 9999;
    max-height: 254px;
    overflow: hidden;
    overflow-y: auto;
    box-sizing: border-box;
}

.autocomplete-suggestion {
    position: relative;
    padding: 0 .6em;
    line-height: 23px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1.02em;
    color: #333;
}

.autocomplete-suggestion b {
    font-weight: normal;
    color: var(--falun-600);
}

.autocomplete-suggestion.selected {
    background: #f0f0f0;
}

/* ============================================================
   Footer
   ============================================================ */
.page-wrap {
    min-height: calc(100vh - 60px);
}

.footer-bar {
    background-color: var(--ink-950);
    color: var(--parchment-200);
    padding: 1.2em 0;
    font-size: 0.82em;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5em;
}

.footer-bar a {
    color: var(--parchment-100);
    text-decoration: none;
    transition: color 0.15s ease;
}

.footer-bar a:hover {
    color: var(--falun-400);
}

.footer-right {
    display: flex;
    gap: 0.5em;
    align-items: center;
}

.footer-right span {
    color: #666;
}

/* ============================================================
   Dark mode
   ============================================================ */
@media (prefers-color-scheme: dark) {
    body {
        background-color: var(--ink-950);
        color: var(--parchment-100);
    }

    a {
        color: var(--falun-400);
    }

    a:hover {
        color: var(--falun-300);
    }

    h2.english_subheading {
        color: #999;
    }

    a.result_link {
        color: var(--parchment-100);
    }

    div.result {
        background-color: var(--ink-800);
        border: 1px solid #3a3a37;
    }

    div.result:hover {
        background-color: #3a3a37;
        cursor: pointer;
        border: 1px solid #4a4a47;
    }

    div.grid-container img {
        filter: invert(1);
    }

    input[name="q"] {
        background-color: var(--ink-800);
        color: var(--parchment-100);
        border: 1px solid #3a3a37;
    }

    input[name="q"]:focus {
        background-color: var(--ink-800);
        color: var(--parchment-100);
        border: 1px solid #4a4a47;
    }

    input[name="q"]::placeholder {
        color: #888;
    }

    .autocomplete-suggestions {
        background: var(--ink-800);
        border: 1px solid #555;
    }

    .autocomplete-suggestion {
        color: var(--parchment-100);
    }

    .autocomplete-suggestion.selected {
        background: #3a3a37;
    }

    tbody {
        background-color: var(--ink-800);
        border: 1px solid #555;
    }

    tbody tr:nth-child(even) {
        background-color: #3a3a37;
    }

    /* Toggle dark mode */
    .direction-toggle {
        border-color: #3a3a37;
    }

    .direction-toggle button {
        background: var(--ink-800);
        color: var(--parchment-100);
    }

    .direction-toggle button:first-child {
        border-right-color: #3a3a37;
    }

    .direction-toggle button.active {
        background-color: var(--falun-700);
        color: #fff;
    }

    .direction-toggle button:not(.active):hover {
        background-color: #3a3a37;
    }

    /* Badges dark */
    .pos-badge {
        background-color: #3a3a37;
        color: var(--parchment-200);
    }

    .match-type {
        color: #777;
    }

    .result-translations {
        color: #aaa;
    }

    /* Footer — already dark, but tweak if needed */
    .footer-bar {
        background-color: #080807;
    }
}
