/* okurairi.com - Wabi-Sabi Kinetic Design */
/* Palette: burgundy-cream */

:root {
    --urushi-black: #1a0f11;
    --kiln-ember: #7a2332;
    --aged-lacquer: #5c1a28;
    --raku-cream: #f2ece0;
    --parchment-warm: #e8ddd0;
    --kintsugi-gold: #c9a84c;
    --incense-smoke: #8a7e72;
    --festival-red: #b83a4a;
}

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

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

body {
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    color: var(--urushi-black);
    background-color: var(--raku-cream);
    background-image: radial-gradient(circle at 50% 50%, var(--raku-cream) 0%, var(--parchment-warm) 100%);
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Particle Canvas */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Navigation */
#site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    pointer-events: none;
}

.wordmark {
    font-family: 'Shippori Mincho', serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: var(--kiln-ember);
    letter-spacing: 0.02em;
    pointer-events: auto;
    animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { transform: scale(1.0); }
    50% { transform: scale(1.02); }
}

.menu-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.5px solid var(--kiln-ember);
    background: var(--raku-cream);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.menu-toggle:hover {
    background: var(--kiln-ember);
}

.menu-toggle:hover .menu-dot {
    background: var(--raku-cream);
}

.menu-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--festival-red);
    transition: background-color 0.3s ease;
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: var(--aged-lacquer);
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: circle(0% at calc(100% - 3.4rem) 2.8rem);
    transition: clip-path 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.menu-overlay.is-open {
    clip-path: circle(150% at calc(100% - 3.4rem) 2.8rem);
    pointer-events: auto;
}

.menu-overlay-inner {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
}

.menu-item {
    font-family: 'Shippori Mincho', serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 3.5vw, 3rem);
    color: var(--raku-cream);
    text-decoration: none;
    letter-spacing: 0.02em;
    opacity: 0;
    transform: perspective(1200px) rotateY(-90deg);
    transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s ease;
}

.menu-overlay.is-open .menu-item {
    opacity: 1;
    transform: perspective(1200px) rotateY(0deg);
}

.menu-overlay.is-open .menu-item[data-index="0"] { transition-delay: 0.15s; }
.menu-overlay.is-open .menu-item[data-index="1"] { transition-delay: 0.25s; }
.menu-overlay.is-open .menu-item[data-index="2"] { transition-delay: 0.35s; }
.menu-overlay.is-open .menu-item[data-index="3"] { transition-delay: 0.45s; }
.menu-overlay.is-open .menu-item[data-index="4"] { transition-delay: 0.55s; }

.menu-item:hover {
    color: var(--kintsugi-gold);
}

/* Sections */
.section {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

.section--hero {
    background: var(--urushi-black);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 2rem;
}

.hero-content {
    position: relative;
    z-index: 2;
    padding-left: 8%;
    max-width: 70%;
}

.hero-title {
    font-family: 'Shippori Mincho', serif;
    font-weight: 700;
    font-size: clamp(3.5rem, 9vw, 7.5rem);
    color: var(--raku-cream);
    letter-spacing: 0.02em;
    line-height: 1.15;
    overflow: hidden;
}

.hero-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
}

.hero-title .char.animated {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.hero-gold-line {
    width: 0;
    height: 1.5px;
    background: var(--kintsugi-gold);
    margin-top: 1rem;
    margin-bottom: 0.8rem;
    transition: width 0.6s ease-out;
}

.hero-gold-line.drawn {
    width: 200px;
}

.hero-subtitle {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--incense-smoke);
    opacity: 0;
    transition: opacity 0.6s ease;
}

.hero-subtitle.visible {
    opacity: 1;
}

.hero-illustration {
    position: absolute;
    right: 10%;
    top: 50%;
    transform: translateY(-50%);
    width: clamp(150px, 20vw, 300px);
    opacity: 0.15;
    z-index: 1;
}

.illustration-bowl .bowl-body,
.illustration-bowl .bowl-rim,
.illustration-bowl .bowl-base {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 2s ease-out;
}

.hero-illustration.revealed .bowl-body,
.hero-illustration.revealed .bowl-rim,
.hero-illustration.revealed .bowl-base {
    stroke-dashoffset: 0;
}

.illustration-bowl .bowl-crack,
.illustration-bowl .bowl-crack2 {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 1.5s ease-out 1s;
}

.hero-illustration.revealed .bowl-crack,
.hero-illustration.revealed .bowl-crack2 {
    stroke-dashoffset: 0;
}

/* Content Sections */
.section--content {
    background: var(--raku-cream);
    background-image: radial-gradient(ellipse at 50% 50%, var(--raku-cream) 40%, var(--parchment-warm) 100%);
    padding: 0;
}

.section--alt {
    background: var(--parchment-warm);
    background-image: radial-gradient(ellipse at 50% 50%, var(--parchment-warm) 40%, var(--raku-cream) 100%);
}

/* Crackle glaze texture overlay */
.section--content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cpath d='M20,5 Q60,20 40,60 Q25,100 50,130 Q70,155 45,190 Q30,220 55,260 Q75,290 50,330 Q35,360 60,395' fill='none' stroke='%231a0f11' stroke-width='0.5' opacity='0.035'/%3E%3Cpath d='M120,10 Q100,50 130,80 Q150,105 120,140 Q95,175 125,210 Q145,240 115,280 Q90,310 120,350 Q140,380 115,400' fill='none' stroke='%231a0f11' stroke-width='0.5' opacity='0.03'/%3E%3Cpath d='M220,0 Q200,40 230,70 Q250,95 215,130 Q195,165 225,200 Q250,230 220,270 Q195,300 230,340 Q255,370 225,400' fill='none' stroke='%231a0f11' stroke-width='0.5' opacity='0.035'/%3E%3Cpath d='M320,15 Q300,55 330,85 Q350,110 315,145 Q295,180 325,215 Q345,245 310,280 Q290,315 325,350 Q345,380 315,400' fill='none' stroke='%231a0f11' stroke-width='0.5' opacity='0.03'/%3E%3Cpath d='M5,100 Q40,85 80,100 Q120,115 160,95 Q200,80 240,100 Q280,120 320,100 Q360,85 395,105' fill='none' stroke='%231a0f11' stroke-width='0.5' opacity='0.03'/%3E%3Cpath d='M10,250 Q50,235 90,255 Q130,270 170,250 Q210,235 250,255 Q290,275 330,250 Q370,235 400,260' fill='none' stroke='%231a0f11' stroke-width='0.5' opacity='0.035'/%3E%3C/svg%3E");
    background-repeat: repeat;
    pointer-events: none;
    z-index: 0;
}

/* Kintsugi Dividers */
.kintsugi-divider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 20px;
    z-index: 2;
}

.divider-svg {
    width: 100%;
    height: 100%;
}

.divider-path {
    stroke-dasharray: 1400;
    stroke-dashoffset: 1400;
    transition: stroke-dashoffset 1s ease-out;
}

.section.in-view .divider-path {
    stroke-dashoffset: 0;
}

/* Section Grid - F-Pattern */
.section-grid {
    display: grid;
    grid-template-columns: 2fr 5fr 1.5fr;
    min-height: 100vh;
    padding: 6rem 2rem 4rem;
    position: relative;
    z-index: 1;
}

.section-anchor {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 4rem;
    gap: 2rem;
}

.section-anchor svg {
    width: clamp(100px, 12vw, 180px);
    opacity: 0.7;
}

.section-number {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 4rem);
    color: var(--kiln-ember);
    opacity: 0.25;
}

.section-content {
    padding: 4rem 3rem 2rem;
}

.section-heading {
    font-family: 'Shippori Mincho', serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 3.5vw, 3rem);
    color: var(--kiln-ember);
    letter-spacing: 0.02em;
    line-height: 1.15;
    margin-bottom: 2rem;
    overflow: hidden;
}

.section-heading .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
}

.section-heading .char.animated {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.section-body {
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    max-width: 62ch;
    margin-bottom: 1.5rem;
    color: var(--urushi-black);
}

.section-margin {
    position: relative;
}

/* Card-Flip Modules */
.cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 3rem;
    padding-bottom: 2rem;
}

.card-flip {
    width: 280px;
    height: 380px;
    perspective: 1200px;
    cursor: pointer;
    position: relative;
    opacity: 0;
    transform: perspective(1200px) rotateY(-15deg);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-flip.card-visible {
    opacity: 1;
    transform: perspective(1200px) rotateY(0deg) rotate(var(--card-rotate, 0deg)) translateY(var(--card-ty, 0px));
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-flip.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 3px;
    overflow: hidden;
}

.card-front {
    background: var(--raku-cream);
    border: 2px solid var(--kiln-ember);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

/* Hand-painted border effect */
.card-front::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    border: 1px solid var(--kiln-ember);
    border-radius: 2px;
    opacity: 0.3;
}

.card-illustration {
    width: 180px;
    height: 220px;
    margin-bottom: 1rem;
}

.card-title {
    font-family: 'Shippori Mincho', serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: var(--kiln-ember);
    letter-spacing: 0.02em;
    text-align: center;
}

.card-back {
    background: var(--raku-cream);
    border: 2px solid var(--kiln-ember);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

.card-back::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 1.5rem;
    right: 1.5rem;
    height: 1px;
    background: var(--kintsugi-gold);
    opacity: 0.4;
    transform: translateY(-50%);
    pointer-events: none;
}

.crackle-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cpath d='M10,5 Q30,25 20,50 Q15,75 30,95 Q40,115 25,140 Q15,160 35,185' fill='none' stroke='%231a0f11' stroke-width='0.4' opacity='0.04'/%3E%3Cpath d='M80,0 Q65,30 85,55 Q95,75 75,100 Q60,130 80,155 Q95,175 75,200' fill='none' stroke='%231a0f11' stroke-width='0.4' opacity='0.03'/%3E%3Cpath d='M150,10 Q135,40 155,65 Q165,85 145,110 Q130,140 155,165 Q170,185 150,200' fill='none' stroke='%231a0f11' stroke-width='0.4' opacity='0.04'/%3E%3Cpath d='M0,60 Q30,50 60,65 Q90,75 120,60 Q150,50 180,65' fill='none' stroke='%231a0f11' stroke-width='0.4' opacity='0.03'/%3E%3Cpath d='M5,140 Q35,130 65,145 Q95,155 125,140 Q155,130 185,145' fill='none' stroke='%231a0f11' stroke-width='0.4' opacity='0.04'/%3E%3C/svg%3E");
    background-repeat: repeat;
    pointer-events: none;
    z-index: 0;
}

.card-text {
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--urushi-black);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.card-annotation {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.5vw, 1.3rem);
    color: var(--kiln-ember);
    opacity: 0.7;
    position: relative;
    z-index: 1;
    align-self: flex-end;
}

.tap-prompt {
    display: none;
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--incense-smoke);
    text-align: center;
    position: absolute;
    bottom: -1.8rem;
    left: 0;
    right: 0;
    animation: pulse-prompt 2s ease-in-out infinite;
}

@keyframes pulse-prompt {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* SVG Illustration Animations */
.illustration-incense .smoke-path,
.illustration-brush path,
.illustration-kintsugi-bowl path,
.illustration-lantern path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 2s ease-out;
}

.section.in-view .illustration-incense .smoke-path,
.section.in-view .illustration-brush path,
.section.in-view .illustration-kintsugi-bowl path,
.section.in-view .illustration-lantern path {
    stroke-dashoffset: 0;
}

/* Footer */
.site-footer {
    background: var(--urushi-black);
    padding: 4rem 2rem;
    text-align: center;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

.footer-mark {
    font-family: 'Shippori Mincho', serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    color: var(--raku-cream);
    letter-spacing: 0.02em;
}

.footer-annotation {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.5vw, 1.3rem);
    color: var(--incense-smoke);
}

/* Hero wordmark color override in dark sections */
.section--hero ~ #site-nav .wordmark {
    color: var(--kiln-ember);
}

body.hero-active .wordmark {
    color: var(--raku-cream);
}

/* Responsive */
@media (max-width: 900px) {
    .section-grid {
        grid-template-columns: 1fr;
        padding: 4rem 1.5rem 3rem;
    }

    .section-anchor {
        flex-direction: row;
        justify-content: flex-start;
        padding-top: 2rem;
        gap: 1.5rem;
    }

    .section-anchor svg {
        width: 80px;
    }

    .section-content {
        padding: 2rem 0;
    }

    .section-margin {
        display: none;
    }

    .cards-container {
        flex-direction: column;
        align-items: center;
    }

    .card-flip {
        width: min(280px, 90vw);
    }

    .tap-prompt {
        display: block;
    }

    .hero-content {
        padding-left: 5%;
        max-width: 90%;
    }

    .hero-illustration {
        opacity: 0.08;
        right: 5%;
    }

    #site-nav {
        padding: 1rem 1.5rem;
    }
}

@media (max-width: 600px) {
    .hero-title {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }

    .section-heading {
        font-size: clamp(1.4rem, 6vw, 2rem);
    }

    .card-flip {
        width: min(260px, 85vw);
        height: 350px;
    }
}

/* Touch device detection */
@media (hover: none) {
    .tap-prompt {
        display: block;
    }
}
