/* =============================================
   AIICE.QUEST - Frozen Wonderland Styles
   ============================================= */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    line-height: 1.8;
    color: #2b1f4e;
    background: #1a1030;
}

/* --- Typography Classes --- */
.cinzel-display {
    font-family: 'Cinzel Decorative', serif;
    font-weight: 700;
    letter-spacing: 0.15em;
}

.quicksand-heading {
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.nunito-body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    line-height: 1.8;
}

.caveat-text {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    color: #b8d4e3;
    text-shadow: 0 0 8px rgba(184, 212, 227, 0.3);
}

/* --- Aurora Background --- */
#aurora-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.aurora-layer {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    opacity: 0.7;
}

.aurora-layer-1 {
    background: radial-gradient(ellipse at 30% 40%, #c8b6ff 0%, transparent 50%),
                radial-gradient(ellipse at 70% 60%, #b8e0ff 0%, transparent 50%);
    animation: aurora1 20s ease-in-out infinite;
}

.aurora-layer-2 {
    background: radial-gradient(ellipse at 60% 30%, #a8f0d4 0%, transparent 45%),
                radial-gradient(ellipse at 40% 70%, #ffe0f0 0%, transparent 45%);
    animation: aurora2 35s ease-in-out infinite;
}

.aurora-layer-3 {
    background: radial-gradient(ellipse at 50% 50%, #c8b6ff 0%, transparent 40%),
                radial-gradient(ellipse at 20% 80%, #b8e0ff 0%, transparent 40%);
    animation: aurora3 50s ease-in-out infinite;
    opacity: 0.5;
}

@keyframes aurora1 {
    0%   { transform: translate(0, 0) rotate(0deg); }
    33%  { transform: translate(5%, -3%) rotate(3deg); }
    66%  { transform: translate(-3%, 5%) rotate(-2deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes aurora2 {
    0%   { transform: translate(0, 0) rotate(0deg); }
    25%  { transform: translate(-4%, 3%) rotate(-2deg); }
    50%  { transform: translate(3%, -5%) rotate(4deg); }
    75%  { transform: translate(-2%, 4%) rotate(-1deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes aurora3 {
    0%   { transform: translate(0, 0) rotate(0deg); }
    20%  { transform: translate(3%, 4%) rotate(2deg); }
    40%  { transform: translate(-5%, -2%) rotate(-3deg); }
    60%  { transform: translate(2%, -4%) rotate(1deg); }
    80%  { transform: translate(-3%, 3%) rotate(-2deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

/* --- Lattice Background --- */
#lattice-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* --- Snowflake Particles --- */
#snowflakes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    width: var(--size, 6px);
    height: var(--size, 6px);
    background: rgba(240, 244, 255, 0.4);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    animation: snowfall var(--duration, 12s) linear infinite;
    animation-delay: var(--delay, 0s);
    opacity: var(--opacity, 0.5);
    left: var(--left, 50%);
    top: -10px;
}

@keyframes snowfall {
    0% {
        transform: translate(0, -10px) rotate(0deg);
        opacity: 0;
    }
    5% {
        opacity: var(--opacity, 0.5);
    }
    90% {
        opacity: var(--opacity, 0.5);
    }
    100% {
        transform: translate(calc(-1 * var(--drift, 100px)), calc(100vh + 20px)) rotate(var(--spin, 180deg));
        opacity: 0;
    }
}

/* --- Hexagonal Pane Base --- */
.hex-pane {
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: rgba(240, 244, 255, 0.15);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    position: relative;
    transition: all 0.4s ease;
}

.hex-pane::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    pointer-events: none;
    z-index: 1;
}

.hex-pane-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 15%;
    position: relative;
    z-index: 2;
}

/* --- Entry Screen --- */
#entry-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.6s ease;
}

#entry-screen.shattered {
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease 0.4s;
}

#entry-pane {
    width: min(80vw, 500px);
    height: min(80vw, 500px);
    display: flex;
    justify-content: center;
    align-items: center;
}

#entry-title {
    font-size: clamp(3rem, 12vw, 10rem);
    line-height: 1;
    margin-bottom: 1rem;
}

#entry-subtitle {
    font-size: clamp(1.2rem, 3vw, 2rem);
    animation: subtitlePulse 3s ease-in-out infinite;
}

@keyframes subtitlePulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* --- Frosted Text Effect --- */
.frosted-text {
    font-family: 'Cinzel Decorative', serif;
    font-weight: 700;
    letter-spacing: 0.15em;
    background: linear-gradient(135deg, #c8b6ff, #b8e0ff, #a8f0d4, #ffe0f0, #c8b6ff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmerGradient 8s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(200, 182, 255, 0.4));
}

.frosted-text-clear {
    font-family: 'Cinzel Decorative', serif;
    font-weight: 700;
    letter-spacing: 0.15em;
    font-size: clamp(3rem, 10vw, 8rem);
    background: linear-gradient(135deg, #c8b6ff, #b8e0ff, #a8f0d4, #ffe0f0);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmerGradient 6s ease-in-out infinite;
}

@keyframes shimmerGradient {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- Shatter Animation --- */
#shatter-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99;
    pointer-events: none;
    display: none;
}

#shatter-container.active {
    display: block;
}

.shard {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(80vw, 500px);
    height: min(80vw, 500px);
    transform: translate(-50%, -50%);
    background: rgba(240, 244, 255, 0.12);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    opacity: 1;
    transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.7s ease;
}

.shard-0 { clip-path: polygon(50% 0%, 100% 25%, 50% 50%); }
.shard-1 { clip-path: polygon(100% 25%, 100% 75%, 50% 50%); }
.shard-2 { clip-path: polygon(100% 75%, 50% 100%, 50% 50%); }
.shard-3 { clip-path: polygon(50% 100%, 0% 75%, 50% 50%); }
.shard-4 { clip-path: polygon(0% 75%, 0% 25%, 50% 50%); }
.shard-5 { clip-path: polygon(0% 25%, 50% 0%, 50% 50%); }

#shatter-container.active .shard-0 { transform: translate(calc(-50% + 40px), calc(-50% - 80px)) rotate(12deg); opacity: 0; }
#shatter-container.active .shard-1 { transform: translate(calc(-50% + 90px), calc(-50% + 0px)) rotate(-8deg); opacity: 0; }
#shatter-container.active .shard-2 { transform: translate(calc(-50% + 40px), calc(-50% + 80px)) rotate(15deg); opacity: 0; }
#shatter-container.active .shard-3 { transform: translate(calc(-50% - 40px), calc(-50% + 80px)) rotate(-12deg); opacity: 0; }
#shatter-container.active .shard-4 { transform: translate(calc(-50% - 90px), calc(-50% + 0px)) rotate(10deg); opacity: 0; }
#shatter-container.active .shard-5 { transform: translate(calc(-50% - 40px), calc(-50% - 80px)) rotate(-15deg); opacity: 0; }

/* --- Main Honeycomb --- */
#honeycomb {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease;
}

#honeycomb.hidden {
    opacity: 0;
    pointer-events: none;
}

#honeycomb.visible {
    opacity: 1;
    pointer-events: all;
}

/* --- Center Pane --- */
#center-pane {
    position: absolute;
    width: min(55vw, 450px);
    height: min(55vw, 450px);
    z-index: 15;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#center-pane.active {
    opacity: 1;
    transform: scale(1);
}

#center-content {
    overflow-y: auto;
    scrollbar-width: none;
}

#center-content::-webkit-scrollbar {
    display: none;
}

/* --- Ring Panes --- */
#ring-panes {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#ring-panes.pushed-back {
    opacity: 0.3;
    transform: scale(0.85);
    pointer-events: none;
}

.ring-pane {
    position: absolute;
    width: min(22vw, 180px);
    height: min(22vw, 180px);
    cursor: pointer;
    transition: transform 0.4s ease, backdrop-filter 0.4s ease, background 0.4s ease;
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
}

.ring-pane:hover {
    backdrop-filter: blur(8px) saturate(200%);
    -webkit-backdrop-filter: blur(8px) saturate(200%);
    background: rgba(240, 244, 255, 0.3);
    transform: var(--hover-transform, scale(1.08));
    z-index: 20;
}

.ring-pane .quicksand-heading {
    font-size: clamp(0.65rem, 1.4vw, 0.95rem);
    color: #f0f4ff;
    margin-bottom: 0.3rem;
}

.ring-pane .nunito-body {
    font-size: clamp(0.5rem, 1vw, 0.75rem);
    color: #c0c8d8;
    font-weight: 300;
}

/* Ring pane positions (hexagonal ring around center) */
.ring-pane[data-pane="0"] {
    transform: translate(0, calc(-1 * min(22vw, 200px))) rotateX(-6deg) rotateY(4deg);
}
.ring-pane[data-pane="1"] {
    transform: translate(calc(min(20vw, 185px)), calc(-0.5 * min(22vw, 180px))) rotateX(3deg) rotateY(-7deg);
}
.ring-pane[data-pane="2"] {
    transform: translate(calc(min(20vw, 185px)), calc(0.5 * min(22vw, 180px))) rotateX(-5deg) rotateY(-6deg);
}
.ring-pane[data-pane="3"] {
    transform: translate(0, calc(min(22vw, 200px))) rotateX(7deg) rotateY(3deg);
}
.ring-pane[data-pane="4"] {
    transform: translate(calc(-1 * min(20vw, 185px)), 0) rotateX(4deg) rotateY(7deg);
}

/* --- Back Button --- */
#back-to-ring {
    position: fixed;
    bottom: 5vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#back-to-ring.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
}

.hex-button {
    background: rgba(240, 244, 255, 0.15);
    backdrop-filter: blur(15px) saturate(150%);
    -webkit-backdrop-filter: blur(15px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #f0f4ff;
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.8rem 2rem;
    cursor: pointer;
    clip-path: polygon(10% 0%, 90% 0%, 100% 50%, 90% 100%, 10% 100%, 0% 50%);
    transition: background 0.3s ease, transform 0.3s ease;
    letter-spacing: 0.05em;
}

.hex-button:hover {
    background: rgba(200, 182, 255, 0.3);
    transform: scale(1.05);
}

/* --- Pane Content Styles --- */
.pane-content {
    color: #f0f4ff;
    text-align: center;
}

.pane-content .cinzel-display {
    font-size: clamp(1rem, 2.5vw, 1.6rem);
    color: #f0f4ff;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #c8b6ff, #b8e0ff, #a8f0d4);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.pane-content .nunito-body {
    font-size: clamp(0.75rem, 1.3vw, 0.95rem);
    color: rgba(240, 244, 255, 0.85);
    margin-bottom: 0.8rem;
    line-height: 1.7;
}

.pane-content .caveat-text {
    font-size: clamp(1rem, 1.8vw, 1.3rem);
}

/* --- Cheshire Pane --- */
.cheshire-grin {
    width: clamp(150px, 40%, 250px);
    margin-bottom: 1.2rem;
    animation: cheshireFade 5s ease-in-out infinite;
}

@keyframes cheshireFade {
    0%, 100% { opacity: 1; }
    40% { opacity: 0.3; }
    60% { opacity: 0.3; }
}

.grin-path {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: drawGrin 2s ease forwards;
}

@keyframes drawGrin {
    to { stroke-dashoffset: 0; }
}

.grin-node {
    animation: nodeGlow 3s ease-in-out infinite;
}

@keyframes nodeGlow {
    0%, 100% { r: 3; opacity: 1; }
    50% { r: 5; opacity: 0.6; }
}

.caveat-dialogue {
    font-style: italic;
    margin-top: 0.8rem;
}

/* --- Ice Garden Pane --- */
.garden-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    margin: 1rem 0;
}

.garden-flower {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.garden-flower:hover {
    transform: scale(1.15);
}

.flower-hex {
    width: clamp(35px, 5vw, 50px);
    height: clamp(35px, 5vw, 50px);
    background: linear-gradient(135deg, rgba(200, 182, 255, 0.4), rgba(168, 240, 212, 0.4));
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease;
    animation: flowerPulse 3s ease-in-out infinite;
    animation-delay: var(--pulse-delay, 0s);
}

.garden-flower:hover .flower-hex {
    background: linear-gradient(135deg, rgba(200, 182, 255, 0.7), rgba(168, 240, 212, 0.7), rgba(255, 224, 240, 0.6));
    transform: scale(1.3);
}

@keyframes flowerPulse {
    0%, 100% { transform: scale(0.95); }
    50% { transform: scale(1.05); }
}

.flower-label {
    font-family: 'Quicksand', sans-serif;
    font-size: clamp(0.5rem, 0.9vw, 0.7rem);
    color: #c0c8d8;
    margin-top: 0.3rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* --- API / Tea Party Pane --- */
.tea-table {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
    perspective: 600px;
}

.teacup {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.teacup:hover {
    transform: rotateX(8deg) rotateY(-5deg) scale(1.1);
}

.teacup-shape {
    width: clamp(40px, 5vw, 55px);
    height: clamp(35px, 4.5vw, 48px);
    background: rgba(240, 244, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0 0 40% 40%;
    overflow: hidden;
    position: relative;
}

.tea-liquid {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    opacity: 0.7;
    animation: teaSlosh 4s ease-in-out infinite;
}

@keyframes teaSlosh {
    0%, 100% { transform: translateX(0); height: 60%; }
    50% { transform: translateX(3px); height: 65%; }
}

.endpoint-label {
    font-family: 'Quicksand', sans-serif;
    font-size: clamp(0.5rem, 0.8vw, 0.65rem);
    color: #c0c8d8;
    margin-top: 0.3rem;
    font-weight: 600;
}

.tea-conversation {
    margin-top: 1rem;
    text-align: left;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.tea-question {
    font-size: clamp(0.7rem, 1.1vw, 0.85rem);
    color: #c8b6ff;
    margin-bottom: 0.3rem;
}

.tea-answer {
    font-size: clamp(0.85rem, 1.3vw, 1rem);
    margin-bottom: 0.6rem;
}

/* --- Queen's Pane --- */
.crown-container {
    width: clamp(80px, 12vw, 130px);
    height: clamp(80px, 12vw, 130px);
    margin: 0 auto 1.5rem;
    position: relative;
    animation: crownSpin 20s linear infinite;
}

@keyframes crownSpin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.crown {
    width: 100%;
    height: 100%;
    position: relative;
}

.crown-hex {
    position: absolute;
    width: 50%;
    height: 50%;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: crownFacet 8s ease-in-out infinite;
}

.crown-hex-1 {
    top: 0; left: 25%;
    background: rgba(200, 182, 255, 0.3);
    animation-delay: 0s;
}
.crown-hex-2 {
    top: 25%; right: 0;
    background: rgba(184, 224, 255, 0.3);
    animation-delay: 1.6s;
}
.crown-hex-3 {
    bottom: 0; right: 10%;
    background: rgba(168, 240, 212, 0.3);
    animation-delay: 3.2s;
}
.crown-hex-4 {
    bottom: 0; left: 10%;
    background: rgba(255, 224, 240, 0.3);
    animation-delay: 4.8s;
}
.crown-hex-5 {
    top: 25%; left: 0;
    background: rgba(184, 212, 227, 0.3);
    animation-delay: 6.4s;
}

@keyframes crownFacet {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}

.queen-decree {
    font-size: clamp(1rem, 2.2vw, 1.5rem) ;
}

/* --- Way Back Pane --- */
.wayback-pane {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.wayback-inscription {
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    margin: 1rem 0 1.5rem;
}

/* --- Condensation Hover Effect --- */
.hex-pane {
    --mouse-x: 50%;
    --mouse-y: 50%;
}

.ring-pane::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle at var(--mouse-x) var(--mouse-y),
        rgba(255, 255, 255, 0.08) 0%,
        transparent 50%
    );
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 3;
}

.ring-pane:hover::after {
    opacity: 1;
}

/* --- Frost Creep (re-blur after idle) --- */
.hex-pane.frost-creep {
    backdrop-filter: blur(30px) saturate(120%);
    -webkit-backdrop-filter: blur(30px) saturate(120%);
    transition: backdrop-filter 3s ease;
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    #honeycomb {
        overflow-y: auto;
        overflow-x: hidden;
        align-items: flex-start;
        padding-top: 5vh;
    }

    #ring-panes {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0;
        padding-bottom: 10vh;
    }

    #ring-panes.pushed-back {
        display: none;
    }

    .ring-pane {
        position: relative;
        width: 70vw;
        height: 70vw;
        max-width: 300px;
        max-height: 300px;
        margin-top: -2rem;
        transform: rotateX(3deg) !important;
    }

    .ring-pane:first-child {
        margin-top: 0;
    }

    .ring-pane .quicksand-heading {
        font-size: 1rem;
    }

    .ring-pane .nunito-body {
        font-size: 0.8rem;
    }

    #center-pane {
        position: relative;
        width: 85vw;
        height: 85vw;
        max-width: 400px;
        max-height: 400px;
    }

    #back-to-ring {
        bottom: 3vh;
    }

    .pane-content .cinzel-display {
        font-size: 1.1rem;
    }

    .pane-content .nunito-body {
        font-size: 0.8rem;
    }

    .garden-grid {
        gap: 0.4rem;
    }

    .tea-table {
        flex-wrap: wrap;
        gap: 0.6rem;
    }
}

@media (max-width: 480px) {
    #entry-pane {
        width: 85vw;
        height: 85vw;
    }

    #entry-title {
        font-size: clamp(2.5rem, 15vw, 5rem);
    }

    .ring-pane {
        width: 80vw;
        height: 80vw;
    }

    #center-pane {
        width: 90vw;
        height: 90vw;
    }
}

/* --- Utility --- */
.hidden {
    opacity: 0;
    pointer-events: none;
}

.visible {
    opacity: 1;
    pointer-events: all;
}
