/* ============================================================
   miris.day - Dark-Academia Game-Studio Journal
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    background-color: #1E1A15;
}

body {
    background-color: #1E1A15;
    color: #C4B8A0;
    font-family: 'Literata', Georgia, serif;
    font-size: clamp(1rem, 1.1vw, 1.1rem);
    line-height: 1.9;
    font-weight: 400;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background-color: #A89060;
    color: #1E1A15;
}

/* --- Opening Section --- */
.opening-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1E1A15;
    overflow: hidden;
}

.opening-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.site-title {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 600;
    color: #E8D8C0;
    letter-spacing: 0em;
    margin-bottom: 1rem;
    opacity: 0;
    animation: titleReveal 2s ease-out 0.5s forwards;
}

@keyframes titleReveal {
    0% {
        opacity: 0;
        letter-spacing: 0em;
        transform: translateY(10px);
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        letter-spacing: 0.15em;
        transform: translateY(0);
    }
}

.opening-date {
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: #8A7D65;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeInUp 1s ease-out 1.5s forwards;
}

.opening-subtitle {
    font-family: 'Crimson Pro', Georgia, serif;
    font-style: italic;
    font-size: clamp(1rem, 1.8vw, 1.4rem);
    font-weight: 400;
    color: #A89060;
    opacity: 0;
    animation: fadeInUp 1s ease-out 2s forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Watercolor Washes --- */
.watercolor-wash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: multiply;
}

.wash-dawn {
    background:
        radial-gradient(ellipse 60% 50% at 50% 50%, rgba(168, 144, 96, 0.0) 0%, rgba(168, 144, 96, 0.0) 100%);
    animation: dawnWash 2.5s ease-out 0.3s forwards;
}

@keyframes dawnWash {
    0% {
        background:
            radial-gradient(ellipse 0% 0% at 50% 50%, rgba(168, 144, 96, 0.15) 0%, rgba(168, 144, 96, 0.0) 70%);
    }
    100% {
        background:
            radial-gradient(ellipse 80% 60% at 50% 50%, rgba(168, 144, 96, 0.08) 0%, rgba(168, 144, 96, 0.0) 70%),
            radial-gradient(ellipse 50% 40% at 40% 45%, rgba(212, 168, 76, 0.05) 0%, transparent 70%),
            radial-gradient(ellipse 40% 50% at 60% 55%, rgba(122, 48, 48, 0.03) 0%, transparent 70%);
    }
}

.wash-gold {
    background:
        radial-gradient(ellipse 70% 50% at 65% 30%, rgba(168, 144, 96, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 50% 60% at 30% 70%, rgba(212, 168, 76, 0.04) 0%, transparent 60%);
}

.wash-rose {
    background:
        radial-gradient(ellipse 60% 50% at 70% 40%, rgba(122, 48, 48, 0.05) 0%, transparent 70%),
        radial-gradient(ellipse 50% 40% at 35% 60%, rgba(168, 144, 96, 0.04) 0%, transparent 60%);
}

.wash-sage {
    background:
        radial-gradient(ellipse 65% 55% at 60% 35%, rgba(138, 125, 101, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 45% 50% at 40% 65%, rgba(168, 144, 96, 0.04) 0%, transparent 60%);
}

.wash-closing {
    background:
        radial-gradient(ellipse 80% 70% at 50% 50%, rgba(30, 26, 21, 0.9) 0%, transparent 70%),
        radial-gradient(ellipse 50% 40% at 50% 50%, rgba(168, 144, 96, 0.05) 0%, transparent 60%);
}

/* --- Wavy Divider --- */
.wavy-divider {
    padding: 2rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
}

.wavy-divider svg {
    width: 80%;
    max-width: 900px;
    height: 12px;
}

/* --- Journal Entry Layout --- */
.journal-entry {
    position: relative;
    padding: 4rem 0;
    background-color: #1E1A15;
    overflow: hidden;
}

.journal-entry[data-section="2"],
.journal-entry[data-section="4"],
.journal-entry[data-section="6"] {
    background-color: #241F19;
}

.entry-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns:
        1fr
        minmax(0, 4fr)
        minmax(0, 2fr)
        1fr;
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.text-column {
    grid-column: 2 / 3;
}

.margin-column {
    grid-column: 3 / 4;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2rem;
    padding-top: 3rem;
}

/* --- Entry Header --- */
.entry-header {
    margin-bottom: 2rem;
}

.timestamp {
    display: inline-block;
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: #8A7D65;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.entry-heading {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #E8D8C0;
    line-height: 1.2;
    position: relative;
}

.ripple-target {
    position: relative;
    display: inline-block;
}

.ripple-target::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(168, 144, 96, 0.08) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: none;
}

.ripple-target.ripple-active::after {
    animation: inkRipple 800ms ease-out forwards;
}

@keyframes inkRipple {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 400px;
        height: 400px;
        opacity: 0;
    }
}

/* Section-level ripple background pulse */
.journal-entry.section-pulse {
    animation: sectionPulse 800ms ease-out forwards;
}

@keyframes sectionPulse {
    0% {
        background-color: #1E1A15;
    }
    30% {
        background-color: #241F19;
    }
    100% {
        background-color: #1E1A15;
    }
}

.journal-entry[data-section="2"].section-pulse,
.journal-entry[data-section="4"].section-pulse,
.journal-entry[data-section="6"].section-pulse {
    animation-name: sectionPulseAlt;
}

@keyframes sectionPulseAlt {
    0% {
        background-color: #241F19;
    }
    30% {
        background-color: #1E1A15;
    }
    100% {
        background-color: #241F19;
    }
}

/* --- Entry Body --- */
.entry-body p {
    margin-bottom: 1.5rem;
    max-width: 65ch;
}

.entry-body p:last-child {
    margin-bottom: 0;
}

/* --- Margin Illustrations --- */
.margin-illustration {
    width: 80px;
    height: 80px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.margin-illustration.visible {
    opacity: 1;
    transform: translateY(0);
}

.margin-illustration svg {
    width: 100%;
    height: 100%;
}

/* --- Pull Quotes --- */
.pull-quote {
    border-left: 3px solid #A89060;
    padding-left: 1.25rem;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    max-width: 280px;
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.8s ease-out 0.2s, transform 0.8s ease-out 0.2s;
}

.pull-quote.visible {
    opacity: 1;
    transform: translateX(0);
}

.pull-quote p {
    font-family: 'Crimson Pro', Georgia, serif;
    font-style: italic;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    font-weight: 400;
    color: #A89060;
    line-height: 1.6;
}

/* --- Closing Section --- */
.closing-section {
    position: relative;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1E1A15;
    overflow: hidden;
}

.closing-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.closing-text {
    font-family: 'Crimson Pro', Georgia, serif;
    font-style: italic;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    font-weight: 400;
    color: #8A7D65;
    letter-spacing: 0.1em;
    text-transform: lowercase;
    margin-bottom: 1rem;
}

.closing-time {
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: #8A7D65;
    margin-bottom: 2rem;
}

.closing-tagline {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 600;
    color: #E8D8C0;
    letter-spacing: 0.08em;
    opacity: 0.6;
}

/* --- Scroll Reveal Animations --- */
.journal-entry .text-column {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.journal-entry.in-view .text-column {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive Design --- */

/* Tablet */
@media (max-width: 1024px) {
    .entry-grid {
        grid-template-columns: 1fr minmax(0, 5fr) minmax(0, 2fr) 1fr;
        gap: 30px;
        padding: 0 1.5rem;
    }

    .pull-quote {
        max-width: 240px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .entry-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0 1.5rem;
    }

    .text-column {
        grid-column: 1;
    }

    .margin-column {
        grid-column: 1;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
        padding-top: 0;
        gap: 1.5rem;
    }

    .margin-illustration {
        width: 60px;
        height: 60px;
    }

    .pull-quote {
        max-width: 100%;
    }

    .journal-entry {
        padding: 3rem 0;
    }

    .wavy-divider svg {
        width: 90%;
    }

    .site-title {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }

    .wash-gold,
    .wash-rose,
    .wash-sage {
        opacity: 0.5;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .entry-grid {
        padding: 0 1rem;
    }

    .entry-body p {
        font-size: 0.95rem;
    }

    .opening-section {
        min-height: 80vh;
    }
}

/* --- Accent Colors --- */

/* Library Red: rare accent for critical marks */
.pull-quote::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #7A3030;
    position: absolute;
    top: -3px;
    left: -5px;
}

.pull-quote {
    position: relative;
}

/* Candlelight: hover and active states */
.entry-heading:hover .ripple-target {
    color: #D4A84C;
    transition: color 0.3s ease;
}

.closing-tagline:hover {
    color: #D4A84C;
    transition: color 0.3s ease;
}

a {
    color: #D4A84C;
    text-decoration: none;
}

a:hover {
    color: #E8D8C0;
}

/* --- Utility --- */
.hidden {
    opacity: 0;
    visibility: hidden;
}
