/* The Universal Compass — silent gallery on stone.
   Layout: 1 full + 4 quartet + 2 full. Stone background. */

:root {
    --ink: #1f1a14;
    --ink-soft: #4a3f30;
    --rule: #6a5d3a;
    --cell-gap: 6px;
    --section-gap: clamp(56px, 8vh, 96px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: #1a1612; }
body {
    color: var(--ink);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    min-height: 100vh;
    background: transparent;
}

/* Cinematic scroll-driven background — fixed full-bleed, scrollY% drives frame */
#bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: -2;
    display: none;            /* shown by JS once first frames load */
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    will-change: contents;
    /* Dim the granite so content reads cleanly and motion is subtle */
    filter: brightness(0.5) contrast(0.95) saturate(0.9);
}

/* Soft veil + edge vignette */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 100% 80% at 50% 50%,
            rgba(0,0,0,0.25) 0%,
            rgba(0,0,0,0.55) 100%);
    z-index: -1;
}

header, main, footer { position: relative; z-index: 1; }

/* ====== Header ====== */
header {
    text-align: center;
    padding: clamp(72px, 12vh, 140px) 24px clamp(48px, 8vh, 96px);
}
h1 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 500;
    font-size: clamp(24px, 2.6vw, 32px);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    line-height: 1.4;
    color: #f0c860;
    /* Soft dark shadow under the gold for legibility on stone */
    text-shadow:
        0 1px 0 rgba(255, 240, 190, 0.25),
        0 2px 4px rgba(20, 10, 2, 0.6),
        0 0 12px rgba(240, 200, 96, 0.18);
}
.rule {
    display: block;
    width: 90px;
    height: 1px;
    background: var(--rule);
    margin: 28px auto 0;
    opacity: 0.55;
}

/* ====== Gallery ====== */
main {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px clamp(64px, 10vh, 120px);
    display: flex;
    flex-direction: column;
    gap: var(--section-gap);
}

/* Full-bleed section: image fills its container, contained, on stone */
.full {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.full figure {
    margin: 0;
    width: 100%;
}
.full img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 92vh;
    object-fit: contain;
    /* All images now have transparent bg — drop-shadow follows the actual silhouette */
    filter: drop-shadow(0 18px 38px rgba(0,0,0,0.55))
            drop-shadow(0 4px 10px rgba(0,0,0,0.45));
}

/* Quartet: 2x2 grid — all transparent images, stone shows through gaps */
.quartet {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: clamp(20px, 3vw, 40px);
    aspect-ratio: 1 / 1;
    width: 100%;
}
.cell {
    margin: 0;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}
.cell img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    filter: drop-shadow(0 12px 24px rgba(0,0,0,0.5))
            drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}
.cell:hover img { transform: scale(1.03); }

/* Subtle reveal on first paint */
section { opacity: 0; transform: translateY(8px); animation: rise 1.2s ease-out forwards; }
section:nth-of-type(1) { animation-delay: 0.05s; }
section:nth-of-type(2) { animation-delay: 0.15s; }
section:nth-of-type(3) { animation-delay: 0.25s; }
section:nth-of-type(4) { animation-delay: 0.35s; }
@keyframes rise {
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    section { opacity: 1; transform: none; animation: none; }
    .cell:hover img { transform: none; }
}

/* ====== Footer ornament ====== */
footer {
    text-align: center;
    padding: clamp(40px, 6vh, 80px) 32px clamp(64px, 10vh, 120px);
}
.ornament {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 28px;
    color: var(--ink-soft);
    opacity: 0.55;
    letter-spacing: 0.4em;
    padding-left: 0.4em;
    text-shadow:
        0 1px 0 rgba(255, 245, 220, 0.2),
        0 -1px 1px rgba(20, 12, 4, 0.5);
}

/* ====== Mobile ====== */
@media (max-width: 760px) {
    header { padding: 56px 20px 40px; }
    h1 { letter-spacing: 0.14em; }
    .rule { margin-top: 24px; width: 60px; }
    main { padding: 0 14px 64px; gap: clamp(32px, 6vh, 56px); }
    .quartet { gap: 3px; }
    .cell:hover img { transform: none; }
    .full img { max-height: 80vh; }
}

/* Print */
@media print {
    html, body { background: white; }
    #bg, body::before { display: none; }
    .full img, .quartet { box-shadow: none; }
}
