/* ============================================================
   logic.day  --  Bauhaus / Swiss Typography
   Palette: #2563eb #1a1a1a #fbbf24 #ffffff #ef4444 #e2e8f0 #f1f5f9
   ============================================================ */

:root {
    --c-white: #ffffff;
    --c-ink:   #1a1a1a;
    --c-blue:  #2563eb;
    --c-red:   #ef4444;
    --c-yellow:#fbbf24;
    --c-subtle:#f1f5f9;
    --c-border:#e2e8f0;

    --c-blue-15:  rgba(37, 99, 235, 0.15);
    --c-blue-12:  rgba(37, 99, 235, 0.12);
    --c-red-15:   rgba(239, 68, 68, 0.15);
    --c-yellow-15:rgba(251, 191, 36, 0.18);

    --grid-max: 1120px;
    --col: 720px;

    --f-display: 'DM Serif Display', 'Times New Roman', serif;
    --f-body:    'Outfit', -apple-system, system-ui, sans-serif;
    --f-math:    'Noto Sans Math', 'DM Serif Display', serif;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--f-body);
    font-weight: 400;
    line-height: 1.8;
    color: var(--c-ink);
    background: var(--c-white);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--c-blue); text-decoration: none; }

.math-symbol {
    font-family: var(--f-math);
    font-feature-settings: "ss01";
}

/* ============================================================
   HERO  --  THE THEOREM
   ============================================================ */

.hero {
    position: relative;
    min-height: 100vh;
    background: var(--c-white);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem 4rem;
    overflow: hidden;
}

.hero-grid {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    pointer-events: none;
    max-width: var(--grid-max);
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    z-index: 1;
}
.hero-grid span {
    border-left: 1px dashed var(--c-border);
    opacity: 0.55;
}
.hero-grid span:first-child { border-left: none; }

/* ---------- Three Primitives ---------- */
.primitives {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 420px;
    height: 420px;
    z-index: 2;
    mix-blend-mode: normal;
    pointer-events: none;
}

.primitive {
    position: absolute;
    top: 50%;
    left: 50%;
    mix-blend-mode: multiply;
    will-change: transform;
}

.primitive--circle {
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.32);
    transform: translate(-65%, -45%);
    animation: rotate-cw 30s linear infinite, drift-circle 14s ease-in-out infinite;
    transform-origin: center center;
}

.primitive--triangle {
    width: 0;
    height: 0;
    border-left: 120px solid transparent;
    border-right: 120px solid transparent;
    border-bottom: 207px solid rgba(239, 68, 68, 0.32);
    transform: translate(-25%, -65%);
    animation: rotate-ccw 45s linear infinite, drift-triangle 16s ease-in-out infinite;
    transform-origin: 120px 138px;
}

.primitive--square {
    width: 200px;
    height: 200px;
    background: rgba(251, 191, 36, 0.34);
    transform: translate(-45%, -25%);
    animation: rotate-cw 60s linear infinite, drift-square 18s ease-in-out infinite;
    transform-origin: center center;
}

@keyframes rotate-cw {
    from { rotate: 0deg; }
    to   { rotate: 360deg; }
}
@keyframes rotate-ccw {
    from { rotate: 0deg; }
    to   { rotate: -360deg; }
}

@keyframes drift-circle {
    0%, 100% { translate: 0 0; }
    50%      { translate: -8px -10px; }
}
@keyframes drift-triangle {
    0%, 100% { translate: 0 0; }
    50%      { translate: 10px -6px; }
}
@keyframes drift-square {
    0%, 100% { translate: 0 0; }
    50%      { translate: -6px 8px; }
}

/* ---------- Hero Content ---------- */
.hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    max-width: 720px;
    margin: 0 auto;
}

.hero-eyebrow {
    font-family: var(--f-body);
    font-size: 0.78rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--c-ink);
    opacity: 0.7;
    margin-bottom: 2rem;
    line-height: 1.4;
}

.hero-eyebrow .math-symbol {
    color: var(--c-blue);
    font-size: 1rem;
    letter-spacing: normal;
    text-transform: none;
}

.hero-title {
    font-family: var(--f-display);
    font-weight: 400;
    font-size: clamp(3rem, 9vw, 7rem);
    line-height: 0.95;
    letter-spacing: -0.02em;
    color: var(--c-ink);
    margin: 0 auto 1.5rem;
    position: relative;
    display: inline-block;
}

.hero-title::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -0.6rem;
    width: 64px;
    height: 4px;
    background: var(--c-ink);
    transform: translateX(-50%);
}

.hero-subtitle {
    font-family: var(--f-display);
    font-style: italic;
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    line-height: 1.55;
    color: var(--c-ink);
    opacity: 0.85;
    max-width: 520px;
    margin: 1.5rem auto 0;
}

.hero-subtitle .math-symbol {
    color: var(--c-blue);
    margin-right: 0.25rem;
    font-style: normal;
}

.hero-meta {
    margin-top: 2.5rem;
    display: inline-flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--c-border);
    background: var(--c-white);
}

.meta-item {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}
.meta-key {
    font-size: 0.65rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--c-ink);
    opacity: 0.55;
}
.meta-val {
    font-family: var(--f-display);
    font-size: 0.95rem;
    color: var(--c-ink);
}
.meta-divider {
    width: 1px;
    height: 22px;
    background: var(--c-border);
}

/* ---------- Hero Axiom Card ---------- */
.hero-axiom {
    position: absolute;
    left: 2rem;
    bottom: 2rem;
    z-index: 3;
    max-width: 240px;
    padding: 0.9rem 1rem;
    border-left: 3px solid var(--c-blue);
    background: var(--c-subtle);
}
.axiom-label {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--c-blue);
    margin-bottom: 0.35rem;
}
.axiom-text {
    font-family: var(--f-display);
    font-size: 0.98rem;
    line-height: 1.4;
    color: var(--c-ink);
}

/* ---------- Hero Scroll Cue ---------- */
.hero-scroll {
    position: absolute;
    right: 2rem;
    bottom: 2rem;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transform: rotate(-90deg);
    transform-origin: right bottom;
}
.scroll-line {
    width: 48px;
    height: 1px;
    background: var(--c-ink);
    display: inline-block;
}
.scroll-text {
    font-size: 0.7rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
}

/* ============================================================
   GATE CONNECTORS  --  Right-angle SVG paths
   ============================================================ */

.gate-connector {
    width: 100%;
    max-width: var(--grid-max);
    margin: 0 auto;
    height: 80px;
    display: block;
    fill: none;
    stroke: var(--c-border);
    stroke-width: 1;
}

.gate-connector path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: trace-line 2.4s ease-out forwards;
}

.gate-connector--mid {
    height: 60px;
}

.gate-node {
    fill: var(--c-blue);
    stroke: none;
}
.gate-node--red    { fill: var(--c-red); }
.gate-node--yellow { fill: var(--c-yellow); }

@keyframes trace-line {
    to { stroke-dashoffset: 0; }
}

/* ============================================================
   PROOF SECTIONS
   ============================================================ */

.proof {
    max-width: var(--grid-max);
    margin: 0 auto;
    padding: 1rem 2rem 4rem;
}

.proof-section {
    max-width: var(--col);
    margin: 0 auto;
    padding: 3rem 0;
    position: relative;
}

.proof-section + .proof-section { border-top: 1px solid var(--c-border); }

.section-head {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.section-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-family: var(--f-display);
    font-size: 1.6rem;
    color: var(--c-ink);
    line-height: 1;
    transition: transform 200ms ease;
}
.section-badge--blue   { background: var(--c-blue-15); border: 1px solid rgba(37,99,235,0.25); }
.section-badge--red    {
    background: var(--c-red-15);
    border: 1px solid rgba(239,68,68,0.28);
    /* triangle accent */
    border-radius: 0;
    clip-path: polygon(50% 6%, 96% 94%, 4% 94%);
}
.section-badge--yellow {
    background: var(--c-yellow-15);
    border: 1px solid rgba(251,191,36,0.45);
    border-radius: 0;
}
.proof-section:hover .section-badge { transform: scale(1.04); }

.section-titles { display: flex; flex-direction: column; gap: 0.35rem; }

.section-kicker {
    font-size: 0.72rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--c-ink);
    opacity: 0.6;
}
.section-kicker .math-symbol {
    color: var(--c-blue);
    letter-spacing: normal;
    text-transform: none;
}

.section-title {
    font-family: var(--f-display);
    font-weight: 400;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--c-ink);
}

.section-body p {
    margin-bottom: 1.1rem;
    font-size: 1.05rem;
    color: var(--c-ink);
}

.section-body strong { color: var(--c-ink); font-weight: 600; }
.section-body em { color: var(--c-blue); font-style: italic; }

/* ---------- Premise list ---------- */
.premise-list {
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 1.25rem 1.5rem;
    background: var(--c-subtle);
    border-left: 3px solid var(--c-yellow);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.premise-list li {
    display: flex;
    align-items: baseline;
    gap: 0.9rem;
    font-size: 1rem;
}
.premise-list .li-mark {
    font-family: var(--f-math);
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 1.4rem;
    text-align: center;
    line-height: 1;
}
.premise-list li:nth-child(1) .li-mark { color: var(--c-blue); }
.premise-list li:nth-child(2) .li-mark { color: var(--c-red); }
.premise-list li:nth-child(3) .li-mark { color: var(--c-yellow); }

/* ---------- Proof Block (Code-like) ---------- */
.proof-figure {
    margin: 1.6rem 0;
    border: 1px solid var(--c-border);
    background: var(--c-white);
}

.proof-block {
    font-family: var(--f-math), 'Outfit', monospace;
    font-size: 0.95rem;
    line-height: 2;
    padding: 1.4rem 1.5rem;
    background:
        linear-gradient(to right, var(--c-subtle) 56px, transparent 56px),
        var(--c-white);
    color: var(--c-ink);
    overflow-x: auto;
    white-space: pre;
}

.proof-line { display: block; }
.proof-num {
    display: inline-block;
    width: 40px;
    color: var(--c-blue);
    font-family: var(--f-display);
    margin-right: 0.5rem;
}
.proof-just {
    color: var(--c-ink);
    opacity: 0.55;
    float: right;
    font-style: italic;
    font-family: var(--f-body);
    font-size: 0.85rem;
}

.proof-figure figcaption {
    padding: 0.65rem 1.5rem;
    font-size: 0.82rem;
    color: var(--c-ink);
    opacity: 0.65;
    border-top: 1px solid var(--c-border);
    background: var(--c-subtle);
    font-style: italic;
}

/* ---------- Therefore section ---------- */
.proof-section--therefore {
    background:
        radial-gradient(circle at top right, var(--c-yellow-15), transparent 60%);
}
.therefore-stamp {
    margin-top: 1.5rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--c-border);
    font-family: var(--f-display);
    font-size: 1.15rem;
    color: var(--c-ink);
}
.therefore-stamp .math-symbol {
    color: var(--c-yellow);
    font-size: 1.5rem;
    margin-right: 0.4rem;
}

/* ============================================================
   TRUTH PANEL
   ============================================================ */

.truth-panel {
    max-width: var(--col);
    margin: 4rem auto 0;
    padding: 2.5rem;
    background: var(--c-subtle);
    border: 1px solid var(--c-border);
    position: relative;
}

.truth-panel::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px;
    width: 32px; height: 32px;
    border-top: 3px solid var(--c-blue);
    border-left: 3px solid var(--c-blue);
}
.truth-panel::after {
    content: '';
    position: absolute;
    bottom: -1px; right: -1px;
    width: 32px; height: 32px;
    border-bottom: 3px solid var(--c-red);
    border-right: 3px solid var(--c-red);
}

.panel-head { margin-bottom: 1.6rem; }
.panel-tag {
    display: inline-block;
    font-size: 0.7rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--c-blue);
    margin-bottom: 0.6rem;
}
.panel-title {
    font-family: var(--f-display);
    font-weight: 400;
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
    line-height: 1.2;
    color: var(--c-ink);
    margin-bottom: 0.4rem;
}
.panel-sub {
    font-size: 0.92rem;
    opacity: 0.7;
}

.truth-table-wrap {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    background: var(--c-white);
    border: 1px solid var(--c-border);
}
.truth-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--f-body);
    font-size: 1rem;
    text-align: center;
}
.truth-table th, .truth-table td {
    padding: 0.85rem 0.5rem;
    border-bottom: 1px solid var(--c-border);
    border-right: 1px solid var(--c-border);
}
.truth-table th:last-child, .truth-table td:last-child { border-right: none; }
.truth-table tbody tr:last-child td { border-bottom: none; }
.truth-table th {
    background: var(--c-white);
    font-weight: 500;
    font-family: var(--f-display);
    font-size: 1.05rem;
    color: var(--c-ink);
    border-bottom: 2px solid var(--c-ink);
}
.truth-table td {
    transition: background 200ms ease, color 200ms ease, font-weight 200ms ease;
    font-family: var(--f-display);
    font-size: 1.05rem;
}
.truth-table td.is-true { color: var(--c-blue); }
.truth-table td.is-false { color: var(--c-red); opacity: 0.6; }

.truth-table th.is-highlight {
    background: var(--c-ink);
    color: var(--c-white);
}
.truth-table td.is-highlight {
    background: var(--c-yellow-15);
    font-weight: 600;
}
.truth-table tr.is-row-hover td {
    background: rgba(37,99,235,0.05);
}

.operations {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.op-chip {
    font-family: var(--f-body);
    font-size: 0.88rem;
    letter-spacing: 0.04em;
    padding: 0.55rem 1rem;
    background: var(--c-white);
    border: 1px solid var(--c-border);
    color: var(--c-ink);
    cursor: pointer;
    transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.op-chip .math-symbol {
    font-size: 1.1rem;
    color: var(--c-blue);
}
.op-chip:hover {
    border-color: var(--c-ink);
}
.op-chip.is-active {
    background: var(--c-ink);
    color: var(--c-white);
    border-color: var(--c-ink);
}
.op-chip.is-active .math-symbol { color: var(--c-yellow); }

/* ============================================================
   QED
   ============================================================ */

.qed-section {
    max-width: var(--col);
    margin: 4rem auto 0;
    padding: 2rem 0 1rem;
    border-top: 1px solid var(--c-border);
    position: relative;
    text-align: left;
}
.qed-text {
    font-family: var(--f-display);
    font-style: italic;
    font-size: 1rem;
    color: var(--c-ink);
    opacity: 0.7;
}
.qed-mark {
    position: absolute;
    bottom: 0.6rem;
    right: 0;
    width: 12px;
    height: 12px;
    background: var(--c-ink);
    display: inline-block;
}

/* ============================================================
   FOOTER
   ============================================================ */

.site-foot {
    background: var(--c-ink);
    color: var(--c-white);
    padding: 4rem 2rem 2rem;
    margin-top: 4rem;
    position: relative;
    overflow: hidden;
}

.site-foot::before {
    content: '';
    position: absolute;
    top: 2rem; right: 2rem;
    width: 80px; height: 80px;
    border-radius: 50%;
    background: rgba(37,99,235,0.4);
    mix-blend-mode: screen;
    pointer-events: none;
}
.site-foot::after {
    content: '';
    position: absolute;
    top: 4rem; right: 5rem;
    width: 60px; height: 60px;
    background: rgba(251,191,36,0.4);
    mix-blend-mode: screen;
    pointer-events: none;
}

.foot-grid {
    max-width: var(--grid-max);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    position: relative;
    z-index: 1;
}

.foot-col p {
    font-size: 0.92rem;
    line-height: 1.7;
    opacity: 0.8;
}
.foot-col ul { list-style: none; }
.foot-col li {
    font-size: 0.9rem;
    padding: 0.3rem 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    opacity: 0.85;
}

.foot-label {
    display: block;
    font-family: var(--f-display);
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: var(--c-white);
}
.foot-line {
    display: block;
    width: 32px;
    height: 2px;
    background: var(--c-yellow);
    margin-bottom: 1rem;
}

.prim-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}
.prim-dot--blue   { background: var(--c-blue); border-radius: 50%; }
.prim-dot--red    {
    background: transparent;
    width: 0; height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid var(--c-red);
}
.prim-dot--yellow { background: var(--c-yellow); }

.foot-base {
    max-width: var(--grid-max);
    margin: 3rem auto 0;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    opacity: 0.7;
    letter-spacing: 0.08em;
    flex-wrap: wrap;
    gap: 1rem;
    position: relative;
    z-index: 1;
}
.foot-base-symbol {
    font-family: var(--f-math);
    color: var(--c-yellow);
    letter-spacing: 0.3em;
}

/* ============================================================
   SCROLL REVEAL
   ============================================================ */

.proof-section,
.truth-panel,
.qed-section {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 700ms ease, transform 700ms ease;
}
.proof-section.is-visible,
.truth-panel.is-visible,
.qed-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

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

@media (max-width: 800px) {
    .hero { padding: 5rem 1.25rem 5rem; }
    .primitives { width: 320px; height: 320px; }
    .primitive--circle { width: 200px; height: 200px; }
    .primitive--triangle {
        border-left: 90px solid transparent;
        border-right: 90px solid transparent;
        border-bottom: 156px solid rgba(239,68,68,0.32);
        transform-origin: 90px 104px;
    }
    .primitive--square { width: 160px; height: 160px; }

    .hero-axiom { left: 1rem; bottom: 1rem; max-width: 200px; padding: 0.7rem 0.85rem; }
    .axiom-text { font-size: 0.88rem; }
    .hero-scroll { display: none; }

    .proof { padding: 1rem 1.25rem 3rem; }
    .proof-section { padding: 2.5rem 0; }

    .section-head { gap: 1rem; }
    .section-badge { width: 44px; height: 44px; font-size: 1.25rem; }

    .truth-panel { padding: 1.5rem; }
    .truth-table th, .truth-table td { padding: 0.6rem 0.3rem; font-size: 0.95rem; }

    .foot-grid { grid-template-columns: 1fr; gap: 2rem; }
    .foot-base { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
    .hero-meta { flex-direction: column; gap: 0.75rem; padding: 1rem; }
    .meta-divider { width: 22px; height: 1px; }
    .proof-block { font-size: 0.82rem; }
    .proof-just { float: none; display: block; padding-left: 40px; }
}
