/* Princess Zeina Theme — Custom CSS
   Works alongside Tailwind CDN.
   Uses CSS custom properties driven by the customizer theme color.
*/

/* ── Local Fonts ───────────────────────────────────────────────────────────── */
@font-face {
    font-family: 'Glacial Indifference';
    src: url('../fonts/GlacialIndifference-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* ── Reset / Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--heading-font, 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif);
}

body {
    font-family: var(--body-font, 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif);
    background: #ffffff;
    color: #000000;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

/* ── Custom Logo sizing ────────────────────────────────────────────────────── */
/* WordPress outputs .custom-logo-link > .custom-logo — neutralise auto-margin centering */
.custom-logo-link {
    display: flex;
    align-items: center;
    margin: 0 !important;   /* override WP/browser defaults that shift it right */
    padding: 0;
    line-height: 0;
}
.custom-logo {
    max-height: 48px;
    width: auto;
    display: block;
}

/* ── Footer title ──────────────────────────────────────────────────────────── */
.pz-footer-title {
    font-family: 'Glacial Indifference', var(--heading-font, sans-serif);
}

/* ── Pagination ────────────────────────────────────────────────────────────── */
.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-links .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    font-size: 0.875rem;
    color: #374151;
    border: 1px solid #e5e7eb;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.nav-links .page-numbers:hover {
    background: var(--theme-color);
    color: #ffffff;
    border-color: var(--theme-color);
}

.nav-links .page-numbers.current {
    background: var(--theme-color);
    color: #ffffff;
    border-color: var(--theme-color);
    pointer-events: none;
}

.nav-links .page-numbers.dots {
    border: none;
    background: transparent;
    pointer-events: none;
    color: #9ca3af;
}

/* ── Prose overrides ───────────────────────────────────────────────────────── */
.prose a         { color: var(--theme-color); text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover   { opacity: 0.7; }
.prose h2, .prose h3 { font-weight: 700; letter-spacing: -0.03em; }

/* ── Contact Form 7 overrides ─────────────────────────────────────────────── */
.wpcf7-form .wpcf7-text,
.wpcf7-form .wpcf7-email,
.wpcf7-form .wpcf7-textarea,
.wpcf7-form select {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 2px;
    padding: 12px 16px;
    font-size: 0.875rem;
    font-family: inherit;
    color: #111827;
    background: #ffffff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.wpcf7-form .wpcf7-text:focus,
.wpcf7-form .wpcf7-email:focus,
.wpcf7-form .wpcf7-textarea:focus {
    border-color: var(--theme-color);
    box-shadow: 0 0 0 1px var(--theme-color);
}

.wpcf7-form .wpcf7-submit {
    background: var(--theme-color);
    color: #ffffff;
    border: none;
    padding: 12px 32px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s;
}

.wpcf7-form .wpcf7-submit:hover { opacity: 0.8; }

.wpcf7-not-valid-tip { font-size: 0.75rem; color: #ef4444; margin-top: 4px; }
.wpcf7-response-output { margin-top: 16px; padding: 12px 16px; font-size: 0.875rem; border: 1px solid #e5e7eb; }

/* ── Gallery carousel (full-screen) ───────────────────────────────────────── */
#pz-gallery-carousel {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* ── Fancybox overrides ────────────────────────────────────────────────────── */
:root {
    --f-button-color: #ffffff;
    --f-button-bg: rgba(0,0,0,0.4);
    --f-button-hover-bg: rgba(0,0,0,0.6);
}

/* ── Header / nav ──────────────────────────────────────────────────────────── */
#site-header {
    border-bottom: 1px solid #f3f4f6;
}

/* ── Sections spacing ──────────────────────────────────────────────────────── */
.pz-section { position: relative; }

/* ── Grid gap trick (0.5px gap via bg on parent) ──────────────────────────── */
#pz-artworks-grid { gap: 1px; }

/* ── Hero section — full viewport on mobile, cinematic ratio on desktop ───── */
.pz-hero {
    height: 100svh; /* mobile: fill the viewport */
}
@media (min-width: 768px) {
    .pz-hero {
        height: auto;
        aspect-ratio: 2.35 / 1;
    }
}


/* ── Artwork row grid ─────────────────────────────────────────────────────────
 *
 * True CSS Grid (not masonry): items always pair up into rows, two per row.
 * align-items: center vertically centers each item against the tallest
 * image in its row, instead of letting items pack into whichever column
 * has space (which is what produced the irregular masonry look).
 *
 * Breakpoints
 * ───────────
 *   mobile   (default / < 640px)  : 1 column
 *   desktop  (≥ 640px)            : 2 columns, side by side, in rows
 *
 * Reveal animation
 * ────────────────
 * Items start opacity:0 + translateY(28px).
 * IntersectionObserver adds .is-animating (enables transition) then .is-visible.
 * .is-animating is removed on transitionend to prevent retrigger on reflow.
 */
#artworks-grid {
    display: grid;
    grid-template-columns: 1fr; /* mobile: 1 column */
    align-items: center;        /* vertically center each item within its row */
    column-gap: 40px;
    row-gap: 20px;
}

@media (min-width: 640px) {
    #artworks-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns, side by side */
    }
}

.artwork-item {
    padding: 20px;
    /* Initial hidden state for reveal animation */
    opacity: 0;
    transform: translateY(28px);
}

@media (min-width: 640px) {
    .artwork-item {
        padding: 144px;
    }
}

/* Step 1: enable the CSS transition (class added by IntersectionObserver) */
.artwork-item.is-animating {
    transition: opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Step 2: animate to fully visible */
.artwork-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}


/* ── Artwork full-screen overlay ─────────────────────────────────────────────
 *
 * Triggered when a visitor clicks an artwork on the archive grid.
 * The overlay fades in and displays the image centred with title +
 * description beneath it, while the browser URL updates to the
 * single-artwork permalink via history.pushState.
 */

/* Prevent body scroll while overlay is open */
body.pz-overlay-open {
    overflow: hidden;
}

/* Backdrop */
#artwork-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #ffffff;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#artwork-overlay.is-open {
    opacity: 1;
    pointer-events: all;
}

/* Close button — fixed to viewport top-right */
#artwork-overlay-close {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    padding: 0;
    transition: color 0.15s;
}

#artwork-overlay-close:hover {
    color: #000000;
}

/* Scrollable inner layer — takes full overlay area */
#artwork-overlay-scroll {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    padding: 80px 24px 72px;
}

/* Content card — centred column */
#artwork-overlay-content {
    width: 100%;
    max-width: 860px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Image wrapper — loading spinner sits here while image loads */
#artwork-overlay-img-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 180px;
}

/* The artwork image */
#artwork-overlay-img {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
    opacity: 0; /* faded in by JS once loaded */
    display: block;
}

/* Loading spinner */
#artwork-overlay-spinner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.12);
    border-top-color: rgba(0, 0, 0, 0.6);
    animation: pz-overlay-spin 0.75s linear infinite;
}

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

/* Text block beneath the image */
#artwork-overlay-text {
    margin-top: 32px;
    text-align: center;
    color: #000000;
    max-width: 620px;
    width: 100%;
    opacity: 0; /* faded in by JS after content loads */
}

#artwork-overlay-title {
    font-family: var(--heading-font, inherit);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 14px;
}

#artwork-overlay-body {
    font-size: 0.875rem;
    line-height: 1.8;
    color: rgba(0, 0, 0, 0.6);
}

#artwork-overlay-body a {
    color: #000000;
    text-decoration: underline;
    text-underline-offset: 3px;
}
