/* =============================================================
   liquid-glass.css  —  전역 Liquid Glass 레이어
   유리 굴절(feDisplacementMap) 텍스트와 frosted glass 카드/패널을
   전 페이지에 입힌다. SVG 필터 defs와 이 파일 링크는 base.html에서
   전역으로 로드된다. styles.css 뒤에 로드되어 질감만 덧입힌다.
   (충돌 회피: 공유 styles.css는 건드리지 않는 별도 파일)
   ============================================================= */

:root {
    --lg-warm: #ff9c52;
    --lg-cool: #79d4ff;
    --lg-iris: #b58bff;   /* 유리 굴절 무지개빛 */
    --lg-rose: #ff7eb6;
    --lg-glass-bg: rgba(255, 255, 255, 0.055);
    --lg-glass-brd: rgba(255, 255, 255, 0.16);
    --lg-ease: cubic-bezier(0.22, 1, 0.36, 1);

    /* monospace 요소(수치/코드/기보)에 섞인 한글이 못생긴 기본 폰트로
       폴백되던 문제 수정 — 라틴 글자는 monospace, 한글은 SUIT로 폴백.
       styles.css의 :root --font-mono 를 뒤에서 덮어써 전역 적용된다. */
    --font-mono: ui-monospace, "SF Mono", "Segoe UI Mono", "Roboto Mono",
        Menlo, Consolas, "Liberation Mono",
        "SUIT Variable", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic",
        monospace;
}

/* SVG 필터 defs 컨테이너는 화면에서 숨긴다 (필터 정의만 참조) */
.lg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}

/* =============================================================
   1) 굴절 텍스트 — 유리 너머 글자가 일렁이는 효과
      전 페이지의 대표 제목(.hero-title / .section-title)에 확산.
      .liquid-text 로 개별 강조어에도 사용.
   ============================================================= */
.liquid-text,
.landing-page .lg-hero__title .liquid-text,
h1.hero-title,
.section-title {
    background: linear-gradient(100deg,
        var(--lg-cool), var(--lg-iris) 42%, var(--lg-rose) 70%, var(--lg-warm));
    -webkit-background-clip: text;
            background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* 잔잔하게 흐르는 굴절 (제목 전반) */
h1.hero-title,
.section-title,
.liquid-text {
    filter: url("#lg-flow");
    padding-right: 0.06em;   /* displacement 잘림 방지 */
}

/* 강하게 일렁이는 굴절 (히어로 강조어) */
.liquid-text--flow {
    filter: url("#lg-liquid");
}

/* =============================================================
   2) 유리 카드/패널 — frosted liquid glass 를 전 페이지에 확산
   ============================================================= */
.portal-grid {
    perspective: 1400px;
}

.portal-card,
.surface-panel,
.status-card,
.mini-stat {
    background:
        linear-gradient(150deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.015)),
        var(--lg-glass-bg);
    border: 1px solid var(--lg-glass-brd);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    box-shadow:
        0 22px 48px rgba(0, 0, 0, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 0 22px rgba(121, 212, 255, 0.05);
}

/* Chromium: 작은 카드 뒤 배경을 실제 굴절시켜 진짜 유리처럼
   (성능 위해 큰 패널이 아닌 카드류에만 backdrop 굴절 적용) */
@supports (backdrop-filter: url("#lg-refract")) {
    .portal-card {
        backdrop-filter: url("#lg-refract") blur(6px) saturate(150%);
        -webkit-backdrop-filter: url("#lg-refract") blur(6px) saturate(150%);
    }
}

/* 카드 유리 테두리 정반사 림라이트 (landing 전용 ::before) */
.landing-page .portal-card {
    position: relative;
    overflow: hidden;
}
.landing-page .portal-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(140deg,
        rgba(255, 255, 255, 0.5),
        transparent 32%,
        transparent 66%,
        rgba(121, 212, 255, 0.28));
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    opacity: 0.9;
    pointer-events: none;
    z-index: 1;
}
.landing-page .portal-card > * {
    position: relative;
    z-index: 2;
}

.landing-page .portal-card .card-icon {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 6px 16px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* 카드 아이콘 — 텍스트 대신 라인 SVG */
.card-icon svg {
    width: 1.6rem;
    height: 1.6rem;
    display: block;
    color: #eef4ff;
    stroke: currentColor;
}

/* 내용을 비운 히어로 — 이펙트 캔버스 높이 유지 */
.lg-hero--empty {
    min-height: clamp(220px, 32vh, 400px);
}

.portal-card:hover {
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow:
        0 30px 66px rgba(0, 0, 0, 0.46),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 0 40px rgba(181, 139, 255, 0.14);
}
.landing-page .portal-card:hover::before {
    background: linear-gradient(140deg,
        rgba(255, 255, 255, 0.65),
        rgba(181, 139, 255, 0.35) 30%,
        transparent 55%,
        rgba(121, 212, 255, 0.4));
}
.landing-page .portal-card .card-meta {
    color: var(--lg-cool);
}

/* 외부(번들) 서비스 카드 — 자체 제작 기능과 시각적으로 구분 */
.portal-card--external {
    background:
        linear-gradient(150deg, rgba(121, 212, 255, 0.07), rgba(255, 255, 255, 0.012)),
        var(--lg-glass-bg);
}
.card-badge--external {
    color: var(--lg-cool);
    background: rgba(121, 212, 255, 0.12);
    border: 1px solid rgba(121, 212, 255, 0.32);
}
.landing-page .portal-card--external .card-meta {
    color: var(--lg-iris);
}

/* =============================================================
   2-b) 기능별 시그니처 효과 — 카드마다 다른 살아있는 모션
   .card-fx 는 콘텐츠 뒤(z-index 0)에 깔리는 효과 전용 레이어.
   ============================================================= */
.landing-page .portal-card > .card-fx {
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    overflow: hidden;
    pointer-events: none;
}

/* 파일 — 사선으로 훑고 지나가는 광택 sheen */
.fx-sheen > .card-fx::before {
    content: "";
    position: absolute;
    top: -60%;
    left: -70%;
    width: 45%;
    height: 220%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
    transform: rotate(18deg);
    animation: fxSheen 5s var(--lg-ease) infinite;
}
@keyframes fxSheen {
    0% { left: -70%; }
    55%, 100% { left: 130%; }
}

/* 일정 — 부드럽게 떠다니는 오로라 */
.fx-aurora > .card-fx {
    background:
        radial-gradient(52% 62% at 22% 28%, rgba(121, 212, 255, 0.24), transparent 70%),
        radial-gradient(52% 62% at 78% 72%, rgba(181, 139, 255, 0.24), transparent 70%);
    animation: fxAurora 9s ease-in-out infinite;
}
@keyframes fxAurora {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(7%, -5%, 0) scale(1.18); }
}

/* 게임 — 제목에 걸리는 크로마틱(RGB 분리) 진동 */
.fx-chroma .card-title {
    animation: fxChroma 2.4s ease-in-out infinite;
}
@keyframes fxChroma {
    0%, 100% { text-shadow: -1.4px 0 rgba(255, 60, 140, 0.55), 1.4px 0 rgba(60, 210, 255, 0.55); }
    50% { text-shadow: 1.4px 0 rgba(255, 60, 140, 0.55), -1.4px 0 rgba(60, 210, 255, 0.55); }
}

/* 주식 — 아래에서 차오르는 상승 글로우(그린) */
.fx-ticker > .card-fx::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -45%;
    height: 65%;
    background: linear-gradient(0deg, rgba(52, 216, 160, 0.22), transparent);
    animation: fxTicker 4.2s ease-in-out infinite;
}
@keyframes fxTicker {
    0%, 100% { transform: translateY(22%); opacity: 0.35; }
    50% { transform: translateY(-32%); opacity: 0.9; }
}

/* 웹훅 — 레이더 핑(수신 콜백) */
.fx-ping > .card-fx::before {
    content: "";
    position: absolute;
    top: 2.35rem;
    left: 2.15rem;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    border: 1px solid rgba(121, 212, 255, 0.55);
    transform: translate(-50%, -50%) scale(0.6);
    animation: fxPing 2.6s ease-out infinite;
}
@keyframes fxPing {
    0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0.85; }
    80%, 100% { transform: translate(-50%, -50%) scale(2.8); opacity: 0; }
}

/* JWT — 위→아래로 훑는 스캔 라인 */
.fx-scan > .card-fx::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(121, 212, 255, 0.85), transparent);
    box-shadow: 0 0 12px rgba(121, 212, 255, 0.6);
    animation: fxScan 3.4s linear infinite;
}
@keyframes fxScan {
    0% { top: -2%; opacity: 0; }
    12% { opacity: 1; }
    88% { opacity: 1; }
    100% { top: 102%; opacity: 0; }
}

/* 관리자 — 잔잔히 흐르는 제어실 그리드 */
.fx-grid > .card-fx {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 22px 22px;
    -webkit-mask-image: radial-gradient(circle at 72% 26%, #000, transparent 76%);
            mask-image: radial-gradient(circle at 72% 26%, #000, transparent 76%);
    animation: fxGrid 6s linear infinite;
}
@keyframes fxGrid {
    to { background-position: 22px 22px; }
}

/* =============================================================
   3) HERO — 유동 유리 슬래브 + gooey 블롭 (랜딩)
   ============================================================= */
.lg-hero {
    position: relative;
    isolation: isolate;
    margin: 0.5rem 0 2.75rem;
    padding: clamp(1.8rem, 4.5vw, 3.6rem);
    border-radius: 32px;
    overflow: hidden;
    border: 1px solid var(--lg-glass-brd);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02)),
        radial-gradient(120% 140% at 12% 0%, rgba(121, 212, 255, 0.16), transparent 46%),
        radial-gradient(120% 140% at 100% 10%, rgba(181, 139, 255, 0.16), transparent 44%),
        radial-gradient(140% 160% at 80% 120%, rgba(255, 156, 82, 0.14), transparent 50%);
    box-shadow:
        0 40px 90px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        inset 0 -1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(22px) saturate(155%);
    -webkit-backdrop-filter: blur(22px) saturate(155%);
}
@supports (backdrop-filter: url("#lg-refract")) {
    .lg-hero {
        backdrop-filter: url("#lg-refract") blur(9px) saturate(160%);
        -webkit-backdrop-filter: url("#lg-refract") blur(9px) saturate(160%);
    }
}

.lg-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(120deg,
        rgba(255, 255, 255, 0.55),
        rgba(121, 212, 255, 0.15) 22%,
        transparent 40%,
        transparent 62%,
        rgba(181, 139, 255, 0.22) 82%,
        rgba(255, 255, 255, 0.4));
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
    z-index: 3;
}

.lg-hero::after {
    content: "";
    position: absolute;
    inset: -30%;
    background:
        radial-gradient(circle at var(--pointer-x, 40%) var(--pointer-y, 35%),
            rgba(255, 255, 255, 0.16), transparent 22%),
        radial-gradient(circle at calc(var(--pointer-x, 40%) + 8%) calc(var(--pointer-y, 35%) + 6%),
            rgba(121, 212, 255, 0.14), transparent 26%);
    opacity: 0.9;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.4s ease;
}

.lg-hero__goo {
    position: absolute;
    inset: -12%;
    z-index: 0;
    filter: url("#lg-goo");
    pointer-events: none;
    opacity: 0.85;
}
.lg-blob {
    position: absolute;
    border-radius: 50%;
    mix-blend-mode: screen;
    will-change: transform;
}
.lg-blob--a {
    width: 20rem; height: 20rem; left: 4%; top: 8%;
    background: radial-gradient(circle at 35% 35%, var(--lg-cool), transparent 68%);
    animation: lgBlobA 17s var(--lg-ease) infinite;
}
.lg-blob--b {
    width: 17rem; height: 17rem; right: 6%; top: 2%;
    background: radial-gradient(circle at 40% 30%, var(--lg-iris), transparent 66%);
    animation: lgBlobB 21s var(--lg-ease) infinite;
}
.lg-blob--c {
    width: 15rem; height: 15rem; left: 42%; bottom: -6%;
    background: radial-gradient(circle at 45% 40%, var(--lg-warm), transparent 66%);
    animation: lgBlobC 19s var(--lg-ease) infinite;
}
@keyframes lgBlobA {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(6rem, 3rem) scale(1.12); }
    66%      { transform: translate(2rem, -2rem) scale(0.94); }
}
@keyframes lgBlobB {
    0%, 100% { transform: translate(0, 0) scale(1); }
    40%      { transform: translate(-5rem, 4rem) scale(1.08); }
    75%      { transform: translate(-2rem, -3rem) scale(0.96); }
}
@keyframes lgBlobC {
    0%, 100% { transform: translate(0, 0) scale(1.05); }
    50%      { transform: translate(-4rem, -4rem) scale(0.9); }
}

.lg-hero__inner {
    position: relative;
    z-index: 2;
    max-width: 46rem;
}
.lg-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 1.15rem;
    padding: 0.42rem 0.9rem;
    border-radius: 999px;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    color: #dbe6f4;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.lg-eyebrow::before {
    content: "";
    width: 0.55rem; height: 0.55rem;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--lg-cool), var(--lg-iris), var(--lg-rose), var(--lg-warm), var(--lg-cool));
    box-shadow: 0 0 16px rgba(181, 139, 255, 0.6);
    animation: lgSpin 6s linear infinite;
}
@keyframes lgSpin { to { transform: rotate(1turn); } }

.lg-hero__title {
    margin: 0 0 1.1rem;
    font-size: clamp(2.4rem, 6.2vw, 5rem);
    line-height: 0.98;
    letter-spacing: -0.045em;
    font-weight: 800;
    color: #f7fbff;
}
.lg-hero__title .liquid-text {
    display: inline-block;
    background: linear-gradient(100deg, var(--lg-cool), var(--lg-iris) 42%, var(--lg-rose) 70%, var(--lg-warm));
    -webkit-background-clip: text;
            background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    padding-right: 0.08em;
}
.lg-hero__lead {
    margin: 0;
    max-width: 34rem;
    font-size: clamp(1rem, 1.6vw, 1.12rem);
    line-height: 1.55;
    color: #b8c6d9;
}
.lg-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1.8rem;
}

/* =============================================================
   4) 반응형 & 모션 접근성
   ============================================================= */
@media (max-width: 620px) {
    .lg-hero { padding: 1.5rem 1.25rem; border-radius: 24px; }
    .lg-hero__goo { opacity: 0.7; }
}

@media (prefers-reduced-motion: reduce) {
    .lg-blob,
    .lg-eyebrow::before,
    .card-fx,
    .card-fx::before,
    .fx-aurora > .card-fx,
    .fx-grid > .card-fx,
    .fx-chroma .card-title {
        animation: none !important;
    }
    .fx-chroma .card-title { text-shadow: none !important; }
    /* displacement 애니메이션으로 인한 repaint 정지 (제목은 그라디언트 유지) */
    h1.hero-title,
    .section-title,
    .liquid-text,
    .liquid-text--flow {
        filter: none !important;
    }
}
