/* =========================================
   상처의 해우소 — Sanctuary of Release
   봉인 의식 디자인 시스템
   ========================================= */

.haewuso-page {
    position: relative;
    min-height: 100vh;
    padding-top: 60px;
    padding-bottom: 100px;
}

/* === 히어로 === */
.haewuso-hero {
    text-align: center;
    padding: 60px 0 50px;
    position: relative;
    animation: haewusoFadeIn 1.2s ease-out;
}

.haewuso-hero-symbol {
    width: 100px;
    height: 100px;
    margin: 0 auto 30px;
    animation: symbolRotate 60s linear infinite;
    opacity: 0.5;
}

.seal-symbol {
    width: 100%;
    height: 100%;
}

@keyframes symbolRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.haewuso-label {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 11px;
    letter-spacing: 0.5em;
    color: rgba(212, 175, 55, 0.5);
    margin-bottom: 16px;
    text-transform: uppercase;
}

.haewuso-title {
    font-family: 'Noto Serif KR', serif;
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 300;
    color: #fff;
    letter-spacing: 0.15em;
    margin-bottom: 24px;
}

.haewuso-desc {
    font-family: 'Noto Serif KR', serif;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 2;
    font-weight: 300;
}

.haewuso-desc em {
    color: rgba(212, 175, 55, 0.7);
    font-style: normal;
}

.haewuso-stats {
    display: flex;
    gap: 40px;
    justify-content: center;
    margin-top: 40px;
}

.haewuso-stat {
    text-align: center;
}

.haewuso-stat-num {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 28px;
    color: var(--color-gold);
    font-weight: 400;
    letter-spacing: 0.05em;
}

.haewuso-stat-label {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 6px;
    letter-spacing: 0.1em;
}

/* === 작성 영역 === */
.haewuso-write {
    max-width: 640px;
    margin: 0 auto 60px;
    animation: haewusoFadeIn 1.4s ease-out;
}

.haewuso-write-inner {
    background: rgba(20, 20, 35, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(212, 175, 55, 0.08);
    border-radius: 20px;
    padding: 32px;
    transition: border-color 0.5s ease;
}

.haewuso-write-inner:focus-within {
    border-color: rgba(212, 175, 55, 0.2);
}

.haewuso-write-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

/* 촛불 애니메이션 */
.write-candle {
    position: relative;
    width: 20px;
    height: 36px;
    flex-shrink: 0;
}

.candle-body {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 20px;
    background: linear-gradient(to bottom, #f5e6c8, #e8d4a8);
    border-radius: 2px 2px 3px 3px;
}

.candle-flame {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 14px;
    background: radial-gradient(ellipse at center bottom, #ff9f43, #f9ca24, transparent);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flameFlicker 1.5s ease-in-out infinite alternate;
    filter: blur(0.5px);
}

.candle-flame::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, rgba(255, 159, 67, 0.2), transparent);
    border-radius: 50%;
    animation: flameGlow 2s ease-in-out infinite alternate;
}

@keyframes flameFlicker {
    0% { transform: translateX(-50%) scaleX(1) scaleY(1); }
    25% { transform: translateX(-50%) scaleX(0.9) scaleY(1.05) rotate(-2deg); }
    50% { transform: translateX(-50%) scaleX(1.05) scaleY(0.95); }
    75% { transform: translateX(-50%) scaleX(0.95) scaleY(1.02) rotate(2deg); }
    100% { transform: translateX(-50%) scaleX(1) scaleY(0.98); }
}

@keyframes flameGlow {
    from { opacity: 0.4; transform: translateX(-50%) scale(1); }
    to { opacity: 0.7; transform: translateX(-50%) scale(1.2); }
}

.write-guide {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 300;
}

.haewuso-textarea {
    width: 100%;
    min-height: 150px;
    max-height: 400px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-family: 'Noto Serif KR', serif;
    font-size: 15px;
    line-height: 1.9;
    resize: vertical;
    outline: none;
    padding: 0;
}

.haewuso-textarea::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.haewuso-write-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.char-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.25);
}

.btn-seal {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 28px;
    background: transparent;
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: var(--color-gold);
    font-family: 'Noto Serif KR', serif;
    font-size: 14px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.4s ease;
    letter-spacing: 0.1em;
}

.btn-seal:hover:not(:disabled) {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--color-gold);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.1);
}

.btn-seal:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* 비로그인 프롬프트 */
.haewuso-login-prompt {
    max-width: 400px;
    margin: 0 auto 60px;
    text-align: center;
    padding: 40px;
    background: rgba(20, 20, 35, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
}

.haewuso-login-prompt p {
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    margin-bottom: 20px;
}

.btn-seal-login {
    display: inline-block;
    padding: 10px 32px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: var(--color-gold);
    font-size: 13px;
    letter-spacing: 0.1em;
    border-radius: 30px;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-seal-login:hover {
    background: rgba(212, 175, 55, 0.1);
}

/* === 봉인 오버레이 애니메이션 === */
.seal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: rgba(5, 5, 10, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease;
}

.seal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.seal-overlay.fade-out {
    opacity: 0;
}

.seal-animation {
    text-align: center;
    position: relative;
}

/* 봉인 링 애니메이션 */
.seal-rings {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 40px;
}

.seal-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid transparent;
}

.seal-ring.ring-1 {
    top: 0; left: 0; right: 0; bottom: 0;
    border-color: rgba(212, 175, 55, 0.3);
    animation: sealRing1 3s ease-out forwards;
}

.seal-ring.ring-2 {
    top: 25px; left: 25px; right: 25px; bottom: 25px;
    border-color: rgba(212, 175, 55, 0.2);
    animation: sealRing2 3s ease-out 0.3s forwards;
}

.seal-ring.ring-3 {
    top: 50px; left: 50px; right: 50px; bottom: 50px;
    border-color: rgba(212, 175, 55, 0.15);
    animation: sealRing3 3s ease-out 0.6s forwards;
}

@keyframes sealRing1 {
    0% { transform: scale(0.3) rotate(0deg); opacity: 0; }
    40% { transform: scale(1.1) rotate(120deg); opacity: 1; }
    100% { transform: scale(1) rotate(360deg); opacity: 0.6; }
}

@keyframes sealRing2 {
    0% { transform: scale(0.3) rotate(0deg); opacity: 0; }
    40% { transform: scale(1.1) rotate(-90deg); opacity: 1; }
    100% { transform: scale(1) rotate(-270deg); opacity: 0.5; }
}

@keyframes sealRing3 {
    0% { transform: scale(0.3) rotate(0deg); opacity: 0; }
    40% { transform: scale(1.15) rotate(60deg); opacity: 1; }
    100% { transform: scale(1) rotate(180deg); opacity: 0.4; }
}

.seal-stamp {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: stampAppear 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 1.2s forwards;
}

.seal-stamp-icon {
    width: 80px;
    height: 80px;
}

@keyframes stampAppear {
    0% { transform: translate(-50%, -50%) scale(0) rotate(-30deg); }
    60% { transform: translate(-50%, -50%) scale(1.2) rotate(5deg); }
    100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

.seal-message {
    font-family: 'Noto Serif KR', serif;
    font-size: 22px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 300;
    letter-spacing: 0.2em;
    opacity: 0;
    animation: sealTextAppear 1s ease-out 2s forwards;
}

.seal-submessage {
    font-family: 'Noto Serif KR', serif;
    font-size: 15px;
    color: rgba(212, 175, 55, 0.6);
    font-weight: 300;
    letter-spacing: 0.3em;
    margin-top: 12px;
    opacity: 0;
    animation: sealTextAppear 1s ease-out 2.5s forwards;
}

@keyframes sealTextAppear {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* === 봉인된 글 벽 === */
.sealed-wall {
    margin-top: 80px;
    animation: haewusoFadeIn 1.6s ease-out;
}

.sealed-wall-header {
    text-align: center;
    margin-bottom: 40px;
}

.sealed-wall-label {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 10px;
    letter-spacing: 0.5em;
    color: rgba(212, 175, 55, 0.3);
    margin-bottom: 10px;
}

.sealed-wall-title {
    font-family: 'Noto Serif KR', serif;
    font-size: 20px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.15em;
}

.sealed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.sealed-card {
    background: rgba(15, 15, 25, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
    animation: sealedCardAppear 0.6s ease-out calc(var(--delay, 0s)) both;
}

.sealed-card:hover {
    border-color: rgba(212, 175, 55, 0.08);
    transform: translateY(-2px);
}

@keyframes sealedCardAppear {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 블러 텍스트 */
.sealed-card-blur {
    margin-bottom: 14px;
    position: relative;
}

.sealed-blur-text {
    font-size: 13px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.15);
    filter: blur(5px);
    -webkit-filter: blur(5px);
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
    overflow: hidden;
    max-height: 80px;
    word-break: break-all;
}

.sealed-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sealed-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sealed-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    opacity: 0.6;
}

.sealed-avatar-placeholder {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.1);
}

.sealed-name {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
}

.sealed-stamp-mini {
    color: rgba(212, 175, 55, 0.3);
}

.sealed-time {
    display: block;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.15);
    margin-top: 10px;
}

/* === 공통 애니메이션 === */
@keyframes haewusoFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === 모션 감소 접근성 === */
@media (prefers-reduced-motion: reduce) {
    .haewuso-hero-symbol,
    .candle-flame,
    .candle-flame::after,
    .seal-ring,
    .seal-stamp,
    .seal-message,
    .seal-submessage,
    .sealed-card {
        animation: none !important;
    }
    .seal-stamp { transform: translate(-50%, -50%) scale(1); }
    .seal-message, .seal-submessage { opacity: 1; }
    .sealed-card { opacity: 1; }
}

/* === 반응형 === */
@media (max-width: 768px) {
    .haewuso-hero { padding: 40px 0 30px; }
    .haewuso-hero-symbol { width: 70px; height: 70px; }
    .haewuso-write-inner { padding: 24px 20px; }
    .haewuso-desc br { display: none; }
    .sealed-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .sealed-card { padding: 16px; }
    .seal-rings { width: 150px; height: 150px; }
    .seal-ring.ring-2 { top: 20px; left: 20px; right: 20px; bottom: 20px; }
    .seal-ring.ring-3 { top: 40px; left: 40px; right: 40px; bottom: 40px; }
}
