@font-face {
    font-family: "Barlow Semi Condensed";
    src: url("../fonts/barlow-semi-condensed-semibold.woff2") format("woff2");
    font-style: normal;
    font-weight: 600;
    font-display: swap;
}

body.wp-child-theme-madara-doujin-child .site-header.doujin-header {
    --header-control: 40px;
    --header-line: rgb(244 241 242 / 10%);
    --header-quiet: #c6b9c0;
    --header-fill: #1d171c;
    position: relative;
    z-index: 20;
    color: var(--doujin-text);
    background: var(--doujin-surface);
    box-shadow: 0 3px 14px rgb(0 0 0 / 19%);
    border-bottom: 1px solid var(--header-line);
    font-family: Inter, system-ui, sans-serif;
}

.doujin-header [hidden] {
    display: none !important;
}

.doujin-header__bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, max-content) minmax(0, 1fr);
    align-items: center;
    gap: clamp(18px, 2.1vw, 32px);
    width: min(var(--doujin-catalog-width), 100% - var(--doujin-catalog-gutter) * 2);
    min-height: 66px;
    margin-inline: auto;
    padding-block: 9px;
}

.doujin-header__tools,
.doujin-header__account,
.doujin-header__links {
    display: flex;
    align-items: center;
}

.doujin-header__tools {
    min-width: 0;
    gap: clamp(14px, 1.7vw, 26px);
}

.doujin-header .doujin-header__brand {
    display: inline-flex;
    flex: none;
    max-width: min(158px, 40%);
    align-items: center;
    color: var(--doujin-text);
    font-size: 1.375rem;
    font-weight: 780;
    letter-spacing: -0.05em;
    line-height: 1;
    overflow-wrap: anywhere;
}

.doujin-header__brand img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 54px;
    object-fit: contain;
}

.doujin-header__brand span::after {
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-inline-start: 3px;
    border-radius: 50%;
    background: var(--doujin-accent);
    box-shadow: 0 0 9px rgb(204 41 64 / 60%);
    content: "";
}

.doujin-header__menu {
    display: contents;
}

.doujin-header__nav {
    grid-column: 2;
    justify-self: center;
}

.doujin-header .doujin-header__links,
.doujin-header .sub-menu,
.doujin-header .doujin-search ul,
.doujin-header .c-user_menu {
    margin: 0;
    padding: 0;
    list-style: none;
}

.doujin-header__links {
    justify-content: center;
    flex-wrap: wrap;
    column-gap: clamp(14px, 1.8vw, 27px);
    max-width: min(560px, 45vw);
}

.doujin-header__links li {
    position: relative;
    margin: 0;
}

.doujin-header .doujin-header__links a,
.doujin-header .doujin-header__account a {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    color: var(--doujin-text);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
}

.doujin-header .doujin-header__links a:hover,
.doujin-header .doujin-header__links a:focus-visible,
.doujin-header .doujin-header__links .current-menu-item > a {
    color: var(--doujin-accent);
}

.doujin-header .doujin-header__links a,
.doujin-header .second-menu a,
.doujin-header .doujin-header__signin,
.doujin-header .doujin-header__register,
.doujin-header .c-user_menu a {
    font-family: "Barlow Semi Condensed", Inter, system-ui, sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.doujin-header__links .sub-menu {
    position: absolute;
    inset-block-start: 100%;
    inset-inline-start: 0;
    min-width: max(150px, 100%);
    border: 1px solid var(--header-line);
    border-radius: 6px;
    background: var(--header-fill);
    box-shadow: 0 12px 26px rgb(0 0 0 / 35%);
    visibility: hidden;
}

.doujin-header__links .sub-menu .sub-menu {
    inset-block-start: 0;
    inset-inline-start: 100%;
}

.doujin-header__links li:is(:hover, :focus-within) > .sub-menu {
    visibility: visible;
}

.doujin-header .doujin-header__links .sub-menu a {
    display: flex;
    padding-inline: 12px;
    white-space: nowrap;
}

.doujin-header__account {
    grid-column: 3;
    justify-self: end;
    gap: 8px;
}

.doujin-header .doujin-header__account > :is(.doujin-header__signin, .doujin-header__register) {
    justify-content: center;
    min-height: 36px;
    padding-inline: 13px;
    border: 1px solid var(--header-line);
    border-radius: 5px;
    white-space: nowrap;
}

.doujin-header .doujin-header__account > .doujin-header__register,
.doujin-header .doujin-search__button {
    border-color: transparent;
    background: var(--doujin-ruby);
    color: #fff;
}

.doujin-header .doujin-header__account > .doujin-header__signin:hover {
    border-color: rgb(255 101 118 / 42%);
    color: var(--doujin-accent);
}

.doujin-header .doujin-header__account > .doujin-header__register:hover,
.doujin-header .doujin-search__button:hover {
    background: #b42339;
}

.doujin-header .doujin-header__account .c-user_item {
    display: flex;
    position: relative;
    align-items: center;
    gap: 10px;
    font-size: 0.8125rem;
}

.doujin-header .c-user_item > span {
    overflow: hidden;
    max-width: 120px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doujin-header .c-user_avatar-image {
    display: block;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.doujin-header .c-user_avatar-image img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
}

.doujin-header .c-user_menu {
    display: none;
    position: absolute;
    z-index: 2;
    inset: 100% 0 auto auto;
    min-width: 165px;
    padding: 4px;
    border: 1px solid var(--header-line);
    border-radius: 6px;
    background: var(--header-fill);
    box-shadow: 0 12px 26px rgb(0 0 0 / 35%);
}

.doujin-header:not(.is-ready) .c-user_avatar:hover .c-user_menu,
.doujin-header .c-user_avatar.is-open .c-user_menu {
    display: block;
}

.doujin-header .c-user_menu a {
    display: flex;
    padding-inline: 9px;
    border-radius: 3px;
    white-space: nowrap;
}

.doujin-header .c-user_menu a:hover {
    background: rgb(255 101 118 / 8%);
    color: var(--doujin-accent);
}

.doujin-search {
    position: relative;
    flex: 1 1 310px;
    max-width: 330px;
    min-width: 0;
}

.doujin-header .doujin-search__form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--header-control);
    height: var(--header-control);
    margin: 0;
    border-radius: 5px;
}

.doujin-header .doujin-search__form input[type="search"] {
    width: 100%;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0 11px;
    border: 1px solid var(--header-line);
    border-right: 0;
    border-radius: 5px 0 0 5px;
    background: var(--header-fill);
    color: var(--doujin-text);
    font: 500 0.875rem/1 Inter, system-ui, sans-serif;
    color-scheme: dark;
}

.doujin-header .doujin-search__form input::placeholder {
    color: var(--header-quiet);
    opacity: 1;
}

.doujin-header .doujin-search__button,
.doujin-header .doujin-header__toggle {
    display: grid;
    width: var(--header-control);
    height: var(--header-control);
    padding: 0;
    border: 0;
    border-radius: 0 5px 5px 0;
    place-items: center;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}

.doujin-header .doujin-header__toggle {
    border: 1px solid var(--header-line);
    border-radius: 5px;
    background: var(--header-fill);
    color: var(--doujin-text);
}

@media (min-width: 961px) {
    .doujin-header .doujin-header__toggle {
        display: none;
    }
}

.doujin-header :is(a, button, input):focus-visible {
    outline: 2px solid var(--doujin-accent);
    outline-offset: 2px;
}

.doujin-header .doujin-search input:focus-visible {
    outline-offset: -2px;
}

.doujin-search__panel {
    position: absolute;
    z-index: 3;
    inset-block-start: calc(100% + 8px);
    inset-inline-start: 0;
    width: clamp(300px, 29vw, 410px);
    max-height: min(66dvh, 548px);
    overflow: auto;
    scroll-padding-block-end: 42px;
    border: 1px solid var(--header-line);
    border-radius: 7px;
    background: var(--header-fill);
    box-shadow: 0 12px 36px rgb(0 0 0 / 56%);
}

.doujin-header .doujin-search__filters button,
.doujin-header .doujin-search__result,
.doujin-header .doujin-search__term,
.doujin-header .doujin-search__all {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 36px;
    padding: 8px 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--doujin-text);
    font-size: 0.8125rem;
    line-height: 1.3;
    text-align: start;
    text-decoration: none;
    cursor: pointer;
}

.doujin-search__panel li + li {
    border-top: 1px solid var(--header-line);
}

.doujin-header .doujin-search__panel :is(a, button):is(:hover, :focus-visible) {
    background: rgb(255 101 118 / 9%);
    outline-offset: -2px;
}

.doujin-header .doujin-search__filters button {
    justify-content: space-between;
}

.doujin-header .doujin-search__filters code {
    padding: 0;
    background: transparent;
    color: #ff9ca7;
    font: 0.75rem/1.3 ui-monospace, monospace;
}

.doujin-search__filters span {
    color: var(--header-quiet);
    font-size: 0.75rem;
    text-align: end;
}

.doujin-search__cover {
    display: block;
    flex: 0 0 39px;
    width: 39px;
    height: 51px;
    border-radius: 3px;
    background: var(--doujin-bg);
    object-fit: cover;
}

.doujin-search__work {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.doujin-search__work > * {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doujin-search__work strong {
    font-size: 0.875rem;
    font-weight: 650;
}

.doujin-search__work small {
    color: var(--header-quiet);
    font-size: 0.72rem;
}

.doujin-search__work-meta {
    display: flex;
    gap: 9px;
}

.doujin-search__work-meta > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.doujin-search__work-meta > span + span { flex: none; }

.doujin-search__results:not([hidden]) + .doujin-search__terms {
    border-top: 1px solid var(--header-line);
}

.doujin-search__term-type {
    flex: none;
    padding: 2px 5px;
    border-radius: 3px;
    background: rgb(244 241 242 / 10%);
    color: var(--doujin-text);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
}

.doujin-search__term-type[data-type="artist"] {
    background: rgb(204 41 64 / 25%);
    color: #ffacb6;
}

.doujin-search__term-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doujin-search__term-count,
.doujin-search__term > i {
    flex: none;
    color: var(--header-quiet);
}

.doujin-search__term > i {
    margin-inline-start: auto;
}

.doujin-header .doujin-search__status {
    margin: 0;
    padding: 12px;
    color: var(--header-quiet);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.doujin-search__status:empty {
    display: none;
}

.doujin-header .doujin-search__all {
    position: sticky;
    inset-block-end: 0;
    justify-content: space-between;
    border-top: 1px solid var(--header-line);
    background: var(--header-fill);
    color: #ff9ca7;
    font-weight: 650;
}

.doujin-header .doujin-search__panel .doujin-search__all:is(:hover, :focus-visible) {
    background: #302028;
}

@media (max-width: 960px) {
    .doujin-header .doujin-header__brand {
        max-width: clamp(91px, 28vw, 124px);
    }

    .doujin-header__bar {
        --header-bar-gap: 8px;
        display: flex;
        position: relative;
        flex-wrap: wrap;
        min-height: 59px;
        gap: var(--header-bar-gap);
    }

    .doujin-header__tools {
        flex: 1 1 0;
        gap: 12px;
    }

    .doujin-search {
        position: static;
        flex: 0 1 330px;
        margin-inline-start: auto;
    }

    .doujin-header.is-ready .doujin-search {
        flex-basis: var(--header-control);
        min-width: var(--header-control);
    }

    .doujin-header.is-ready .doujin-search.has-interacted {
        transition: flex-basis 230ms cubic-bezier(.22, .7, .23, 1);
    }

    .doujin-header.is-ready .doujin-search.is-open {
        flex-basis: 330px;
    }

    .doujin-header.is-ready .doujin-search:not(.is-open) input[type="search"] {
        visibility: hidden;
    }

    .doujin-header.is-ready .doujin-search:not(.is-open) .doujin-search__button {
        border-radius: 5px;
    }

    .doujin-header .doujin-search__form input[type="search"] {
        font-size: 1rem;
    }

    .doujin-search__panel {
        inset-block-start: 100%;
        inset-inline: auto calc(var(--header-control) + var(--header-bar-gap));
        width: min(380px, 100% - var(--header-control) - var(--header-bar-gap));
    }

    .doujin-header__menu {
        display: flex;
        flex: 1 0 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .doujin-header.is-ready .doujin-header__menu {
        position: absolute;
        z-index: 2;
        inset: calc(100% + 1px) 0 auto auto;
        width: min(100%, 330px);
        max-height: 70vh;
        overflow: auto;
        padding: 10px;
        border: 1px solid var(--header-line);
        border-radius: 0 0 7px 7px;
        background: var(--header-fill);
        box-shadow: 0 12px 36px rgb(0 0 0 / 56%);
    }

    .doujin-header.is-ready .doujin-header__toggle[aria-expanded="false"] + .doujin-header__menu {
        display: none;
    }

    .doujin-header__links {
        flex-direction: column;
        align-items: stretch;
        max-width: none;
    }

    .doujin-header .doujin-header__links a {
        display: flex;
        min-height: 40px;
        padding-inline: 10px;
    }

    .doujin-header .doujin-header__links .sub-menu {
        position: static;
        margin-inline-start: 12px;
        border: 0;
        box-shadow: none;
        visibility: visible;
    }

    .doujin-header__account {
        flex-wrap: wrap;
        padding: 8px 4px 4px;
        border-top: 1px solid var(--header-line);
    }

    .doujin-header .doujin-header__account--signed-in {
        display: block;
        padding-inline: 0;
    }

    .doujin-header .doujin-header__account .c-user_item {
        display: block;
    }

    .doujin-header .c-user_item > span {
        display: block;
        max-width: none;
        margin: 3px 10px 5px;
        padding: 0;
        color: var(--header-quiet);
        font-size: 0.75rem;
        font-weight: 600;
    }

    .doujin-header .c-user_avatar-image {
        display: none;
    }

    .doujin-header .c-user_menu {
        display: block;
        position: static;
        padding: 0;
        border: 0;
        box-shadow: none;
    }

    .doujin-header .c-user_menu li {
        margin: 0;
    }

    .doujin-header .c-user_menu a {
        min-height: 44px;
        padding-inline: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .doujin-header.is-ready .doujin-search.has-interacted {
        transition: none;
    }
}
