/* =========================================
   MANGA MONUMENT — manga.css
   Modular stylesheet for /manga routes
   Imports site vars from style.css
   ========================================= */

/* ── Hub Page Layout ── */
.manga-hub-page
{
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.manga-characters-grid
{
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.2rem;
    padding: 2rem 0;
}

/* ── Panel Card ── */
.manga-char-panel
{
    position: relative;
    background: linear-gradient(135deg, var(--bg-panel) 0%, var(--bg-card) 100%);
    border: 2px solid rgba(0, 255, 255, 0.25);
    border-radius: 15px;
    overflow: hidden;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.4s ease;
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.1);
}

.manga-char-panel:hover
{
    border-color: var(--panel-accent);
    box-shadow: 0 0 40px var(--panel-accent), 0 20px 40px rgba(0, 0, 0, 0.4), inset 0 0 20px rgba(255, 255, 255, 0.03);
    transform: translateY(-8px) scale(1.02);
}

/* Top glow bar */
.panel-glow-bar
{
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--panel-accent), transparent);
    animation: topGlow 2s ease-in-out infinite alternate;
    z-index: 2;
}

/* ── .char-portrait — clipping box only, no animation ── */
.char-portrait
{
    width: 100%;
    aspect-ratio: 3 / 4;
    background-color: rgba(26, 26, 46, 0.8);
    position: relative;
    overflow: hidden;
}

/* ── .char-portrait-inner — carries image + translate drift ── */
.char-portrait-inner
{
    position: absolute;
    inset: 0;
    width: 108%;
    height: 108%;
    margin: -4%;
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    animation: panelDrift 18s ease-in-out infinite;
    animation-delay: var(--drift-delay, 0s);
    animation-play-state: paused; /* JS releases on image load */
    will-change: transform;
}

/* ── Hub portrait drift — translate only, more keyframes for random feel ── */
@keyframes panelDrift
{
    0%   { transform: translate(0px,    0px);  }
    15%  { transform: translate(-8px,  -5px);  }
    30%  { transform: translate(-5px,  -12px); }
    45%  { transform: translate(6px,   -8px);  }
    60%  { transform: translate(10px,  -3px);  }
    75%  { transform: translate(3px,   -14px); }
    88%  { transform: translate(-6px,  -6px);  }
    100% { transform: translate(0px,    0px);  }
}

/* ── Hero banner drift — keeps background-position approach ── */
@keyframes heroDrift
{
    0%   { background-position: 40% 20%; background-size: 130%; }
    25%  { background-position: 60% 30%; background-size: 135%; }
    50%  { background-position: 55% 50%; background-size: 130%; }
    75%  { background-position: 45% 30%; background-size: 128%; }
    100% { background-position: 40% 20%; background-size: 130%; }
}

/* Fallback icon when no portrait image is present */
.portrait-fallback
{
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    color: var(--panel-accent, var(--ghost-cyan));
    text-shadow: 0 0 30px var(--panel-accent, var(--ghost-cyan));
    opacity: 1;
    pointer-events: none;
    z-index: 1;
}

/* ── Panel Info Block ── */
.char-info
{
    padding: 1rem 1.2rem 1.2rem;
}

.char-name
{
    font-family: var(--font-ghost);
    font-size: 1.05rem;
    color: var(--panel-accent);
    text-shadow: 0 0 10px var(--panel-accent);
    margin: 0 0 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.char-role
{
    font-size: 0.815rem;
    color: var(--ghost-green);
    margin: 0 0 0.8rem;
    font-family: var(--font-ghost);
}

.char-stats
{
    margin-bottom: 0.8rem;
}

.stat-row
{
    display: flex;
    justify-content: space-between;
    font-size: 0.83rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-label
{
    color: var(--ghost-green);
    font-family: var(--font-ghost);
}

.stat-value
{
    color: var(--panel-accent);
    font-family: var(--font-ghost);
    text-align: right;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.char-tagline
{
    font-size: 0.935rem;
    color: var(--ghost-cosmiclatte);
    font-style: italic;
    margin: 0.5rem 0 0.8rem;
    line-height: 1.4;
}

.panel-enter-hint
{
    font-family: var(--font-ghost);
    font-size: 0.715rem;
    color: var(--panel-accent);
    opacity: 0;
    transition: opacity 0.3s ease;
    text-align: right;
    letter-spacing: 1px;
}

.manga-char-panel:hover .panel-enter-hint
{
    opacity: 1;
}

/* ── Show Page Layout ── */
.manga-show-page
{
    --panel-accent: var(--ghost-cyan);
}

/* ── Hero banner — now uses heroDrift, independent from hub cards ── */
.manga-hero-banner
{
    width: 100%;
    height: 40vh;
    min-height: 280px;
    background-size: 130%;
    background-position: center 20%;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
    animation: heroDrift 25s ease-in-out infinite;
}

.manga-hero-overlay
{
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.85) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2rem;
    gap: 0.5rem;
}

.manga-show-content
{
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
}

/* ── Dedication Card ── */
.dedication-card
{
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.85) 0%, rgba(22, 33, 62, 0.85) 100%);
    border: 2px solid var(--panel-accent);
    border-radius: 20px;
    padding: 3rem;
    text-align: center;
    box-shadow: 0 0 40px color-mix(in srgb, var(--panel-accent) 25%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    margin-bottom: 3rem;
    backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
}

.dedication-card::before
{
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--panel-accent), transparent);
    animation: topGlow 2s ease-in-out infinite alternate;
}

.dedication-icon
{
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
}

.dedication-tagline
{
    font-family: var(--font-ghost);
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    color: var(--panel-accent);
    text-shadow: 0 0 20px var(--panel-accent);
    border: none;
    margin: 0 0 1.5rem;
    font-style: italic;
    line-height: 1.5;
}

.dedication-body
{
    color: var(--text-ghost);
    font-size: 1.1rem;
    line-height: 1.9;
    max-width: 750px;
    margin: 0 auto;
}

/* ── Panel Strip — Full-width Stack, img-driven height ── */
.manga-panels-strip
{
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.manga-panel-frame
{
    width: 100%;
    min-height: 400px;
    max-height: 193vh;
    background-color: rgba(19, 2, 33, 0.8);
    border-radius: 12px;
    border: 2px solid rgba(0, 255, 255, 0.2);
    overflow: hidden;
    position: relative;
    transition: border-color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.4s ease;
}

.manga-panel-frame:hover
{
    border-color: var(--panel-accent);
    box-shadow: 0 0 40px var(--panel-accent);
    transform: scale(1.01);
}

/* ── Inner wrapper — relative so img drives height naturally ── */
.manga-panel-inner
{
    position: relative;
    width: 108%;
    margin-left: -4%;
    will-change: transform;
    animation: panelDriftSmooth 20s ease-in-out infinite;
    animation-delay: var(--drift-delay, 0s);
}

/* ── Full image — no cropping, full vertical height shown ── */
.manga-panel-inner img
{
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0;
}

/* ── Show page panel drift — translate only, GPU composited ── */
@keyframes panelDriftSmooth
{
    0%   { transform: translate(0px,   0px);  }
    25%  { transform: translate(-16px, -10px);  }
    50%  { transform: translate(-10px, -20px); }
    75%  { transform: translate(12px,  -12px);  }
    100% { transform: translate(0px,   0px);  }
}

/* ── Placeholder when no panels are set ── */
.panels-placeholder
{
    text-align: center;
    color: var(--text-accent);
    font-family: var(--font-ghost);
    padding: 3rem;
    font-size: 1rem;
}

/* ===========================================
   MANGA PAGE TITLES — Centered Headers
   =========================================== */

.manga-show-page .page-title,
.manga-hub-page .page-title
{
    text-align: center !important;
    margin: 0 auto;
    max-width: 800px;
    width: fit-content;
}

.manga-show-page .page-title::before,
.manga-show-page .page-title::after
{
    display: block;
    content: '';
    width: 120px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--panel-accent), transparent);
    margin: 1rem auto 0.5rem;
}

.manga-hub-page .page-title::before,
.manga-hub-page .page-title::after
{
    display: none;
}

/* ===========================================
   GLOBAL RECORDING MODE OVERRIDES
   =========================================== */

.recording-mode .char-portrait-inner
{
    animation: none !important;
    transform: none !important;
}

.recording-mode .manga-hero-banner
{
    animation: none !important;
    background-position: center 20% !important;
}

.recording-mode .manga-panel-frame
{
    animation: none !important;
}

.recording-mode .manga-panel-inner
{
    animation: none !important;
    transform: none !important;
}

.recording-mode .manga-char-panel
{
    backdrop-filter: none !important;
    background: rgba(26, 26, 46, 0.98) !important;
}

.recording-mode .dedication-card
{
    backdrop-filter: none !important;
    background: rgba(26, 26, 46, 0.98) !important;
}

.recording-mode .panel-glow-bar,
.recording-mode .dedication-card::before
{
    animation: none !important;
}

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

@media (max-width: 1100px)
{
    .manga-characters-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px)
{
    .manga-characters-grid { grid-template-columns: repeat(2, 1fr); }
    .dedication-card       { padding: 2rem; }
    .manga-hero-banner     { height: 30vh; }
    .manga-panel-frame     { min-height: 300px; }
}

@media (max-width: 480px)
{
    .manga-characters-grid { grid-template-columns: 1fr; }
    .dedication-card       { padding: 1.5rem; }
    .manga-panel-frame     { min-height: 200px; }
}
