/* Shared styles for every page: reset, header/navbar, layout, footer.
   Loaded before each page's own stylesheet. */

/* --- ACCENT COLOUR: every text, border, button, glow and tint on the site uses these two lines.
   Amber since revision-1.6 (was red #ff0000 / 255, 0, 0; the 404 page keeps red, see 404.css).
   --accent-rgb is the same colour as numbers, for see-through versions: rgba(var(--accent-rgb), 0.3).
   Dark tinted backgrounds are derived from --accent with rgb(from …), each with a plain black fallback line. --- */
:root {
    --accent: #ffb000;
    --accent-rgb: 255, 176, 0;
    /* Paragraph text (About Me, project and gallery descriptions, subtitle): a warm off-white that is easier to
       read in long passages; headings, labels, buttons and bold keywords keep the full accent */
    --text: #f2e3c6;
}

/* --- FONT: VT323, self-hosted (was Google Fonts). Latin subset; license in assets/vendor/fonts/OFL-VT323.txt.
   Each page preloads this file so it starts downloading immediately. --- */
@font-face {
    font-family: 'VT323';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../vendor/fonts/vt323-v18-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- FONT: IBM Plex Mono, self-hosted (Latin subset; license in assets/vendor/fonts/OFL-IBMPlexMono.txt).
   Used by the home page's About Me / project card text and every page's footer text. --- */
@font-face {
    font-family: 'IBM Plex Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../vendor/fonts/ibm-plex-mono-v20-latin-400.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'IBM Plex Mono';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../vendor/fonts/ibm-plex-mono-v20-latin-700.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- SITE NAVBAR: floating buttons that follow the page ---
   Desktop: a centred row of buttons at the top, no bar behind it.
   Phones/tablets (768px and under): a fixed app-style bar along the bottom, icon above label.
   Same markup on every page; the current page's link has aria-current="page" and is filled red. */
:root {
    --nav-bar-height: 3.5rem;
    /* phone bottom bar; pages reserve this much space at the bottom */
}

#site-nav {
    position: fixed;
    top: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    gap: 0.75rem;
}

/* Same look as the home page hero buttons: accent outline on 80% black, VT323, glow */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    letter-spacing: 0.05rem;
    white-space: nowrap;
    color: var(--accent);
    text-decoration: none;
    text-shadow: 0 0 10px var(--accent);
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--accent);
    padding: 0.3rem 0.9rem;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.nav-icon {
    text-shadow: none;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link[aria-current="page"] {
    background: var(--accent);
    color: #000;
    text-shadow: none;
    box-shadow: 0 0 15px var(--accent);
}

/* --- RESET & BASICS --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #000;
    color: var(--accent);
    /* Accent colour (amber; set at the top of this file) */
    font-family: 'Courier New', Courier, monospace;
    overflow-x: hidden;
    width: 100vw;
    height: 100vh;
}

/* --- CANVAS --- */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    /* Let clicks pass through to content */
}

/* --- CONTENT OVERLAY --- */
main {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 40px;
}

section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- FOOTER --- */
/* Footer darkness on every page: how much of the 3D background shows through
   (0 = fully see-through, 1 = solid black). Tune this one number; text and links stay at full brightness. */
:root {
    --footer-bg-alpha: 0.6;
}

footer {
    padding: 2rem;
    text-align: center;
    font-size: 0.8rem;
    width: 100%;
    background: rgba(0, 0, 0, var(--footer-bg-alpha));
    z-index: 2;
    border-top: 1px solid rgba(var(--accent-rgb), 0.3);
}

/* Copyright and last-update lines (the links keep VT323) */
footer p {
    font-family: 'IBM Plex Mono', 'Courier New', Courier, monospace;
}

footer p + p {
    margin-top: 0.4rem;
}

/* Contact / profile links: bracketed like the site's buttons */
.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.5rem;
    margin-bottom: 1rem;
}

.footer-link {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    letter-spacing: 0.05rem;
    color: var(--accent);
    text-decoration: none;
    padding: 0.1rem 0.4rem;
    transition: background 0.2s, color 0.2s;
}

.footer-link:hover,
.footer-link:focus-visible {
    background: var(--accent);
    color: #000;
}

/* [ ↑ TOP ] (home page): on its own line above the links */
.footer-top {
    display: inline-block;
    margin-bottom: 0.75rem;
}

/* --- SITE NAVBAR ON PHONES/TABLETS: fixed bottom bar, five equal slots, icon above label --- */
@media (max-width: 768px) {
    /* Nothing is fixed at the top on phones, so pages start near the top of the screen */
    main {
        padding-top: 1rem;
    }

    #site-nav {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        height: calc(var(--nav-bar-height) + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        gap: 0;
        background: rgba(0, 0, 0, 0.95);
        background: rgb(from var(--accent) calc(r * 0.04) calc(g * 0.04) calc(b * 0.04) / 0.95);
        border-top: 1px solid var(--accent);
        backdrop-filter: blur(5px);
    }

    .nav-link {
        flex: 1;
        min-width: 0;
        flex-direction: column;
        justify-content: center;
        gap: 0.1rem;
        font-size: 0.9rem;
        letter-spacing: 0;
        padding: 0.2rem 0;
        background: transparent;
        border: none;
    }

    .nav-icon {
        font-size: 1.1rem;
        line-height: 1;
    }

    /* Keep the page's last content (the footer) clear of the bar: an empty block at the end of main
       (body has a fixed 100vh height, so padding on body would not add scroll space) */
    main::after {
        content: '';
        display: block;
        flex-shrink: 0;
        height: calc(var(--nav-bar-height) + env(safe-area-inset-bottom, 0px));
    }
}

/* --- CONTACT PANEL (phones): opened by the navbar's /CONTACT, see site.js --- */
.contact-panel {
    position: fixed;
    inset: 0;
    z-index: 999;
    /* below the bottom navbar (1000), so the bar stays visible and /CONTACT toggles the panel */
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: flex-end;
}

.contact-sheet {
    width: 100%;
    margin-bottom: calc(var(--nav-bar-height) + env(safe-area-inset-bottom, 0px));
    padding: 1rem 1rem 1.25rem;
    background: rgba(0, 0, 0, 0.97);
    background: rgb(from var(--accent) calc(r * 0.04) calc(g * 0.04) calc(b * 0.04) / 0.97);
    border-top: 1px solid var(--accent);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.contact-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'VT323', monospace;
    font-size: 1.4rem;
    color: var(--accent);
    text-shadow: 0 0 8px var(--accent);
}

.contact-email {
    font-family: 'IBM Plex Mono', 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    color: var(--accent);
    word-break: break-all;
    user-select: all;
}

.contact-close,
.contact-action {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    color: var(--accent);
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--accent);
    text-shadow: 0 0 10px var(--accent);
    text-decoration: none;
    cursor: pointer;
}

.contact-close {
    padding: 0.1rem 0.6rem;
}

.contact-action {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Desktop: a small box in the middle of the screen (the navbar is at the top there, not the bottom) */
@media (min-width: 769px) {
    .contact-panel {
        align-items: center;
        justify-content: center;
    }

    .contact-sheet {
        width: min(26rem, calc(100% - 2rem));
        margin-bottom: 0;
        border: 1px solid var(--accent);
        box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.3);
    }
}

.contact-close:hover,
.contact-close:focus-visible,
.contact-action:hover,
.contact-action:focus-visible {
    background: var(--accent);
    color: #000;
    text-shadow: none;
}

/* --- FULL-SCREEN PHOTO VIEWER (PhotoSwipe, opened by lightbox.js on the home and gallery pages) --- */
.pswp {
    z-index: 9999;
    --pswp-bg: #000;
    --pswp-icon-color: var(--accent);
    --pswp-icon-color-secondary: #000;
    --pswp-icon-stroke-color: #000;
    --pswp-icon-stroke-width: 2px;
}

.pswp__button {
    filter: drop-shadow(0 0 6px rgba(var(--accent-rgb), 0.8));
}

.pswp__counter {
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
    color: var(--accent);
    text-shadow: 0 0 8px var(--accent);
    opacity: 1;
}

/* Caption bar along the bottom (registered by lightbox.js) */
.pswp__custom-caption {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    width: calc(100% - 2rem);
    max-width: 800px;
    padding: 0.6rem 1rem;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--accent);
    text-align: center;
    color: rgba(var(--accent-rgb), 0.85);
    font-size: 0.85rem;
    line-height: 1.4;
}

.pswp__custom-caption strong {
    display: block;
    font-family: 'VT323', monospace;
    font-size: 1.4rem;
    font-weight: 400;
    letter-spacing: 0.1rem;
    text-transform: uppercase;
    color: var(--accent);
    text-shadow: 0 0 8px var(--accent);
}
