/* ==========================================================================
   style.css — Global styles for Conor Ashlee-Purle portfolio

   Architecture:
   - Multi-page site: index.html, project.html, about.html, commission.html,
     extra.html, familyArchive.html
   - All interactive elements use .interactive class (opacity 0.85 → 1 on hover)
   - Gallery images have their own opacity rules (0.85 → 1, no scale)
   - Background: blackGlitch.webp + noise overlay (injected by noise.js)

   Z-index layers:
     10     .centered-container (main menu)
     50     .section-screen (family archive)
    100     .top-left-actions (home/about buttons)
    100     .preloader
   1000     .lightbox
   1001     .lightbox-nav, .lightbox-close
  10000     #device-check-overlay (mobile gate — topmost)
   ========================================================================== */

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Prevent overscroll bounce (white flash at scroll edges on macOS/Chrome) */
html {
    overscroll-behavior: none;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;

    /* Image background with noise overlay — noise.js prepends a noise tile layer at runtime */
    background-color: #000;
    background-image: url('data/background/blackGlitch.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* Fixed background for desktop parallax; mobile is gated by the device overlay. */
    background-attachment: fixed;
}

/* ---------- Mobile Gate ---------- */

#device-check-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 2rem;
    text-align: center;
}

#device-check-overlay.hidden {
    /* JS toggles this to allow desktop entry. */
    display: none;
}

#device-check-message {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    max-width: 600px;
}

#mobile-check-why-link {
    color: #fff;
    text-decoration: underline;
    cursor: pointer;
    margin-bottom: 1rem;
}

#mobile-check-explanation {
    max-width: 500px;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
}

/* ---------- Utility classes ---------- */

.hidden {
    display: none !important;
}

/*
 * .interactive — Shared hover behavior for all clickable elements.
 * Base: opacity 0.85, hover: opacity 1 + slight scale.
 * Modifier: .interactive--lg gives a larger scale (1.1) for utility buttons.
 */
.interactive {
    opacity: 0.85;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.3s ease;
}

.interactive:hover {
    opacity: 1;
    transform: scale(1.05);
}

.interactive--lg:hover {
    transform: scale(1.1);
}

/* ---------- Top-left actions (home + about buttons) ---------- */

.top-left-actions {
    position: fixed;
    top: 2rem;
    left: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
    z-index: 100;
}

/* Hide the home button on the home page itself */
body.is-home .top-left-actions .btn-home {
    display: none;
}

/* Home button in top-left-actions (about, familyArchive, password) */
.top-left-actions .btn-home {
    max-width: 100px;
}

.about-btn img {
    max-width: 180px;
    height: auto;
}

/* ---------- Main menu (centered) ---------- */

.centered-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 3rem;
    align-items: center;
    z-index: 10;
}

.menu-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.menu-title img {
    max-height: 70px;
    height: auto;
    display: block;
}

.menu-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    max-width: 900px;
}

/* Projects stack vertically in the main menu */
#main-menu .menu-buttons {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
}

.menu-buttons img {
    max-height: 50px;
    height: auto;
}

/* ---------- Section screens (family archive) ---------- */

.section-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
}

/* ---------- Album links (family archive) ---------- */

.album-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    align-items: center;
    justify-content: center;
    max-width: 900px;
}

.album-links img {
    max-height: 50px;
    height: auto;
}

/* ---------- Password screen ---------- */

#password-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    background: transparent;
}

.password-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.password-title {
    max-width: 300px;
}

.password-input {
    padding: 1rem 2rem;
    font-size: 1.5rem;
    border: 3px solid #444cf7;
    background: #fff;
    text-align: center;
    min-width: 300px;
    font-family: inherit;
}

.password-feedback img {
    max-width: 200px;
    height: auto;
}

.password-buttons img {
    max-width: 150px;
}

/* ---------- Preloader (progress bar while images load) ---------- */

.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    background: rgba(229, 229, 247, 0.95);
}

#loader-bar {
    width: 0%;
    height: 4px;
    background: #444cf7;
    /* Width is updated by loader.js while assets load. */
    transition: width 0.3s ease;
    max-width: 400px;
}

/* ---------- Gallery ---------- */

#gallery {
    width: 100%;
    min-height: 100vh;
    padding: 2rem;
    padding-bottom: 4rem;
}

/* Masonry layout — columns created dynamically by project.js */
.gallery-grid {
    display: flex;
    gap: 1rem;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
}

.masonry-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.gallery-item {
    position: relative;
    cursor: pointer;
}

/* Gallery images: same 0.85 opacity as everything, hover to 1, no scale */
.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.gallery-item:hover img {
    opacity: 1;
}

/* Progressive loading: images start invisible and fade in when loaded */
.gallery-item--loading img {
    /* JS applies this while the image is still downloading. */
    opacity: 0;
}

.gallery-item--loaded img {
    /* JS swaps to this after decode to avoid popping. */
    opacity: 0.85;
}

/* ---------- Gallery bottom bar (nav left, info/extra right) ---------- */

.gallery-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 5rem;
    padding: 0 0 2rem;
}

.gallery-bottom-left {
    display: flex;
    align-items: flex-end;
}

.gallery-bottom-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
}

.btn-nav {
    max-width: 100px;
}

.btn-extra {
    max-width: 80px;
}

.project-info-image {
    max-width: 360px;
    width: 100%;
    height: auto;
    display: block;
}

/* ---------- Lightbox (full-screen image viewer) ---------- */

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#lightbox-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    opacity: 1;
}

#bio-lightbox-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.lightbox-nav {
    position: fixed;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    z-index: 1001;
    /* Let clicks pass through except on actual buttons. */
    pointer-events: none;
}

.lightbox-btn {
    max-width: 100px;
    pointer-events: auto;
}

/* Override inline opacity set by JS at first/last image boundaries */
.lightbox-btn:hover {
    opacity: 1 !important;
}

.lightbox-close {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 1001;
    max-width: 80px;
}

/* ---------- About screen ---------- */

#about-screen {
    width: 100%;
    min-height: 100vh;
    padding: 2rem;
    padding-bottom: 4rem;
}

.about-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
    padding-top: 4rem;
}

.bio-image {
    max-width: 500px;
    width: 100%;
    height: auto;
}

.cv-images {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 500px;
}

.cv-image {
    width: 100%;
    height: auto;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.cv-image:hover {
    opacity: 1;
}

.about-sections {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.about-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.about-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: none;
    text-decoration: none;
}

.section-title {
    max-height: 50px;
    max-width: 200px;
    width: auto;
    height: auto;
}

/* ---------- Extra horizontal scroll ---------- */

#extra-container {
    width: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.extra-scroll {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    height: 80dvh;
    padding: 0 2rem;
    scroll-behavior: smooth;
    align-items: center;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

/* Hide scrollbar completely */
.extra-scroll::-webkit-scrollbar {
    display: none;
}

.extra-image {
    height: 65dvh;
    width: auto;
    flex-shrink: 0;
    opacity: 0.85;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.extra-image:hover {
    opacity: 1;
}

.extra-back-container {
    height: 20dvh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-back-extra {
    max-width: 100px;
}

/* ---------- Commission horizontal scroll ---------- */

#commission-container {
    width: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.commission-scroll {
    display: flex;
    gap: 4rem; /* Extra space between commission groups */
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    height: 80dvh;
    padding: 0 20dvw;
    scroll-behavior: smooth;
    align-items: center;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.commission-scroll::-webkit-scrollbar {
    display: none;
}

.commission-group {
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
}

.commission-image {
    height: 65dvh;
    width: auto;
    flex-shrink: 0;
    opacity: 0.85;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.commission-image:hover {
    opacity: 1;
}

.commission-home-container {
    height: 20dvh;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding-left: 2rem;
}

.btn-home-commission {
    max-width: 100px;
}

/* ---------- Bio images (fixed, bottom-right) ---------- */

.bio-images-container {
    position: fixed;
    right: 2rem;
    bottom: 2rem;
    display: flex;
    justify-content: flex-end;
    z-index: 99;
    /* Keeps portraits above page content without blocking lightbox. */
}

.bio-images {
    display: flex;
    gap: 0.5rem;
}

.bio-me-image {
    width: auto;
    max-height: 150px;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.bio-me-image:hover {
    opacity: 1;
}
