:root {
    --bg-color: #050505;
    --text-color: #ffffff;
    --accent-color: #f0f0f0;
    --font-main: 'Roboto', sans-serif;
    --transition-speed: 0.6s;
    --easing: cubic-bezier(0.23, 1, 0.32, 1);
    --slate-bg: rgba(47,55,64,0.96);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    border-radius: 0; /* remove all rounded corners site-wide */
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
}

#app {
    position: relative;
    width: 100vw;
    height: 100vh;
}

/* Scroll Container */
#viewport {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    cursor: crosshair;
}

.parallax-layer {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    will-change: transform;
    display: flex;
    align-items: center;
}

#parallax-bg {
    z-index: 1;
    width: 400%; /* Wider for slower parallax */
    background-image: url('/bg_pattern.png');
    background-repeat: repeat;
    opacity: 0.2;
}

#content-reel {
    z-index: 2;
    padding: 0 5vw;
    gap: 0; /* Gapless for full-width feel as requested */
}

#foreground-labels {
    z-index: 3;
    pointer-events: none; /* keep default - container non-interactive, buttons inside will override */
}

/* Project page shell */
#project-page {
    z-index: 40;
    inset: 0;
    display: block;
    align-items: stretch;
    justify-content: flex-start;
    /* use solid canvas to fully occlude the main portfolio beneath */
    background: var(--bg-color);
    pointer-events: auto;
}

/* When a project is open, hide the main portfolio layers so they are not visible behind project pages */
.project-open #content-reel,
.project-open #parallax-bg,
.project-open #foreground-labels {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

#project-page.hidden {
    display: none;
}

#project-reel {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    display: block;
    z-index: 41;
    will-change: transform;
}

/* Back button (matches menu toggle visual using two bars) */
.project-back {
    position: fixed;
    top: 22px;
    left: 22px;
    z-index: 60;
    background: none;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 0;
}

/* ensure bars inside project-back use the same visual style as the menu toggle (slate gray by default) */
.project-back .bar {
    width: 100%;
    height: 2px;
    background: #9aa0a6; /* slate gray for close X */
    transition: background 0.18s ease, transform 0.3s;
}

/* Menu toggle default (inactive) uses slate gray; when open the bars become white for contrast */
#menu-toggle .bar {
    background: #9aa0a6;
}
#menu-toggle.open .bar {
    background: white;
}

/* Also ensure the project-back shows white when marked open (keeps visual parity with menu state) */
.project-back.open .bar {
    background: white;
}

/* Project detail slide */
.slide {
    position: absolute;
    top: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-detail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Video slide container: full-bleed, centered, iframe covers the slide */
.project-video {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
    position: relative;
    overflow: hidden;
}
.project-video-iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 177.77vh; /* 16:9 fallback scaled large to cover */
    height: 100vh;
    transform: translate(-50%, -50%);
    border: 0;
    max-width: none;
    max-height: none;
    /* Do not block pointer events so swipe/scroll gestures work over the video panel */
    pointer-events: none;
}

/* If explicit user interaction is desired (e.g. tap to enable), add .interactive to the .project-video container:
   .project-video.interactive .project-video-iframe { pointer-events: auto; } */
.project-video.interactive .project-video-iframe {
    pointer-events: auto;
}

/* Slate interrupting sections */
.project-slate {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--slate-bg);
    color: var(--text-color);
    padding: 6vh 8vw;
    box-sizing: border-box;
}

.project-slate-inner {
    max-width: 60ch;
}

.project-slate h3 {
    margin: 0 0 0.6rem 0;
    font-size: 1.15rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 900;
}

.project-slate p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
    opacity: 0.95;
}

/* Overlay labels inside project page */
#project-overlay-labels {
    z-index: 50;
    pointer-events: none;
}

.project-detail-label {
    position: absolute;
    bottom: 8vh;
    z-index: 52;
    pointer-events: auto;
}

.project-detail-title {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.9);
    font-weight: 900;
    font-size: clamp(2rem, 6vw, 4rem);
    cursor: pointer;
}

/* Ensure project overlay and title buttons are interactive despite parent pointer-events:none */
.project-overlay {
    pointer-events: auto;
}

.project-title {
    background: transparent;
    border: none;
    color: #ffffff;
    font-family: var(--font-main);
    text-align: left;
    padding: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Project Item */
.project-item {
    position: relative;
    height: 100vh;
    width: 100vw;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.2s var(--easing);
}

.project-item:hover .project-image {
    transform: scale(1.05);
}

.project-overlay {
    position: absolute;
    bottom: 10vh;
    left: 5vw;
    text-align: left;
    z-index: 4;
}

.project-title {
    font-size: clamp(3rem, 12vw, 10rem);
    font-weight: 900;
    letter-spacing: -0.05em;
    line-height: 0.85;
    text-transform: uppercase;
    margin: 0;
    opacity: 0;
    transform: translateY(30px);
    color: #ffffff;
}

/* Private lock badge shown on items that are marked private/secured.
   Badge is added dynamically by JS when project is in secured list or has private flag. */
.project-item .private-badge {
    position: absolute;
    top: 18vh;
    right: 5vw;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.06);
    padding: 8px 10px;
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.95);
    z-index: 10;
    pointer-events: none;
}

/* small lock icon inside badge */
.project-item .private-badge svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    opacity: 0.95;
}

/* on mobile adjust badge to top-right corner and increase touch spacing (visual only) */
@media (max-width: 768px) {
    .project-item .private-badge {
        top: 12vh;
        right: 4vw;
        padding: 10px 12px;
        font-size: 0.95rem;
    }
}

/* Project description overlay (semi-transparent dark slate grey) */
.project-desc {
    position: absolute;
    /* anchor left edge to match project image left padding (container uses 5vw) */
    top: 18vh;
    bottom: 18vh;
    left: 5vw;
    /* fixed width so it sits to the left side of the image */
    width: 42vw;
    background: rgba(47, 55, 64, 0.5);
    color: var(--text-color);
    /* add extra bottom padding so the share-bar can sit inside the popup without overlapping the scrollable text */
    padding: 2.2rem 2rem 5.2rem 2rem;
    border-radius: 0;
    z-index: 6;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.45s var(--easing), transform 0.45s var(--easing);
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* anchor content at top for predictable layout */
    align-items: flex-start; /* left-align children */
    text-align: left; /* ensure inline text is left aligned */
    backdrop-filter: blur(6px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);

    /* keep container non-scrolling so global gestures & layout remain stable */
    max-height: calc(100vh - 36vh); /* respects top/bottom insets while leaving room for share-bar and safe area */
    overflow: visible;
}

/* Make only the description text itself scrollable so the popup frame remains fixed.
   The desc-text class is applied to the paragraph inside the overlay. */
.project-desc .desc-text {
    display: block;
    margin-top: 0.3rem;
    /* Make the text area occupy the top 75% of the popup box so it ends above the share bar */
    max-height: calc(75% - 120px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 8px; /* avoid text clipping under scrollbar */
}

/* Share bar inside project popup: place at the bottom-right inside the popup so it doesn't overlap the scrollable text */
.share-bar {
    position: absolute;
    right: 1.6rem; /* padded from the right wall of the cell */
    bottom: 1.6rem; /* sit near the popup bottom so it no longer overlaps the desc-text area */
    display: flex;
    gap: 12px; /* added more spacing between icons for clarity */
    align-items: center;
    justify-content: flex-end; /* align icons to the right edge of the bar */
    pointer-events: auto;
    z-index: 12; /* ensure share buttons sit above desc content and are easily tappable */
}

/* Allow taps and clicks on essential interactive elements inside the description overlay
   while leaving the overlay container itself pointer-events: none so swipe gestures pass through. */
.project-desc .project-link,
.project-desc .share-bar,
.project-desc .share-btn,
.project-desc h3,
.project-desc p {
    pointer-events: auto;
    -webkit-tap-highlight-color: rgba(255,255,255,0.03);
}

/* Generic share button: smaller, mostly transparent white icons */
.share-btn {
    width: 19px; /* half size */
    height: 19px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.02); /* even more transparent */
    border: 1px solid rgba(255,255,255,0.03);
    color: rgba(255,255,255,0.92); /* slightly transparent white */
    cursor: pointer;
    transition: background 0.12s, transform 0.08s;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
    box-sizing: border-box;
}
.share-btn:hover {
    background: rgba(255,255,255,0.04);
    transform: translateY(-2px);
}

/* SVG icons inside share buttons inherit white color */
.share-btn svg { width: 14px; height: 14px; fill: currentColor; display: block; opacity: 0.95; }

/* Small label for accessibility (visually hidden) */
.sr-only { 
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Mobile: keep share bar compact inside the adjusted wider popup */
@media (max-width: 768px) {
    .project-desc {
        top: 16vh;
        bottom: 4vh;
        left: 4vw;
        right: 4vw;
        width: auto;
        /* add extra bottom padding so the share bar can sit below text without overlapping */
        padding: 1.2rem 1rem 5.2rem 1rem;
        border-radius: 0;
        justify-content: flex-start;
        align-items: flex-start;
        text-align: left;
    }
    /* On mobile make the share bar participate in layout (flow below text) instead of absolute positioning */
    .share-bar {
        position: relative;
        gap: 10px;
        margin-top: 0.6rem;
        justify-content: flex-end;
        right: auto;
        bottom: auto;
        left: auto;
    }
    .share-btn { width: 36px; height: 36px; }
}

/* Visible state (applied via JS) */
.project-desc.visible {
    opacity: 1;
    transform: translateY(0);
    /* keep overlay visually interactive but allow global gestures by leaving pointer-events on the container disabled;
       individual interactive children (links, share bar, buttons, text) are enabled below so taps still work. */
}

/* Desc content styling */
.project-desc h3 {
    margin: 0 0 0.6rem 0;
    font-size: 1.05rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 900;
}

.project-desc p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.4;
    opacity: 0.95;
}

/* Link moved to the upper-right of the popup so it doesn't interfere with vertical scrolling */
.project-desc { position: absolute; } /* ensure positioned ancestor for absolute link */

.project-desc .project-link {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-block;
    background: transparent;
    color: rgba(255,255,255,0.96);
    padding: 6px 10px;
    border: none;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 4px;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    box-shadow: none;
    text-align: right;
    align-self: auto;
    z-index: 10;
}

/* ensure on narrow screens the link remains reachable and doesn't overlap critical content */
@media (max-width: 768px) {
    .project-desc .project-link {
        top: 10px;
        right: 10px;
        padding: 8px 10px;
        font-size: 0.95rem;
    }
}

/* Touch-friendly: allow tap to toggle */
@media (hover: none) {
    /* On touch devices keep the description left-aligned but more spacious */
    .project-desc {
        top: 16vh;
        bottom: 4vh;
        left: 4vw;
        right: 4vw;
        width: auto;
        padding: 1.2rem 1rem;
    }
}

/* Menu Toggle */
#menu-toggle {
    position: fixed;
    top: 40px;
    right: 40px;
    z-index: 100;
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

/* global control bar default: slate gray for inactive state */
.bar {
    width: 100%;
    height: 2px;
    background: #9aa0a6; /* slate gray default for controls */
    transition: background 0.18s ease, transform 0.3s;
}

/* menu toggle-specific overrides: keep slate when closed, switch to white when open */
#menu-toggle .bar {
    background: #9aa0a6;
}
#menu-toggle.open .bar {
    background: white;
}

#menu-toggle.open .bar:nth-child(1),
.project-back.open .bar:nth-child(1) { transform: translateY(5px) rotate(45deg); }
#menu-toggle.open .bar:nth-child(2),
.project-back.open .bar:nth-child(2) { transform: translateY(-5px) rotate(-45deg); }

/* Overlay Menu */
#overlay-menu {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.98);
    z-index: 90;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s var(--easing), visibility 0.5s;
}

#overlay-menu.visible {
    opacity: 1;
    visibility: visible;
}

.menu-content {
    width: 100%;
    max-width: 1200px;
    /* Occupy full height and distribute logo/categories and footer evenly */
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    padding: 5vh 5vw; /* balanced vertical padding so categories sit centered between logo and footer */
    position: relative; /* ensure this content stacks above the canvas */
    z-index: 95;
}

/* Menu background canvas for Three.js */
#menu-bg-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 88; /* below .menu-content (90) but above overlay root so it's behind content */
    pointer-events: none;
    display: block;
    /* pixelated effect when rendered at low resolution and scaled up */
    image-rendering: pixelated;
    background: #000; /* ensure black environment */
}

/* Logo at top of menu: intentionally larger (~2x) than .cat-btn */
.menu-logo {
    color: white;
    font-weight: 900;
    font-family: var(--font-main);
    text-transform: uppercase;
    /* ~double the visible size of menu items (cat-btn uses clamp starting around 2.4rem) */
    font-size: clamp(4.8rem, 15vw, 11.2rem);
    line-height: 0.85;
    margin-bottom: 12px;
    letter-spacing: -0.04em;
    align-self: flex-start;
    user-select: none;
    pointer-events: none;
}

/* Category list stacked tightly (couched) with minimal line-height and no gaps */
.category-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    margin: 0;
    padding: 0;
    margin-bottom: 12px; /* small spacing so categories don't visually butt into footer/form */
}

/* Tight leading: remove extra padding/margins so each button sits flush to the next */
.cat-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.28);
    font-family: var(--font-main);
    font-size: clamp(2.4rem, 7.5vw, 5.6rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    cursor: pointer;
    transition: color 0.22s, transform 0.22s;
    text-align: left;
    margin: 0;
    padding: 0;
    line-height: 0.88; /* tightened leading */
    display: block;
}

/* Keep hover transform but reduced offset so items remain visually tight */
.cat-btn:hover, .cat-btn.active {
    color: white;
    transform: translateX(12px);
}

/* Menu footer now holds a horizontal contact form aligned to the left and copyright to the right */
.menu-footer {
    margin-top: 28px;
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
}

/* Contact form: compact horizontal layout */
.contact-form {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* New short message input placed between email and send */
.contact-message {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    color: white;
    padding: 10px 12px;
    border-radius: 0;
    font-size: 0.95rem;
    min-width: 320px; /* increased width for a more comfortable message area */
    outline: none;
    transition: border-color 0.18s, background 0.18s;
}

.contact-input {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    color: white;
    padding: 10px 14px;
    border-radius: 0;
    font-size: 0.95rem;
    min-width: 260px;
    outline: none;
    transition: border-color 0.18s, background 0.18s;
}

/* remove native focus outlines and shadows for form fields and buttons to keep visual style consistent */
input:focus, textarea:focus, button:focus, .contact-input:focus, .contact-message:focus, .contact-submit:focus, .cat-btn:focus {
    outline: none;
    box-shadow: none;
}

.contact-input::placeholder { color: rgba(255,255,255,0.35); }

.contact-submit {
    background: rgba(255,255,255,0.9);
    color: var(--bg-color);
    border: none;
    padding: 9px 14px;
    border-radius: 0;
    font-weight: 800;
    cursor: pointer;
    font-size: 0.9rem;
    letter-spacing: 0.06em;
    transition: transform 0.12s ease;
}

/* Group small discreet actions next to client login */
.client-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* tiny secondary action buttons (Terms / Disclaimer) */
.client-action {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.56);
    padding: 6px 8px;
    font-size: 0.78rem;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.14s, transform 0.12s;
    border-radius: 0;
}
.client-action:hover {
    opacity: 1;
    transform: translateY(-2px);
}

/* Discreet client login button for private presentations */
.client-login {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.65);
    padding: 8px 10px;
    font-size: 0.85rem;
    text-transform: none;
    cursor: pointer;
    margin-left: 6px;
    align-self: center;
    opacity: 0.78;
    transition: opacity 0.18s, transform 0.12s;
    border-radius: 0;
}
.client-login:hover {
    opacity: 1;
    transform: translateY(-2px);
}

/* Menu popup base styles - centered large overlays that scroll internally */
.menu-popup {
    position: fixed;
    inset: 8vh 8vw;
    display: none;
    z-index: 160;
    background: rgba(10,12,14,0.96);
    color: var(--text-color);
    border: 1px solid rgba(255,255,255,0.04);
    box-shadow: 0 30px 80px rgba(0,0,0,0.7);
    border-radius: 6px;
    /* allow the close button to sit visually above the popup content so it remains visible and tappable on small screens */
    overflow: visible;
    max-width: 1100px;
    margin: 0 auto;
}

/* visible state toggled by JS */
.menu-popup.visible {
    display: block;
    animation: popupIn 240ms var(--easing);
}

/* close button placed top-right inside the centered overlay */
.menu-popup .popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    /* match the same X size used across the UI for consistency */
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    cursor: pointer;
    z-index: 220; /* higher than popup content so it is never covered */
    -webkit-tap-highlight-color: transparent;
}
.menu-popup .popup-close .bar {
    /* center the two bars precisely inside the close button so the X is always fully visible */
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px; /* consistent visible X size across the UI */
    height: 2px;
    background: white;
    transform-origin: center;
    transform: translate(-50%, -50%); /* center without rotation by default */
    transition: 0.18s;
    pointer-events: none; /* ensure clicks hit the button, not the bars */
}
/* rotate each centered bar to form a perfect X */
.menu-popup .popup-close .bar:nth-child(1) { transform: translate(-50%, -50%) rotate(45deg); }
.menu-popup .popup-close .bar:nth-child(2) { transform: translate(-50%, -50%) rotate(-45deg); }

/* content area fills the overlay and becomes scrollable */
.menu-popup-content {
    padding: 40px 36px 28px 36px;
    box-sizing: border-box;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* body area is the scrollable region for long legal text */
.menu-popup-body {
    margin-top: 16px;
    overflow: auto;
    padding-right: 12px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.92);
    -webkit-overflow-scrolling: touch;
}

/* heading inside the overlay */
.menu-popup-content h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* subtle entrance */
@keyframes popupIn {
    from { transform: translateY(12px) scale(0.995); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* mobile adjustments: make the overlay full-bleed-ish and taller for reading */
@media (max-width: 768px) {
    .menu-popup {
        inset: 6vh 3vw;
        border-radius: 4px;
        max-width: none;
    }
    .menu-popup-content {
        padding: 20px;
    }
    .menu-popup-body {
        font-size: 0.96rem;
        line-height: 1.6;
    }
}

.contact-submit:active { transform: translateY(1px); }

.contact-meta {
    margin-left: 8px;
}

.contact-meta p {
    margin: 0;
    font-size: 0.75rem;
    opacity: 0.5;
}

/* Slight mobile tweaks to keep form compact */
@media (max-width: 768px) {
    .menu-content { padding-bottom: 4vh; }
    .cat-btn { font-size: 3rem; line-height: 0.92; }

    /* Stack the contact form on mobile for touch friendliness */
    .contact-form {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
    }

    .contact-input {
        min-width: 100%;
        padding: 8px 10px;
    }

    .contact-message {
        min-width: 100%;
        padding: 8px 10px;
        height: 48px; /* slightly larger touch target for message */
    }

    .contact-submit {
        width: auto;
        align-self: flex-start;
        padding: 10px 16px;
    }

    /* Move copyright under the form when stacked */
    .contact-meta {
        margin-left: 0;
        margin-top: 6px;
    }
}

/* Indicators - arm removed: only subtle indicators remain without the horizontal line */
.scroll-indicator {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 0; /* remove the horizontal arm */
    background: transparent; /* no visible line */
    opacity: 0.0;
    pointer-events: none;
    transition: opacity 0.3s, width 0.3s;
    z-index: 50;
}

.scroll-indicator.left { left: 37.5vw; }
.scroll-indicator.right { right: 37.5vw; }

/* No pseudo-element arrows or arms */
.scroll-indicator::before,
.scroll-indicator::after {
    content: none;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    /* Reduce overall vertical padding to free space for the compact category area */
    .menu-content { padding: 4vh 4vw 4vh; gap: 8px; }

    /* Reduce logo size a bit and shrink its bottom margin */
    .menu-logo { font-size: clamp(2.4rem, 10vw, 4.2rem); margin-bottom: 6px; }

    /* Make the category list compact and constrain it to roughly half the viewport height */
    /* keep categories tightly stacked on mobile and remove scrolling */
    .category-list { gap: 0; width: 100%; max-height: none; overflow: visible; -webkit-overflow-scrolling: auto; padding-right: 6px; }

    /* Halve the category button size and tighten spacing so the list takes ~half the vertical space */
    .cat-btn { font-size: 1.6rem; line-height: 0.92; padding: 4px 0; width: 100%; text-align: left; color: rgba(255,255,255,0.28); }

    /* Slight hover/active translate remains but reduced so items don't crowd */
    .cat-btn:hover, .cat-btn.active { transform: translateX(6px); color: white; }

    /* Stack and space footer elements vertically for touch, but keep them compact */
    .menu-footer {
        margin-top: 12px;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
    }

    /* Stack the contact form on mobile for touch friendliness */
    .contact-form {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        width: 100%;
    }

    .contact-input {
        min-width: 100%;
        padding: 8px 10px;
    }

    .contact-message {
        min-width: 100%;
        padding: 8px 10px;
        height: 48px; /* slightly larger touch target for message */
    }

    .contact-submit {
        width: 100%;
        padding: 10px;
        align-self: stretch;
    }

    /* Move copyright under the form when stacked and make it subtle */
    .contact-meta {
        margin-left: 0;
        margin-top: 6px;
        text-align: left;
    }

    /* Make the project description wider on mobile but keep the frame fixed and let only the text scroll.
       This prevents the title/share bar from being pushed off-screen while allowing long copy to be scrolled. */
    .project-desc {
        width: 84vw;
        left: 3vw;
        right: auto;
        top: 12vh;            /* move slightly higher to free bottom space */
        bottom: 12vh;         /* increase bottom inset so box doesn't extend off-screen */
        /* add extra bottom padding to keep content above the share bar */
        padding: 0.9rem 0.9rem 5.2rem 0.9rem;
        max-height: calc(100vh - 24vh); /* ensure it never exceeds available viewport */
        overflow: visible;
    }

    .project-desc .desc-text {
        display: block;
        margin-top: 0.3rem;
        /* Mobile: make the text area end at ~3/4 of the popup so the share bar sits below it */
        max-height: calc(75% - 100px);
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        padding-right: 8px;
    }

    /* Slight tweak: slate sections occupy full width on mobile and their inner content can scroll if long */
    .project-slate-inner { padding: 0 1rem; max-width: none; overflow: auto; max-height: calc(100vh - 20vh); -webkit-overflow-scrolling: touch; }

    /* 4-up grid style for project slides (contact-sheet / detail grid)
       Updated: make the grid full-bleed within the slide, 2x2, no gaps so each cell touches edges. */
    .project-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(2, 1fr);
        gap: 0; /* edge-to-edge */
        width: 100%;        /* fill the slide width */
        max-width: none;
        height: 100%;       /* fill the slide height */
        margin: 0;
        box-sizing: border-box;
        align-items: stretch;
        justify-items: stretch;
        background: transparent;
    }
    .project-grid-cell {
        overflow: hidden;
        display: block;
        width: 100%;
        height: 100%;
        background: #000;
    }
    .project-grid-cell img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        transition: transform 0.6s var(--easing);
    }
    .project-grid-cell:hover img { transform: scale(1.04); }

    .project-grid-caption {
        text-align: center;
        color: rgba(255,255,255,0.9);
        margin-top: 12px;
        font-weight: 700;
        letter-spacing: 0.06em;
        font-size: 0.95rem;
    }

    @media (max-width: 768px) {
        /* on small screens keep full-bleed but constrain the overall slide paddings via existing slide styles */
        .project-grid {
            width: 100%;
            height: 100%;
            gap: 4px; /* tiny gutter to avoid UI feel of perfectly touching pixels on some devices */
        }
        .project-grid-caption { font-size: 0.95rem; margin-top: 10px; }
    }

    /* Make popup overlays feel roomier on small screens */
    .menu-popup {
        inset: 6vh 4vw;
        border-radius: 6px;
    }
    .menu-popup-content { padding: 18px; }
    .menu-popup-body { font-size: 0.96rem; padding-right: 8px; }

    /* Improve spacing for client action buttons */
    .client-actions { gap: 10px; flex-wrap: wrap; }

    /* Slightly adjust menu toggle and project overlay positions for small screens */
    #menu-toggle { top: 18px; right: 18px; }

    /* ensure project title overlay has extra bottom space and doesn't overlap the description;
       also ensure it can reflow if label size changes */
    .project-overlay { bottom: 12vh; left: 4vw; max-width: 86vw; }

    /* if title buttons are large, allow them to wrap and stay visible */
    .project-title { white-space: normal; line-height: 0.9; }
}

/* Desktop: place share-bar beneath the large project title inside the description box
   while keeping the existing mobile behavior (absolute/bottom positioning) unchanged. */
@media (min-width: 769px) {
    /* ensure the description box stacks content top-to-bottom */
    .project-desc {
        display: flex;
        flex-direction: column;
    }

    /* Put share-bar back into document flow and right-align it under the heading */
    .share-bar {
        position: relative;
        right: auto;
        bottom: auto;
        margin-top: 0.6rem;
        gap: 12px;
        justify-content: flex-end;
        align-self: flex-end; /* align the bar to the right edge of the popup */
        pointer-events: auto;
        z-index: 12;
    }

    /* slightly larger desktop icon for clarity */
    .share-btn {
        width: 22px;
        height: 22px;
    }

    /* keep the project link positioned at the top-right as before */
    .project-desc .project-link {
        top: 12px;
        right: 12px;
    }

    /* Desktop 2x2 contact-sheet grid: same 4-up layout used on mobile but available for wider viewports too */
    .project-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(2, 1fr);
        gap: 0; /* edge-to-edge */
        width: 100%;        /* fill the slide width */
        max-width: none;
        height: 100%;       /* fill the slide height */
        margin: 0;
        box-sizing: border-box;
        align-items: stretch;
        justify-items: stretch;
        background: transparent;
    }
    .project-grid-cell {
        overflow: hidden;
        display: block;
        width: 100%;
        height: 100%;
        background: #000;
    }
    .project-grid-cell img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        transition: transform 0.6s var(--easing);
    }
    .project-grid-cell:hover img { transform: scale(1.04); }

    .project-grid-caption {
        text-align: center;
        color: rgba(255,255,255,0.9);
        margin-top: 12px;
        font-weight: 700;
        letter-spacing: 0.06em;
        font-size: 0.95rem;
    }
}