
/* =========================
   GLOBAL
========================= */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    line-height: 1.6;

    background: #f5f6f8;
    color: #222;

    display: flex;
    flex-direction: column;

    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
    text-underline-offset: 3px;
}

a:hover {
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #60a5fa;
    outline-offset: 3px;
}

[hidden] {
    display: none !important;
}


/* =========================
   TOP BAR
========================= */

.site-header {
    position: relative;
    z-index: 100;
    width: 100%;
}

.navbar {
    width: 100%;

    background: #1f2937;
    color: white;

    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.15);
}

.navbar-inner {
    position: relative;

    width: 100%;
    max-width: 1400px;

    margin: 0 auto;

    min-height: 68px;
    padding: 0 24px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 24px;
}


/* Logo */

.site-logo {
    flex: 0 0 auto;

    color: white;

    font-size: 1.3rem;
    font-weight: 750;
    letter-spacing: -0.025em;
    line-height: 1.2;

    white-space: nowrap;
}

.site-logo:hover {
    color: white;
    text-decoration: none;
}


/* =========================
   NAVIGATION
========================= */

.main-navigation {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    gap: 5px;
    min-width: 0;
}

.main-navigation > a,
.logout-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 42px;
    padding: 9px 12px;

    border: 0;
    border-radius: 6px;

    background: transparent;
    color: white;

    font: inherit;
    font-size: 0.94rem;
    line-height: 1.4;

    cursor: pointer;

    transition:
        background-color 150ms ease,
        color 150ms ease;
}

.main-navigation > a:hover,
.logout-form button:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    text-decoration: none;
}


/* =========================
   LOGIN / REGISTRATION
========================= */

.navigation-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 5px;
}

.login-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 42px;
    padding: 9px 13px;

    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;

    background: rgba(255, 255, 255, 0.12);
    color: white;

    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;

    white-space: nowrap;

    transition:
        background-color 150ms ease,
        border-color 150ms ease;
}

.main-navigation > a.login-button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.login-button-primary,
.main-navigation > a.login-button-primary {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
}

.login-button-primary:hover,
.main-navigation > a.login-button-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: white;
}


/* =========================
   LOGOUT
========================= */

.logout-form {
    margin: 0;
}

.logout-form button {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
}


/* =========================
   ACCOUNT MENU
========================= */

.account-menu {
    position: relative;
    flex: 0 0 auto;
    margin-left: 4px;
}

.account-toggle {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    min-height: 42px;
    max-width: 220px;
    padding: 8px 11px;

    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;

    background: rgba(255, 255, 255, 0.09);
    color: white;

    font-size: 0.92rem;
    cursor: pointer;
}

.account-toggle:hover,
.account-open .account-toggle {
    background: rgba(255, 255, 255, 0.16);
}

.account-icon,
.account-chevron {
    flex: 0 0 auto;
}

.account-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-chevron {
    opacity: 0.75;
}

.account-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 200;

    width: max-content;
    min-width: 190px;
    max-width: min(280px, calc(100vw - 32px));

    padding: 6px;

    background: #ffffff;
    color: #222;

    border: 1px solid #e1e5eb;
    border-radius: 8px;

    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.account-dropdown > a,
.account-dropdown .logout-form button {
    display: flex;
    align-items: center;

    width: 100%;
    min-height: 42px;
    padding: 10px 12px;

    border: 0;
    border-radius: 5px;

    background: transparent;
    color: #273244;

    font-size: 0.93rem;
    text-align: left;
    text-decoration: none;
}

.account-dropdown > a:hover,
.account-dropdown .logout-form button:hover {
    background: #f1f4f8;
    color: #1d4ed8;
}


/* =========================
   MOBILE MENU BUTTON
========================= */

.menu-toggle {
    display: none;

    align-items: center;
    justify-content: center;

    width: 44px;
    height: 44px;
    padding: 6px;

    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;

    background: transparent;
    color: white;

    font-size: 1.55rem;
    line-height: 1;

    cursor: pointer;
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
}


/* =========================
   MAIN
========================= */

.site-main {
    flex: 1 0 auto;
    width: 100%;
    min-width: 0;
}

.content-container {
    width: 100%;
    max-width: 1150px;

    margin: 0 auto;
    padding: 36px 24px 48px;

    min-width: 0;
}

.content-container a {
    color: #2563eb;
}

.content-container a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}


/* =========================
   FOOTER
========================= */

.site-footer {
    flex: 0 0 auto;
    width: 100%;

    margin-top: auto;

    background: #1f2937;
    color: #f3f4f6;

    border-top: 1px solid rgba(255, 255, 255, 0.08);
}


/* Two columns on desktop */

.footer-inner {
    display: grid;

    grid-template-columns:
        minmax(0, 1.6fr)
        minmax(180px, 0.7fr);

    align-items: start;
    gap: 56px;

    width: 100%;
    max-width: 1200px;

    margin: 0 auto;
    padding: 38px 24px 34px;
}


/* Footer sections */

.footer-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    gap: 8px;
    min-width: 0;
}


/* Brand */

.footer-brand,
.footer-section > strong {
    margin: 0 0 4px;

    color: #ffffff;

    font-size: 1.12rem;
    font-weight: 750;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.footer-brand {
    display: inline-block;
    max-width: 100%;

    text-decoration: none;
    white-space: nowrap;
}

.footer-brand:hover {
    color: #ffffff;
    text-decoration: none;
}


/* Description */

.footer-section p,
.footer-description {
    max-width: 460px;

    margin: 0;

    color: #cbd5e1;
    font-size: 0.92rem;
    line-height: 1.75;

    overflow-wrap: anywhere;
}


/* Information heading */

.footer-heading {
    margin: 0 0 5px;

    color: #ffffff;

    font-size: 0.96rem;
    font-weight: 700;
    line-height: 1.5;
}


/* Footer links */

.footer-links {
    gap: 8px;
}

.footer-section a:not(.footer-brand) {
    color: #cbd5e1;
    font-size: 0.92rem;
    line-height: 1.5;

    text-decoration: none;
    text-underline-offset: 4px;

    transition:
        color 150ms ease,
        opacity 150ms ease;
}

.footer-section a:not(.footer-brand):hover {
    color: #ffffff;
    text-decoration: underline;
}


/* Copyright */

.footer-bottom {
    width: 100%;

    border-top: 1px solid rgba(255, 255, 255, 0.12);

    padding: 0 24px;

    color: #aeb9c8;
    font-size: 0.84rem;
}

.footer-bottom-inner {
    display: flex;
    align-items: center;

    width: 100%;
    max-width: 1200px;
    min-height: 52px;

    margin: 0 auto;
}


/* =========================
   TABLET
========================= */

@media (max-width: 1000px) {
    .navbar-inner {
        gap: 14px;
        padding-inline: 20px;
    }

    .main-navigation {
        gap: 2px;
    }

    .main-navigation > a,
    .logout-form button {
        padding: 8px 9px;
        font-size: 0.88rem;
    }

    .site-logo {
        font-size: 1.2rem;
    }

    .navigation-actions {
        gap: 5px;
        margin-left: 2px;
    }

    .login-button {
        padding-inline: 9px;
        font-size: 0.86rem;
    }

    .account-toggle {
        max-width: 155px;
        padding-inline: 8px;
    }

    .footer-inner {
        gap: 36px;
    }
}


/* =========================
   MOBILE
========================= */

@media (max-width: 760px) {
    .navbar-inner {
        min-height: 60px;
        padding: 0 16px;
        gap: 12px;
    }

    .site-logo {
        font-size: 1.2rem;
    }

    .menu-toggle {
        display: inline-flex;
        flex: 0 0 auto;
        margin-left: auto;
    }

    .main-navigation {
        display: none;

        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 1000;

        max-height: calc(100vh - 80px);
        overflow-y: auto;

        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;

        gap: 4px;
        padding: 12px 16px 16px;

        background: #1f2937;

        border-top: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    }

    .main-navigation.navigation-open {
        display: flex;
    }

    .main-navigation > a,
    .main-navigation > a.login-button,
    .logout-form button {
        display: flex;

        width: 100%;
        min-height: 44px;
        padding: 11px 12px;

        justify-content: flex-start;
        text-align: left;

        font-size: 0.95rem;
        white-space: normal;
    }

    .navigation-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));

        gap: 8px;
        margin: 8px 0 0;
    }

    .navigation-actions .login-button {
        justify-content: center;
        text-align: center;
        white-space: normal;
    }


    /* Account menu */

    .account-menu {
        width: 100%;
        margin: 4px 0 0;
        padding-top: 8px;

        border-top: 1px solid rgba(255, 255, 255, 0.12);
    }

    .account-toggle {
        width: 100%;
        max-width: none;
        min-height: 44px;

        justify-content: flex-start;
        padding: 10px 12px;
    }

    .account-name {
        flex: 1 1 auto;
        overflow-wrap: anywhere;
        text-overflow: clip;
        white-space: normal;
    }

    .account-dropdown {
        position: static;

        width: 100%;
        min-width: 0;
        max-width: none;

        margin-top: 5px;
        padding: 4px;

        background: rgba(0, 0, 0, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 6px;

        box-shadow: none;
    }

    .account-dropdown > a,
    .account-dropdown .logout-form button {
        min-height: 44px;
        padding: 11px 12px;

        color: #ffffff;
    }

    .account-dropdown > a:hover,
    .account-dropdown .logout-form button:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }

    .logout-form {
        width: 100%;
    }


    /* Main content */

    .content-container {
        padding: 26px 16px 36px;
    }


    /* Footer: stack sections */

    .footer-inner {
        grid-template-columns: minmax(0, 1fr);

        gap: 25px;

        padding: 30px 20px;
    }

    .footer-section {
        gap: 8px;
    }

    .footer-brand {
        white-space: nowrap;
    }

    .footer-description {
        max-width: 100%;
    }

    .footer-links {
        gap: 9px;
    }

    .footer-bottom {
        padding-inline: 20px;
    }

    .footer-bottom-inner {
        min-height: 48px;
    }
}


/* =========================
   VERY SMALL SCREENS
========================= */

@media (max-width: 380px) {
    .navbar-inner {
        min-height: 56px;
        padding-inline: 12px;
    }

    .site-logo {
        font-size: 1.1rem;
    }

    .content-container {
        padding-inline: 12px;
    }

    .navigation-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .footer-inner {
        padding: 26px 16px;
        gap: 23px;
    }

    .footer-brand {
        font-size: 1.08rem;
    }

    .footer-bottom {
        padding-inline: 16px;
    }
}


/* =========================
   REDUCED MOTION
========================= */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
