/* ============================================
   aiice.io - Midnight Palace Design System
   ============================================ */

/* Fonts: Cormorant Garamond, Outfit */
/* Colors: #0B1224, #0F1A30, #121E38, #162550, #1A2A4E, #B8C4D8, #C8CDD6, #D4AF37, #E8C966, #F0EDE6 */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: #0B1224;
    color: #C8CDD6;
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: 17px;
    line-height: 1.7;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Cormorant Garamond', serif;
    letter-spacing: -0.02em;
    line-height: 1.05;
}

h2 {
    font-weight: 600;
    color: #F0EDE6;
}

h3 {
    font-weight: 500;
    font-style: italic;
    color: #B8C4D8;
}

/* --- Marble Surface Texture (CSS-only) --- */
.marble-surface {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 1;
    z-index: 0;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(212,175,55,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(184,196,216,0.03) 0%, transparent 40%),
        radial-gradient(ellipse at 40% 80%, rgba(212,175,55,0.03) 0%, transparent 45%),
        radial-gradient(ellipse at 85% 15%, rgba(184,196,216,0.02) 0%, transparent 35%);
    transition: opacity 0.6s ease;
}

.marble-surface--hero {
    opacity: 0;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(212,175,55,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(184,196,216,0.03) 0%, transparent 40%),
        radial-gradient(ellipse at 40% 80%, rgba(212,175,55,0.03) 0%, transparent 45%),
        radial-gradient(ellipse at 85% 15%, rgba(184,196,216,0.02) 0%, transparent 35%);
}

.marble-surface--hero.visible {
    opacity: 1;
}

.marble-surface--rich {
    background:
        radial-gradient(ellipse at 15% 25%, rgba(212,175,55,0.06) 0%, transparent 45%),
        radial-gradient(ellipse at 75% 55%, rgba(184,196,216,0.05) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 85%, rgba(212,175,55,0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 90% 10%, rgba(184,196,216,0.04) 0%, transparent 30%),
        radial-gradient(ellipse at 35% 50%, rgba(212,175,55,0.03) 0%, transparent 55%);
}

.marble-surface--vault {
    opacity: 1;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(212,175,55,0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 70%, rgba(184,196,216,0.04) 0%, transparent 45%),
        radial-gradient(ellipse at 80% 20%, rgba(212,175,55,0.04) 0%, transparent 40%),
        radial-gradient(ellipse at 10% 80%, rgba(184,196,216,0.03) 0%, transparent 50%);
    transition: transform 0.1s linear;
}

/* --- Column Fragments (ghostly classical presences) --- */
.column-fragment {
    position: absolute;
    top: 10%;
    width: 60px;
    height: 80%;
    opacity: 0.035;
    z-index: 0;
    pointer-events: none;
}

.column-fragment--left {
    left: 3vw;
    background:
        linear-gradient(180deg, transparent 0%, #B8C4D8 5%, #B8C4D8 90%, transparent 100%);
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 500'%3E%3Crect x='15' y='40' width='30' height='420' fill='white'/%3E%3Cellipse cx='30' cy='35' rx='25' ry='12' fill='white'/%3E%3Cellipse cx='30' cy='465' rx='25' ry='12' fill='white'/%3E%3Cpath d='M5,25 Q15,0 30,8 Q45,0 55,25 L55,35 Q40,28 30,30 Q20,28 5,35 Z' fill='white'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 500'%3E%3Crect x='15' y='40' width='30' height='420' fill='white'/%3E%3Cellipse cx='30' cy='35' rx='25' ry='12' fill='white'/%3E%3Cellipse cx='30' cy='465' rx='25' ry='12' fill='white'/%3E%3Cpath d='M5,25 Q15,0 30,8 Q45,0 55,25 L55,35 Q40,28 30,30 Q20,28 5,35 Z' fill='white'/%3E%3C/svg%3E");
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
}

.column-fragment--right {
    right: 3vw;
    background:
        linear-gradient(180deg, transparent 0%, #B8C4D8 5%, #B8C4D8 90%, transparent 100%);
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 500'%3E%3Crect x='15' y='40' width='30' height='420' fill='white'/%3E%3Cellipse cx='30' cy='35' rx='25' ry='12' fill='white'/%3E%3Cellipse cx='30' cy='465' rx='25' ry='12' fill='white'/%3E%3Cpath d='M5,25 Q15,0 30,8 Q45,0 55,25 L55,35 Q40,28 30,30 Q20,28 5,35 Z' fill='white'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 500'%3E%3Crect x='15' y='40' width='30' height='420' fill='white'/%3E%3Cellipse cx='30' cy='35' rx='25' ry='12' fill='white'/%3E%3Cellipse cx='30' cy='465' rx='25' ry='12' fill='white'/%3E%3Cpath d='M5,25 Q15,0 30,8 Q45,0 55,25 L55,35 Q40,28 30,30 Q20,28 5,35 Z' fill='white'/%3E%3C/svg%3E");
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
}

.column-fragment--vault {
    opacity: 0.05;
}

/* --- Scenes --- */
.scene {
    position: relative;
    width: 100%;
}

.scene--fullscreen {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 40%, #162550 0%, #0B1224 70%);
    overflow: hidden;
}

.scene--gallery,
.scene--chambers,
.scene--final {
    padding: 0 8vw;
}

/* --- Scene 1: The Threshold --- */
.threshold-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.site-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 120px;
    color: #F0EDE6;
    letter-spacing: 0.08em;
    line-height: 1;
}

.letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.letter.visible {
    opacity: 1;
    transform: translateY(0);
}

.title-underline {
    height: 1.5px;
    background: linear-gradient(90deg, #D4AF37, #E8C966);
    width: 0;
    margin: 16px auto 0;
    transition: width 1200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.title-underline.visible {
    width: 100%;
}

.tagline {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: 18px;
    color: #B8C4D8;
    margin-top: 24px;
    opacity: 0;
    transition: opacity 800ms ease;
}

.tagline.visible {
    opacity: 1;
}

.tagline-lines {
    position: relative;
    width: 200px;
    height: 2px;
    margin: 12px auto 0;
}

.tagline-line {
    position: absolute;
    height: 1px;
    background: #D4AF37;
    width: 0;
    transition: width 800ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.tagline-line--top {
    top: 0;
    left: 0;
}

.tagline-line--bottom {
    bottom: 0;
    right: 0;
}

.tagline.visible ~ .tagline-lines .tagline-line {
    width: 100%;
}

/* Gold Dust Particles */
.gold-dust {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.gold-particle {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: #D4AF37;
    opacity: 0.15;
}

/* Scroll Chevron */
.scroll-chevron {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    animation: chevronPulse 2s ease-in-out infinite;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.scroll-chevron.visible {
    opacity: 1;
}

@keyframes chevronPulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
}

/* --- Card Grid System --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
    padding: 80px 0;
    position: relative;
}

.card-grid--dense {
    padding-top: 40px;
}

.card-grid--final {
    padding-bottom: 40px;
}

/* Card spans */
.card--span4 { grid-column: span 4; }
.card--span5 { grid-column: span 5; }
.card--span6 { grid-column: span 6; }
.card--span7 { grid-column: span 7; }
.card--span8 { grid-column: span 8; }
.card--span12 { grid-column: span 12; }

/* --- Card Base --- */
.card {
    position: relative;
    background: linear-gradient(180deg, #121E38 0%, #0F1A30 100%);
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.15);
    padding: 40px;
    overflow: hidden;
    min-height: 220px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.3),
        0 1px 4px rgba(0, 0, 0, 0.2);
    transition:
        box-shadow 0.4s ease,
        border-color 0.4s ease,
        transform 0.4s ease;
}

.card:hover {
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.3);
    border-color: rgba(212, 175, 55, 0.4);
    transform: translateY(-4px);
    background: linear-gradient(180deg, #1A2A4E 0%, #121E38 100%);
}

.card:hover .marble-surface {
    opacity: 1;
}

.card:hover .marble-surface:not(.marble-surface--rich) {
    background:
        radial-gradient(ellipse at 20% 30%, rgba(212,175,55,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(184,196,216,0.06) 0%, transparent 40%),
        radial-gradient(ellipse at 40% 80%, rgba(212,175,55,0.06) 0%, transparent 45%),
        radial-gradient(ellipse at 85% 15%, rgba(184,196,216,0.04) 0%, transparent 35%);
}

.card--feature {
    min-height: 340px;
    padding: 50px;
}

.card--tall {
    min-height: 360px;
}

.card--bar {
    min-height: auto;
    padding: 20px 40px;
    background: transparent;
    border: none;
    box-shadow: none;
}

.card--bar:hover {
    box-shadow: none;
    border-color: transparent;
    transform: none;
}

/* Card reveal animation */
.reveal-card {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
}

.reveal-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Card Content --- */
.card-content {
    position: relative;
    z-index: 2;
}

.card-content--overlay {
    position: absolute;
    z-index: 3;
    left: 40px;
    right: 40px;
}

.card-content--overlay:not(.card-content--bottom) {
    top: 40px;
}

.card-content--bottom {
    bottom: 40px;
}

.card-label {
    display: inline-block;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #D4AF37;
    opacity: 0.7;
    margin-bottom: 16px;
}

.card-title {
    font-size: clamp(28px, 3vw, 42px);
    color: #F0EDE6;
    font-weight: 600;
    margin-bottom: 16px;
    position: relative;
    display: inline-block;
}

.card-title::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    height: 1.5px;
    background: #D4AF37;
    width: 0;
    transition: width 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.card:hover .card-title::after {
    width: 100%;
}

.card-title--gold {
    color: #D4AF37;
}

.card-title--gold::after {
    background: #E8C966;
}

.card-subtitle {
    font-size: clamp(22px, 2.5vw, 34px);
    margin-bottom: 12px;
    position: relative;
    display: inline-block;
}

.card-subtitle::after {
    content: '';
    position: absolute;
    bottom: -3px;
    right: 0;
    height: 1px;
    background: #D4AF37;
    width: 0;
    transition: width 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.card:hover .card-subtitle::after {
    width: 100%;
}

.card-body {
    font-size: 16px;
    line-height: 1.7;
    color: #C8CDD6;
    max-width: 540px;
}

/* --- Card Filigree SVG --- */
.card-filigree {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.filigree-svg {
    width: 100%;
    height: 100%;
    opacity: 0.2;
}

.filigree-path {
    transition: stroke-dashoffset 600ms ease;
}

.card:hover .filigree-path {
    stroke-dashoffset: 0;
}

/* --- Card Abstract Compositions --- */
.card-abstract,
.card-duotone {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.abstract-composition {
    position: relative;
    width: 100%;
    height: 100%;
}

.abstract-composition--centered {
    display: flex;
    align-items: center;
    justify-content: center;
}

.abstract-composition--centered .shape {
    position: absolute;
}

.shape {
    position: absolute;
    border-radius: 0;
    transition: transform 0.6s ease, opacity 0.6s ease;
}

.shape--circle {
    border-radius: 50%;
}

.shape--triangle {
    background: none !important;
}

.card:hover .shape {
    transform: scale(1.05);
}

.duotone-shapes {
    position: relative;
    width: 100%;
    height: 100%;
}

/* --- Box Border Animation (feature cards) --- */
.card-box-border {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    pointer-events: none;
    z-index: 4;
}

.card-box-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid transparent;
    border-radius: 12px;
    transition: border-color 0.3s ease;
}

.card:hover .card-box-border::before {
    border-color: rgba(212, 175, 55, 0.3);
}

/* --- Ornamental Bar --- */
.bar-ornament {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 10px 0;
}

.bar-line {
    height: 1px;
    flex: 1;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.3), transparent);
}

.bar-diamond {
    width: 8px;
    height: 8px;
    background: #D4AF37;
    transform: rotate(45deg);
    opacity: 0.4;
}

/* --- Marble Divider --- */
.marble-divider {
    height: 4px;
    margin: 0 auto;
    width: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(184, 196, 216, 0.08) 15%,
        rgba(212, 175, 55, 0.12) 30%,
        rgba(184, 196, 216, 0.06) 50%,
        rgba(212, 175, 55, 0.1) 70%,
        rgba(184, 196, 216, 0.08) 85%,
        transparent 100%
    );
    border-radius: 2px;
}

/* --- Scene 4: The Vault --- */
.scene--vault {
    background: #0B1224;
    flex-direction: column;
}

.vault-content {
    position: relative;
    z-index: 2;
    transition: transform 0.1s linear;
}

.vault-door {
    position: relative;
    padding: 80px 120px;
    text-align: center;
}

.vault-door-border {
    position: absolute;
    inset: 0;
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 4px;
    opacity: 0;
    transition: opacity 1s ease;
}

.vault-door-border.visible {
    opacity: 1;
}

.vault-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-style: italic;
    font-size: clamp(36px, 5vw, 64px);
    color: #F0EDE6;
    line-height: 1.2;
}

/* --- Scene 5: Closing --- */
.closing {
    text-align: center;
    padding: 120px 0 80px;
    position: relative;
}

.closing-logo {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 36px;
    color: #D4AF37;
    letter-spacing: 0.08em;
    display: block;
}

.closing-underline {
    height: 1.5px;
    background: linear-gradient(90deg, #D4AF37, #E8C966);
    width: 0;
    margin: 12px auto 0;
    max-width: 120px;
    transition: width 1000ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.closing-underline.visible {
    width: 100%;
}

.closing-year {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: 13px;
    color: #B8C4D8;
    margin-top: 16px;
    display: block;
    letter-spacing: 0.06em;
}

/* --- Pediment Shape (section divider accent) --- */
.scene--chambers::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 30px;
    clip-path: polygon(0 100%, 50% 0, 100% 100%);
    background: rgba(184, 196, 216, 0.04);
    pointer-events: none;
}

/* --- Mosaic Grid Lines (between cards) --- */
.card-grid::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .scene--gallery,
    .scene--chambers,
    .scene--final {
        padding: 0 5vw;
    }

    .card--span4,
    .card--span5 {
        grid-column: span 6;
    }

    .card--span7 {
        grid-column: span 6;
    }

    .card--span8 {
        grid-column: span 12;
    }

    .site-title {
        font-size: 80px;
    }

    .vault-door {
        padding: 60px 60px;
    }
}

@media (max-width: 768px) {
    .scene--gallery,
    .scene--chambers,
    .scene--final {
        padding: 0 16px;
    }

    .card--span4,
    .card--span5,
    .card--span6,
    .card--span7,
    .card--span8 {
        grid-column: span 12;
    }

    .card {
        padding: 30px;
    }

    .card--feature {
        padding: 36px;
    }

    .card-content--overlay {
        left: 30px;
        right: 30px;
    }

    .card-content--overlay:not(.card-content--bottom) {
        top: 30px;
    }

    .card-content--bottom {
        bottom: 30px;
    }

    .site-title {
        font-size: 56px;
    }

    .card-grid {
        gap: 16px;
        padding: 40px 0;
    }

    .vault-door {
        padding: 40px 24px;
    }

    .column-fragment {
        display: none;
    }

    .closing {
        padding: 80px 0 60px;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 44px;
    }

    .vault-text {
        font-size: 28px;
    }
}

/* --- Gold Particle Animations --- */
@keyframes floatDown {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0.15;
    }
    50% {
        opacity: 0.2;
    }
    100% {
        transform: translateY(100vh) translateX(20px);
        opacity: 0;
    }
}
