/* =============================================================
   가능성.com — Glassmorphic Possibility Dreamscape
   Colors: #f5ede0 #e8ddd0 #c8b8a8 #7a9b7a #8a7a8a #c87070 #3a2a20
   Fonts: Gowun Batang (display), Noto Sans KR (body), DM Sans (accent)
   ============================================================= */

/* ─── Google Fonts are loaded in HTML ─── */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --cream-dawn: #f5ede0;
    --soft-linen: #e8ddd0;
    --pale-sand: #c8b8a8;
    --frost-glass: rgba(245, 237, 224, 0.6);
    --frost-glass-deep: rgba(245, 237, 224, 0.75);
    --glass-border: rgba(255, 255, 255, 0.4);
    --rose-possibility: #c87070;
    --rose-glass: rgba(200, 112, 112, 0.45);
    --sage-dream: #7a9b7a;
    --twilight-mauve: #8a7a8a;
    --deep-umber: #3a2a20;
    --city-color: rgba(138, 122, 138, 0.06);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: var(--cream-dawn);
    color: var(--deep-umber);
    line-height: 1.75;
    overflow-x: hidden;
}

/* ─── Typography helpers ─── */
.dm-sans {
    font-family: 'DM Sans', sans-serif;
}

/* ─── Glassmorphic panel base ─── */
.glass-panel {
    background: var(--frost-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.glass-panel.glass-rose {
    background: var(--rose-glass);
    border-color: rgba(200, 112, 112, 0.3);
}

/* ─── City silhouette watermark ─── */
.city-silhouette {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    z-index: 0;
}

.city-silhouette svg rect {
    fill: var(--twilight-mauve);
    opacity: 0.07;
}

/* ─────────────────────────────────────────
   HERO SECTION
   ───────────────────────────────────────── */
.hero {
    position: relative;
    min-height: 100vh;
    background: linear-gradient(160deg, var(--cream-dawn) 0%, var(--soft-linen) 60%, var(--pale-sand) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 4rem 2rem;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 40% at 20% 30%, rgba(122, 155, 122, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 50% 50% at 80% 70%, rgba(200, 112, 112, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse 70% 60% at 50% 50%, rgba(138, 122, 138, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.hero-city {
    height: 120px;
    opacity: 1;
}

.hero-panels {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1100px;
    display: grid;
    grid-template-columns: 1fr 60% 1fr;
    grid-template-rows: auto auto;
    gap: 1.5rem;
    align-items: center;
}

/* Main hero panel */
.hero-main-panel {
    grid-column: 2;
    grid-row: 1 / 3;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(245, 237, 224, 0.72);
    text-align: center;
    padding: 3.5rem 2.5rem;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    transform: rotate(-0.5deg);
    box-shadow: 0 8px 40px rgba(58, 42, 32, 0.08), 0 2px 8px rgba(58, 42, 32, 0.04);
}

.hero-title-wrap {
    line-height: 1.1;
}

.hero-serif {
    font-family: 'Gowun Batang', serif;
    font-size: clamp(3.5rem, 8vw, 6rem);
    font-weight: 400;
    color: var(--deep-umber);
    letter-spacing: -0.02em;
}

.hero-sans {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(3rem, 7vw, 5.2rem);
    font-weight: 300;
    color: var(--twilight-mauve);
    letter-spacing: -0.03em;
}

.hero-subtitle {
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    color: var(--twilight-mauve);
    text-transform: uppercase;
}

.hero-tagline {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: clamp(0.9rem, 1.8vw, 1.1rem);
    color: var(--deep-umber);
    opacity: 0.75;
    max-width: 36ch;
    line-height: 1.9;
}

/* Floating accent panels */
.hero-accent-panel {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(232, 221, 208, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    position: relative;
}

.panel-left {
    grid-column: 1;
    grid-row: 1;
    transform: rotate(-2deg) translateY(10px);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

.panel-right {
    grid-column: 3;
    grid-row: 1;
    transform: rotate(1.5deg) translateY(-8px);
}

.panel-top-right {
    grid-column: 3;
    grid-row: 2;
    transform: rotate(-1deg) translateY(5px);
    align-items: flex-start;
    min-height: 120px;
}

.panel-word {
    font-family: 'Gowun Batang', serif;
    font-size: clamp(2rem, 4vw, 3rem);
    color: var(--deep-umber);
    opacity: 0.5;
    position: relative;
    z-index: 1;
}

.small-text {
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--deep-umber);
    opacity: 0.6;
    letter-spacing: 0.03em;
}

/* Glitch texture overlay */
.glitch-texture {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(200, 112, 112, 0.04) 2px,
        rgba(200, 112, 112, 0.04) 4px
    );
    pointer-events: none;
    border-radius: 16px;
}

/* Scroll hint */
.hero-scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--twilight-mauve);
    opacity: 0.6;
    z-index: 2;
    animation: float-hint 2.5s ease-in-out infinite;
}

@keyframes float-hint {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(6px); }
}

/* ─────────────────────────────────────────
   MOSAIC SECTION
   ───────────────────────────────────────── */
.mosaic {
    position: relative;
    background: linear-gradient(180deg, var(--soft-linen) 0%, var(--cream-dawn) 50%, var(--soft-linen) 100%);
    padding: 5rem 2rem 6rem;
    overflow: hidden;
}

.mosaic-city {
    height: 100px;
    position: absolute;
    bottom: 0;
    opacity: 0.8;
}

.masonry-grid {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    columns: 3;
    column-gap: 1.5rem;
}

.masonry-panel {
    break-inside: avoid;
    margin-bottom: 1.5rem;
    display: block;
}

/* Panel size variants */
.panel-tall {
    min-height: 320px;
}

.panel-medium {
    min-height: 220px;
}

.panel-short {
    min-height: 160px;
}

.panel-minimal {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-word-only {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-english {
    min-height: 180px;
}

/* Panel content styles */
.panel-heading {
    font-family: 'Gowun Batang', serif;
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 400;
    color: var(--deep-umber);
    margin-bottom: 1rem;
    line-height: 1.3;
}

.panel-heading-sm {
    font-family: 'Gowun Batang', serif;
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--deep-umber);
    margin-bottom: 0.75rem;
}

.panel-body {
    font-size: 0.95rem;
    color: var(--deep-umber);
    opacity: 0.82;
    line-height: 1.8;
    margin-bottom: 0.8rem;
}

.panel-body-sm {
    font-size: 0.85rem;
    color: var(--deep-umber);
    opacity: 0.78;
    line-height: 1.8;
    position: relative;
    z-index: 1;
}

.panel-quote {
    border-left: 2px solid var(--sage-dream);
    padding-left: 1.2rem;
}

.panel-quote p {
    font-family: 'Gowun Batang', serif;
    font-size: 1rem;
    color: var(--deep-umber);
    line-height: 1.8;
    margin-bottom: 0.5rem;
}

.panel-quote cite {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--twilight-mauve);
    opacity: 0.8;
}

/* Sage accent bar */
.sage-accent {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--sage-dream), transparent);
    border-radius: 0 0 16px 16px;
}

.sage-accent-2 {
    background: linear-gradient(90deg, transparent, var(--twilight-mauve), transparent);
}

/* Solo word displays */
.solo-word {
    font-family: 'Gowun Batang', serif;
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 400;
    color: var(--deep-umber);
    opacity: 0.3;
}

.solo-word-sm {
    font-family: 'Gowun Batang', serif;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    font-weight: 400;
    color: var(--twilight-mauve);
    opacity: 0.45;
}

/* English definition panel */
.english-text {
    font-size: 2rem;
    font-weight: 300;
    color: var(--deep-umber);
    margin-bottom: 0.8rem;
    line-height: 1.2;
}

.english-sub {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: var(--rose-possibility);
    text-transform: uppercase;
    display: block;
}

.english-def {
    font-size: 0.78rem;
    color: var(--deep-umber);
    opacity: 0.65;
    line-height: 1.7;
}

/* ─────────────────────────────────────────
   GLITCH PANEL
   ───────────────────────────────────────── */
.glitch-panel {
    position: relative;
}

.glitch-lines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(200, 112, 112, 0.05) 2px,
        rgba(200, 112, 112, 0.05) 4px
    );
    pointer-events: none;
    border-radius: 16px;
    z-index: 0;
}

.glitch-scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(122, 155, 122, 0.04) 3px,
        rgba(122, 155, 122, 0.04) 6px
    );
    pointer-events: none;
    border-radius: 16px;
    z-index: 0;
}

.glitch-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}

.glitch-word {
    font-family: 'Gowun Batang', serif;
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 400;
    color: var(--deep-umber);
    position: relative;
    display: inline-block;
    text-shadow:
        2px 0 0 rgba(200, 112, 112, 0.25),
        -2px 0 0 rgba(122, 155, 122, 0.25);
}

.glitch-word::before {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 2px;
    color: var(--rose-possibility);
    opacity: 0.18;
    clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
}

.glitch-word::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: -2px;
    color: var(--sage-dream);
    opacity: 0.18;
    clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
}

.panel-glitch {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─────────────────────────────────────────
   CARD-FLIP COMPONENT
   ───────────────────────────────────────── */
.card-container {
    perspective: 1000px;
    cursor: pointer;
    min-height: 240px;
}

.card {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 240px;
    transform-style: preserve-3d;
    transition: transform 0.6s ease-in-out;
}

.card.flipped {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-radius: 16px;
    padding: 2rem;
    min-height: 240px;
}

.card-back {
    transform: rotateY(180deg);
}

.card-label {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--twilight-mauve);
    opacity: 0.7;
}

.card-heading {
    font-family: 'Gowun Batang', serif;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 400;
    color: var(--deep-umber);
    line-height: 1.2;
}

.card-back .card-heading {
    color: #fff;
}

.card-text {
    font-size: 0.9rem;
    color: var(--deep-umber);
    opacity: 0.78;
    line-height: 1.7;
    flex: 1;
    padding: 0.8rem 0;
}

.card-back .card-text {
    color: rgba(255, 255, 255, 0.88);
    opacity: 1;
}

.card-back .card-label {
    color: rgba(255, 255, 255, 0.7);
    opacity: 1;
}

.flip-hint {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--rose-possibility);
    opacity: 0.8;
    display: block;
    align-self: flex-end;
}

.card-back .flip-hint {
    color: rgba(255, 255, 255, 0.7);
}

/* Hover lift for card containers */
.card-container:hover .card:not(.flipped) {
    transform: rotateY(5deg) scale(1.01);
}

.card-container:hover .card.flipped {
    transform: rotateY(175deg) scale(1.01);
}

/* ─────────────────────────────────────────
   HORIZON / FOOTER
   ───────────────────────────────────────── */
.horizon {
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.horizon-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        var(--soft-linen) 0%,
        var(--pale-sand) 40%,
        var(--twilight-mauve) 100%
    );
    opacity: 0.6;
}

.horizon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        var(--soft-linen) 0%,
        #b8a8b0 100%
    );
}

.horizon-panel {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2.5rem 4rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(245, 237, 224, 0.5);
}

.horizon-text {
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--deep-umber);
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

.horizon-sub {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--twilight-mauve);
    opacity: 0.7;
}

/* ─────────────────────────────────────────
   ENTRANCE ANIMATIONS
   ───────────────────────────────────────── */
.hero-main-panel,
.hero-accent-panel {
    animation: panel-rise 1.2s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.hero-accent-panel {
    animation-delay: 0.3s;
}

.panel-top-right {
    animation-delay: 0.5s;
}

@keyframes panel-rise {
    from {
        opacity: 0;
        transform: translateY(40px) rotate(var(--rot, 0deg));
    }
    to {
        opacity: 1;
        transform: translateY(0) rotate(var(--rot, 0deg));
    }
}

.masonry-panel,
.card-container {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.masonry-panel.visible,
.card-container.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger handled in JS */

/* ─────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────── */
@media (max-width: 900px) {
    .hero-panels {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 1rem;
    }

    .hero-main-panel {
        grid-column: 1;
        grid-row: 1;
        min-height: 55vw;
        transform: none;
    }

    .panel-left,
    .panel-right,
    .panel-top-right {
        display: none;
    }

    .masonry-grid {
        columns: 2;
    }
}

@media (max-width: 600px) {
    .hero {
        padding: 3rem 1rem;
    }

    .masonry-grid {
        columns: 1;
    }

    .horizon-panel {
        padding: 2rem 2rem;
    }
}
