/* ===========================================
   tanso.center — Surreal Carbon Dreamscape
   =========================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #3a1018;
    color: #f0e4d4;
    font-family: 'Newsreader', serif;
    font-weight: 400;
    font-size: clamp(15px, 1.5vw, 18px);
    line-height: 1.8;
    overflow-x: hidden;
}

a {
    color: #c4a050;
    text-decoration: none;
}

/* --- Retro Pattern Backgrounds --- */
.retro-pattern-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.06;
    background-image:
        radial-gradient(circle at 25% 25%, #c4a050 1px, transparent 1px),
        radial-gradient(circle at 75% 75%, #c4a050 1px, transparent 1px),
        radial-gradient(circle at 50% 50%, #8a5a3a 0.5px, transparent 0.5px);
    background-size: 40px 40px, 40px 40px, 20px 20px;
}

.retro-pattern-bg.pattern-hexagon {
    background-image:
        linear-gradient(30deg, #c4a050 12%, transparent 12.5%, transparent 87%, #c4a050 87.5%, #c4a050),
        linear-gradient(150deg, #c4a050 12%, transparent 12.5%, transparent 87%, #c4a050 87.5%, #c4a050),
        linear-gradient(210deg, #c4a050 12%, transparent 12.5%, transparent 87%, #c4a050 87.5%, #c4a050),
        linear-gradient(330deg, #c4a050 12%, transparent 12.5%, transparent 87%, #c4a050 87.5%, #c4a050);
    background-size: 60px 104px;
    background-position: 0 0, 0 0, 30px 52px, 30px 52px;
    opacity: 0.04;
}

.hero-retro-pattern {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.05;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 49px, #b87a7a 49px, #b87a7a 50px),
        repeating-linear-gradient(90deg, transparent, transparent 49px, #b87a7a 49px, #b87a7a 50px);
    background-size: 50px 50px;
}

/* --- Leather Texture --- */
.card-leather-texture {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(138, 90, 58, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(138, 90, 58, 0.1) 0%, transparent 40%),
        radial-gradient(ellipse at 60% 80%, rgba(138, 90, 58, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 30% 70%, rgba(196, 160, 80, 0.05) 0%, transparent 30%);
    z-index: 0;
}

.card-leather-texture::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    opacity: 0.5;
}

/* ============================================
   HERO SECTION
   ============================================ */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    background-color: #5c1a2a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

/* Melting TANSO Title */
#tanso-title {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-size: clamp(60px, 14vw, 180px);
    letter-spacing: 0.08em;
    color: #f0e4d4;
    display: flex;
    gap: 0.02em;
    line-height: 1;
    margin-bottom: 0;
}

#tanso-title .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(-30px);
    transition: opacity 0.6s ease, transform 0.8s ease;
}

#tanso-title .letter.visible {
    opacity: 1;
}

#tanso-title .letter[data-index="0"].visible { transform: translateY(0) skewY(0deg); }
#tanso-title .letter[data-index="1"].visible { transform: translateY(0) skewY(1.2deg); }
#tanso-title .letter[data-index="2"].visible { transform: translateY(0) skewY(2.4deg); }
#tanso-title .letter[data-index="3"].visible { transform: translateY(0) skewY(3.6deg); }
#tanso-title .letter[data-index="4"].visible { transform: translateY(0) skewY(5deg); }

/* CENTER panel */
#center-panel {
    background-color: #f0e4d4;
    color: #5c1a2a;
    padding: 18px 50px 14px;
    text-align: center;
    transform: translateY(40px);
    opacity: 0;
    transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.8s, opacity 0.6s ease 0.8s;
    margin-top: -4px;
}

#center-panel.visible {
    transform: translateY(0);
    opacity: 1;
}

.center-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(14px, 2.5vw, 22px);
    font-weight: 500;
    letter-spacing: 0.5em;
    display: block;
}

.center-subtitle {
    font-family: 'Newsreader', serif;
    font-style: italic;
    font-size: clamp(12px, 1.2vw, 15px);
    margin-top: 6px;
    opacity: 0.7;
    letter-spacing: 0.05em;
}

/* Scroll hint */
.hero-scroll-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.scroll-line {
    display: block;
    width: 1px;
    height: 50px;
    background: linear-gradient(to bottom, transparent, #c4a050);
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.3; transform: scaleY(0.6); }
    50% { opacity: 1; transform: scaleY(1); }
}

/* ============================================
   CARD GRID SECTION
   ============================================ */
#card-grid {
    position: relative;
    background-color: #3a1018;
    padding: 100px 5vw 120px;
    overflow: visible;
}

.surreal-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 30px;
    max-width: 1300px;
    margin: 0 auto;
}

/* Card base */
.surreal-card {
    position: relative;
    background-color: #f0e4d4;
    color: #3a1018;
    border: 1px solid #8a5a3a;
    border-radius: 3px;
    transform: rotate(var(--rotation, 0deg));
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
    overflow: hidden;
    opacity: 0;
    translate: 0 40px;
}

.surreal-card.in-view {
    opacity: 1;
    translate: 0 0;
    transition: opacity 0.7s ease, translate 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
}

.surreal-card:hover {
    transform: rotate(0deg) scale(1.02);
    box-shadow: 0 20px 60px rgba(58, 16, 24, 0.4);
    z-index: 10;
}

.card-inner {
    position: relative;
    z-index: 1;
    padding: 32px 28px;
}

.card-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #8a5a3a;
    display: block;
    margin-bottom: 12px;
}

.card-title {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-size: clamp(22px, 3vw, 32px);
    line-height: 1.2;
    margin-bottom: 14px;
    color: #3a1018;
}

.card-body {
    font-family: 'Newsreader', serif;
    font-size: clamp(14px, 1.3vw, 16px);
    line-height: 1.75;
    color: #5c1a2a;
    margin-bottom: 16px;
}

.card-body:last-child {
    margin-bottom: 0;
}

/* Underline-draw links */
.underline-draw {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: #8a5a3a;
    background-image: linear-gradient(#c4a050, #c4a050);
    background-size: 0% 2px;
    background-repeat: no-repeat;
    background-position: left bottom;
    padding-bottom: 3px;
    transition: background-size 0.3s ease, color 0.3s ease;
    display: inline-block;
}

.underline-draw:hover {
    background-size: 100% 2px;
    color: #c4a050;
}

/* Card size variants */
.card-large {
    grid-column: span 7;
    min-height: 320px;
}

.card-medium {
    grid-column: span 5;
    min-height: 260px;
}

.card-small {
    grid-column: span 4;
    min-height: 200px;
}

.card-tall {
    grid-column: span 5;
    grid-row: span 2;
    min-height: 420px;
}

.card-wide {
    grid-column: span 8;
    min-height: 240px;
}

.card-accent {
    background-color: #e8dcc8;
}

/* ============================================
   FORMULA STRIP
   ============================================ */
#formula-strip {
    background-color: #5c1a2a;
    padding: 30px 0;
    overflow: hidden;
    border-top: 1px solid rgba(196, 160, 80, 0.2);
    border-bottom: 1px solid rgba(196, 160, 80, 0.2);
}

.formula-scroll {
    overflow: hidden;
    width: 100%;
}

.formula-track {
    display: flex;
    gap: 30px;
    white-space: nowrap;
    animation: formulaScroll 30s linear infinite;
    width: max-content;
}

.formula {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(16px, 2vw, 22px);
    font-weight: 400;
    color: #c4a050;
    letter-spacing: 0.05em;
}

.formula-sep {
    color: #b87a7a;
    font-size: 20px;
    opacity: 0.5;
}

@keyframes formulaScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ============================================
   DEEP SECTION — Carbon Cycle
   ============================================ */
#deep-section {
    position: relative;
    background-color: #3a1018;
    padding: 120px 5vw;
    overflow: hidden;
}

.deep-content {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 80px;
    align-items: center;
}

.section-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #c4a050;
    display: block;
    margin-bottom: 20px;
}

.deep-title {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1.15;
    color: #f0e4d4;
    margin-bottom: 30px;
}

.deep-body {
    font-family: 'Newsreader', serif;
    font-size: clamp(15px, 1.5vw, 18px);
    line-height: 1.8;
    color: #b87a7a;
    margin-bottom: 24px;
}

.deep-body:last-child {
    margin-bottom: 0;
}

.deep-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.carbon-cycle-svg {
    width: 100%;
    max-width: 400px;
    height: auto;
    opacity: 0;
    transform: rotate(-10deg) scale(0.9);
    transition: opacity 1s ease, transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.carbon-cycle-svg.in-view {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Animated cycle nodes */
.cycle-node {
    animation: nodePulse 3s ease-in-out infinite;
}

.cycle-node:nth-child(2) { animation-delay: 0.75s; }
.cycle-node:nth-child(3) { animation-delay: 1.5s; }
.cycle-node:nth-child(4) { animation-delay: 2.25s; }

@keyframes nodePulse {
    0%, 100% { r: 6; opacity: 1; }
    50% { r: 9; opacity: 0.7; }
}

/* Flow path animation */
.flow-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: flowDraw 4s ease-in-out infinite;
}

.flow-path:nth-of-type(2) { animation-delay: 1s; }
.flow-path:nth-of-type(3) { animation-delay: 2s; }
.flow-path:nth-of-type(4) { animation-delay: 3s; }

@keyframes flowDraw {
    0% { stroke-dashoffset: 200; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -200; }
}

/* ============================================
   CLOSING SECTION
   ============================================ */
#closing {
    position: relative;
    background-color: #5c1a2a;
    padding: 120px 5vw;
    text-align: center;
    overflow: hidden;
}

.closing-content {
    position: relative;
    z-index: 1;
    max-width: 700px;
    margin: 0 auto;
}

.closing-title {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-size: clamp(60px, 12vw, 140px);
    line-height: 1;
    color: #f0e4d4;
    margin-bottom: 40px;
    display: flex;
    justify-content: center;
    gap: 0.1em;
}

.closing-title .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.closing-title .letter.visible {
    opacity: 1;
}

.closing-title .letter[data-index="0"].visible {
    transform: translateY(0) skewY(-2deg);
}

.closing-title .letter[data-index="1"].visible {
    transform: translateY(0) skewY(2deg);
}

.closing-body {
    font-family: 'Newsreader', serif;
    font-size: clamp(16px, 1.8vw, 20px);
    line-height: 1.8;
    color: #e8dcc8;
    margin-bottom: 40px;
}

.highlight {
    color: #c4a050;
    font-style: italic;
}

.closing-formula {
    display: inline-block;
    border: 1px solid rgba(196, 160, 80, 0.3);
    padding: 12px 30px;
}

.formula-mono {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.15em;
    color: #c4a050;
}

/* ============================================
   FOOTER
   ============================================ */
#footer {
    background-color: #3a1018;
    padding: 30px 5vw;
    border-top: 1px solid rgba(138, 90, 58, 0.2);
}

.footer-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-mark {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: #8a5a3a;
}

.footer-sep {
    color: #8a5a3a;
    opacity: 0.4;
}

.footer-note {
    font-family: 'Newsreader', serif;
    font-style: italic;
    font-size: 13px;
    color: #b87a7a;
    opacity: 0.6;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .surreal-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 20px;
    }

    .card-large,
    .card-wide {
        grid-column: span 6;
    }

    .card-medium,
    .card-tall {
        grid-column: span 6;
        grid-row: span 1;
    }

    .card-small {
        grid-column: span 3;
    }

    .deep-content {
        grid-template-columns: 1fr;
        gap: 50px;
    }

    .deep-visual {
        order: -1;
    }

    .carbon-cycle-svg {
        max-width: 280px;
    }
}

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

    .card-large,
    .card-medium,
    .card-small,
    .card-tall,
    .card-wide {
        grid-column: span 1;
        grid-row: span 1;
    }

    #tanso-title {
        font-size: clamp(48px, 16vw, 100px);
    }

    .closing-title {
        font-size: clamp(48px, 16vw, 100px);
    }

    #center-panel {
        padding: 14px 30px 10px;
    }

    .center-text {
        letter-spacing: 0.3em;
    }
}