/* =========================================
   bada.day - Japanese-Minimal Design
   Palette: Warm Cream, Persimmon, Celadon
   Typography: Playfair Display, Outfit, DM Mono
   ========================================= */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #FAF6F0;
    --bg-card: #FFFFFF;
    --text-primary: #5A4E3C;
    --text-secondary: #B8A990;
    --accent-warm: #E8A87C;
    --accent-cool: #7EBDAB;
    --divider: #D4C5A9;
    --error: #D4726A;
    --bg-error: #FAF0EC;
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Outfit', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'DM Mono', 'Courier New', monospace;
    --ease-gentle: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    position: relative;
}

/* --- Washi Texture Overlay --- */
.washi-filter {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.03;
}

/* --- Ghost Fish (Animated Swimming Fish) --- */
.ghost-fish {
    position: fixed;
    top: 50%;
    left: -60px;
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    animation: ghostSwim 45s linear infinite, ghostOpacity 8s ease-in-out infinite;
    animation-delay: 1.8s, 1.8s;
    will-change: transform, opacity;
    transition: animation-play-state 0.3s;
}

.ghost-fish.paused {
    animation-play-state: paused;
}

@keyframes ghostSwim {
    0% {
        transform: translateX(0) translateY(0);
    }
    8% {
        transform: translateX(calc(8vw + 20px)) translateY(-14px);
    }
    16% {
        transform: translateX(calc(16vw + 40px)) translateY(-24px);
    }
    24% {
        transform: translateX(calc(24vw + 55px)) translateY(-30px);
    }
    32% {
        transform: translateX(calc(32vw + 60px)) translateY(-18px);
    }
    40% {
        transform: translateX(calc(40vw + 60px)) translateY(-6px);
    }
    48% {
        transform: translateX(calc(48vw + 60px)) translateY(8px);
    }
    56% {
        transform: translateX(calc(56vw + 60px)) translateY(4px);
    }
    64% {
        transform: translateX(calc(64vw + 65px)) translateY(-12px);
    }
    72% {
        transform: translateX(calc(72vw + 70px)) translateY(-22px);
    }
    80% {
        transform: translateX(calc(80vw + 80px)) translateY(-16px);
    }
    88% {
        transform: translateX(calc(88vw + 95px)) translateY(-8px);
    }
    96% {
        transform: translateX(calc(96vw + 110px)) translateY(-2px);
    }
    100% {
        transform: translateX(calc(100vw + 120px)) translateY(0);
    }
}

@keyframes ghostOpacity {
    0%, 100% {
        opacity: 0.15;
    }
    50% {
        opacity: 0.35;
    }
}

/* --- Navigation Fish Icon (Top-Right) --- */
.nav-fish {
    position: fixed;
    top: clamp(1.2rem, 3vw, 2rem);
    right: clamp(1.2rem, 3vw, 2rem);
    z-index: 900;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    transition: transform 0.3s ease;
}

.nav-fish:hover {
    transform: scale(1.1);
}

.nav-fish.shake {
    animation: shakeError 300ms ease-out;
}

@keyframes shakeError {
    0% { transform: translateX(0); }
    15% { transform: translateX(-4px); }
    30% { transform: translateX(3px); }
    50% { transform: translateX(-2px); }
    70% { transform: translateX(1px); }
    100% { transform: translateX(0); }
}

/* --- Menu Overlay (Noren Curtain) --- */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    z-index: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-100%);
    transition: transform 0.6s var(--ease-gentle);
    pointer-events: none;
}

.menu-overlay.open {
    transform: translateY(0);
    pointer-events: auto;
}

.menu-overlay-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.menu-item {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.03em;
    line-height: 1.2;
    transition: color 0.3s ease;
    position: relative;
}

.menu-item:hover {
    color: var(--accent-warm);
}

.menu-item::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent-warm);
    transition: width 0.4s ease;
}

.menu-item:hover::after {
    width: 100%;
}

/* --- Hero Section --- */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 6vw, 5rem);
    overflow: hidden;
}

/* Caustic light effect - overlapping radial gradients */
.hero-caustics {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    pointer-events: none;
    background:
        radial-gradient(ellipse 300px 200px at 30% 40%, rgba(232, 168, 124, 0.035) 0%, transparent 70%),
        radial-gradient(ellipse 250px 350px at 70% 30%, rgba(232, 168, 124, 0.03) 0%, transparent 70%),
        radial-gradient(ellipse 400px 200px at 50% 70%, rgba(232, 168, 124, 0.025) 0%, transparent 70%),
        radial-gradient(ellipse 200px 280px at 20% 60%, rgba(126, 189, 171, 0.025) 0%, transparent 70%),
        radial-gradient(ellipse 350px 150px at 80% 65%, rgba(232, 168, 124, 0.02) 0%, transparent 70%),
        radial-gradient(ellipse 180px 260px at 55% 20%, rgba(126, 189, 171, 0.02) 0%, transparent 70%),
        radial-gradient(ellipse 320px 180px at 40% 80%, rgba(232, 168, 124, 0.015) 0%, transparent 70%);
    animation: causticDrift 20s ease-in-out infinite alternate;
}

@keyframes causticDrift {
    0% {
        transform: translate(0%, 0%);
    }
    25% {
        transform: translate(-5%, -3%);
    }
    50% {
        transform: translate(-8%, -5%);
    }
    75% {
        transform: translate(-3%, -7%);
    }
    100% {
        transform: translate(-10%, -2%);
    }
}

/* Hero title */
.hero-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.8rem, 7vw, 5.5rem);
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: var(--text-primary);
    text-align: center;
    position: relative;
    z-index: 10;
}

.hero-title .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(12px);
    animation: letterReveal 0.5s var(--ease-gentle) forwards;
    animation-delay: calc(600ms + (var(--i) * 80ms));
}

@keyframes letterReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scroll chevron */
.scroll-chevron {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    animation: chevronPulse 2.5s ease-in-out infinite;
    animation-delay: 2s;
    animation-fill-mode: forwards;
}

@keyframes chevronPulse {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
        opacity: 0.6;
    }
    50% {
        transform: translateX(-50%) translateY(6px);
        opacity: 1;
    }
}

/* --- Card Grid Container --- */
.card-grid-container {
    max-width: 75vw;
    margin: 0 auto;
    padding: 0 clamp(2rem, 6vw, 5rem);
    padding-bottom: 6rem;
}

@media (max-width: 1024px) {
    .card-grid-container {
        max-width: 90vw;
    }
}

@media (max-width: 768px) {
    .card-grid-container {
        max-width: 100%;
        padding: 0 clamp(1.5rem, 5vw, 3rem);
    }
}

/* --- Card Cluster --- */
.card-cluster {
    margin-bottom: 4rem;
    position: relative;
}

/* Cluster divider line - 38.2% width (golden section) */
.cluster-divider {
    width: 38.2%;
    height: 1px;
    background-color: var(--divider);
    margin-bottom: 1rem;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.8s var(--ease-gentle);
}

.card-cluster.visible .cluster-divider {
    transform: scaleX(1);
}

/* Cluster label */
.cluster-label {
    display: block;
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: clamp(0.7rem, 0.85vw, 0.8rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* --- Card Grid (Golden Section: 1:1.618:1) --- */
.card-grid {
    display: grid;
    grid-template-columns: 1fr 1.618fr 1fr;
    gap: clamp(1.2rem, 3vw, 2.4rem);
    position: relative;
}

@media (max-width: 1024px) {
    .card-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Card --- */
.card {
    background-color: var(--bg-card);
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(139, 115, 85, 0.08);
    padding: clamp(1.5rem, 2.5vw, 2rem);
    border-bottom: 1px solid var(--divider);
    transition:
        background-color 0.4s ease,
        border-color 0.4s ease,
        transform 0.4s ease;
    opacity: 0;
    transform: translateY(24px);
    cursor: pointer;
}

.card.visible {
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity 0.6s var(--ease-gentle),
        transform 0.6s var(--ease-gentle),
        background-color 0.4s ease,
        border-color 0.4s ease;
}

/* Card hover - "melts" into background (inverse darkening) */
.card:hover {
    background-color: var(--bg-primary);
    border-bottom-color: var(--accent-warm);
}

.card:hover .card-title {
    color: var(--accent-warm);
    transition-delay: 100ms;
}

/* Card shake on click (startled fish) */
.card.shake {
    animation: cardShake 400ms ease-out;
}

@keyframes cardShake {
    0% { transform: translateX(0); }
    15% { transform: translateX(-4px); }
    30% { transform: translateX(3px); }
    50% { transform: translateX(-2px); }
    70% { transform: translateX(1px); }
    100% { transform: translateX(0); }
}

/* Card metadata */
.card-meta {
    display: block;
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: clamp(0.7rem, 0.85vw, 0.8rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

/* Card title */
.card-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    letter-spacing: 0em;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    transition: color 0.3s ease;
}

/* Card body */
.card-body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: var(--text-primary);
}

/* Card fish drawing */
.card-fish-drawing {
    margin-top: 1.2rem;
    opacity: 0.6;
    transition: opacity 0.4s ease;
}

.card:hover .card-fish-drawing {
    opacity: 0.85;
}

/* Card column assignments */
.card-col-1 {
    grid-column: 1;
}

.card-col-2 {
    grid-column: 2;
}

.card-col-3 {
    grid-column: 3;
}

@media (max-width: 1024px) {
    .card-col-1 { grid-column: 1; }
    .card-col-2 { grid-column: 2; }
    .card-col-3 { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
    .card-col-1,
    .card-col-2,
    .card-col-3 {
        grid-column: 1;
    }
}

/* --- Fish Silhouettes --- */
.fish-silhouette {
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    position: relative;
}

/* Fish between clusters */
.fish-silhouette.fish-between {
    margin: 2rem auto;
    width: 32px;
    height: 32px;
}

/* Fish inline within card grids */
.fish-silhouette.fish-inline {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    height: 28px;
    position: absolute;
    right: -14px;
    top: 50%;
    transform: translateY(-50%);
}

@media (max-width: 1024px) {
    .fish-silhouette.fish-inline {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        margin: 1rem auto;
        grid-column: 1 / -1;
    }
}

.fish-shape {
    width: 28px;
    height: 16px;
    background-color: var(--color);
    clip-path: polygon(0% 50%, 35% 10%, 70% 0%, 85% 25%, 100% 50%, 85% 75%, 70% 100%, 35% 90%);
    transform: rotate(var(--rotation));
    transition: transform 0.4s ease;
}

/* Rotate fish on nearby card hover */
.card:hover ~ .fish-silhouette .fish-shape,
.card-cluster:hover .fish-silhouette .fish-shape {
    transform: rotate(calc(var(--rotation) + 15deg));
}

/* --- Ma Markers --- */
.ma-marker {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem 0;
}

.ma-dot {
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--divider);
}

.ma-lines {
    display: flex;
    gap: 3px;
    align-items: center;
}

.ma-lines span {
    display: block;
    width: 12px;
    height: 1px;
    background-color: var(--divider);
}

/* --- Error State --- */
.card.error {
    background-color: var(--bg-error);
    animation: cardShake 400ms ease-out;
}

.card.error .card-meta {
    font-family: var(--font-mono);
    color: var(--error);
}

/* --- Footer --- */
.site-footer {
    text-align: center;
    padding: 3rem clamp(2rem, 6vw, 5rem);
    border-top: 1px solid var(--divider);
    margin: 0 clamp(2rem, 6vw, 5rem);
}

.footer-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-secondary);
    letter-spacing: -0.02em;
}

/* --- Selection --- */
::selection {
    background-color: var(--accent-warm);
    color: var(--bg-primary);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--divider);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* --- Responsive Adjustments --- */
@media (max-width: 480px) {
    .hero-title {
        font-size: clamp(2.4rem, 10vw, 3.5rem);
    }

    .menu-item {
        font-size: clamp(1.6rem, 8vw, 2.5rem);
    }

    .card-cluster {
        margin-bottom: 3rem;
    }

    .ma-marker {
        padding: 2rem 0;
    }

    .site-footer {
        margin: 0 clamp(1rem, 4vw, 2rem);
        padding: 2rem clamp(1rem, 4vw, 2rem);
    }
}
