/* =========================================================================
   Wafuu Design System & Core Styles
   ========================================================================= */

@font-face {
    font-family: 'AoyagiReisho';
    src: url('../assets/fonts/aoyagi/aoyagireisyosimo_ttf_2_01.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Nippon Colors (Dark - Default) */
    --clr-kurenai: #cb1b45; /* Crimson/Vermillion */
    --clr-sumi: #1c1c1c;    /* Ink Black */
    --clr-aizome: #1a2a3a;  /* Deep Indigo */
    --clr-gofun: #fffffc;   /* Chalk White */
    --clr-gold: #cfb53b;    /* Gold Leaf */
    --bg-overlay: multiply;
    
    --font-primary: 'Zen Old Mincho', serif;
    --font-secondary: 'Noto Serif JP', serif;
    
    --cursor-size: 10px;
}

body.light-theme {
    /* Inverted Nippon Colors (Light Mode) */
    --clr-sumi: #fffffc;    /* Chalk White Background */
    --clr-gofun: #1c1c1c;   /* Ink Black Text */
    --clr-aizome: #d1d8e0;  /* Light grey-blue */
    --bg-overlay: normal;   /* Don't multiply texture aggressively */
}

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

html, body {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden; 
    overflow-y: auto; /* Restored vertical scroll for ScrollTrigger */
    font-family: var(--font-secondary);
    color: var(--clr-gofun);
    background-color: var(--clr-sumi);
    cursor: none; /* Hide default cursor to use custom Sumi-e cursor */
}

/* Washi Background Overlay */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background-image: url('../assets/washi.png');
    background-blend-mode: var(--bg-overlay);
    background-size: cover;
    pointer-events: none;
    z-index: -2;
    transition: background-blend-mode 0.5s ease;
}

/* =========================================================================
   Overlays & Transitions
   ========================================================================= */

.transition-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--clr-sumi);
    z-index: 9999;
    pointer-events: none;
    transform: scaleY(0);
    transform-origin: bottom;
    /* transition mask logic will be handled via GSAP */
}

/* =========================================================================
   Custom Cursor
   ========================================================================= */
.custom-cursor {
    position: fixed;
    top: 0; left: 0;
    width: var(--cursor-size);
    height: var(--cursor-size);
    background: var(--clr-kurenai);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    transition: transform 0.1s ease;
    mix-blend-mode: screen;
}

.custom-cursor-follower {
    position: fixed;
    top: 0; left: 0;
    width: 40px;
    height: 40px;
    border: 1px solid var(--clr-gofun);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    opacity: 0.5;
}

.custom-cursor.active {
    transform: translate(-50%, -50%) scale(2);
    background: var(--clr-gold);
}
.custom-cursor-follower.active {
    transform: translate(-50%, -50%) scale(1.5);
    border-color: var(--clr-gold);
}


/* =========================================================================
   Global Header & Nav
   ========================================================================= */
.global-header {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    padding: 2rem 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.logo {
    font-family: var(--font-primary);
    font-size: 2.5rem;
    font-weight: 900;
    display: flex;
    align-items: baseline;
    gap: 10px;
    text-shadow: 0 4px 20px rgba(0,0,0,0.8);
}

.en-logo {
    font-size: 1rem;
    font-family: var(--font-secondary);
    letter-spacing: 0.2em;
    font-weight: 300;
}

.global-nav {
    display: flex;
    gap: 3rem;
}

.nav-link {
    color: var(--clr-gofun);
    text-decoration: none;
    font-size: 1rem;
    letter-spacing: 0.15em;
    position: relative;
    padding: 10px;
    transition: color 0.4s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0; left: 50%;
    width: 0; height: 1px;
    background: var(--clr-kurenai);
    transition: width 0.4s ease, left 0.4s ease;
}

.nav-link:hover::after, .nav-link.active::after {
    width: 100%;
    left: 0;
}

/* Header Controls Container */
.header-controls {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

/* Base Control Button (Hanko/Seal Style) */
.ctrl-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 252, 0.3);
    color: var(--clr-gofun);
    width: 45px;
    height: 45px;
    border-radius: 50%; /* Perfect circles to match Hanko */
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-primary);
    font-size: 1.1rem;
    cursor: none;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
}

body.light-theme .ctrl-btn {
    border-color: rgba(28, 28, 28, 0.3);
    color: var(--clr-sumi);
}

/* Hover/Ink Fill Effect */
.ctrl-btn::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    background: var(--clr-kurenai);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
    z-index: -1;
}

.ctrl-btn:hover::before {
    width: 250%; height: 250%;
}

.ctrl-btn:hover {
    border-color: transparent;
    color: var(--clr-gofun);
    box-shadow: 0 0 20px rgba(203, 27, 69, 0.6);
}

/* Audio Toggle specifics */
#audio-toggle {
    gap: 4px;
}
.sound-wave {
    width: 2px;
    height: 15px;
    background: var(--clr-gofun);
    animation: wave 1.2s infinite ease-in-out;
}
body.light-theme .sound-wave {
    background: var(--clr-sumi);
}
.ctrl-btn:hover .sound-wave {
    background: var(--clr-gofun) !important;
}

#audio-toggle.muted .sound-wave {
    animation: none;
    height: 3px;
}
.sound-wave:nth-child(2) { animation-delay: 0.2s; }
.sound-wave:nth-child(3) { animation-delay: 0.4s; }

@keyframes wave {
    0%, 100% { height: 5px; }
    50% { height: 18px; }
}

/* HTMX Transition animations */
#main-content.htmx-swapping {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

#main-content {
    width: 100%;
    height: 100%;
    transition: opacity 0.8s ease-in;
}

/* Vertical Text (Tategaki) Utility */
.tategaki {
    writing-mode: vertical-rl;
    text-orientation: upright;
}

/* English Language Overrides */
html[lang="en"] .tategaki {
    writing-mode: horizontal-tb; /* English is brutal to read stacked, flip to standard horizontal */
    text-orientation: mixed;
}

/* Authentic Script/Brush fonts for English */
html[lang="en"] .hero-text, 
html[lang="en"] .hero-secondary-text {
    font-family: 'Kaushan Script', cursive !important;
    white-space: nowrap; /* Prevent messy English brush wrapping */
    padding-right: 2rem;
    padding-bottom: 2rem;
}
