/* reiwa.boo - Scholarly Supernatural Design */
/* Colors: #1a1a2e (deep base), #4a90d9 (primary blue), #f5f0e8 (warm off-white), #e8b84b (accent gold), #6c757d (muted gray) */
/* Fonts: EB Garamond (headings), Inter (body) */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    background-color: #1a1a2e;
    color: #f5f0e8;
    overflow-x: hidden;
    line-height: 1.7;
}

/* ==========================================
   WATERCOLOR BACKGROUND
   ========================================== */

.watercolor-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.watercolor-wash {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
}

.wash-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(ellipse at center, #4a90d9 0%, transparent 70%);
    top: -10%;
    left: -10%;
    animation: watercolorDrift1 25s ease-in-out infinite;
}

.wash-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(ellipse at center, #4a90d9 0%, #1a1a2e 70%);
    bottom: 10%;
    right: -5%;
    animation: watercolorDrift2 30s ease-in-out infinite;
}

.wash-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(ellipse at center, #e8b84b 0%, transparent 70%);
    top: 40%;
    left: 50%;
    opacity: 0.08;
    animation: watercolorDrift3 20s ease-in-out infinite;
}

@keyframes watercolorDrift1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(50px, 30px) scale(1.1); }
    66% { transform: translate(-30px, 50px) scale(0.95); }
}

@keyframes watercolorDrift2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-40px, -30px) scale(1.05); }
    66% { transform: translate(30px, -20px) scale(1.1); }
}

@keyframes watercolorDrift3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-60px, 20px) scale(1.15); }
}

/* ==========================================
   HUD FRAME
   ========================================== */

.hud-frame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

.hud-corner {
    position: absolute;
    width: 30px;
    height: 30px;
}

.hud-tl {
    top: 16px;
    left: 16px;
    border-top: 1px solid rgba(74, 144, 217, 0.4);
    border-left: 1px solid rgba(74, 144, 217, 0.4);
}

.hud-tr {
    top: 16px;
    right: 16px;
    border-top: 1px solid rgba(74, 144, 217, 0.4);
    border-right: 1px solid rgba(74, 144, 217, 0.4);
}

.hud-bl {
    bottom: 16px;
    left: 16px;
    border-bottom: 1px solid rgba(74, 144, 217, 0.4);
    border-left: 1px solid rgba(74, 144, 217, 0.4);
}

.hud-br {
    bottom: 16px;
    right: 16px;
    border-bottom: 1px solid rgba(74, 144, 217, 0.4);
    border-right: 1px solid rgba(74, 144, 217, 0.4);
}

.hud-line {
    position: absolute;
    background: rgba(74, 144, 217, 0.1);
}

.hud-line-top {
    top: 16px;
    left: 46px;
    right: 46px;
    height: 1px;
}

.hud-line-bottom {
    bottom: 16px;
    left: 46px;
    right: 46px;
    height: 1px;
}

.hud-line-left {
    top: 46px;
    left: 16px;
    bottom: 46px;
    width: 1px;
}

.hud-line-right {
    top: 46px;
    right: 16px;
    bottom: 46px;
    width: 1px;
}

/* ==========================================
   HUD NAVIGATION
   ========================================== */

.hud-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 48px;
    background: linear-gradient(to bottom, rgba(26, 26, 46, 0.9), transparent);
}

.hud-nav-label {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 4px;
    color: #4a90d9;
}

.hud-nav-links {
    display: flex;
    gap: 32px;
}

.hud-link {
    font-family: 'EB Garamond', serif;
    font-size: 14px;
    color: rgba(245, 240, 232, 0.5);
    text-decoration: none;
    letter-spacing: 1px;
    transition: color 0.4s ease, text-shadow 0.4s ease;
    position: relative;
}

.hud-link:hover {
    color: #f5f0e8;
    text-shadow: 0 0 20px rgba(74, 144, 217, 0.5);
}

.hud-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: #4a90d9;
    transition: width 0.3s ease;
}

.hud-link:hover::after {
    width: 100%;
}

.hud-coordinates {
    font-size: 10px;
    letter-spacing: 2px;
    color: rgba(74, 144, 217, 0.5);
    display: flex;
    gap: 8px;
}

.coord-label {
    color: #e8b84b;
    font-weight: 500;
}

/* ==========================================
   HERO SECTION
   ========================================== */

.hero {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero-content {
    position: relative;
}

.hero-glitch {
    position: relative;
    font-family: 'EB Garamond', serif;
    font-size: 80px;
    font-weight: 400;
    color: rgba(74, 144, 217, 0.15);
    letter-spacing: 20px;
    margin-bottom: 16px;
    user-select: none;
}

.glitch-text {
    position: relative;
    display: inline-block;
}

.hero-glitch::before,
.hero-glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.hero-glitch::before {
    color: rgba(232, 184, 75, 0.3);
    animation: glitch1 4s infinite;
}

.hero-glitch::after {
    color: rgba(74, 144, 217, 0.3);
    animation: glitch2 4s infinite;
}

@keyframes glitch1 {
    0%, 90%, 100% { opacity: 0; transform: translate(0); }
    91% { opacity: 1; transform: translate(-3px, 2px); clip-path: inset(20% 0 40% 0); }
    93% { opacity: 1; transform: translate(3px, -1px); clip-path: inset(60% 0 10% 0); }
    95% { opacity: 0; transform: translate(0); }
}

@keyframes glitch2 {
    0%, 88%, 100% { opacity: 0; transform: translate(0); }
    89% { opacity: 1; transform: translate(2px, -2px); clip-path: inset(40% 0 20% 0); }
    91% { opacity: 1; transform: translate(-2px, 1px); clip-path: inset(10% 0 70% 0); }
    93% { opacity: 0; transform: translate(0); }
}

.hero-title {
    font-family: 'EB Garamond', serif;
    font-size: 64px;
    font-weight: 400;
    letter-spacing: 8px;
    color: #f5f0e8;
    margin-bottom: 16px;
    text-shadow: 0 0 60px rgba(74, 144, 217, 0.3);
}

.hero-subtitle {
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: 20px;
    color: rgba(245, 240, 232, 0.6);
    letter-spacing: 3px;
    margin-bottom: 40px;
}

.hero-hud-panel {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: center;
}

.hud-panel-line {
    width: 60px;
    height: 1px;
    background: linear-gradient(to right, transparent, #4a90d9, transparent);
}

.hud-panel-text {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    letter-spacing: 4px;
    color: rgba(74, 144, 217, 0.6);
}

.hero-scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    animation: scrollPulse 2s ease-in-out infinite;
}

.scroll-kanji {
    font-size: 10px;
    letter-spacing: 3px;
    color: rgba(74, 144, 217, 0.4);
}

.scroll-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, #4a90d9, transparent);
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.4; transform: translateX(-50%) translateY(0); }
    50% { opacity: 1; transform: translateX(-50%) translateY(8px); }
}

/* ==========================================
   CHAPTERS
   ========================================== */

.chapter {
    position: relative;
    z-index: 1;
    padding: 120px 48px;
    max-width: 1200px;
    margin: 0 auto;
}

.chapter-header {
    text-align: center;
    margin-bottom: 80px;
}

.chapter-number {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    letter-spacing: 6px;
    color: #e8b84b;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.chapter-title {
    font-family: 'EB Garamond', serif;
    font-size: 42px;
    font-weight: 400;
    color: #f5f0e8;
    letter-spacing: 4px;
    margin-bottom: 24px;
}

.chapter-rule {
    width: 60px;
    height: 1px;
    background: #4a90d9;
    margin: 0 auto;
    opacity: 0.5;
}

/* ==========================================
   HUD INFO PANELS
   ========================================== */

.chapter-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.hud-info-panel {
    position: relative;
    padding: 32px;
    background: rgba(26, 26, 46, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(74, 144, 217, 0.15);
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.hud-info-panel:hover {
    border-color: rgba(74, 144, 217, 0.35);
    box-shadow: 0 0 40px rgba(74, 144, 217, 0.08);
}

.panel-border {
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    pointer-events: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(74, 144, 217, 0.1);
}

.panel-id {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    letter-spacing: 3px;
    color: #6c757d;
}

.panel-status {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    letter-spacing: 2px;
    color: #4a90d9;
    padding: 2px 8px;
    border: 1px solid rgba(74, 144, 217, 0.3);
}

.panel-title {
    font-family: 'EB Garamond', serif;
    font-size: 26px;
    font-weight: 600;
    color: #f5f0e8;
    margin-bottom: 16px;
}

.panel-text {
    font-size: 14px;
    line-height: 1.8;
    color: rgba(245, 240, 232, 0.7);
    margin-bottom: 24px;
}

.panel-data {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(74, 144, 217, 0.08);
}

.data-label {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    letter-spacing: 3px;
    color: #6c757d;
}

.data-value {
    font-family: 'EB Garamond', serif;
    font-size: 15px;
    color: #e8b84b;
}

.panel-motif {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.motif-svg {
    width: 120px;
    height: 120px;
    animation: motifSpin 60s linear infinite;
}

@keyframes motifSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==========================================
   HAUNTING CARDS
   ========================================== */

.haunting-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.haunting-card {
    position: relative;
    overflow: hidden;
    background: rgba(26, 26, 46, 0.7);
    border: 1px solid rgba(74, 144, 217, 0.12);
    transition: transform 0.4s ease, border-color 0.4s ease;
}

.haunting-card:hover {
    transform: translateY(-4px);
    border-color: rgba(74, 144, 217, 0.3);
}

.card-glitch-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(74, 144, 217, 0.03) 2px,
        rgba(74, 144, 217, 0.03) 4px
    );
}

.haunting-card:hover .card-glitch-overlay {
    opacity: 1;
    animation: cardGlitch 0.3s steps(3) forwards;
}

@keyframes cardGlitch {
    0% { opacity: 0; transform: translateX(0); }
    33% { opacity: 0.8; transform: translateX(-2px); }
    66% { opacity: 0.5; transform: translateX(2px); }
    100% { opacity: 0; transform: translateX(0); }
}

.card-inner {
    padding: 28px;
    position: relative;
    z-index: 1;
}

.card-hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-index {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    letter-spacing: 3px;
    color: #4a90d9;
}

.card-freq {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    letter-spacing: 2px;
    color: #6c757d;
}

.card-title {
    font-family: 'EB Garamond', serif;
    font-size: 22px;
    font-weight: 600;
    color: #f5f0e8;
    margin-bottom: 12px;
}

.card-desc {
    font-size: 13px;
    line-height: 1.8;
    color: rgba(245, 240, 232, 0.6);
    margin-bottom: 20px;
}

.card-severity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.severity-label {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    letter-spacing: 3px;
    color: #6c757d;
}

.severity-bar {
    flex: 1;
    height: 2px;
    background: rgba(74, 144, 217, 0.15);
    position: relative;
}

.severity-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(to right, #4a90d9, #e8b84b);
    transition: width 1s ease;
}

/* ==========================================
   STUDIES LAYOUT
   ========================================== */

.studies-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

.study-quote {
    font-family: 'EB Garamond', serif;
    font-size: 18px;
    font-style: italic;
    line-height: 1.8;
    color: rgba(245, 240, 232, 0.8);
    padding: 24px;
    border-left: 2px solid rgba(232, 184, 75, 0.4);
    margin-bottom: 16px;
    background: rgba(74, 144, 217, 0.03);
}

.study-author {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: #6c757d;
    letter-spacing: 1px;
    margin-bottom: 32px;
}

.study-diagram {
    margin-top: 24px;
}

.diagram-svg {
    width: 100%;
    max-width: 400px;
    height: auto;
}

.study-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-widget {
    padding: 20px;
    background: rgba(26, 26, 46, 0.6);
    border: 1px solid rgba(74, 144, 217, 0.12);
}

.widget-header {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    letter-spacing: 3px;
    color: #4a90d9;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(74, 144, 217, 0.1);
}

.spectral-meter {
    padding: 8px 0;
}

.meter-track {
    width: 100%;
    height: 4px;
    background: rgba(74, 144, 217, 0.1);
    margin-bottom: 8px;
    position: relative;
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    background: linear-gradient(to right, #4a90d9, #e8b84b);
    width: 0%;
    transition: width 2s ease;
}

.meter-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #6c757d;
    letter-spacing: 1px;
}

.phenomena-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.phenomenon-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.phenomenon-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.phenomenon-dot.active {
    background: #4a90d9;
    box-shadow: 0 0 8px rgba(74, 144, 217, 0.5);
    animation: dotPulse 2s ease-in-out infinite;
}

.phenomenon-dot.dormant {
    background: #6c757d;
}

.phenomenon-dot.critical {
    background: #e8b84b;
    box-shadow: 0 0 8px rgba(232, 184, 75, 0.5);
    animation: dotPulse 1s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.phenomenon-name {
    font-size: 13px;
    color: rgba(245, 240, 232, 0.7);
}

.widget-text {
    font-size: 13px;
    line-height: 1.7;
    color: rgba(245, 240, 232, 0.6);
}

/* ==========================================
   ARCHIVE LAYOUT
   ========================================== */

.archive-layout {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.archive-entry {
    display: flex;
    gap: 32px;
    padding: 32px;
    background: rgba(26, 26, 46, 0.5);
    border: 1px solid rgba(74, 144, 217, 0.1);
    transition: border-color 0.4s ease, background 0.4s ease;
}

.archive-entry:hover {
    border-color: rgba(74, 144, 217, 0.25);
    background: rgba(26, 26, 46, 0.7);
}

.entry-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    padding-right: 32px;
    border-right: 1px solid rgba(74, 144, 217, 0.15);
}

.date-era {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    letter-spacing: 3px;
    color: #6c757d;
}

.date-year {
    font-family: 'EB Garamond', serif;
    font-size: 36px;
    color: #4a90d9;
    line-height: 1;
}

.entry-content {
    flex: 1;
}

.entry-title {
    font-family: 'EB Garamond', serif;
    font-size: 22px;
    font-weight: 600;
    color: #f5f0e8;
    margin-bottom: 12px;
}

.entry-text {
    font-size: 14px;
    line-height: 1.8;
    color: rgba(245, 240, 232, 0.6);
    margin-bottom: 16px;
}

.entry-tags {
    display: flex;
    gap: 8px;
}

.tag {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    letter-spacing: 2px;
    color: #e8b84b;
    padding: 4px 12px;
    border: 1px solid rgba(232, 184, 75, 0.25);
    transition: background 0.3s ease, color 0.3s ease;
}

.tag:hover {
    background: rgba(232, 184, 75, 0.1);
}

/* ==========================================
   FOOTER
   ========================================== */

.site-footer {
    position: relative;
    z-index: 1;
    padding: 40px 48px;
    margin-top: 80px;
}

.footer-hud {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-line {
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(74, 144, 217, 0.3), transparent);
    margin-bottom: 24px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-left,
.footer-center,
.footer-right {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer-center {
    align-items: center;
}

.footer-right {
    align-items: flex-end;
}

.footer-label {
    font-family: 'EB Garamond', serif;
    font-size: 18px;
    color: #f5f0e8;
}

.footer-sub {
    font-size: 10px;
    letter-spacing: 2px;
    color: #6c757d;
}

.footer-status {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    letter-spacing: 3px;
    color: #4a90d9;
}

.footer-time {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    letter-spacing: 2px;
    color: rgba(245, 240, 232, 0.4);
    font-variant-numeric: tabular-nums;
}

.footer-coord {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    letter-spacing: 3px;
    color: #6c757d;
}

.footer-year {
    font-family: 'EB Garamond', serif;
    font-size: 14px;
    color: #e8b84b;
}

/* ==========================================
   SCROLL REVEAL ANIMATIONS
   ========================================== */

.chapter {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.chapter.revealed {
    opacity: 1;
    transform: translateY(0);
}

.hud-info-panel,
.haunting-card,
.archive-entry {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.hud-info-panel.revealed,
.haunting-card.revealed,
.archive-entry.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================
   BLUR-FOCUS TRANSITIONS
   ========================================== */

.chapter-header {
    filter: blur(0);
    transition: filter 0.6s ease;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .hud-nav {
        flex-direction: column;
        gap: 12px;
        padding: 16px 24px;
    }

    .hud-nav-links {
        gap: 16px;
    }

    .hero-title {
        font-size: 36px;
    }

    .hero-glitch {
        font-size: 48px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

    .chapter {
        padding: 80px 24px;
    }

    .chapter-content,
    .haunting-grid {
        grid-template-columns: 1fr;
    }

    .studies-layout {
        grid-template-columns: 1fr;
    }

    .archive-entry {
        flex-direction: column;
    }

    .entry-date {
        flex-direction: row;
        gap: 8px;
        padding-right: 0;
        padding-bottom: 16px;
        border-right: none;
        border-bottom: 1px solid rgba(74, 144, 217, 0.15);
    }

    .footer-content {
        flex-direction: column;
        gap: 16px;
        align-items: center;
        text-align: center;
    }

    .footer-right {
        align-items: center;
    }
}
