/* Shared component refinements loaded after main.css. */
.mobile-search-panel {
    display: none;
}

.account-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 17px;
    border: 1px solid var(--color-account-border);
    border-radius: var(--radius-md);
    background: var(--color-account-bg);
    color: var(--color-account-text);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.account-button:hover {
    border-color: var(--color-border-strong);
    background: var(--color-account-hover);
    color: var(--color-account-text);
}

.account-button:active {
    transform: translateY(1px);
}

@media (max-width: 900px) {
    .mobile-search-panel {
        position: absolute;
        top: calc(var(--header-height) + 8px);
        left: var(--page-gutter);
        right: var(--page-gutter);
        z-index: 60;
        padding: 10px;
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        background: var(--color-surface);
        box-shadow: var(--shadow-md);
    }

    .mobile-search-panel.is-open {
        display: block;
    }
}


/* Shared compact back navigation */
.back-link {
    margin-bottom: 12px;
}

.back-link a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--color-text-muted);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.back-link a:hover {
    color: var(--color-brand);
}

.back-link__arrow {
    font-size: 17px;
    line-height: 1;
}


/* Cookie notice */
.cookie-notice[hidden] {
    display: none !important;
}

.cookie-notice {
    position: fixed;
    z-index: 140;
    left: 50%;
    bottom: 18px;
    width: min(calc(100% - 32px), 760px);
    transform: translateX(-50%);
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
}

.cookie-notice__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.cookie-notice__text {
    margin: 0;
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.5;
}

.cookie-notice__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.cookie-notice__actions .button {
    min-height: 40px;
    padding: 0 14px;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .cookie-notice {
        bottom: 10px;
        width: calc(100% - 20px);
        padding: 13px;
    }

    .cookie-notice__inner {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .cookie-notice__actions {
        width: 100%;
    }

    .cookie-notice__actions .button {
        flex: 1 1 0;
        justify-content: center;
    }
}

/* Soft modernization v1: navigation states and refined footer. */
.desktop-nav a[aria-current="page"] {
    position: relative;
    color: var(--color-brand);
}

.desktop-nav a[aria-current="page"]::after {
    position: absolute;
    right: 0;
    bottom: -12px;
    left: 0;
    height: 2px;
    border-radius: 2px;
    background: var(--color-brand);
    content: "";
}

.mobile-menu-nav a[aria-current="page"] {
    color: var(--color-brand);
    background: transparent;
    border-radius: 0;
    font-weight: 800;
}

.footer-inner {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(200px, 1.3fr) repeat(2, minmax(135px, 0.8fr)) minmax(210px, 1fr);
    align-items: start;
    gap: clamp(20px, 3vw, 44px);
    padding-block: 38px 20px;
}

.footer-brand__link {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--color-heading);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.1;
}

.footer-brand__link:hover {
    color: var(--color-heading);
}

.footer-brand__link img {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    object-fit: contain;
}

.footer-brand__description {
    margin: 16px 0 0;
    color: var(--color-text-muted);
    font-size: 13px;
    line-height: 1.6;
}

.footer-group {
    display: grid;
    align-content: start;
    gap: 11px;
}

.footer-group h2 {
    margin: 2px 0 7px;
    color: var(--color-heading);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: 0;
}

.footer-group a {
    width: fit-content;
    color: var(--color-text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.footer-group a:hover {
    color: var(--color-brand);
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px 24px;
    padding-block: 0 22px;
    border-top: 0;
    color: var(--color-text-muted);
    font-size: 12px;
}

@media (max-width: 900px) {
    .footer-inner {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px;
        padding-block: 32px 20px;
    }
}

@media (max-width: 560px) {
    .footer-inner {
        grid-template-columns: 1fr;
        gap: 26px;
        padding-block: 28px 16px;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Figma-inspired header controls; keep current dimensions and search behavior. */
.header-actions .header-search .search-input {
    background: var(--color-bg);
}

.header-actions .header-search .search-input:focus {
    background: var(--color-surface);
}

.header-actions .theme-toggle {
    color: var(--color-brand);
}

.header-actions .theme-toggle svg {
    width: 19px;
    height: 19px;
}

/* Icon visibility follows the actual theme, including the initial stored theme. */
.theme-toggle [data-theme-icon="moon"] {
    display: block;
}

.theme-toggle [data-theme-icon="sun"] {
    display: none;
}

html[data-theme="dark"] .theme-toggle [data-theme-icon="moon"] {
    display: none;
}

html[data-theme="dark"] .theme-toggle [data-theme-icon="sun"] {
    display: block;
}

.account-button--header {
    gap: 9px;
    white-space: nowrap;
}

.account-button--header svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

/* Safari samples both the page canvas and the sticky header for its chrome.
   Preserve the soft canvas under the bottom browser toolbar, but keep the
   header permanently opaque white and the top theme-color white. */
@media (max-width: 900px) {
    body {
        position: relative;
    }

    .page-shell {
        background: var(--color-bg);
    }

    .site-header {
        background: var(--color-surface);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}
