/* =====================================================
   main.css
   Things every page of the website will use:
   colors, text, nav bar, buttons, footer, accessibility
   ===================================================== */


/* ---------- Colors (change them here and they change everywhere) ---------- */
:root {
    --blue: #234466;
    --dark: #0A141E;
    --cyan: #00FFFF;
    --light-blue: #4B75FF;
    --corner: 10px;
}


/* ---------- Page basics ---------- */
html {
    /* never shorter than the screen: the gradient on body is sized to the page,
       so while a page is still loading it would repeat down the screen */
    min-height: 100vh;
    scroll-behavior: smooth;
    scroll-padding-top: 100px;   /* so the nav bar doesn't cover headings we jump to */
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    font-size: 1.125rem;
    line-height: 1.6;
    color: white;
    background: linear-gradient(180deg, var(--dark) 0%, var(--blue) 55%, var(--dark) 100%);
    background-color: var(--dark);   /* shown instead of a repeat if the page is ever shorter */
    background-repeat: no-repeat;
}

a {
    color: white;
    text-decoration: none;
}

h1 {
    margin: 0;
    font-size: 3rem;
    line-height: 1.15;
    color: var(--cyan);
}

h2 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.3;
}



/* ---------- Nav bar ---------- */
/* The header is the part that sticks to the top. It has to be the header
   and not the nav inside it, because sticky only works inside a tall parent. */
header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(10, 20, 30, 0.85);
    backdrop-filter: blur(8px);
}

.navbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 32px;
}

.logo img {
    display: block;
    width: 64px;
    height: 48px;
}

.nav-links {
    display: flex;
    gap: 8px;
    margin: 0 auto 0 0;
    padding: 0;
    list-style: none;
}

.nav-links a {
    display: block;
    padding: 10px 16px;
    border-radius: var(--corner);
}

.nav-links a:hover {
    background: rgba(0, 255, 255, 0.15);
    color: var(--cyan);
}

/* the page we are on right now */
.nav-links a[aria-current="page"] {
    color: var(--cyan);
    font-weight: bold;
}


/* ---------- Search bar ---------- */
.search-bar {
    display: flex;
}

.search-bar input {
    min-height: 44px;
    padding: 0 14px;
    font-size: 1rem;
    background: white;
    color: var(--dark);
    border: none;
    border-radius: var(--corner) 0 0 var(--corner);
}

.search-bar button {
    border-radius: 0 var(--corner) var(--corner) 0;
}


/* ---------- Buttons ---------- */
button,
.button {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 20px;
    font-size: 1rem;
    font-weight: bold;
    background: var(--cyan);
    color: var(--dark);
    border: none;
    border-radius: var(--corner);
    cursor: pointer;
}

button:hover,
.button:hover {
    background: white;
}


/* ---------- Logged-in user menu (picture + dropdown) ---------- */
/* the header must sit above page content that has its own stacking order,
   like the profile banner, or the dropdown would slide underneath it */
.site-header {
    z-index: 50;
}

.navbar [hidden] {
    display: none !important;
}

.user-menu {
    position: relative;
}

.nav-profile-link {
    display: block;
    border-radius: 50%;
}

.nav-avatar {
    display: block;
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    border: 2px solid var(--cyan);
    border-radius: 50%;
    object-fit: cover;
    background: var(--dark);
}

/* the person's initials when there is no picture */
.nav-avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
    line-height: 1;
    background: var(--cyan);
    color: var(--dark);
}

/* opens on hover, and on keyboard focus so it works without a mouse */
.user-menu-list {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 30;
    min-width: 180px;
    margin: 0;
    padding: 6px 0;
    list-style: none;
    background: rgba(10, 20, 30, 0.97);
    border: 1px solid var(--cyan);
    border-radius: var(--corner);
}

.user-menu:hover .user-menu-list,
.user-menu:focus-within .user-menu-list {
    display: block;
}

.user-menu-list a,
.user-menu-list button {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-height: 0;
    padding: 10px 16px;
    font: inherit;
    font-weight: normal;
    text-align: left;
    color: white;
    background: transparent;
    border-radius: 0;
}

.user-menu-list a:hover,
.user-menu-list button:hover {
    background: rgba(0, 255, 255, 0.15);
    color: var(--cyan);
}


/* ---------- Footer ---------- */
footer {
    padding: 40px 32px;
    text-align: center;
    background: rgba(10, 20, 30, 0.85);
    backdrop-filter: blur(8px);
}

footer p {
    margin: 0;
}

footer a {
    text-decoration: underline solid;
}

/* ---------- Accessibility ---------- */
/* thick cyan outline when using the keyboard */
:focus-visible {
    outline: 3px solid var(--cyan);
    outline-offset: 3px;
    border-radius: 4px;
}

/* hidden on screen but still read by screen readers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* "skip to content" link, only shows up when you press Tab */
.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    z-index: 20;
    padding: 12px 20px;
    background: var(--cyan);
    color: var(--dark);
    font-weight: bold;
    border-radius: var(--corner);
}

.skip-link:focus {
    top: 16px;
}

/* no animations for people who turned them off on their computer */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}


/* ---------- Phones and small screens ---------- */
@media (max-width: 800px) {
    h1 {
        font-size: 2.25rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    img {
        width: 100%;
    }

    .navbar {
        flex-wrap: wrap;
        padding: 12px 16px;
    }

    .nav-links {
        order: 3;          /* links drop to their own row */
        width: 100%;
        flex-wrap: wrap;
    }
}
