/* ============================================================================
TILT CARD GRID — Interactive 3D tilt gallery
Theme: plutonium6_default
Template: templates/tilt_card_grid_dev.php

Colors are sourced from the central dynamic color system (root_values.php /
cms_themes.themeColors) via hsla(var(--Token), alpha) — no hardcoded hex/rgba.
============================================================================ */

:root {
--tilt-bg: hsla(var(--ColorBgDark), 1);
--tilt-card-bg: hsla(var(--Gray20), 0.7);
--tilt-card-border: hsla(var(--White), 0.1);
--tilt-text-main: hsla(var(--ColorTextInverse), 1);
--tilt-text-sub: hsla(var(--Gray70), 1);
--tilt-accent: hsla(var(--ColorBrand3), 1);
}

/* :has() raises specificity above theme.css's bare `body` rule so this wins
   regardless of <link> order (this stylesheet loads before theme.css in <head>).
   Flex column pushes the footer to the bottom of the layout instead of it
   being centered as a row item alongside the gallery grid. */
body:has(.gallery-container) {
background-color: var(--tilt-bg);
color: var(--tilt-text-main);
min-height: 100vh;
display: flex;
flex-direction: column;
}

/* Grid Layout - grows to fill remaining space, clears the fixed 125px site header */
.gallery-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2.5rem;
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 160px 2rem 4rem;
flex: 1 0 auto;
}

/* Outer wrapper provides CSS Perspective space */
.tilt-card-wrapper {
perspective: 1000px;
}

/* Main Card Container */
.tilt-card {
background: var(--tilt-card-bg);
border: 1px solid var(--tilt-card-border);
border-radius: 1rem;
padding: 1.25rem;
backdrop-filter: blur(12px);
transform-style: preserve-3d;
will-change: transform;
transition: transform 0.15s ease-out, box-shadow 0.3s ease;
box-shadow: 0 10px 30px -10px hsla(var(--Black), 0.5);
}

.tilt-card:hover {
box-shadow: 0 20px 40px -15px hsla(var(--ColorBrand3), 0.25);
}

/* Child Elements - independently tilted/translated on the Z-axis (set via JS
   on mousemove) so the image and text pop forward detached from the card
   background's own, more subdued tilt. */
.card-image-container {
overflow: hidden;
border-radius: 0.75rem;
transform: translateZ(0px);
filter: drop-shadow(0px 0px 0px transparent);
transition: transform 0.2s ease-out, filter 0.2s ease-out;
}

.card-image-container img {
width: 100%;
height: 200px;
object-fit: cover;
display: block;
transition: transform 0.4s ease;
}

/* Image zoom - independent of the card tilt/pop, pure hover crop-zoom */
.tilt-card-wrapper:hover .card-image-container img {
transform: scale(1.15);
}

.card-content {
margin-top: 1.25rem;
transform: translateZ(0px);
transition: transform 0.2s ease-out;
transform-style: preserve-3d;
}

.card-title {
font-size: 1.25rem;
font-weight: 600;
color: var(--tilt-text-main);
margin-bottom: 0.5rem;
}

.card-description {
font-size: 0.875rem;
color: var(--tilt-text-sub);
line-height: 1.5;
margin-bottom: 1.25rem;
}

.card-button {
display: inline-block;
padding: 0.5rem 1rem;
background-color: var(--tilt-text-main);
color: var(--tilt-bg);
text-decoration: none;
border-radius: 0.5rem;
font-size: 0.875rem;
font-weight: 600;
transform: translateZ(0px);
transition: background-color 0.2s ease, transform 0.2s ease-out;
}

.card-button:hover {
background-color: var(--tilt-accent);
}

/* ============================================================================
TILT CARD DETAIL MODAL
Extends the site's page-load-modal pattern (fixed overlay + centered dialog)
with a fade+scale entrance and a brand-tinted, blurred backdrop.
============================================================================ */

.tilt-modal {
display: none;
position: fixed;
inset: 0;
z-index: var(--ZIndexModal, 9999);
align-items: center;
justify-content: center;
padding: 2rem;
}

.tilt-modal.is-open {
display: flex;
}

.tilt-modal-overlay {
position: absolute;
inset: 0;
background: hsla(var(--ColorBrand3), 0.8);
backdrop-filter: blur(8px);
}

/* Fades in and scales up to its full 90% width on open */
.tilt-modal-dialog {
position: relative;
width: 90vw;
max-width: 1400px;
max-height: 85vh;
overflow-y: auto;
background: var(--tilt-card-bg);
border: 1px solid var(--tilt-card-border);
border-radius: 1rem;
box-shadow: 0 20px 60px hsla(var(--Black), 0.4);
opacity: 0;
transform: scale(0.85);
transition: opacity 0.35s ease, transform 0.35s ease;
}

.tilt-modal.is-open .tilt-modal-dialog {
opacity: 1;
transform: scale(1);
}

.tilt-modal-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1.5rem 2rem;
}

.tilt-modal-header h2 {
margin: 0;
color: var(--tilt-text-main);
font-size: 1.5rem;
}

.tilt-modal-close {
background: transparent;
border: none;
color: var(--tilt-text-sub);
cursor: pointer;
padding: 0.25rem;
display: flex;
border-radius: 0.5rem;
transition: color 0.2s ease, background-color 0.2s ease;
}

.tilt-modal-close:hover {
color: var(--tilt-text-main);
background-color: hsla(var(--White), 0.1);
}

.tilt-modal-content {
padding: 0 2rem 2rem;
color: var(--tilt-text-sub);
line-height: 1.6;
}

.tilt-modal-cover {
border-radius: 0.75rem;
overflow: hidden;
margin-bottom: 1.5rem;
}

.tilt-modal-cover img {
width: 100%;
max-height: 360px;
object-fit: cover;
display: block;
}

.tilt-modal-summary {
font-size: 1.1rem;
color: var(--tilt-text-main);
margin-bottom: 1.5rem;
}

.tilt-modal-detail {
margin-bottom: 1.5rem;
}

.tilt-modal-gallery h3 {
color: var(--tilt-text-main);
margin-bottom: 1rem;
}

.tilt-gallery-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
gap: 0.75rem;
margin-bottom: 1.25rem;
}

.tilt-gallery-thumb {
padding: 0;
border: 2px solid transparent;
border-radius: 0.5rem;
overflow: hidden;
cursor: pointer;
background: none;
aspect-ratio: 1;
transition: border-color 0.2s ease;
}

.tilt-gallery-thumb img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}

.tilt-gallery-thumb.is-active,
.tilt-gallery-thumb:hover {
border-color: var(--tilt-accent);
}

.tilt-gallery-detail {
background: hsla(var(--White), 0.05);
border-radius: 0.75rem;
padding: 1rem 1.25rem;
}

