/* Skip link: off-screen until focused, then pinned above the sticky nav. */
.skip-link {
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 1100;
    padding: 0.75rem 1rem;
    background-color: var(--landing-card);
    color: var(--landing-text);
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(10, 10, 10, 0.15);
    transform: translateY(calc(-100% - 1rem));
}

.skip-link:focus {
    transform: none;
}

/* Keep the skip target's first heading clear of the sticky nav. */
#main {
    scroll-margin-top: 6.5rem;
}

/* Navigation */
.nav {
    background-color: var(--landing-card);
    box-shadow: 0 2px 10px rgba(10, 10, 10, 0.05);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

/* Block-level image: no inline baseline gap, so the logo centres on the link row. */
.nav-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.nav-logo img {
    display: block;
    width: auto;
    height: 70px;
}

/*
 * Inline links on one row. When they would wrap (narrow window, large text,
 * long translation) the script after the nav adds .nav-compact for the drawer.
 * Without JavaScript the links wrap instead of hiding behind a dead button.
 */
.nav-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
    list-style: none;
    margin: 0;
    padding-left: 0;
}

/* Bootstrap's .nav-link padding/colour would double the anchor spacing. */
.nav-link {
    margin: 0;
    padding: 0;
}

.nav-link a {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    color: var(--landing-text);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    transition: color 180ms ease;
}

@media (hover: hover) and (pointer: fine) {
    .nav-link a:hover {
        color: var(--hostpass-action);
    }
}

/* Hamburger Menu */
.hamburger {
    display: none;
    cursor: pointer;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    padding: 0;
    border: 0;
    background: transparent;
    position: relative;
    margin-left: auto;
}

.hamburger span {
    display: block;
    position: absolute;
    height: 3px;
    width: 30px;
    background: var(--landing-ink);
    border-radius: 3px;
    opacity: 1;
    left: 7px;
    transform: rotate(0deg);
    transition: transform 250ms var(--hostpass-ease-out), top 250ms var(--hostpass-ease-out), opacity 150ms ease;
}

.hamburger span:nth-child(1) {
    top: 12px;
}

.hamburger span:nth-child(2) {
    top: 20px;
}

.hamburger span:nth-child(3) {
    top: 28px;
}

/* Open state: the bars cross into a close mark. */
.hamburger.active span:nth-child(1) {
    top: 20px;
    transform: rotate(135deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    top: 20px;
    transform: rotate(-135deg);
}

/* Navigation Overlay */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 10, 10, 0.5);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: opacity 300ms ease, visibility 300ms ease;
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Prevent body scroll when menu is open */
body.menu-open {
    overflow: hidden;
}

/* Drawer navigation: phones, landscape phones, and any width the inline links outgrow. */
.nav-compact .hamburger {
    display: block;
    z-index: 101;
}

.nav-compact .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    transform: translateX(100%);
    visibility: hidden;
    width: 70%;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding: calc(6rem + env(safe-area-inset-top, 0px)) calc(1rem + env(safe-area-inset-right, 0px)) calc(1.5rem + env(safe-area-inset-bottom, 0px)) calc(1rem + env(safe-area-inset-left, 0px));
    background-color: var(--landing-card);
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    gap: 0.75rem;
    transition: transform 300ms var(--hostpass-ease-out), visibility 300ms ease;
    box-shadow: -5px 0 15px rgba(10, 10, 10, 0.1);
    z-index: 100;
}

.nav-compact .nav-links.active {
    transform: translateX(0);
    visibility: visible;
    /* Visible at once on open so focus can move into the drawer; closing still waits for the slide. */
    transition: transform 300ms var(--hostpass-ease-out), visibility 0s;
}

/* Reduced motion: the drawer and overlay appear in place instead of sliding. */
@media (prefers-reduced-motion: reduce) {
    .nav-compact .nav-links {
        transform: none;
    }
}

.nav-compact .nav-links > li {
    flex-shrink: 0;
}

.nav-compact .nav-link a {
    min-height: 44px;
    padding: 0.5rem 1rem;
}

/* Language Switcher */
.language-switcher {
    display: flex;
    align-items: center;
    margin-left: 0.5rem;
}

.nav-compact .language-switcher {
    margin: 0.75rem 0 0;
}

/* Language Switcher Dropdown */
.language-switcher .dropdown {
    position: relative;
    display: inline-block;
}

.language-switcher .dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    margin: 0;
    border: 0;
    font: inherit;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 6px;
    transition: background-color 180ms ease;
    cursor: pointer;
}

/* Bootstrap draws its own caret; the chevron icon is the one caret. */
.language-switcher .dropdown-toggle::after {
    display: none;
}

.language-switcher .dropdown-toggle .arrow {
    width: 0.75em;
    height: 0.75em;
}

.language-switcher .dropdown-toggle.active {
    background-color: var(--hostpass-action);
    color: var(--landing-text-on-dark);
}

@media (hover: hover) and (pointer: fine) {
    .language-switcher .dropdown-toggle.active:hover {
        background-color: var(--hostpass-action-hover);
    }
}

.language-switcher .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--landing-card);
    box-shadow: 0 2px 10px rgba(10, 10, 10, 0.1);
    border-radius: 4px;
    padding: 0.5rem 0;
    z-index: 101;
    min-width: 100px;
}

.language-switcher .dropdown-menu a {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--landing-text);
    font-weight: 500;
    white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) {
    .language-switcher .dropdown-menu a:hover {
        background-color: var(--landing-lavender);
    }
}

.language-switcher .dropdown-menu.show {
    display: block;
}

/* Login Button in Navbar */
.nav-link-login {
    display: flex;
    align-items: center;
}

.nav-link-login a.btn-login {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    margin-left: 0.5rem;
    line-height: normal;
    border-width: 1px;
}

.nav-compact .nav-link-login a.btn-login {
    margin-left: 0;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Touch: every nav and language target is at least 44px tall without enlarging the text. */
@media (pointer: coarse) {
    .nav-link a,
    .language-switcher .dropdown-toggle,
    .language-switcher .dropdown-menu a {
        min-height: 44px;
    }
}
