/** @format */

/* Self-hosted Roboto Serif (variable, latin subset) — no third-party requests,
   no render-blocking @import. Downloaded from Google Fonts; see fonts/. */
@font-face {
    font-family: 'Roboto Serif';
    font-style: normal;
    font-weight: 100 900;
    font-stretch: 100%;
    font-display: swap;
    src: url('../fonts/roboto-serif-latin-var.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;
}

/* Self-hosted Caveat (handwritten title + notes on the film base). Caveat
   has no Vietnamese subset, so caption text is folded to ASCII in JS. */
@font-face {
    font-family: 'Caveat';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/caveat-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Caveat';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/caveat-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;
}

/* Reset default browser styles and set up box-sizing */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Set up basic styles for the entire document */
html, body {
    font-family: 'Roboto Serif', serif;
    font-weight: 400;
    background-color: #15120f; /* warm near-black mat */
    color: #efe9df;
    font-size: 16px;
    -ms-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

/* Film grain over the gallery + a soft vignette, for an analog feel.
   Scoped to .gallery so the About page stays clean. Grain is a real file
   (not a data: URI) so the strict CSP stays intact. */
body.gallery::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    background-image: url('../assets/grain.png');
    background-size: 128px 128px;
    mix-blend-mode: overlay;
    opacity: 0.28;
}
body.gallery::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9997;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 52%, rgba(0, 0, 0, 0.4) 100%);
}
/* No grain/vignette in zoom — the photo should be presented clean */
body.gallery.zoomed::before,
body.gallery.zoomed::after {
    opacity: 0;
}
/* Hide the first-run hint while zoomed */
body.zoomed .tip-container {
    opacity: 0;
    pointer-events: none;
}

/* Respect reduced-motion: instant slide changes, no spinner spin */
@media (prefers-reduced-motion: reduce) {
    .background-main,
    .header-area,
    .photo-counter,
    .background-main .content-wrapper,
    .tip-container { transition: none !important; }
    .background-main.loading::before { animation: none !important; }
}

/* Auto-hide chrome: fade header, caption, and counter when idle */
.header-area,
.photo-counter,
.background-main .content-wrapper {
    transition: opacity 0.6s ease;
}
body.idle .header-area,
body.idle .photo-counter {
    opacity: 0 !important;
    pointer-events: none;
}
/* In zoom view, keep the header/counter hidden regardless of idle state */
body.zoomed .header-area,
body.zoomed .photo-counter {
    opacity: 0 !important;
    pointer-events: none;
}

/* Clearfix utility class to clear floats */
.clearfix::after {
    content: '';
    display: block;
    clear: both;
    visibility: hidden;
    line-height: 0;
    height: 0;
}

.clearfix {
    display: inline-block;
}

/* Ensure clearfix works in older versions of Internet Explorer */
html[xmlns] .clearfix {
    display: block;
}

* html .clearfix {
    height: 1%;
}

/* Remove default list styles */
ul, ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Ensure proper display for semantic HTML5 elements */
header, nav, section, article, aside, footer {
    display: block;
}

/* Style links and their hover state */
a {
    text-decoration: none;
    color: #3cf;
    transition: color 0.3s ease;
}

a:hover {
    color: #fc3;
}

/* Remove default margins from headings */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
}

/* Set default paragraph styles */
p {
    font-size: 14px;
    line-height: 1.6;
}

/* Ensure images are responsive and don't overflow */
img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    background-color: black;
    display: block;
    overflow: hidden;
}

/* Header styles */
:root {
    --color-text: #fff;
    --color-header-bg: rgba(0, 0, 0, 0.5);
    /* Other CSS variables can be added here */
}

/* Style the header area with a gradient background */
.header-area {
    background: linear-gradient(to bottom, var(--color-header-bg), transparent);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 20px 40px;
    transition: opacity 0.6s ease;
}

/* Style the main navigation container */
.header-area .main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Style the logo in the header */
.header-area .main-nav .logo {
    color: var(--color-text);
    font-size: 19px;
    font-weight: 500;
    letter-spacing: 1px;
    opacity: 0.92;
    transition: opacity 0.3s ease;
}

/* Style the navigation menu */
.header-area .main-nav .nav {
    display: flex;
    align-items: center;
}

/* Style individual navigation items */
.header-area .main-nav .nav li {
    list-style-type: none;
    padding: 0;
    margin-left: 30px;
}

/* Style navigation links */
.header-area .main-nav .nav li a {
    color: var(--color-text);
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    transition: transform 0.5s ease, color 0.3s ease;
}

/* Responsive adjustment for smaller screens */
@media (max-width: 1200px) {
    .header-area .main-nav .nav li {
        padding: 0 7px;
    }
}

/* Style for main background sections */
.background-main {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.7s ease;
}

.background-main.is-current {
    opacity: 1;
    pointer-events: auto;
}

.background-main.fullscreen {
    z-index: 9999;
    opacity: 1;
    pointer-events: auto;
    background: #000; /* black letterbox behind the centered photo */
}
.background-main.fullscreen .print {
    transform: none !important;
    filter: none !important;
    clip-path: none !important;
    -webkit-clip-path: none !important;
    background: none;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
}

/* While the pop-out animation runs, don't let the print's torn clip / shadow
   crop the photo as it scales between the print and full screen. */
.background-main.flipping .print {
    clip-path: none !important;
    -webkit-clip-path: none !important;
    filter: none !important;
    overflow: visible;
}
.background-main.flipping:not(.fullscreen) .photo {
    position: relative;
    z-index: 10001;
}
.background-main.fullscreen .photo {
    /* Sized to the contained image (centered) rather than the whole viewport,
       so the pop-out FLIP scales uniformly (no momentary stretch on portraits).
       The section's black background provides the letterbox. */
    position: fixed;
    inset: 0;
    margin: auto;
    width: auto;
    height: auto;
    max-width: 100vw !important; /* beat any inline cap set by fitPrint() */
    max-height: 100vh !important;
    max-height: 100dvh !important;
    object-fit: contain;
    background: none;
    border-radius: 0;
}
.background-main.fullscreen .content-wrapper {
    display: none;
}

/* Instant-film print: the photo, then a white film base carrying the
   caption — one object, centered in the section. No will-change: it would
   make .print the containing block and break the fullscreen photo's fixed
   positioning. */
.print {
    position: relative;
    max-width: 92vw;
    background: #f5f0e6; /* JS overrides with seeded discoloration stains */
    padding: 16px 16px 0; /* even border on three sides; base supplies bottom */
    /* drop-shadow (not box-shadow) so the shadow follows the torn clip-path */
    filter: drop-shadow(0 22px 40px rgba(0, 0, 0, 0.5)) drop-shadow(0 5px 12px rgba(0, 0, 0, 0.4));
}

.photo {
    display: block;
    width: auto;
    height: auto;
    max-width: min(84vw, 2000px);
    max-height: 74vh;
    max-height: 74dvh; /* dvh accounts for the mobile browser toolbar */
    object-fit: contain;
    background: #2a2622;
}

/* Portrait photos on wide screens: caption beside the photo (uses the empty
   horizontal space, lets the photo run taller). Landscapes + mobile keep the
   caption below. */
@media (min-width: 769px) {
    .print.portrait {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 18px;
        padding: 16px;
    }
    .print.portrait .photo {
        max-height: 86vh;
        max-height: 86dvh;
    }
    .print.portrait .content-wrapper {
        flex: 0 0 300px;
        width: 300px;
        padding: 0 10px 0 2px;
    }
}

/* The film base — handwritten caption, width follows the photo */
.background-main .content-wrapper {
    padding: 15px 6px 17px;
    text-align: left;
}

.background-main .content-title {
    font-family: 'Caveat', 'Roboto Serif', serif;
    font-size: clamp(1.9rem, 3vw, 2.7rem);
    line-height: 0.95;
    color: #2b2620;
    margin-bottom: 2px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* Small printed-stamp line: date · location */
.background-main .content-meta {
    font-family: 'Roboto Serif', serif;
    font-size: clamp(0.58rem, 0.8vw, 0.7rem);
    color: rgba(43, 38, 32, 0.5);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 9px;
    font-weight: 600;
}

.background-main .content-desc {
    font-family: 'Caveat', 'Roboto Serif', serif;
    font-size: clamp(1.15rem, 1.5vw, 1.4rem);
    color: rgba(43, 38, 32, 0.82);
    line-height: 1.15;
    margin-bottom: 0;
    font-weight: 500;
    max-width: 46ch;
}

/* Styles for the About Us page */
.about-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 90px 20px 30px; /* top clears the fixed header */
    background-image: url('../photos/w2048/deyumeesh.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* Style the content area in the About Us page — frosted panel, fits the
   viewport (scrolls internally only if the screen is very short). */
.about-content {
    max-width: 600px;
    max-height: calc(100vh - 130px);
    max-height: calc(100dvh - 130px);
    overflow-y: auto;
    background: linear-gradient(135deg, rgba(15, 15, 18, 0.72), rgba(15, 15, 18, 0.55)) !important;
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 26px 30px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

/* Style headings and paragraphs in the About Us content */
.about-content h1 {
    font-size: clamp(1.2rem, 2.5vw, 1.7rem);
    margin-bottom: 12px;
    color: #ffffff !important;
    font-weight: 700;
    font-family: 'Roboto Serif', serif;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.about-content p {
    font-size: clamp(0.82rem, 1.15vw, 0.94rem);
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.92) !important;
    margin-bottom: 12px;
    font-family: 'Roboto Serif', serif;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
    font-weight: 400;
}

.about-content .signoff {
    margin-bottom: 0;
    font-weight: 500;
    color: #ffffff !important;
}

/* Responsive styles for smaller screens */
@media only screen and (max-width: 768px) {
    .about-container {
        padding: 78px 16px 24px;
        min-height: 100vh;
        min-height: 100dvh;
        align-items: center;
    }

    .about-content {
        padding: 20px 22px;
        width: 88%;
        max-width: 500px;
        max-height: calc(100vh - 110px);
        max-height: calc(100dvh - 110px);
    }

    .about-content h1 {
        font-size: clamp(1.1rem, 3vw, 1.4rem);
        margin-bottom: 10px;
    }

    .about-content p {
        font-size: clamp(0.82rem, 1.5vw, 0.9rem);
        margin-bottom: 10px;
    }
}

@media only screen and (max-width: 480px) {
    .about-container {
        padding: 66px 12px 18px;
    }

    .about-content {
        padding: 16px 18px;
        width: 92%;
        max-width: 430px;
        max-height: calc(100vh - 92px);
        max-height: calc(100dvh - 92px);
    }

    .about-content h1 {
        font-size: clamp(1rem, 3.6vw, 1.3rem);
        margin-bottom: 8px;
    }

    .about-content p {
        font-size: clamp(0.8rem, 1.8vw, 0.86rem);
        margin-bottom: 8px;
        line-height: 1.45;
    }
}

/* Ensure each section takes up the full viewport height */
section {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: relative;
}

/* Remove default body margins and prevent horizontal scrolling */
body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Set z-index for gallery container */
#gallery {
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    .header-area {
        padding: 10px 20px;
    }

    .header-area .main-nav .logo {
        font-size: 20px; /* Slightly smaller on mobile */
    }

    .header-area .main-nav .nav {
        display: flex; /* Always visible */
        align-items: center;
    }

    .header-area .main-nav .nav li {
        margin: 0;
        margin-left: 20px; /* Reduced spacing on mobile */
    }

    .header-area .main-nav .nav li a {
        font-size: 13px; /* Smaller font size for mobile */
    }

    .background-main .content-wrapper {
        padding: 12px 4px 14px;
    }

    .background-main .content-title {
        font-size: clamp(1.7rem, 7vw, 2.2rem);
        margin-bottom: 1px;
    }

    .background-main .content-meta {
        font-size: clamp(0.58rem, 2vw, 0.68rem);
        margin-bottom: 7px;
    }

    .background-main .content-desc {
        font-size: clamp(1.18rem, 4.4vw, 1.35rem);
    }
}

@media (max-width: 480px) {
    .header-area .main-nav .logo {
        font-size: 18px; /* Even smaller on very small screens */
    }

    .header-area .main-nav .nav li {
        margin-left: 15px; /* Even less spacing */
    }

    .header-area .main-nav .nav li a {
        font-size: 12px; /* Smaller font size for very small screens */
    }

    .background-main .content-title {
        font-size: clamp(1.55rem, 8.5vw, 1.95rem);
        margin-bottom: 1px;
    }

    .background-main .content-meta {
        font-size: clamp(0.56rem, 2.6vw, 0.66rem);
        margin-bottom: 6px;
    }

    .background-main .content-desc {
        font-size: clamp(1.12rem, 5vw, 1.25rem);
    }

    .background-main .content-wrapper {
        padding: 10px 4px 12px;
    }
}

.logo {
    display: flex;
    align-items: center; /* Aligns items vertically in the center */
    gap: 10px; /* Adds space between the image and the text */
    text-decoration: none;
    color: inherit;
}

.logo img {
    height: 26px;
    width: auto;
    background: transparent;
}

/* Tip container styles */
.tip-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    transition: all 0.5s cubic-bezier(0.22, 0.44, 0, 1);
    pointer-events: none;
}

.tip-content {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.3));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    opacity: 0.9;
    transition: all 0.3s ease;
}

.tip-icon {
    font-size: 16px;
    opacity: 0.8;
}

.tip-text {
    color: rgba(255, 255, 255, 0.9);
    font-family: 'Roboto Serif', serif;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Hide tip when scrolled */
.tip-container.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    pointer-events: none;
}

/* Hover effect for tip */
.tip-content:hover {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.4));
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

/* Responsive styles for tip */
@media (max-width: 768px) {
    .tip-container {
        bottom: 20px;
    }
    
    .tip-content {
        padding: 10px 16px;
        border-radius: 20px;
    }
    
    .tip-text {
        font-size: 12px; /* Reduced from 13px */
    }
    
    .tip-icon {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .tip-container {
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 30px);
        max-width: 280px; /* Reduced from 300px */
    }
    
    .tip-content {
        padding: 8px 14px;
        border-radius: 18px;
        justify-content: center;
    }
    
    .tip-text {
        font-size: 11px; /* Reduced from 12px */
        text-align: center;
    }
    
    .tip-icon {
        font-size: 13px;
    }
}

/* Phones: let the print use more of the screen, lighter mount */
@media (max-width: 768px) {
    .photo {
        max-width: 90vw;
        max-height: 64vh;
        max-height: 64dvh;
    }
    .print {
        max-width: 94vw;
        padding: 10px 10px 0;
    }
}

/* Loading spinner */
.background-main.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 3;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.background-main.loading .content-wrapper {
    opacity: 0 !important;
}

/* Fullscreen controls */
.fullscreen-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    pointer-events: none;
}

.fullscreen-controls button {
    pointer-events: auto;
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    border: none;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease, opacity 0.3s ease;
    font-family: sans-serif;
    backdrop-filter: blur(4px);
}

.fullscreen-controls button:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.fs-close {
    top: 24px;
    right: 24px;
    font-size: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.fs-prev,
.fs-next {
    top: 50%;
    transform: translateY(-50%);
    font-size: 44px;
    width: 48px;
    height: 72px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

.fullscreen:hover .fs-prev,
.fullscreen:hover .fs-next {
    opacity: 1;
}

.fs-prev {
    left: 16px;
}

.fs-next {
    right: 16px;
}

.fullscreen::after {
    display: none;
}

/* Photo counter */
.photo-counter {
    position: fixed;
    bottom: 26px;
    right: 30px;
    z-index: 1001;
    color: rgba(243, 239, 230, 0.45);
    font-family: ui-monospace, 'SF Mono', Menlo, Monaco, 'Courier New', monospace;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 2px;
    transition: opacity 0.3s ease;
}

/* Responsive styles for new features */
@media (max-width: 768px) {
    .photo-counter {
        bottom: 20px;
        right: 20px;
        font-size: 11px;
        padding: 5px 12px;
    }

    .fs-close {
        top: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .fs-prev,
    .fs-next {
        width: 40px;
        height: 60px;
        font-size: 36px;
    }

    .fs-prev { left: 8px; }
    .fs-next { right: 8px; }
}

@media (max-width: 480px) {
    .photo-counter {
        bottom: 15px;
        right: 15px;
        font-size: 10px;
        padding: 4px 10px;
    }
}