/* ============================================================
   reiwa.day — Styles
   A Digital Chronicle of the Reiwa Era
   ============================================================ */

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

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

body {
    background-color: #4A1A2E;
    color: #F0E8E0;
    font-family: 'Noto Serif JP', serif;
    font-weight: 400;
    font-size: clamp(16px, 1.5vw, 18px);
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- SVG Noise Filter for Marble Textures --- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ============================================================
   Calendar Gate (Hero - 100vh)
   ============================================================ */
#calendar-gate {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #4A1A2E;
    overflow: hidden;
}

/* Marble header panels */
.gate-marble-panel {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    opacity: 0;
    animation: marbleFadeIn 1.2s ease forwards;
}

.gate-marble-left {
    left: 0;
    background:
        linear-gradient(135deg, rgba(200, 184, 168, 0.06) 0%, transparent 50%),
        linear-gradient(225deg, rgba(200, 184, 168, 0.04) 10%, transparent 60%),
        linear-gradient(45deg, rgba(240, 232, 224, 0.03) 0%, transparent 40%),
        linear-gradient(315deg, rgba(200, 184, 168, 0.05) 5%, transparent 45%);
    animation-delay: 0s;
}

.gate-marble-right {
    right: 0;
    background:
        linear-gradient(225deg, rgba(200, 184, 168, 0.06) 0%, transparent 50%),
        linear-gradient(135deg, rgba(200, 184, 168, 0.04) 10%, transparent 60%),
        linear-gradient(315deg, rgba(240, 232, 224, 0.03) 0%, transparent 40%),
        linear-gradient(45deg, rgba(200, 184, 168, 0.05) 5%, transparent 45%);
    animation-delay: 0.15s;
}

@keyframes marbleFadeIn {
    0% { opacity: 0; transform: scale(1.02); }
    100% { opacity: 1; transform: scale(1); }
}

/* Marble veining overlay on gate */
#calendar-gate::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(73deg, transparent 30%, rgba(200, 184, 168, 0.03) 31%, transparent 32%),
        linear-gradient(107deg, transparent 45%, rgba(200, 184, 168, 0.025) 46%, transparent 47%),
        linear-gradient(160deg, transparent 55%, rgba(200, 184, 168, 0.02) 56%, transparent 57%),
        linear-gradient(200deg, transparent 25%, rgba(200, 184, 168, 0.03) 26%, transparent 27%),
        linear-gradient(250deg, transparent 65%, rgba(200, 184, 168, 0.02) 66%, transparent 67%);
    pointer-events: none;
    z-index: 1;
}

/* Gate content container */
.gate-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 700px;
    padding: 40px 20px;
}

/* Floral SVG frame */
#gate-floral-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 600px;
    height: auto;
    z-index: 1;
}

/* Path-draw animation for floral paths */
.floral-path {
    stroke-dasharray: var(--path-length, 500);
    stroke-dashoffset: var(--path-length, 500);
    opacity: 0;
}

.floral-path.animate {
    animation: pathDraw 2.5s ease forwards;
}

.floral-path.frame-line.animate {
    animation: pathDraw 1.8s ease forwards;
}

@keyframes pathDraw {
    0% {
        stroke-dashoffset: var(--path-length, 500);
        opacity: 1;
    }
    1% {
        opacity: 1;
    }
    100% {
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

/* Wordmark */
#gate-wordmark {
    position: relative;
    z-index: 2;
    text-align: center;
    opacity: 0;
    animation: wordmarkFadeIn 1s ease forwards;
    animation-delay: 1.5s;
}

.gate-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(42px, 7vw, 80px);
    color: #F0E8E0;
    letter-spacing: 0.05em;
    line-height: 1.1;
    margin-bottom: 12px;
    text-shadow: 0 2px 20px rgba(42, 10, 26, 0.5);
}

.gate-subtitle {
    font-family: 'Noto Serif JP', serif;
    font-weight: 400;
    font-size: clamp(14px, 2vw, 18px);
    color: #C8B8A8;
    letter-spacing: 0.15em;
    margin-bottom: 20px;
}

.gate-date-display {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 13px;
    color: #C8A040;
    letter-spacing: 0.1em;
}

@keyframes wordmarkFadeIn {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Scroll hint */
.gate-scroll-hint {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    opacity: 0;
    animation: scrollHintIn 0.8s ease forwards;
    animation-delay: 3s;
}

.scroll-kanji {
    font-family: 'Noto Serif JP', serif;
    font-size: 18px;
    color: #C8B8A8;
    display: block;
    animation: scrollFloat 2.5s ease-in-out infinite;
}

@keyframes scrollHintIn {
    0% { opacity: 0; }
    100% { opacity: 0.6; }
}

@keyframes scrollFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* ============================================================
   Season Sections
   ============================================================ */
.season-section {
    position: relative;
    padding: 80px 24px 60px;
    max-width: 1100px;
    margin: 0 auto;
}

/* Seasonal color shifts via subtle overlays */
#season-spring {
    border-top: 1px solid rgba(216, 139, 175, 0.15);
}

#season-summer {
    border-top: 1px solid rgba(74, 139, 107, 0.15);
}

#season-autumn {
    border-top: 1px solid rgba(200, 160, 64, 0.15);
}

#season-winter {
    border-top: 1px solid rgba(200, 184, 168, 0.15);
}

/* Season header */
.season-header {
    text-align: center;
    margin-bottom: 48px;
    position: relative;
}

.season-floral {
    display: block;
    margin: 0 auto 20px;
    width: 180px;
    height: auto;
    opacity: 0.9;
}

/* Season-specific floral draw animations */
.season-draw {
    stroke-dasharray: var(--path-length, 400);
    stroke-dashoffset: var(--path-length, 400);
    opacity: 0;
}

.season-draw.animate {
    animation: seasonPathDraw 2s ease forwards;
}

@keyframes seasonPathDraw {
    0% {
        stroke-dashoffset: var(--path-length, 400);
        opacity: 1;
    }
    1% { opacity: 1; }
    100% {
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

.season-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(28px, 4vw, 52px);
    color: #F0E8E0;
    line-height: 1.2;
    margin-bottom: 6px;
}

.season-title-en {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 0.55em;
    color: #C8B8A8;
    margin-left: 8px;
}

.season-months {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 13px;
    color: #C8A040;
    letter-spacing: 0.1em;
}

/* Seasonal accent colors on season titles */
#season-spring .season-title { color: #F0E8E0; }
#season-spring .season-months { color: #D88BAF; }

#season-summer .season-title { color: #F0E8E0; }
#season-summer .season-months { color: #4A8B6B; }

#season-autumn .season-title { color: #F0E8E0; }
#season-autumn .season-months { color: #C8A040; }

#season-winter .season-title { color: #F0E8E0; }
#season-winter .season-months { color: #C8B8A8; }

/* ============================================================
   Day Grid
   ============================================================ */
.day-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 1000px;
    margin: 0 auto;
}

/* ============================================================
   Day Cards - Marble Texture
   ============================================================ */
.day-card {
    position: relative;
    background-color: #F0E8E0;
    border: 1px solid #4A1A2E;
    border-radius: 2px;
    padding: 24px 20px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Marble texture on cards */
.day-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(125deg, rgba(200, 184, 168, 0.15) 0%, transparent 30%),
        linear-gradient(235deg, rgba(200, 184, 168, 0.1) 10%, transparent 40%),
        linear-gradient(75deg, transparent 50%, rgba(200, 184, 168, 0.08) 51%, transparent 52%),
        linear-gradient(170deg, transparent 30%, rgba(200, 184, 168, 0.06) 31%, transparent 33%),
        linear-gradient(290deg, transparent 60%, rgba(200, 184, 168, 0.1) 61%, transparent 63%),
        linear-gradient(20deg, transparent 70%, rgba(200, 184, 168, 0.05) 71%, transparent 72%);
    pointer-events: none;
    z-index: 0;
}

/* Additional marble veining */
.day-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(155deg, transparent 20%, rgba(74, 26, 46, 0.03) 21%, transparent 22%),
        linear-gradient(195deg, transparent 55%, rgba(74, 26, 46, 0.02) 56%, transparent 57%),
        linear-gradient(85deg, transparent 40%, rgba(74, 26, 46, 0.025) 41%, transparent 42%);
    pointer-events: none;
    z-index: 0;
}

.day-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(42, 10, 26, 0.3);
}

/* Card date */
.card-date {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(74, 26, 46, 0.12);
}

.card-era {
    font-family: 'Noto Serif JP', serif;
    font-weight: 400;
    font-size: 12px;
    color: #4A1A2E;
    opacity: 0.7;
}

.card-gregorian {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 13px;
    color: #C8A040;
    letter-spacing: 0.05em;
}

/* Card content */
.card-content {
    position: relative;
    z-index: 1;
}

.card-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(18px, 2.2vw, 22px);
    color: #4A1A2E;
    margin-bottom: 8px;
    line-height: 1.3;
}

.card-body {
    font-family: 'Noto Serif JP', serif;
    font-weight: 400;
    font-size: clamp(13px, 1.2vw, 15px);
    color: #2A0A1A;
    line-height: 1.7;
    opacity: 0.85;
}

/* Card floral accent */
.card-floral-accent {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 50px;
    height: 50px;
    z-index: 1;
    opacity: 0.4;
}

/* Card-draw animation */
.card-draw {
    stroke-dasharray: var(--path-length, 200);
    stroke-dashoffset: var(--path-length, 200);
    opacity: 0;
}

.card-draw.animate {
    animation: cardPathDraw 1.5s ease forwards;
}

@keyframes cardPathDraw {
    0% {
        stroke-dashoffset: var(--path-length, 200);
        opacity: 1;
    }
    1% { opacity: 1; }
    100% {
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

/* Seasonal card border accents */
#season-spring .day-card {
    border-color: rgba(74, 26, 46, 0.5);
}
#season-spring .day-card:hover {
    border-color: #D88BAF;
}

#season-summer .day-card {
    border-color: rgba(74, 26, 46, 0.5);
}
#season-summer .day-card:hover {
    border-color: #4A8B6B;
}

#season-autumn .day-card {
    border-color: rgba(74, 26, 46, 0.5);
}
#season-autumn .day-card:hover {
    border-color: #C8A040;
}

#season-winter .day-card {
    border-color: rgba(74, 26, 46, 0.5);
}
#season-winter .day-card:hover {
    border-color: #C8B8A8;
}

/* ============================================================
   Twilight Footer
   ============================================================ */
#twilight-footer {
    position: relative;
    background-color: #2A0A1A;
    padding: 60px 24px 40px;
    overflow: hidden;
}

/* Marble veining in footer */
.footer-marble-veins {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(130deg, transparent 20%, rgba(200, 184, 168, 0.025) 21%, transparent 22%),
        linear-gradient(210deg, transparent 40%, rgba(200, 184, 168, 0.02) 41%, transparent 42%),
        linear-gradient(70deg, transparent 55%, rgba(200, 184, 168, 0.018) 56%, transparent 57%),
        linear-gradient(300deg, transparent 30%, rgba(200, 184, 168, 0.022) 31%, transparent 32%),
        linear-gradient(170deg, transparent 65%, rgba(200, 184, 168, 0.015) 66%, transparent 67%);
    pointer-events: none;
}

.footer-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.footer-floral {
    display: block;
    margin: 0 auto 24px;
    width: 280px;
    height: auto;
    opacity: 0.7;
}

.footer-draw {
    stroke-dasharray: var(--path-length, 400);
    stroke-dashoffset: var(--path-length, 400);
    opacity: 0;
}

.footer-draw.animate {
    animation: footerPathDraw 2s ease forwards;
}

@keyframes footerPathDraw {
    0% {
        stroke-dashoffset: var(--path-length, 400);
        opacity: 1;
    }
    1% { opacity: 1; }
    100% {
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

.footer-era {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(20px, 3vw, 28px);
    color: #F0E8E0;
    margin-bottom: 8px;
    letter-spacing: 0.1em;
}

.footer-note {
    font-family: 'Noto Serif JP', serif;
    font-weight: 400;
    font-size: 14px;
    color: #C8B8A8;
    margin-bottom: 16px;
    letter-spacing: 0.08em;
}

.footer-date {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 12px;
    color: #C8A040;
    letter-spacing: 0.1em;
    opacity: 0.8;
}

/* ============================================================
   Responsive Design
   ============================================================ */
@media (max-width: 900px) {
    .day-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .season-section {
        padding: 60px 20px 48px;
    }
}

@media (max-width: 600px) {
    .day-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .gate-content {
        padding: 30px 16px;
    }

    #gate-floral-frame {
        max-width: 340px;
    }

    .season-section {
        padding: 48px 16px 36px;
    }

    .season-header {
        margin-bottom: 32px;
    }

    .season-floral {
        width: 140px;
    }

    .day-card {
        padding: 20px 16px;
    }

    #twilight-footer {
        padding: 48px 16px 32px;
    }

    .footer-floral {
        width: 220px;
    }
}

/* ============================================================
   Card entrance animations
   ============================================================ */
.day-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.day-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger card animations within a grid */
.day-card:nth-child(1) { transition-delay: 0s; }
.day-card:nth-child(2) { transition-delay: 0.1s; }
.day-card:nth-child(3) { transition-delay: 0.2s; }

/* Season header entrance */
.season-header {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.season-header.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Footer entrance */
.footer-content {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.footer-content.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   Selection styling
   ============================================================ */
::selection {
    background-color: #C8A040;
    color: #2A0A1A;
}

/* Scrollbar styling (Webkit) */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #2A0A1A;
}

::-webkit-scrollbar-thumb {
    background: #4A1A2E;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #D88BAF;
}
