/* ═══════════════════════════════
   ✦ CHRONOSTASIS
   Setsuna Meiou / Sailor Pluto
   ═══════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Shippori+Mincho:wght@400;500;600&family=Azeret+Mono:wght@300;400;500&display=swap');

/* ═══════════════════════════════
   ✦ RESET & BASE
   ═══════════════════════════════ */

/* ✦ CSS Variables */

:root {
    --void: #0a0b0e;
    --void-raised: #10111a;
    --void-surface: #161720;

    --silver: #b5b8c4;
    --silver-dim: #8a8d9a;
    --steel: #6e7080;
    --steel-dark: #3a3c4a;
    --steel-faint: #252730;

    --garnet: #8b3a4a;
    --garnet-light: #a8506a;
    --font-heading: 'Cormorant', Georgia, serif;
    --font-body: 'Shippori Mincho', Georgia, serif;
    --font-mono: 'Azeret Mono', monospace;

    --max-prose: 680px;
    --max-content: 780px;
}

/* ✦ Base */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1.1rem;
    line-height: 1.85;
    background: var(--void);
    color: var(--silver);
    overflow-x: hidden;
}

/* Subtle grain */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 128px 128px;
    pointer-events: none;
    z-index: 100;
}

.fixed-figure {
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 0;
    pointer-events: none;
    width: clamp(320px, 30vw, 580px);
    max-height: 85vh;
    overflow: hidden;
    opacity: 0;
    animation: figureReveal 4s ease 1.5s forwards;
}

.fixed-figure img {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0.30;
    filter: grayscale(30%) brightness(1.1);
    -webkit-mask-image: linear-gradient(
        to top,
        rgba(0,0,0,0.7) 0%,
        rgba(0,0,0,0.4) 50%,
        transparent 85%
    ),
    linear-gradient(
        to right,
        rgba(0,0,0,0.6) 0%,
        rgba(0,0,0,0.3) 60%,
        transparent 90%
    );
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(
        to top,
        rgba(0,0,0,0.7) 0%,
        rgba(0,0,0,0.4) 50%,
        transparent 85%
    ),
    linear-gradient(
        to right,
        rgba(0,0,0,0.6) 0%,
        rgba(0,0,0,0.3) 60%,
        transparent 90%
    );
    mask-composite: intersect;
}

@keyframes figureReveal {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@media (max-width: 1100px) {
    .fixed-figure {
        opacity: 0.5;
        width: 250px;
    }
    .fixed-figure img {
        opacity: 0.22;
    }
}

@media (max-width: 768px) {
    .fixed-figure {
        display: none;
    }
}

/* ═══════════════════════════════
   ✦ TYPOGRAPHY
   ═══════════════════════════════ */

/* ✦ Typography */

h1, h2, h3 {
    font-family: var(--font-heading);
    line-height: 1.3;
    color: var(--silver);
}

p { margin-bottom: 1.5rem; }
p:last-child { margin-bottom: 0; }

a {
    color: var(--garnet-light);
    text-decoration: none;
    transition: color 0.3s ease, border-color 0.3s ease;
    border-bottom: 1px solid transparent;
}

a:hover {
    color: var(--garnet);
    border-bottom-color: var(--garnet);
}

em, i {
    font-style: italic;
    color: var(--silver);
}

strong {
    font-weight: 600;
    color: var(--silver);
}

.key-concept {
    color: var(--silver);
    letter-spacing: 0.3px;
}

.soft-emphasis {
    font-style: italic;
    color: var(--silver-dim);
}

.earned-emphasis {
    color: var(--garnet-light);
}

.symbolic {
    color: var(--garnet-light);
}

.key-turn {
    font-style: italic;
    color: var(--silver);
}

.name-emphasis {
    color: var(--silver);
}

.title-emphasis {
    color: var(--silver-dim);
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--void-raised);
    color: var(--silver);
    padding: 8px 16px;
    z-index: 200;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.skip-link:focus { top: 0; border-bottom: none; }

/* ═══════════════════════════════
   ✦ COMPONENTS
   ═══════════════════════════════ */

/* ✦ Navigation */

.shrine-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-100%);
    transition: opacity 0.5s ease, transform 0.5s ease;
    pointer-events: none;
}

.shrine-nav.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.nav-container {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    background: rgba(10, 11, 14, 0.9);
    backdrop-filter: blur(12px);
    padding: 0.8rem 2rem;
    border-bottom: 1px solid var(--steel-faint);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: lowercase;
    color: var(--steel);
    border-bottom: none;
    transition: color 0.3s ease;
}

.nav-link:hover { color: var(--silver); border-bottom: none; }

.nav-link.active {
    color: var(--garnet-light);
}

.nav-icon {
    font-size: 0.9rem;
    color: var(--steel-dark);
    transition: color 0.3s ease;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    color: var(--garnet-light);
}

/* Nav hint — small garnet dot */
.nav-hint {
    position: fixed;
    top: 1.2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    transition: opacity 0.4s ease;
}

.nav-hint.hidden { opacity: 0; pointer-events: none; }

.hint-garnet {
    width: 6px;
    height: 6px;
    background: var(--garnet);
    border-radius: 50%;
    opacity: 0.5;
    animation: garnetPulse 4s ease-in-out infinite;
}

@keyframes garnetPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* ✦ Header */

.shrine-header {
    text-align: center;
    padding: 8rem 2rem 4rem;
}

.header-content {
    max-width: var(--max-content);
    margin: 0 auto;
}

.shrine-title {
    font-family: var(--font-heading);
    font-size: clamp(3.2rem, 6.5vw, 4.6rem);
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: lowercase;
    color: var(--silver);
    margin-bottom: 1rem;
}

.shrine-subtitle {
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--steel);
    margin-bottom: 0.5rem;
}

.shrine-tagline {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    color: var(--steel-dark);
}

/* ✦ Intro Context */

.intro-context {
    max-width: var(--max-prose);
    margin: 0 auto 3rem;
    padding: 1.8rem 2rem;
    border: 1px solid var(--steel-faint);
    text-align: center;
    opacity: 0;
    transform: translateY(12px);
    animation: contextReveal 2.5s ease 0.8s forwards;
}

@keyframes contextReveal {
    0% {
        opacity: 0;
        transform: translateY(12px);
        border-color: var(--steel-faint);
    }
    60% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        border-color: var(--steel-dark);
    }
}

.intro-context p {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--steel);
    margin-bottom: 0;
}

.intro-context em {
    color: var(--silver-dim);
}

/* ✦ Opening Prose */

.opening-prose {
    padding: 2rem 2rem 4rem;
}

.prose-content {
    max-width: var(--max-prose);
    margin: 0 auto;
    text-align: center;
}

.prose-content .prose-lead {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 400;
    font-style: italic;
    color: var(--silver);
    margin-bottom: 2rem;
}

.prose-content p {
    font-size: 1.1rem;
    color: var(--silver-dim);
    margin-bottom: 1.2rem;
}

.prose-content .prose-closing {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 400;
    font-style: italic;
    color: var(--silver);
    margin-top: 2rem;
}

/* ✦ Dividers */

.triple-gem-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    margin: 4rem 0;
    font-size: 0.6rem;
    color: var(--garnet);
    opacity: 0.5;
}

.triple-gem-divider span {
    display: inline-block;
}

/* ✦ Sections */

.shrine-section {
    padding: 4rem 2rem;
}

.section-header {
    max-width: var(--max-prose);
    margin: 0 auto 3rem;
    text-align: center;
}

.section-icon {
    font-size: 1.4rem;
    color: var(--garnet);
    margin-bottom: 1rem;
    opacity: 0.6;
}

.section-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 4.5vw, 2.9rem);
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: lowercase;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 300;
    letter-spacing: 0.12em;
    color: var(--steel);
    text-transform: lowercase;
}

.section-content {
    max-width: var(--max-prose);
    margin: 0 auto;
}

.content-block p {
    text-align: left;
}

/* ✦ Time Fracture Interludes */

.interlude {
    padding: 5rem 2rem;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.interlude.fracture-visible {
    opacity: 1;
}

.fracture-content {
    max-width: 550px;
    margin: 0 auto;
    text-align: center;
}

.fracture-text {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 400;
    font-style: italic;
    color: var(--steel);
    margin-bottom: 1rem;
    line-height: 1.7;
}

.fracture-text.emphasis,
.fracture-text.final {
    color: var(--silver-dim);
}

.fracture-text.soft-glow {
    color: var(--silver-dim);
}

.fracture-text.meta {
    font-family: var(--font-mono);
    font-style: normal;
    font-size: 0.88rem;
    letter-spacing: 0.08em;
    color: var(--steel-dark);
    margin-bottom: 1.5rem;
}

.fracture-text.echo {
    opacity: 0.6;
}

.fracture-text.final-heartbeat {
    font-size: 1.35rem;
    color: var(--silver-dim);
    margin-top: 1.5rem;
}

/* Fracture animation classes - subtle */
.fracture-text.rupture-flicker {
    animation: textFlicker 6s ease-in-out infinite;
}

.fracture-text.rupture-shift {
    animation: textShift 8s ease-in-out infinite;
}

.fracture-text.rupture-glitch {
    animation: textGlitch 7s ease-in-out infinite;
}

.fracture-text.rupture-repeat {
    animation: textRepeat 5s ease-in-out infinite;
}

.fracture-text.fade {
    opacity: 0.7;
}

/* Split fracture (Interlude 2) */
.split-fracture {
    max-width: 600px;
}

.split-line {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-style: italic;
}

.split-line.left {
    text-align: left;
    color: var(--silver-dim);
}

.split-line.right {
    text-align: right;
    color: var(--steel);
}

.split-line.center {
    text-align: center;
    color: var(--silver);
    margin-top: 0.5rem;
}

.split-line.center.emphasis {
    font-size: 1.25rem;
    color: var(--silver);
    margin-top: 1rem;
}

/* Release fracture (Interlude 3) */
.release-fracture {
    max-width: 500px;
}

.release-line {
    color: var(--steel);
}

/* Keyframes — very subtle */
@keyframes textFlicker {
    0%, 100% { opacity: 0.9; }
    45% { opacity: 0.5; }
    60% { opacity: 0.85; }
}

@keyframes textShift {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(2px); }
}

@keyframes textGlitch {
    0%, 100% { transform: skewX(0deg); opacity: 0.9; }
    20% { transform: skewX(0.5deg); opacity: 0.7; }
    40% { transform: skewX(-0.5deg); }
}

@keyframes textRepeat {
    0%, 100% { opacity: 0.9; }
    35% { opacity: 0.55; }
    70% { opacity: 0.9; }
}

/* ✦ Closing */

.shrine-closing {
    text-align: center;
    padding: 5rem 2rem;
}

.closing-content {
    max-width: var(--max-prose);
    margin: 0 auto;
}

.closing-text {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    font-weight: 400;
    font-style: italic;
    color: var(--silver-dim);
    margin-bottom: 0.8rem;
}

/* ✦ Footer */

.shrine-footer {
    border-top: none;
    padding: 3rem 2rem;
    margin-top: 2rem;
    position: relative;
}

.shrine-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--steel-faint) 30%, var(--steel-faint) 70%, transparent);
}

.footer-content {
    max-width: var(--max-content);
    margin: 0 auto;
    text-align: center;
}

.footer-content p {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--steel);
    margin-bottom: 0.8rem;
}

.footer-content a {
    color: var(--silver-dim);
    border-bottom: 1px solid transparent;
}

.footer-content a:hover {
    color: var(--garnet-light);
    border-bottom-color: var(--garnet-light);
}

.footer-content .footer-network {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    color: var(--steel-dark);
    margin-top: 1.5rem;
}

.footer-network .symbol {
    color: var(--garnet);
    font-size: 0.85rem;
    vertical-align: -1px;
}

/* Sister shrines */
/* ✦ Linkback */

.footer-linkback {
    margin: 0 auto 1.5rem;
    padding-bottom: 1.5rem;
    max-width: 500px;
    border-bottom: 1px solid var(--steel-faint);
    text-align: center;
}

.footer-linkback h3 {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: lowercase;
    color: var(--steel-dark);
    margin-bottom: 1rem;
}

.linkback-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.linkback-item a {
    line-height: 0;
    border-bottom: none;
    transition: opacity 0.3s ease;
}

.linkback-item a:hover {
    opacity: 0.8;
    border-bottom: none;
}

.linkback-item img {
    display: block;
    border: 1px solid var(--steel-faint);
}

.linkback-badge {
    position: relative;
    display: inline-block;
    line-height: 0;
}

.linkback-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: rgba(10, 11, 14, 0.95);
    border: 1px solid var(--garnet);
    padding: 0.3rem 0.65rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-style: italic;
    letter-spacing: 0.06em;
    color: var(--silver);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10;
}

.linkback-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--garnet);
}

.linkback-badge:hover .linkback-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.linkback-code {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 320px;
    width: 100%;
}

.linkback-code code {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--steel);
    background: var(--void);
    border: 1px solid var(--steel-faint);
    border-radius: 3px;
    padding: 0.4rem 0.6rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}

.copy-btn {
    background: transparent;
    border: 1px solid var(--steel-dark);
    color: var(--steel);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 0.35rem 0.75rem;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.05em;
}

.copy-btn:hover {
    border-color: var(--garnet-light);
    color: var(--garnet-light);
}

.copy-btn.copied {
    border-color: var(--garnet);
    color: var(--garnet);
}

/* ✦ Sister Shrines */

.footer-shrines {
    margin: 1.5rem auto;
    padding: 1.5rem 0;
    max-width: 500px;
    border-top: 1px solid var(--steel-faint);
    border-bottom: 1px solid var(--steel-faint);
}

.footer-shrines h3 {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: lowercase;
    color: var(--steel-dark);
    margin-bottom: 1rem;
}

.shrine-links-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.5rem;
}

.shrine-links-list li {
    font-size: 1rem;
}

.shrine-links-list a {
    color: var(--silver-dim);
}

.shrine-links-list a:hover {
    color: var(--garnet-light);
}

.shrine-links-list .link-subject {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--steel-dark);
    margin-left: 0.3rem;
}

/* ═══════════════════════════════
   ✦ MEDIA QUERIES
   ═══════════════════════════════ */

/* ✦ Responsive */

@media (max-width: 768px) {
    .shrine-title {
        font-size: 2.8rem;
        letter-spacing: 0.1em;
    }

    .section-title {
        font-size: 2rem;
    }

    .shrine-header {
        padding: 5rem 1.5rem 3rem;
    }

    .shrine-section {
        padding: 3rem 1.5rem;
    }

    .nav-container {
        gap: 1.5rem;
        padding: 0.7rem 1rem;
    }

    .nav-text { display: none; }

    .nav-icon { font-size: 1.1rem; }

    .split-line.left,
    .split-line.right {
        text-align: center;
    }

    .shrine-links-list {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .shrine-title {
        font-size: 2.3rem;
    }
}

/* ✦ Scrollbar */

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb { background: var(--steel-dark); border-radius: 2px; }

/* ✦ Accessibility */

*:focus {
    outline: 2px solid var(--garnet-light);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
