/* ==========================================================
   turingtest.quest — Bauhaus Machine-Shop Aesthetic
   Colors: #3A3A3A, #6B6B6B, #E8E8E8, #D4A574, #C9B59D, #FAFAF9
   Fonts: Space Mono, IBM Plex Sans, EB Garamond
   ========================================================== */

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

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

body {
    background-color: #FAFAF9;
    color: #3A3A3A;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 2.1vw, 1.1rem);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================
   Background Grid
   ========================================================== */

#background-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.8s ease;
    background-image:
        linear-gradient(to right, #E8E8E8 0.5px, transparent 0.5px),
        linear-gradient(to bottom, #E8E8E8 0.5px, transparent 0.5px);
    background-size: 60px 60px;
}

#background-grid.visible {
    opacity: 1;
}

/* ==========================================================
   Navigation
   ========================================================== */

#nav-hamburger {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 1000;
}

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

.hamburger-line {
    display: block;
    width: 28px;
    height: 2px;
    background-color: #3A3A3A;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#nav-toggle.active .hamburger-line:nth-child(1) {
    transform: translateY(10px) rotate(45deg);
}

#nav-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

#nav-toggle.active .hamburger-line:nth-child(3) {
    transform: translateY(-10px) rotate(-45deg);
}

#nav-menu {
    display: none;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    padding: 20px 0;
}

#nav-menu.open {
    display: flex;
}

.nav-link {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    color: #3A3A3A;
    text-decoration: none;
    text-transform: uppercase;
    position: relative;
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
    transition: border-bottom-color 0.2s ease;
}

.nav-link:hover {
    border-bottom-color: #D4A574;
}

/* ==========================================================
   Main Content
   ========================================================== */

#main-content {
    position: relative;
    z-index: 1;
    max-width: 760px;
    margin: 0 auto;
    padding: 0 40px;
}

/* ==========================================================
   Sections
   ========================================================== */

.content-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 120px 0 80px 0;
}

.section-inner {
    width: 100%;
}

/* ==========================================================
   Section Divider (Hairline Rule)
   ========================================================== */

.section-divider {
    width: 100%;
    height: 1px;
    background-color: #6B6B6B;
}

.hairline-rule {
    width: 60px;
    height: 1px;
    background-color: #D4A574;
    margin: 20px 0 32px 0;
}

/* ==========================================================
   Typography
   ========================================================== */

.headline {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-transform: uppercase;
    color: #3A3A3A;
}

.body-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 2.1vw, 1.1rem);
    line-height: 1.7;
    color: #3A3A3A;
    margin-bottom: 20px;
}

.accent-text {
    font-family: 'EB Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.05rem, 2.3vw, 1.25rem);
    line-height: 1.6;
    color: #3A3A3A;
    margin-bottom: 8px;
}

.attribution {
    display: block;
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: #6B6B6B;
    margin-bottom: 28px;
}

/* ==========================================================
   SVG Diagrams
   ========================================================== */

.diagram-container {
    margin: 40px 0;
    padding-left: 20px;
}

.line-diagram {
    width: 100%;
    max-width: 600px;
    height: auto;
}

/* Stroke draw animation */
.draw-stroke {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 0.6s ease;
}

.draw-stroke.drawn {
    stroke-dashoffset: 0;
}

/* Animate-dash cycling */
.animate-dash.active {
    animation: dashCycle 4s linear infinite;
}

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

/* ==========================================================
   Reveal Animation
   ========================================================== */

.reveal-element {
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.reveal-element.revealed {
    opacity: 1;
}

/* Zoom-focus for diagrams */
.diagram-container.reveal-element {
    transform: scale(0.95);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.diagram-container.reveal-element.revealed {
    opacity: 1;
    transform: scale(1.0);
}

/* ==========================================================
   Expandable Blocks
   ========================================================== */

.expandable-block {
    margin: 24px 0;
    border-left: 2px solid #E8E8E8;
    padding-left: 20px;
}

.expandable-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 12px 0;
}

.expandable-title {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    color: #3A3A3A;
    text-transform: uppercase;
}

.expandable-icon {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 1.1rem;
    color: #D4A574;
    transition: transform 0.2s ease;
    user-select: none;
}

.expandable-block.expanded .expandable-icon {
    transform: rotate(45deg);
}

.expandable-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.expandable-block.expanded .expandable-content {
    max-height: 600px;
}

.expandable-block.expanded {
    border-left-color: #D4A574;
}

/* ==========================================================
   Coda Section
   ========================================================== */

.coda-line {
    margin: 48px 0 32px 0;
}

.coda-svg {
    max-width: 400px;
}

.coda-domain {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    color: #6B6B6B;
    text-transform: lowercase;
}

/* ==========================================================
   Link Underline Animation
   ========================================================== */

a {
    color: #3A3A3A;
    text-decoration: none;
    position: relative;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: #D4A574;
    transition: width 0.2s ease;
}

a:hover::after {
    width: 100%;
}

/* ==========================================================
   Responsive
   ========================================================== */

@media (max-width: 768px) {
    #main-content {
        padding: 0 24px;
    }

    .content-section {
        min-height: auto;
        padding: 80px 0 60px 0;
    }

    .diagram-container {
        padding-left: 0;
    }

    #nav-hamburger {
        top: 16px;
        left: 16px;
    }

    .headline {
        font-size: clamp(1.4rem, 5vw, 2.2rem);
    }
}

@media (max-width: 480px) {
    #main-content {
        padding: 0 16px;
    }

    .content-section {
        padding: 60px 0 40px 0;
    }

    .expandable-block {
        padding-left: 12px;
    }
}
