/* ========================================
   logic.day - Pop-Art Logic Celebration
   ======================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(16px, 1.6vw, 19px);
    line-height: 1.65;
    color: #0a0a0a;
    background-color: #faf8f0;
    overflow-x: hidden;
}

/* --- Typography --- */
h1, h2, h3, .operator-symbol, .operator-label, .table-title, .section-title {
    font-family: 'Bungee', cursive;
    font-weight: 400;
}

.truth-table th,
.truth-table td {
    font-family: 'Fira Mono', monospace;
    font-weight: 400;
    font-size: 14px;
    letter-spacing: 0.04em;
}

/* --- Z-Pattern Section Base --- */
.z-section {
    position: relative;
    min-height: 100vh;
    padding: clamp(40px, 8vw, 100px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.z-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: clamp(40px, 8vw, 100px);
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.z-top-left {
    justify-self: start;
    align-self: start;
}

.z-top-right {
    justify-self: end;
    align-self: start;
    text-align: right;
}

.z-bottom-left {
    justify-self: start;
    align-self: end;
}

.z-bottom-right {
    justify-self: end;
    align-self: end;
    text-align: right;
}

/* --- Ben-Day Dot Overlay --- */
.ben-day-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(10, 10, 10, 0.06) 1px, transparent 1px);
    background-size: 12px 12px;
    z-index: 0;
}

.z-grid,
.syllogism-composition,
.truth-tables-grid,
.section-title {
    position: relative;
    z-index: 1;
}

/* ========================================
   HERO SECTION
   ======================================== */

.hero-section {
    min-height: 100vh;
}

/* --- Neon Text --- */
.neon-text {
    font-size: clamp(48px, 8vw, 120px);
    color: #0a0a0a;
    text-shadow: none;
    transition: text-shadow 0.1s ease;
}

.neon-text.glow-1 {
    text-shadow:
        0 0 2px #34d399;
}

.neon-text.glow-2 {
    text-shadow:
        0 0 2px #34d399,
        0 0 6px #4a2a8a;
}

.neon-text.glow-3 {
    text-shadow:
        0 0 2px #34d399,
        0 0 6px #4a2a8a,
        0 0 12px #2dd4bf;
}

.neon-text.glow-4 {
    text-shadow:
        0 0 2px #34d399,
        0 0 6px #4a2a8a,
        0 0 12px #2dd4bf,
        0 0 24px #34d399;
}

.neon-text-small {
    font-size: clamp(36px, 6vw, 72px);
    color: #0a0a0a;
    text-shadow:
        0 0 2px #34d399,
        0 0 6px #4a2a8a,
        0 0 12px #2dd4bf,
        0 0 24px #34d399;
    text-align: center;
    margin-bottom: clamp(30px, 5vw, 60px);
}

/* --- .DAY text --- */
.day-text {
    font-family: 'Bungee', cursive;
    font-size: clamp(36px, 6vw, 72px);
    color: #0a0a0a;
    opacity: 0;
    transition: opacity 0.4s ease;
    display: inline-block;
}

.day-text.visible {
    opacity: 1;
}

/* --- Crystal Diamond --- */
.crystal-diamond {
    width: 24px;
    height: 24px;
    background: #a78bfa;
    transform: rotate(45deg);
    display: inline-block;
    margin-left: 12px;
    box-shadow: 0 0 8px rgba(167, 139, 250, 0.5);
    vertical-align: middle;
}

.crystal-diamond.small {
    width: 14px;
    height: 14px;
    margin-left: 8px;
    margin-top: 12px;
}

/* --- Speech Bubble --- */
.speech-bubble {
    background: #fff8e0;
    border: 3px solid #0a0a0a;
    border-radius: 20px;
    padding: clamp(20px, 3vw, 40px);
    position: relative;
    display: inline-block;
    max-width: 400px;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
}

.speech-bubble.visible {
    opacity: 1;
    transform: scale(1);
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -16px;
    left: 30px;
    width: 0;
    height: 0;
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-top: 16px solid #0a0a0a;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 32px;
    width: 0;
    height: 0;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-top: 14px solid #fff8e0;
    z-index: 1;
}

#hero-bubble p {
    font-family: 'Bungee', cursive;
    font-size: clamp(20px, 3vw, 36px);
    color: #0a0a0a;
}

/* --- AND Gate SVG --- */
.and-gate-wrapper {
    width: clamp(120px, 15vw, 200px);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.and-gate-wrapper.visible {
    opacity: 1;
}

.and-gate-svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 4px #34d399) drop-shadow(0 0 12px #2dd4bf) drop-shadow(0 0 24px #34d399);
}

.gate-path,
.gate-input-1,
.gate-input-2,
.gate-output {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 0.6s ease;
}

.and-gate-wrapper.visible .gate-path,
.and-gate-wrapper.visible .gate-input-1,
.and-gate-wrapper.visible .gate-input-2,
.and-gate-wrapper.visible .gate-output {
    stroke-dashoffset: 0;
}

/* ========================================
   OPERATORS SECTION
   ======================================== */

.operator-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.operator-symbol {
    font-size: clamp(48px, 10vw, 140px);
    line-height: 1;
    display: block;
}

.operator-label {
    font-size: clamp(24px, 4vw, 48px);
    letter-spacing: 0.05em;
}

/* Neon Glow Variations */
.neon-glow-green {
    color: #0a0a0a;
    text-shadow:
        0 0 2px #34d399,
        0 0 6px #34d399,
        0 0 12px #34d399,
        0 0 24px #34d399;
}

.neon-glow-violet {
    color: #0a0a0a;
    text-shadow:
        0 0 2px #4a2a8a,
        0 0 6px #4a2a8a,
        0 0 12px #4a2a8a,
        0 0 24px #4a2a8a;
}

.neon-glow-teal {
    color: #0a0a0a;
    text-shadow:
        0 0 2px #2dd4bf,
        0 0 6px #2dd4bf,
        0 0 12px #2dd4bf,
        0 0 24px #2dd4bf;
}

.operator-explain {
    max-width: 400px;
    display: inline-block;
}

.operator-explain h2 {
    font-size: clamp(20px, 3vw, 36px);
    margin-bottom: 12px;
}

.operator-explain p {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    line-height: 1.65;
}

/* Z-pattern animation states */
.animate-z {
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.animate-z[data-z="top-left"] {
    transform: translateX(-40px);
}

.animate-z[data-z="top-right"] {
    transform: translateX(40px);
}

.animate-z[data-z="bottom-left"] {
    transform: translateX(-40px);
}

.animate-z[data-z="bottom-right"] {
    transform: translateX(40px);
}

.animate-z.z-visible {
    opacity: 1;
    transform: translateX(0);
}

/* ========================================
   TRUTH TABLES SECTION
   ======================================== */

#truth-tables {
    padding-bottom: clamp(60px, 10vw, 120px);
}

.truth-tables-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: clamp(30px, 5vw, 60px);
    max-width: 1000px;
    margin: 0 auto;
}

.truth-table-container {
    text-align: center;
}

.table-title {
    font-size: clamp(24px, 4vw, 42px);
    margin-bottom: 16px;
    text-shadow:
        0 0 2px #34d399,
        0 0 6px #4a2a8a;
}

.truth-table {
    width: 100%;
    border-collapse: collapse;
    border: 3px solid #0a0a0a;
}

.truth-table th {
    background: #0a0a0a;
    color: #faf8f0;
    padding: 12px 16px;
    text-transform: uppercase;
    font-size: 15px;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.truth-table td {
    padding: 12px 16px;
    border: 2px solid #0a0a0a;
    text-align: center;
    font-size: 16px;
    font-weight: 400;
    transition: background-color 0.1s ease;
}

.truth-table td.val-true {
    background: rgba(52, 211, 153, 0.2);
    color: #0a0a0a;
}

.truth-table td.val-false {
    background: rgba(74, 42, 138, 0.15);
    color: #0a0a0a;
}

/* Row hover highlight */
.truth-table tbody tr:hover td.val-true {
    background: rgba(52, 211, 153, 0.3);
}

.truth-table tbody tr:hover td.val-false {
    background: rgba(74, 42, 138, 0.3);
}

/* Column highlight class applied via JS */
.truth-table th.col-highlight {
    background: #34d399;
    color: #0a0a0a;
}

.truth-table td.col-highlight-true {
    background: rgba(52, 211, 153, 0.35);
}

.truth-table td.col-highlight-false {
    background: rgba(74, 42, 138, 0.35);
}

/* ========================================
   SYLLOGISM SECTION
   ======================================== */

#syllogism {
    padding-bottom: clamp(80px, 12vw, 160px);
}

.syllogism-composition {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: clamp(16px, 3vw, 40px);
    max-width: 1100px;
    margin: 0 auto;
}

.syllogism-arrow {
    width: 60px;
    flex-shrink: 0;
}

.syllogism-arrow svg {
    width: 100%;
    height: auto;
}

.speech-bubble.premise {
    max-width: 280px;
}

.speech-bubble.conclusion {
    max-width: 320px;
    border-color: #34d399;
    box-shadow:
        0 0 4px #34d399,
        0 0 12px #2dd4bf,
        0 0 24px #34d399;
}

.speech-bubble.conclusion::after {
    border-top-color: #34d399;
}

.speech-bubble.conclusion::before {
    border-top-color: #fff8e0;
}

.premise-label {
    font-family: 'Fira Mono', monospace;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #4a2a8a;
    margin-bottom: 6px;
}

.premise-text {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(16px, 2vw, 22px);
    font-weight: 500;
    line-height: 1.5;
}

.conclusion .crystal-diamond {
    margin-top: 12px;
    margin-left: 0;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .z-grid {
        grid-template-columns: 1fr;
        gap: clamp(24px, 6vw, 60px);
    }

    .z-top-right,
    .z-bottom-right {
        justify-self: start;
        text-align: left;
    }

    .syllogism-composition {
        flex-direction: column;
    }

    .syllogism-arrow {
        transform: rotate(90deg);
    }

    .truth-tables-grid {
        grid-template-columns: 1fr;
    }

    .operator-explain {
        max-width: 100%;
    }

    .speech-bubble {
        max-width: 100%;
    }

    .speech-bubble.premise,
    .speech-bubble.conclusion {
        max-width: 100%;
    }
}
