/* =========================================================
   tanso.in — Design Language
   Aesthetic: street-style, ma-negative-space, duotone,
              playfair-elegant, retro halftone patterns
   Palette: #C8A96E, #A0A0A0, #1B1B1B, #2A2A2A, #FFFFFF,
            #E8E4DF, #0A0A0A, #8B7442
   Fonts:   Playfair Display, Work Sans, Noto Sans JP
   ========================================================= */

:root {
    --bg-carbon: #111111;
    --bg-void: #0A0A0A;
    --bg-light: #E8E4DF;
    --surface-slate: #1E1E1E;
    --surface-smoke: #2A2A2A;
    --gold: #C8A96E;
    --gold-muted: #8B7442;
    --gray-warm: #A0A0A0;
    --ink-dark: #1B1B1B;
    --pure-white: #FFFFFF;

    --font-display: "Playfair Display", Georgia, serif;
    --font-body: "Work Sans", "Inter", system-ui, sans-serif;
    --font-jp: "Noto Sans JP", "Playfair Display", serif;

    --ease-gallery: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-void);
    color: var(--gray-warm);
    font-family: var(--font-body);
    font-weight: 300;
    line-height: 1.75;
    letter-spacing: 0.04em;
    overflow-x: hidden;
    min-height: 100vh;
}

/* =========================================================
   Fixed Kanji Logo
   ========================================================= */
#kanji-mark {
    position: fixed;
    top: 24px;
    left: 24px;
    font-family: var(--font-jp);
    font-weight: 300;
    font-size: 28px;
    color: var(--gold);
    text-decoration: none;
    z-index: 100;
    line-height: 1;
    letter-spacing: 0;
    transition: color 0.6s var(--ease-gallery), transform 0.6s var(--ease-gallery);
}

#kanji-mark:hover {
    color: var(--gold-muted);
    transform: scale(1.05);
}

/* Hide kanji mark color shifts on light section */
body.on-light #kanji-mark {
    color: var(--ink-dark);
}

/* =========================================================
   Hairline Scroll Indicator
   ========================================================= */
#scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 1px;
    height: 100vh;
    background: transparent;
    z-index: 90;
    pointer-events: none;
}

#scroll-indicator-fill {
    display: block;
    width: 1px;
    height: 0%;
    background: var(--gold);
    opacity: 0;
    transition: opacity 1.2s var(--ease-gallery);
    will-change: height;
}

body.scrolled #scroll-indicator-fill {
    opacity: 0.4;
}

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

/* =========================================================
   Layout — invisible 16-column grid
   ========================================================= */
#gallery {
    position: relative;
    z-index: 2;
}

.room {
    position: relative;
    min-height: 100vh;
    padding: 20vh 0;
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    align-items: center;
    overflow: hidden;
}

.room-content {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 6vh;
}

/* Lateral content migration - left → center → right */
.content-left {
    grid-column: 2 / span 5;
}

.content-center {
    grid-column: 6 / span 6;
}

.content-right {
    grid-column: 11 / span 5;
    text-align: right;
}

.content-full {
    grid-column: 2 / span 14;
}

/* =========================================================
   Typography
   ========================================================= */
.eyebrow {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--gold-muted);
}

.hero {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(3rem, 7vw, 6.5rem);
    letter-spacing: 0.02em;
    line-height: 1.0;
    color: var(--gold);
}

.hero em {
    font-style: italic;
    font-weight: 400;
    color: var(--pure-white);
}

.section-head {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.2rem, 5vw, 4.5rem);
    letter-spacing: 0.01em;
    line-height: 1.05;
    color: var(--gold);
}

.brilliance-headline {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(5rem, 12vw, 10rem);
    letter-spacing: 0.01em;
    line-height: 0.95;
    color: var(--gold);
    text-align: right;
    padding-block: 30vh;
    margin: 0;
}

.body-line {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    letter-spacing: 0.04em;
    line-height: 1.75;
    color: var(--gray-warm);
    max-width: 36ch;
}

.caption-line {
    font-style: normal;
    color: var(--gray-warm);
    margin-top: 4vh;
}

.brilliance-caption {
    color: var(--gray-warm);
    text-align: right;
    margin-left: auto;
}

.trace-line {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.75rem, 0.9vw, 0.9rem);
    letter-spacing: 0.18em;
    line-height: 1.8;
    color: var(--gray-warm);
    text-align: center;
    text-transform: lowercase;
    max-width: 48ch;
    margin: 0 auto;
}

.contact-caption {
    color: var(--ink-dark);
    grid-column: 3 / span 6;
    text-align: left;
    margin-top: 8vh;
    letter-spacing: 0.18em;
    font-size: 0.85rem;
    text-transform: uppercase;
}

/* =========================================================
   Kanji Watermark
   ========================================================= */
.kanji-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-jp);
    font-weight: 300;
    font-size: 80vw;
    color: var(--pure-white);
    opacity: 0;
    line-height: 1;
    pointer-events: none;
    z-index: 1;
    letter-spacing: 0;
    user-select: none;
    transition: opacity 2s var(--ease-gallery);
    filter: blur(0.5px);
}

#room-element .kanji-watermark.materialized {
    opacity: 0.04;
}

.kanji-trace.materialized {
    opacity: 0.02;
}

/* =========================================================
   Photographs (CSS-rendered duotone scenes)
   ========================================================= */
.photo-frame {
    position: relative;
    margin: 0;
    overflow: hidden;
}

.photo-frame figcaption {
    margin-top: 1.2rem;
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.72rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--gold-muted);
}

.photo-large {
    width: 100%;
    aspect-ratio: 4 / 5;
    max-width: 520px;
}

.photo-medium {
    width: 70%;
    aspect-ratio: 4 / 3;
    max-width: 380px;
}

.photo-offset-left {
    margin-right: auto;
    margin-left: -20%;
    margin-top: 6vh;
    text-align: left;
}

.photo {
    width: 100%;
    height: 100%;
    background-color: #161616;
    background-size: cover;
    background-position: center;
    filter: grayscale(100%) sepia(20%) brightness(0.9) contrast(1.2);
    position: relative;
}

.photo::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--gold);
    mix-blend-mode: multiply;
    opacity: 0.15;
    pointer-events: none;
}

/* Asphalt / concrete texture: layered radial + linear gradients to evoke
   rain-slicked pavement at night */
.photo-asphalt {
    background-image:
        radial-gradient(ellipse at 30% 40%, rgba(255, 255, 255, 0.18) 0%, transparent 28%),
        radial-gradient(ellipse at 70% 75%, rgba(255, 255, 255, 0.10) 0%, transparent 22%),
        radial-gradient(circle at 22% 78%, rgba(255, 255, 255, 0.06) 0%, transparent 8%),
        radial-gradient(circle at 80% 30%, rgba(200, 169, 110, 0.12) 0%, transparent 14%),
        repeating-linear-gradient(95deg,
            #0d0d0d 0px, #0d0d0d 1px,
            #1a1a1a 1px, #1a1a1a 3px,
            #0a0a0a 3px, #0a0a0a 4px),
        linear-gradient(180deg, #050505 0%, #1a1a1a 70%, #2a2a2a 100%);
    background-blend-mode: screen, screen, screen, screen, multiply, normal;
}

/* Silhouetted figure under a streetlight */
.photo-figure {
    background-image:
        radial-gradient(ellipse 30% 18% at 50% 12%, rgba(255, 240, 200, 0.55) 0%, transparent 70%),
        radial-gradient(ellipse 60% 80% at 50% 100%, rgba(0, 0, 0, 0.9) 0%, transparent 60%),
        linear-gradient(180deg,
            #1c1c1c 0%,
            #141414 30%,
            #050505 60%,
            #0a0a0a 100%),
        repeating-linear-gradient(90deg,
            transparent 0px, transparent 2px,
            rgba(255, 255, 255, 0.02) 2px, rgba(255, 255, 255, 0.02) 3px);
    background-blend-mode: screen, multiply, normal, overlay;
    position: relative;
}

.photo-figure::before {
    /* silhouette body */
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 18%;
    height: 62%;
    transform: translateX(-50%);
    background: #050505;
    clip-path: polygon(
        38% 0%, 62% 0%,         /* head top */
        70% 12%, 65% 24%,       /* head bottom / neck */
        88% 36%, 92% 56%,       /* shoulder & arm right */
        82% 60%, 76% 100%,      /* hip / leg right */
        24% 100%, 18% 60%,
        8% 56%, 12% 36%,
        35% 24%, 30% 12%
    );
    filter: blur(0.6px);
}

/* =========================================================
   Halftone Dot Patterns (SVG-as-data-URI background)
   ========================================================= */
.halftone-divider {
    width: 100vw;
    height: 4px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 4'><circle cx='2' cy='2' r='1' fill='%23C8A96E' fill-opacity='0.3'/><circle cx='10' cy='2' r='1' fill='%23C8A96E' fill-opacity='0.3'/><circle cx='18' cy='2' r='1' fill='%23C8A96E' fill-opacity='0.3'/><circle cx='26' cy='2' r='1' fill='%23C8A96E' fill-opacity='0.3'/></svg>");
    background-repeat: repeat-x;
    background-size: 32px 4px;
    margin: 0;
}

.halftone-bg {
    position: absolute;
    top: 0;
    right: 0;
    width: 60%;
    height: 100%;
    z-index: 1;
    background-image:
        radial-gradient(circle at 8px 8px, rgba(200, 169, 110, 0.18) 1.6px, transparent 1.8px);
    background-size: 16px 16px;
    background-position: 0 100%;
    /* gradient mask: dense at bottom (8px spacing), sparse at top */
    -webkit-mask-image: linear-gradient(to top,
        rgba(0, 0, 0, 1) 0%,
        rgba(0, 0, 0, 0.8) 30%,
        rgba(0, 0, 0, 0.3) 70%,
        rgba(0, 0, 0, 0) 100%);
    mask-image: linear-gradient(to top,
        rgba(0, 0, 0, 1) 0%,
        rgba(0, 0, 0, 0.8) 30%,
        rgba(0, 0, 0, 0.3) 70%,
        rgba(0, 0, 0, 0) 100%);
    pointer-events: none;
}

/* =========================================================
   Room 3 — Light / Contact Sheet
   ========================================================= */
.room-light {
    background: var(--bg-light);
    color: var(--ink-dark);
    transition: background 1.2s var(--ease-gallery);
}

.palette-wipe {
    position: absolute;
    inset: 0;
    background: var(--bg-void);
    transform-origin: bottom center;
    transform: scaleY(1);
    transition: transform 1.2s var(--ease-gallery);
    z-index: 2;
    pointer-events: none;
}

.room-light.in-view .palette-wipe {
    transform: scaleY(0);
}

.contact-sheet {
    position: relative;
    width: 100%;
    padding: 8vh 4vw;
    margin: 0 auto;
}

.reg-mark {
    position: absolute;
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 1.4rem;
    color: var(--gold);
    opacity: 0.4;
    line-height: 1;
}

.reg-tl { top: 1vh; left: 1vw; }
.reg-tr { top: 1vh; right: 1vw; }
.reg-bl { bottom: 1vh; left: 1vw; }
.reg-br { bottom: 1vh; right: 1vw; }

.contact-strip {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 16px;
    align-items: center;
    justify-items: center;
}

.contact-frame {
    width: 100%;
    aspect-ratio: 3 / 2;
    max-width: 120px;
    background-color: #2c2c2c;
    background-size: cover;
    background-position: center;
    filter: grayscale(100%) sepia(20%) brightness(0.85) contrast(1.25);
    position: relative;
    overflow: hidden;
}

.contact-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--gold);
    mix-blend-mode: multiply;
    opacity: 0.12;
}

/* Ten distinct procedurally-generated frames */
.frame-1  { background-image: radial-gradient(ellipse at 30% 40%, #b9b9b9 0%, #2a2a2a 50%, #050505 100%); }
.frame-2  { background-image: linear-gradient(135deg, #050505 0%, #303030 45%, #c8c8c8 55%, #060606 100%); }
.frame-3  { background-image:
                radial-gradient(circle at 60% 30%, #d0d0d0 0%, transparent 18%),
                linear-gradient(180deg, #0a0a0a, #2c2c2c 60%, #0a0a0a); }
.frame-4  { background-image: repeating-linear-gradient(105deg, #0c0c0c 0px, #0c0c0c 4px, #2a2a2a 4px, #2a2a2a 7px); }
.frame-5  { background-image:
                radial-gradient(ellipse at 50% 100%, #d8d8d8 0%, #404040 30%, #060606 70%); }
.frame-6  { background-image:
                radial-gradient(circle at 25% 25%, #ffffff 0%, transparent 12%),
                radial-gradient(circle at 75% 75%, #888888 0%, transparent 24%),
                linear-gradient(180deg, #111111, #050505); }
.frame-7  { background-image: linear-gradient(45deg, #0a0a0a 0%, #0a0a0a 38%, #d4d4d4 42%, #d4d4d4 48%, #0a0a0a 52%, #0a0a0a 100%); }
.frame-8  { background-image:
                radial-gradient(ellipse at 70% 60%, #c0c0c0 0%, #404040 35%, #0a0a0a 80%); }
.frame-9  { background-image:
                radial-gradient(circle at 50% 50%, #050505 0%, #050505 30%, #303030 60%, #b0b0b0 100%); }
.frame-10 { background-image:
                linear-gradient(180deg, transparent 0%, transparent 60%, #050505 60%, #050505 100%),
                radial-gradient(ellipse at 50% 30%, #e8e8e8 0%, #5a5a5a 40%, #1a1a1a 100%); }

/* =========================================================
   Reveal animation states (driven by IntersectionObserver)
   ========================================================= */
.reveal-item {
    opacity: 0;
    transform: translateY(30px);
    transition:
        opacity 0.5s var(--ease-gallery),
        transform 0.5s var(--ease-gallery);
}

.reveal.in-view .reveal-item {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
.reveal.in-view .reveal-item:nth-child(1) { transition-delay: 0ms; }
.reveal.in-view .reveal-item:nth-child(2) { transition-delay: 200ms; }
.reveal.in-view .reveal-item:nth-child(3) { transition-delay: 400ms; }
.reveal.in-view .reveal-item:nth-child(4) { transition-delay: 600ms; }
.reveal.in-view .reveal-item:nth-child(5) { transition-delay: 800ms; }

/* Hero on Room 1 has a slower fade per spec */
#room-element .reveal-item.hero {
    transition-duration: 1.5s;
}

#room-element .reveal-item.body-line {
    transition-delay: 1300ms;
    transition-duration: 1.2s;
}

/* =========================================================
   Final room
   ========================================================= */
.room-final {
    min-height: 100vh;
    padding: 30vh 0 25vh;
}

.room-final .kanji-trace {
    top: 75%;
}

/* =========================================================
   Responsive collapse
   ========================================================= */
@media (max-width: 720px) {
    .room {
        grid-template-columns: repeat(8, 1fr);
        padding: 12vh 0;
    }
    .content-left   { grid-column: 2 / span 6; }
    .content-center { grid-column: 2 / span 6; }
    .content-right  { grid-column: 2 / span 6; text-align: left; }
    .content-full   { grid-column: 1 / span 8; }

    .brilliance-headline {
        text-align: left;
        padding-block: 12vh;
    }

    .photo-offset-left {
        margin-left: 0;
    }

    .contact-strip {
        grid-template-columns: repeat(5, 1fr);
        gap: 12px;
    }

    .kanji-watermark {
        font-size: 110vw;
    }

    .brilliance-caption {
        text-align: left;
        margin-left: 0;
    }
}
