/* ==========================================================================
   tanso.tech - Carbon / Element Six
   Monochrome + Amber Accent | Sidebar Layout | Retro-Industrial Japanese
   ========================================================================== */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    background: #0A0A0A;
}

body {
    font-family: 'Libre Baskerville', Georgia, serif;
    color: #FAFAFA;
    background: #0A0A0A;
    overflow-x: hidden;
    line-height: 1.75;
}

/* --- Ripple Container --- */
#ripple-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    border: 1px solid #4A4A4A;
    opacity: 0.6;
    transform: scale(0);
    animation: rippleExpand 600ms cubic-bezier(0.25, 0.1, 0.25, 1.0) forwards;
}

.ripple-large {
    animation: rippleExpandLarge 1200ms cubic-bezier(0.25, 0.1, 0.25, 1.0) forwards;
}

@keyframes rippleExpand {
    0% { transform: scale(0); opacity: 0.6; }
    100% { transform: scale(1); opacity: 0; }
}

@keyframes rippleExpandLarge {
    0% { transform: scale(0); opacity: 0.4; }
    100% { transform: scale(1); opacity: 0; }
}

/* --- Sidebar Navigation --- */
#sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 220px;
    height: 100vh;
    background: #0A0A0A;
    border-right: 1px solid #1C1C1C;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem 0;
    opacity: 0;
    transform: translateX(-100%);
    animation: sidebarFadeIn 600ms cubic-bezier(0.25, 0.1, 0.25, 1.0) 800ms forwards;
}

@keyframes sidebarFadeIn {
    0% { opacity: 0; transform: translateX(-100%); }
    100% { opacity: 1; transform: translateX(0); }
}

.sidebar-logo {
    text-align: center;
    padding: 0 1.5rem 2rem;
    border-bottom: 1px solid #1C1C1C;
}

.sidebar-logo-kanji {
    font-family: 'Josefin Sans', sans-serif;
    font-size: 1.8rem;
    font-weight: 300;
    color: #D4A853;
    letter-spacing: 0.15em;
}

.sidebar-nav {
    list-style: none;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
    padding: 2rem 0;
}

.nav-link {
    display: block;
    padding: 0.75rem 1.5rem;
    font-family: 'Josefin Sans', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #B8B8B8;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: color 400ms cubic-bezier(0.25, 0.1, 0.25, 1.0),
                border-color 400ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.nav-link:hover {
    color: #FFFFFF;
    border-left-color: #D4A853;
}

.nav-link.active {
    color: #FFFFFF;
    border-left-color: #D4A853;
}

.sidebar-footer {
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid #1C1C1C;
}

.sidebar-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #4A4A4A;
}

/* --- Mobile Header --- */
#mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background: #0A0A0A;
    border-bottom: 1px solid #1C1C1C;
    z-index: 1001;
    align-items: center;
    padding: 0 1rem;
}

#hamburger {
    width: 28px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0;
}

#hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: #FAFAFA;
    transition: transform 400ms, opacity 400ms;
}

#hamburger.open span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

#hamburger.open span:nth-child(2) {
    opacity: 0;
}

#hamburger.open span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

.mobile-logo {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 1rem;
    color: #FAFAFA;
    letter-spacing: 0.08em;
    margin-left: 1rem;
}

/* --- Main Content --- */
#main-content {
    margin-left: 220px;
    position: relative;
}

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

.section-dark {
    background: #0A0A0A;
    color: #FAFAFA;
}

.section-light {
    background: #FAFAFA;
    color: #0A0A0A;
}

/* --- Grain Overlay --- */
.grain-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    background-repeat: repeat;
    pointer-events: none;
    z-index: 1;
}

/* === SECTION 1: HERO / OPENING === */
#opening {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 4rem;
    height: 100vh;
}

.hero-image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.hero-image {
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 70% 40%, #4A4A4A 0%, transparent 50%),
        radial-gradient(ellipse at 30% 70%, #1C1C1C 0%, transparent 60%),
        radial-gradient(circle at 55% 55%, #B8B8B8 0%, transparent 25%),
        repeating-conic-gradient(from 0deg at 50% 50%, #0A0A0A 0deg 60deg, #1C1C1C 60deg 120deg),
        linear-gradient(145deg, #0A0A0A 0%, #1C1C1C 40%, #4A4A4A 60%, #1C1C1C 80%, #0A0A0A 100%);
    filter: contrast(1.3) brightness(0.7);
}

.hero-text {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(3rem, 12vw, 8rem);
    color: #FFFFFF;
    letter-spacing: 0.04em;
    line-height: 1;
    text-shadow: 0 2px 40px rgba(0,0,0,0.8);
}

.hero-subtitle {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #B8B8B8;
    margin-top: 1rem;
}

.hero-curve {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 80vh;
    z-index: 2;
    opacity: 0.5;
}

#hero-curve-path {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    animation: drawCurve 2000ms cubic-bezier(0.25, 0.1, 0.25, 1.0) 1000ms forwards;
}

@keyframes drawCurve {
    to { stroke-dashoffset: 0; }
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    right: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
}

.scroll-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    color: #B8B8B8;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.5rem;
}

.scroll-line {
    width: 1px;
    height: 40px;
    background: #B8B8B8;
    animation: scrollPulse 2000ms cubic-bezier(0.25, 0.1, 0.25, 1.0) infinite;
}

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

/* === SECTION DIVIDERS === */
.section-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 4rem;
    background: #FAFAFA;
}

.section-divider hr {
    flex: 1;
    border: none;
    height: 1px;
    background: #D4A853;
}

.divider-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #D4A853;
    white-space: nowrap;
}

.divider-dark {
    background: #0A0A0A;
}

/* === SECTION 2: ORIGIN STORY === */
#origin {
    padding: 8rem 4rem;
}

.two-col {
    display: grid;
    grid-template-columns: 55fr 45fr;
    gap: 4rem;
    align-items: start;
    max-width: 1100px;
}

.section-heading {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(1.8rem, 4vw, 3rem);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #0A0A0A;
    margin-bottom: 2rem;
}

.section-heading-light {
    color: #FAFAFA;
}

.body-text {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    color: #4A4A4A;
    margin-bottom: 1.5rem;
}

.caption {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #B8B8B8;
    margin-top: 2rem;
}

.col-image {
    position: relative;
}

.image-placeholder {
    width: 100%;
    aspect-ratio: 4/5;
    position: relative;
    overflow: hidden;
}

.graphite-image {
    background:
        radial-gradient(ellipse at 40% 30%, #4A4A4A 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, #B8B8B8 0%, transparent 40%),
        linear-gradient(160deg, #1C1C1C 0%, #4A4A4A 30%, #1C1C1C 60%, #0A0A0A 100%);
    filter: contrast(1.4) grayscale(1);
}

.atomic-diagram {
    position: absolute;
    bottom: -30px;
    right: -20px;
    width: 120px;
    height: 120px;
    opacity: 0.7;
}

.section-curve {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    opacity: 0.4;
}

/* === SECTION 3: TRANSFORMATION (ALLOTROPES) === */
#transformation {
    padding: 8rem 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#transformation .section-heading {
    text-align: center;
    margin-bottom: 4rem;
}

.allotrope-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    max-width: 1100px;
    width: 100%;
}

.allotrope-card {
    border: 1px solid #B8B8B8;
    padding: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 800ms cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 800ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.allotrope-card.visible {
    opacity: 1;
    transform: translateX(0) rotate(0deg);
}

.card-1 { transform: translateX(-40px) rotate(-1.5deg); }
.card-1.visible { transform: translateX(0) rotate(-1.5deg); }

.card-2 { transform: translateX(40px) rotate(1deg); transition-delay: 150ms; }
.card-2.visible { transform: translateX(0) rotate(1deg); }

.card-3 { transform: translateX(-40px) rotate(-0.8deg); transition-delay: 300ms; }
.card-3.visible { transform: translateX(0) rotate(-0.8deg); }

.card-image {
    width: 100%;
    aspect-ratio: 16/10;
    position: relative;
    overflow: hidden;
}

.diamond-image {
    background:
        radial-gradient(circle at 50% 50%, #FFFFFF 0%, transparent 20%),
        radial-gradient(circle at 30% 30%, #B8B8B8 0%, transparent 30%),
        radial-gradient(circle at 70% 40%, #FAFAFA 0%, transparent 25%),
        linear-gradient(135deg, #0A0A0A 0%, #4A4A4A 50%, #0A0A0A 100%);
    filter: contrast(1.5) brightness(0.9);
}

.graphite-card-image {
    background:
        repeating-linear-gradient(0deg, #1C1C1C 0px, #1C1C1C 2px, #4A4A4A 2px, #4A4A4A 4px),
        linear-gradient(90deg, #0A0A0A 0%, #1C1C1C 100%);
    filter: contrast(1.2);
}

.fullerene-image {
    background:
        radial-gradient(circle at 50% 50%, #4A4A4A 20%, transparent 50%),
        radial-gradient(circle at 50% 50%, transparent 18%, #B8B8B8 19%, #B8B8B8 20%, transparent 21%),
        radial-gradient(circle at 50% 50%, transparent 35%, #4A4A4A 36%, #4A4A4A 37%, transparent 38%),
        linear-gradient(180deg, #0A0A0A 0%, #1C1C1C 100%);
}

.card-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #FAFAFA;
    padding: 1.5rem 1.5rem 0.5rem;
}

.card-text {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 0.9rem;
    line-height: 1.65;
    color: #B8B8B8;
    padding: 0 1.5rem;
}

.card-caption {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    color: #4A4A4A;
    padding: 1rem 1.5rem 1.5rem;
}

/* === SECTION 4: MODERN APPLICATIONS === */
#applications {
    padding: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carbon-fiber-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(45deg, #0A0A0A 0px, #0A0A0A 2px, #1C1C1C 2px, #1C1C1C 4px),
        repeating-linear-gradient(-45deg, #0A0A0A 0px, #0A0A0A 2px, #1C1C1C 2px, #1C1C1C 4px);
    opacity: 0.5;
}

.applications-content {
    position: relative;
    z-index: 2;
    padding: 6rem 4rem;
    max-width: 1100px;
    width: 100%;
}

.typewriter-block {
    margin-bottom: 3rem;
    min-height: 2rem;
}

.typewriter-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.85rem, 1.5vw, 1.1rem);
    color: #D4A853;
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid #D4A853;
    width: 0;
    animation: typeWriter 3000ms cubic-bezier(0.25, 0.1, 0.25, 1.0) forwards,
               blinkCaret 800ms step-end infinite;
}

.typewriter-text.typed {
    width: 100%;
}

.typewriter-text.dissolve {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    color: #FAFAFA;
    border-right-color: transparent;
    white-space: normal;
    transition: all 800ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

@keyframes typeWriter {
    0% { width: 0; }
    100% { width: 100%; }
}

@keyframes blinkCaret {
    from, to { border-color: #D4A853; }
    50% { border-color: transparent; }
}

.applications-headline {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(2rem, 5vw, 4rem);
    color: #FFFFFF;
    letter-spacing: 0.04em;
    margin-bottom: 4rem;
    line-height: 1.1;
}

.applications-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
}

.app-item {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 800ms cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 800ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.app-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.app-number {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #D4A853;
    display: block;
    margin-bottom: 0.5rem;
}

.app-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #FAFAFA;
    margin-bottom: 0.75rem;
}

.app-desc {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 0.9rem;
    line-height: 1.65;
    color: #B8B8B8;
}

/* === SECTION 5: CLOSING === */
#closing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    background: #0A0A0A;
    position: relative;
}

.hex-grid-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 2000ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 100' fill='none' stroke='%23B8B8B8' stroke-width='0.5'/%3E%3Cpath d='M28 0L28 34L0 50L0 84L28 100L56 84L56 50L28 34' fill='none' stroke='%23B8B8B8' stroke-width='0.5'/%3E%3C/svg%3E");
    background-size: 56px 100px;
}

.hex-grid-bg.visible {
    opacity: 0.15;
    animation: hexPulse 4000ms cubic-bezier(0.25, 0.1, 0.25, 1.0) infinite;
}

@keyframes hexPulse {
    0%, 100% { opacity: 0.08; }
    50% { opacity: 0.15; }
}

.closing-text {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    color: #D4A853;
    letter-spacing: 0.06em;
    text-align: center;
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1200ms cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 1200ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.closing-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.closing-domain {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #4A4A4A;
    letter-spacing: 0.2em;
    margin-top: 2rem;
    position: relative;
    z-index: 2;
}

/* === FOOTER === */
#site-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: #0A0A0A;
    border-top: 1px solid #1C1C1C;
    margin-left: 220px;
}

.footer-domain {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    color: #B8B8B8;
    letter-spacing: 0.08em;
}

.footer-kanji {
    font-size: 1.2rem;
    color: #D4A853;
}

/* === SECTION WIDE (Applications - sidebar collapses) === */
.section-wide {
    background: #0A0A0A;
    color: #FAFAFA;
}

/* === RESPONSIVE: Mobile === */
@media (max-width: 768px) {
    #sidebar {
        display: none;
    }

    #sidebar.mobile-open {
        display: flex;
        width: 100%;
        height: 100vh;
        z-index: 1002;
        animation: none;
        opacity: 1;
        transform: translateX(0);
    }

    #mobile-header {
        display: flex;
    }

    #main-content {
        margin-left: 0;
        margin-top: 50px;
    }

    #site-footer {
        margin-left: 0;
    }

    #opening {
        padding: 2rem;
    }

    .hero-title {
        font-size: clamp(2.5rem, 10vw, 5rem);
    }

    #origin {
        padding: 4rem 2rem;
    }

    .two-col {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    #transformation {
        padding: 4rem 2rem;
    }

    .allotrope-cards {
        grid-template-columns: 1fr;
    }

    .applications-content {
        padding: 4rem 2rem;
    }

    .applications-grid {
        grid-template-columns: 1fr;
    }

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

    .scroll-indicator {
        right: 1.5rem;
    }

    .typewriter-text {
        white-space: normal;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: clamp(2rem, 9vw, 3.5rem);
    }

    .applications-headline {
        font-size: clamp(1.5rem, 6vw, 2.5rem);
    }
}

/* === Reveal animations base === */
.section-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 800ms cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 800ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.section-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}
