/* Shared site header: title left + cube selector right (same row); primary nav row centered */

.header {
    background: #faf8f6;
    border-bottom: 1px solid #e8e0dc;
    padding: 1rem 1.5rem;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
}

/* Top row: brand left, cube selector right */
.header-brand-stack {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    width: 100%;
    margin-bottom: 0.75rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: flex-start;
}

.header-brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.header-brand-link:hover .header-wordmark {
    color: #3d2e29;
}

.header-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
    flex-shrink: 0;
}

.header-brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
}

.header-wordmark {
    font-family: "Fraunces", serif;
    color: #523f38;
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    line-height: 1.1;
    font-weight: 400;
}

.header-subtitle {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: #7a6a62;
    margin: 0;
}

.header-cube-wrap {
    flex: 0 1 360px;
    min-width: min(100%, 200px);
    max-width: 360px;
    margin-left: auto;
}

.header-cube-wrap select {
    width: 100%;
    padding: 0.65rem 0.75rem;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    background: white;
}

/* Centered link row */
.header-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem 1.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e8e0dc;
    width: 100%;
}

.header-nav > a {
    color: #523f38;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.header-nav > a:hover {
    color: #667eea;
}

.header-nav > a[aria-current="page"] {
    color: #667eea;
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown-trigger {
    display: inline-block;
    background: none;
    border: none;
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    color: #523f38;
    cursor: pointer;
    padding: 0.25rem 0;
    text-decoration: none;
}

.nav-dropdown-trigger:hover,
.nav-dropdown:focus-within .nav-dropdown-trigger {
    color: #667eea;
}

/* No margin between trigger and menu — margin created a hover dead zone. Use padding inside the menu instead. */
.nav-dropdown-menu {
    display: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 100%;
    margin-top: 0;
    min-width: 220px;
    padding: 0.5rem 0;
    list-style: none;
    background: #fff;
    border: 1px solid #e8e0dc;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    z-index: 200;
}

/* Invisible bridge so moving from trigger to items does not leave the dropdown hit area */
.nav-dropdown-menu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 0.5rem;
}

.nav-dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-dropdown-menu a:hover {
    background: #f5f5f5;
    color: #667eea;
}

.nav-dropdown-menu a.is-disabled {
    opacity: 0.45;
    pointer-events: none;
    cursor: not-allowed;
}

.nav-dropdown-menu a.is-disabled:hover {
    background: transparent;
    color: #333;
}

@media (hover: hover) {
    .nav-dropdown:hover .nav-dropdown-menu {
        display: block;
    }
}

.nav-dropdown:focus-within .nav-dropdown-menu {
    display: block;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
    }
    .header-logo {
        width: 48px;
        height: 48px;
    }
}

@media (max-width: 520px) {
    .header-brand-stack {
        flex-direction: column;
        align-items: stretch;
    }
    .header-cube-wrap {
        margin-left: 0;
        max-width: none;
        flex: 1 1 auto;
    }
}

/* Shared site footer (contact + deploy version from /api/version) */
.footer {
    background: white;
    border-top: 1px solid #eee;
    padding: 2rem;
    margin-top: 4rem;
    text-align: center;
    color: #666;
}

.footer p {
    margin-bottom: 0.5rem;
}

.footer p:last-child {
    margin-bottom: 0;
}

.footer a {
    color: #667eea;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.footer .footer-version {
    font-size: 0.875rem;
    color: #999;
}

@media (max-width: 768px) {
    .footer {
        padding: 1.5rem 1rem;
        margin-top: 2.5rem;
    }
}
