/* ===========================================
   rinji.dev — Bauhaus Ephemeral Architecture
   =========================================== */

/* --- CSS Custom Properties --- */
:root {
    --bauhaus-black: #0D0D0D;
    --workshop-gold: #D4A843;
    --blueprint-blue: #2D5E8A;
    --drafting-white: #E8E4DC;
    --ethereal-lavender: #A8A0C0;
    --sharp-graphite: #3A3A3A;
    --module-red: #C24D3F;

    --font-headline: 'Roboto Slab', serif;
    --font-body: 'IBM Plex Sans', sans-serif;
    --font-code: 'IBM Plex Mono', monospace;

    --bezier-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bauhaus-black);
    color: var(--drafting-white);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(16px, 1.5vw, 18px);
    line-height: 1.75;
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: var(--font-headline);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--workshop-gold);
}

h2 {
    font-size: clamp(28px, 4.5vw, 60px);
    margin-bottom: 1em;
}

h3 {
    font-size: clamp(20px, 2.5vw, 32px);
    margin-bottom: 0.5em;
}

code {
    font-family: var(--font-code);
    font-weight: 400;
    font-size: 14px;
}

/* --- Workshop Gate (Hero) --- */
#workshop-gate {
    position: relative;
    width: 100%;
    height: 100vh;
    background: var(--bauhaus-black);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Sharp-angle SVG frame */
#gate-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

#gate-frame .frame-line {
    fill: none;
    stroke: var(--workshop-gold);
    stroke-width: 0.5;
    opacity: 0;
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
}

#gate-frame .frame-line.animate {
    animation: drawLine 1s ease-out forwards;
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
        opacity: 0.3;
    }
}

/* Gold wireframe overlay */
#wireframe-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.08;
}

#wireframe-overlay svg {
    width: 100%;
    height: 100%;
}

#wireframe-overlay line,
#wireframe-overlay rect {
    fill: none;
    stroke: var(--workshop-gold);
    stroke-width: 0.5;
}

/* Bauhaus geometric forms */
#bauhaus-forms {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.bauhaus-circle,
.bauhaus-triangle,
.bauhaus-square {
    position: absolute;
    opacity: 0;
    transform: scale(0.8);
    transition: transform 0.3s var(--bezier-bounce);
    pointer-events: auto;
}

.bauhaus-circle.visible,
.bauhaus-triangle.visible,
.bauhaus-square.visible {
    opacity: 1;
    transform: scale(1);
    animation: fadeScale 0.6s ease-out forwards;
}

@keyframes fadeScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.bauhaus-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 1.5px solid var(--workshop-gold);
    top: 20%;
    left: 15%;
}

.bauhaus-circle:hover {
    transform: scale(1.05) rotate(5deg);
}

.bauhaus-triangle {
    width: 0;
    height: 0;
    border-left: 80px solid transparent;
    border-right: 80px solid transparent;
    border-bottom: 140px solid transparent;
    position: absolute;
    top: 61.8%;
    left: 61.8%;
    transform: translateX(-50%) translateY(-50%);
}

.bauhaus-triangle::after {
    content: '';
    position: absolute;
    top: 0;
    left: -80px;
    width: 0;
    height: 0;
    border-left: 80px solid transparent;
    border-right: 80px solid transparent;
    border-bottom: 140px solid var(--workshop-gold);
    opacity: 0.15;
}

.bauhaus-triangle::before {
    content: '';
    position: absolute;
    top: 4px;
    left: -76px;
    width: 0;
    height: 0;
    border-left: 76px solid transparent;
    border-right: 76px solid transparent;
    border-bottom: 133px solid var(--bauhaus-black);
    z-index: 1;
}

.bauhaus-triangle.visible {
    border-bottom-color: transparent;
}

.bauhaus-triangle:hover {
    transform: translateX(-50%) translateY(-50%) rotate(15deg);
}

.bauhaus-square {
    width: 120px;
    height: 120px;
    border: 1.5px solid var(--workshop-gold);
    top: 25%;
    right: 18%;
}

.bauhaus-square:hover {
    transform: scale(1.02);
}

/* Line-illustration modules */
#gate-modules {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.line-module {
    fill: none;
    stroke: var(--drafting-white);
    stroke-width: 1;
    opacity: 0.3;
    transition: opacity 0.3s ease, transform 0.3s var(--bezier-bounce);
    pointer-events: auto;
}

.line-module:hover {
    opacity: 0.6;
    transform: scale(1.05);
}

.module-1 {
    position: absolute;
    width: 80px;
    height: 80px;
    top: 10%;
    right: 8%;
}

.module-2 {
    position: absolute;
    width: 70px;
    height: 70px;
    bottom: 15%;
    left: 8%;
}

.module-3 {
    position: absolute;
    width: 90px;
    height: 90px;
    bottom: 20%;
    right: 25%;
}

/* Wordmark */
#wordmark {
    position: relative;
    z-index: 10;
    text-align: center;
    opacity: 0;
}

#wordmark.visible {
    animation: wordmarkIn 0.6s ease-out forwards;
}

@keyframes wordmarkIn {
    from {
        opacity: 0;
        letter-spacing: 0.1em;
    }
    to {
        opacity: 1;
        letter-spacing: -0.01em;
    }
}

#wordmark h1 {
    font-family: var(--font-headline);
    font-size: clamp(48px, 8vw, 120px);
    color: var(--workshop-gold);
    letter-spacing: -0.01em;
    line-height: 1;
    margin-bottom: 0.2em;
}

#wordmark .subtitle {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: clamp(14px, 2vw, 20px);
    color: var(--ethereal-lavender);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0.8;
}

/* --- Documentation Flow (F-pattern) --- */
#documentation-flow {
    position: relative;
    padding: 120px 0;
    background: var(--bauhaus-black);
}

.doc-section {
    max-width: 800px;
    margin-left: 10vw;
    padding: 80px 0;
    display: flex;
    gap: 60px;
    align-items: flex-start;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

.section-content {
    flex: 1;
    max-width: 600px;
}

.section-content h2 {
    font-size: clamp(28px, 4.5vw, 60px);
    color: var(--workshop-gold);
    margin-bottom: 0.6em;
}

.section-content p {
    color: var(--drafting-white);
    margin-bottom: 1.2em;
    line-height: 1.75;
}

.code-block {
    background: rgba(61, 61, 61, 0.3);
    border-left: 3px solid var(--workshop-gold);
    padding: 16px 20px;
    border-radius: 0 4px 4px 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ethereal-lavender);
    overflow-x: auto;
}

.code-block code {
    color: var(--ethereal-lavender);
}

.section-illustration {
    flex-shrink: 0;
    width: 160px;
    opacity: 0.25;
    transition: opacity 0.3s ease;
}

.section-illustration:hover {
    opacity: 0.5;
}

.section-illustration .line-module {
    width: 100%;
    height: auto;
    opacity: 1;
}

/* Gold separator */
.gold-separator {
    max-width: 800px;
    margin-left: 10vw;
    height: 2px;
    background: linear-gradient(135deg, var(--workshop-gold) 0%, transparent 80%);
    clip-path: polygon(0 0, 100% 0, 95% 100%, 0 100%);
    opacity: 0.4;
}

/* --- Module Showcase --- */
#module-showcase {
    position: relative;
    padding: 120px 10vw;
    background: var(--sharp-graphite);
    clip-path: polygon(0 0, 100% 40px, 100% calc(100% - 40px), 0 100%);
}

.showcase-title {
    text-align: left;
    margin-bottom: 60px;
    font-size: clamp(28px, 4.5vw, 60px);
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
}

.module-card {
    background: rgba(13, 13, 13, 0.6);
    border: 1px solid rgba(212, 168, 67, 0.15);
    padding: 40px 30px;
    transition: transform 0.3s var(--bezier-bounce), border-color 0.3s ease;
}

.module-card:hover {
    border-color: rgba(212, 168, 67, 0.4);
}

.module-card-circle:hover {
    transform: scale(1.05) rotate(2deg);
}

.module-card-triangle:hover {
    transform: scale(1.02) rotate(-1deg);
}

.module-card-rect:hover {
    transform: scale(1.02);
}

.card-shape {
    width: 100px;
    height: 100px;
    margin-bottom: 30px;
}

.card-shape svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: var(--workshop-gold);
    stroke-width: 1.5;
}

.module-card h3 {
    color: var(--workshop-gold);
}

.module-card p {
    color: var(--drafting-white);
    opacity: 0.8;
    font-size: clamp(14px, 1.2vw, 16px);
    line-height: 1.7;
}

/* --- Blueprint Footer --- */
#blueprint-footer {
    position: relative;
    background: var(--bauhaus-black);
    padding: 80px 10vw 60px;
    overflow: hidden;
}

.footer-angle {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: var(--sharp-graphite);
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 100%);
}

.footer-wireframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.06;
}

.footer-wireframe svg {
    width: 100%;
    height: 100%;
}

.footer-wireframe line,
.footer-wireframe rect,
.footer-wireframe circle,
.footer-wireframe polygon {
    fill: none;
    stroke: var(--workshop-gold);
    stroke-width: 1;
}

.footer-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    gap: 60px;
    padding-top: 40px;
}

.footer-wordmark {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(28px, 4vw, 48px);
    color: var(--workshop-gold);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.footer-text p {
    color: var(--drafting-white);
    opacity: 0.6;
    margin-bottom: 0.5em;
}

.footer-text .footer-sub {
    color: var(--ethereal-lavender);
    font-size: 14px;
    opacity: 0.4;
    font-style: italic;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .module-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .doc-section {
        flex-direction: column;
        margin-left: 5vw;
        margin-right: 5vw;
    }

    .section-illustration {
        display: none;
    }

    .bauhaus-circle {
        width: 100px;
        height: 100px;
    }

    .bauhaus-square {
        width: 80px;
        height: 80px;
    }

    .footer-content {
        flex-direction: column;
        gap: 20px;
    }

    #module-showcase {
        padding: 80px 5vw;
    }

    #blueprint-footer {
        padding: 60px 5vw 40px;
    }
}

@media (max-width: 600px) {
    .bauhaus-circle {
        width: 80px;
        height: 80px;
        top: 15%;
        left: 10%;
    }

    .bauhaus-square {
        width: 60px;
        height: 60px;
        right: 10%;
    }

    .bauhaus-triangle {
        border-left-width: 50px;
        border-right-width: 50px;
        border-bottom-width: 87px;
    }

    .bauhaus-triangle::after {
        left: -50px;
        border-left-width: 50px;
        border-right-width: 50px;
        border-bottom-width: 87px;
    }

    .bauhaus-triangle::before {
        left: -46px;
        border-left-width: 46px;
        border-right-width: 46px;
        border-bottom-width: 80px;
    }
}
