/* Shared site header (KYK). Same look as the product card header:
   black bar, red KYK block, red "Japan Quality" strip, nav, search,
   phone and cart counter. Loaded on every public page. */
.kh-header {
    --kh-red: #DB0016;
    --kh-red-d: #B80016;
    background: #111;
    position: sticky;
    top: 0;
    z-index: 1040;
    font-family: "Jost", sans-serif;
    color: #fff;
}

.kh-header *,
.kh-header *::before,
.kh-header *::after { box-sizing: border-box; }

.kh-wrap {
    display: flex;
    height: 72px;
}

.kh-logo {
    background: var(--kh-red);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: max(204px, calc((100vw - 1320px) / 2 + 204px));
    padding: 0 24px 0 20px;
    flex: none;
    text-decoration: none;
}

.kh-logo img {
    height: 32px;
    width: auto;
    max-width: none;
    display: block;
}

.kh-band {
    flex: none;
    overflow: hidden;
    width: 24px;
    background: var(--kh-red-d);
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.kh-band span {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 7px;
    line-height: 1;
    letter-spacing: 0.12em;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
    color: #fff;
}

.kh-main {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 28px;
    min-width: 0;
    padding: 0 max(24px, calc((100vw - 1320px) / 2)) 0 28px;
}

.kh-sub {
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #8a8a8a;
    font-weight: 700;
    white-space: nowrap;
}

.kh-nav {
    display: flex;
    gap: 26px;
    white-space: nowrap;
}

.kh-nav a {
    color: #e8e8e8;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
    padding: 26px 0 24px;
    border-bottom: 2px solid transparent;
    text-decoration: none;
}

.kh-nav a:hover,
.kh-nav a:focus-visible,
.kh-nav a[aria-current="page"] {
    color: #fff;
    border-color: var(--kh-red);
}

.kh-search {
    margin: 0 0 0 auto;
    display: flex;
    align-items: center;
    background: #1e1e1e;
    border: 1px solid #2c2c2c;
    height: 44px;
    width: 250px;
    border-radius: 2px;
    padding: 0 12px;
    gap: 8px;
}

.kh-search:focus-within { border-color: var(--kh-red); }

.kh-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.kh-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 14px;
    padding: 0;
    height: auto;
    box-shadow: none;
}

.kh-search input::placeholder { color: #9a9a9a; opacity: 1; }

.kh-search button {
    background: none;
    border: 0;
    padding: 0;
    display: grid;
    place-items: center;
    color: #9a9a9a;
    cursor: pointer;
}

.kh-phone {
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    text-decoration: none;
}

.kh-phone:hover { color: #fff; text-decoration: underline; }

.kh-cart {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #333;
    display: grid;
    place-items: center;
    flex: none;
    text-decoration: none;
    transition: transform 0.2s;
}

.kh-cart:hover { border-color: #555; }
.kh-cart.bump { transform: scale(1.12); }

/* !important beats the inline display:none that older page scripts set */
.kh-cart-count {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--kh-red);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border: 2px solid #111;
}

.kh-burger {
    display: none;
    background: none;
    border: 0;
    width: 44px;
    height: 44px;
    place-items: center;
    color: #fff;
    cursor: pointer;
    flex: none;
}

/* Mobile panel: search, nav, contacts. Toggled by js/header.js. */
.kh-panel {
    display: none;
    background: #111;
    border-top: 1px solid #262626;
    padding: 16px 18px 22px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
}

.kh-header.is-open .kh-panel { display: block; }

.kh-panel .kh-search {
    display: flex;
    width: 100%;
    margin: 0 0 10px;
}

.kh-panel nav a {
    display: block;
    color: #e8e8e8;
    font-weight: 600;
    font-size: 17px;
    padding: 13px 0;
    border-bottom: 1px solid #222;
    text-decoration: none;
}

.kh-panel nav a[aria-current="page"] { color: #fff; box-shadow: inset 3px 0 0 var(--kh-red); padding-left: 12px; }

.kh-panel .kh-contacts {
    margin: 16px 0 0;
    display: grid;
    gap: 8px;
}

.kh-panel .kh-contacts a {
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
}

.kh-panel .kh-contacts a + a { color: #bdbdbd; font-weight: 500; }

@media (max-width: 1200px) {
    .kh-sub { display: none; }
    .kh-main { gap: 20px; }
    .kh-nav { gap: 18px; }
    .kh-search { width: 200px; }
}

@media (max-width: 1060px) {
    .kh-phone { display: none; }
}

@media (max-width: 900px) {
    .kh-wrap { height: 60px; }
    .kh-logo { width: auto; padding: 0 14px 0 18px; }
    .kh-logo img { height: 26px; }
    .kh-band { width: 20px; }
    .kh-band span { font-size: 6px; letter-spacing: 0.1em; }
    .kh-main { padding: 0 8px 0 10px; gap: 8px; }
    .kh-main > .kh-nav,
    .kh-main > .kh-search,
    .kh-main > .kh-phone { display: none; }
    .kh-cart { margin-left: auto; }
    .kh-burger { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
    .kh-cart { transition: none; }
}

@media (forced-colors: active) {
    .kh-logo, .kh-band { border: 1px solid CanvasText; }
}
