/* =====================================================
   toron.day — Bauhaus Debate Chamber
   Bento-box grid as the architecture of structured debate
   ===================================================== */

:root {
    --bg-primary: #F0ECE0;       /* Debate cream */
    --bg-secondary: #E4E0D4;     /* Chalk warm */
    --surface: #FFFFFF;          /* Paper white */
    --text-primary: #1A1A1A;     /* Near black */
    --text-secondary: #3A3A3A;   /* Debate charcoal */
    --pos-a: #DA291C;            /* Argument red */
    --pos-b: #0B3D91;            /* Argument blue */
    --pos-c: #F5E400;            /* Argument yellow */
    --synthesis: #C4B8A0;        /* Blended neutral */
    --frame-line: #C4B8A0;
    --gap: 4px;

    --font-head: "Noto Sans KR", "IBM Plex Sans", system-ui, sans-serif;
    --font-body: "IBM Plex Sans", "Noto Sans KR", system-ui, sans-serif;
    --font-label: "Space Grotesk", "IBM Plex Sans", system-ui, sans-serif;
}

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

html, body {
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    position: relative;
}

h1, h2, h3 {
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

p { font-family: var(--font-body); }

[hidden] { display: none !important; }

/* =====================================================
   Geometric shapes — the language of position
   ===================================================== */

.shape {
    display: inline-block;
    flex-shrink: 0;
    vertical-align: middle;
}
.shape.circle {
    width: 14px; height: 14px;
    background: var(--pos-a);
    border-radius: 50%;
}
.shape.square {
    width: 12px; height: 12px;
    background: var(--pos-b);
}
.shape.triangle {
    width: 0; height: 0;
    background: transparent;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 13px solid var(--pos-c);
}

/* =====================================================
   Wordmark (top-left)
   ===================================================== */

.wordmark {
    position: fixed;
    top: 24px;
    left: 28px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-label);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-primary);
    background: rgba(240, 236, 224, 0.85);
    padding: 8px 14px;
    border: 1px solid var(--frame-line);
    backdrop-filter: blur(6px);
}
.wordmark .mark-circle,
.wordmark .mark-square,
.wordmark .mark-triangle {
    display: inline-block;
}
.wordmark .mark-circle {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--pos-a);
}
.wordmark .mark-square {
    width: 9px; height: 9px;
    background: var(--pos-b);
}
.wordmark .mark-triangle {
    width: 0; height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 9px solid var(--pos-c);
}
.wordmark-text { margin-left: 4px; }

/* =====================================================
   Language Toggle (top-right)
   ===================================================== */

.lang-toggle {
    position: fixed;
    top: 24px;
    right: 28px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(240, 236, 224, 0.85);
    padding: 8px 14px;
    border: 1px solid var(--frame-line);
    backdrop-filter: blur(6px);
}
.lang-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: var(--font-label);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    padding: 2px 4px;
    transition: color 0.2s ease;
}
.lang-btn.active {
    color: var(--text-primary);
    border-bottom: 2px solid var(--pos-a);
}
.lang-btn:hover { color: var(--text-primary); }
.lang-divider {
    color: var(--frame-line);
    font-family: var(--font-label);
    font-size: 13px;
}

/* =====================================================
   Section Navigator (bottom-left dot grid)
   ===================================================== */

.section-nav {
    position: fixed;
    bottom: 28px;
    left: 28px;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(2, 14px);
    grid-template-rows: repeat(2, 14px);
    gap: 6px;
    padding: 12px;
    background: rgba(240, 236, 224, 0.85);
    border: 1px solid var(--frame-line);
    backdrop-filter: blur(6px);
}
.nav-dot {
    width: 14px; height: 14px;
    border: 1px solid var(--frame-line);
    background: var(--bg-primary);
    cursor: pointer;
    padding: 0;
    transition: background 0.3s ease, transform 0.3s ease;
}
.nav-dot:nth-child(1) { /* Opening — A red circle */ border-radius: 50%; }
.nav-dot:nth-child(3) { /* Synthesis — yellow triangle treat as square */ }
.nav-dot.active {
    transform: scale(1.15);
}
.nav-dot.active[data-section="0"] { background: var(--pos-a); border-color: var(--pos-a); }
.nav-dot.active[data-section="1"] { background: var(--pos-b); border-color: var(--pos-b); }
.nav-dot.active[data-section="2"] { background: var(--pos-c); border-color: var(--pos-c); }
.nav-dot.active[data-section="3"] { background: var(--synthesis); border-color: var(--synthesis); }

/* =====================================================
   Floor (overall canvas)
   ===================================================== */

.debate-floor {
    width: 100%;
    background: var(--bg-primary);
    background-image:
        linear-gradient(to right, rgba(196, 184, 160, 0.18) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(196, 184, 160, 0.18) 1px, transparent 1px);
    background-size: 80px 80px;
}

/* =====================================================
   Section: OPENING — 2x2 colour fields with overlay
   ===================================================== */

.opening {
    height: 100vh;
    min-height: 700px;
    width: 100%;
    position: relative;
}

.opening-grid {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: var(--gap);
    background: var(--frame-line);
    padding: var(--gap);
    position: relative;
}

.opening-cell {
    width: 100%;
    height: 100%;
    transition: filter 0.6s ease;
}
.cell-red    { background: var(--pos-a); }
.cell-blue   { background: var(--pos-b); }
.cell-yellow { background: var(--pos-c); }
.cell-cream  { background: var(--bg-primary); }

.opening-overlay {
    position: absolute;
    inset: var(--gap);
    background: rgba(255, 255, 255, 0.88);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: clamp(32px, 7vw, 96px);
    gap: 28px;
    backdrop-filter: blur(2px);
}

.opening-meta {
    font-family: var(--font-label);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-left: 4px solid var(--pos-a);
    padding-left: 12px;
}

.opening-title-ko h1,
.opening-title-en h1 {
    font-size: clamp(40px, 7vw, 88px);
    line-height: 1.05;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.opening-sub-ko p,
.opening-sub-en p {
    font-size: clamp(15px, 1.4vw, 18px);
    color: var(--text-secondary);
    max-width: 56ch;
}

.opening-positions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 8px;
}
.pos-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: var(--surface);
    border: 1px solid var(--frame-line);
    font-family: var(--font-label);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-primary);
}
.pos-pill.pos-a { border-bottom: 3px solid var(--pos-a); }
.pos-pill.pos-b { border-bottom: 3px solid var(--pos-b); }
.pos-pill.pos-c { border-bottom: 3px solid var(--pos-c); }

/* =====================================================
   Section: POSITIONS — 9-cell bento
   ===================================================== */

.positions {
    padding: clamp(48px, 7vw, 96px) clamp(24px, 4vw, 64px);
    border-top: 1px solid var(--frame-line);
    border-bottom: 1px solid var(--frame-line);
    background: var(--bg-primary);
}

.section-header {
    max-width: 1280px;
    margin: 0 auto 40px;
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 24px;
    align-items: end;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--frame-line);
}
.section-index {
    font-family: var(--font-label);
    font-size: 36px;
    font-weight: 700;
    color: var(--pos-a);
    letter-spacing: 0.04em;
    line-height: 1;
}
.section-header h2 {
    font-size: clamp(28px, 3.5vw, 44px);
    margin-bottom: 8px;
}
.section-header p {
    color: var(--text-secondary);
    font-size: 16px;
    max-width: 64ch;
}

.positions-grid {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    grid-auto-rows: minmax(220px, auto);
    gap: var(--gap);
    background: var(--frame-line);
    border: 1px solid var(--frame-line);
    transition: opacity 0.3s ease;
}

.bento-cell {
    background: var(--surface);
    padding: 32px;
    border: 1px solid var(--frame-line);
    margin: -1px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
    transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
    overflow: hidden;
}

.bento-cell.wide { grid-column: span 2; }
.bento-cell.tall { grid-row: span 2; }

@media (max-width: 768px) {
    .bento-cell.wide,
    .bento-cell.tall {
        grid-column: auto;
        grid-row: auto;
    }
}

.bento-cell.pos-a-cell { background: rgba(218, 41, 28, 0.05); }
.bento-cell.pos-b-cell { background: rgba(11, 61, 145, 0.05); }
.bento-cell.pos-c-cell { background: rgba(245, 228, 0, 0.05); }

.cell-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--frame-line);
}
.cell-label {
    font-family: var(--font-label);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.pos-a-cell .cell-label { color: var(--pos-a); }
.pos-b-cell .cell-label { color: var(--pos-b); }
.pos-c-cell .cell-label { color: #8c7e00; }

.cell-body {
    flex: 1;
}
.cell-body h3 {
    font-size: 22px;
    line-height: 1.25;
    margin-bottom: 12px;
    color: var(--text-primary);
}
.cell-body p {
    font-size: 15.5px;
    line-height: 1.7;
    color: var(--text-secondary);
}
.lang-ko .cell-body p,
.cell-body.lang-ko p {
    line-height: 1.8; /* wider leading for Korean */
}

.cell-foot {
    padding-top: 12px;
    border-top: 1px solid var(--frame-line);
    font-family: var(--font-label);
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

/* Active / dim */
.positions-grid.has-active .bento-cell { opacity: 0.7; }
.positions-grid.has-active .bento-cell.is-active {
    opacity: 1;
    transform: scale(1.03);
    z-index: 2;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}
.positions-grid.has-active .bento-cell.is-active.pos-a-cell { background: rgba(218, 41, 28, 0.15); }
.positions-grid.has-active .bento-cell.is-active.pos-b-cell { background: rgba(11, 61, 145, 0.15); }
.positions-grid.has-active .bento-cell.is-active.pos-c-cell { background: rgba(245, 228, 0, 0.18); }

/* =====================================================
   Section: SYNTHESIS — colours converge
   ===================================================== */

.synthesis {
    position: relative;
    padding: clamp(64px, 9vw, 120px) clamp(24px, 4vw, 64px);
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-bottom: 1px solid var(--frame-line);
    overflow: hidden;
}
.synthesis .section-header {
    margin-bottom: 60px;
}
.synthesis .section-index { color: var(--pos-c); }

.synthesis-stage {
    position: relative;
    max-width: 900px;
    height: 560px;
    margin: 0 auto;
    border: 1px solid var(--frame-line);
    background: var(--surface);
}

.synth-cell {
    position: absolute;
    width: 200px;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px;
    mix-blend-mode: multiply;
    transition: transform 1.2s cubic-bezier(.7,.05,.3,1), opacity 1.2s ease;
    will-change: transform;
}
.synth-cell .shape { transform: scale(1.8); }
.synth-cell p {
    font-family: var(--font-label);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-primary);
}

.synth-a { background: var(--pos-a); top: 30px; left: 80px; }
.synth-b { background: var(--pos-b); top: 30px; right: 80px; }
.synth-c { background: var(--pos-c); bottom: 30px; left: 50%; transform: translateX(-50%); }

.synth-a p, .synth-b p { color: #fff; }
.synth-b .shape.square { background: #fff; }
.synth-a .shape.circle { background: #fff; }

.synthesis-stage.converged .synth-a {
    transform: translate(160px, 140px);
}
.synthesis-stage.converged .synth-b {
    transform: translate(-160px, 140px);
}
.synthesis-stage.converged .synth-c {
    transform: translateX(-50%) translateY(-180px);
}

.blend-zone {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0;
    transition: opacity 1.4s ease;
    pointer-events: none;
}
.synthesis-stage.converged .blend-zone { opacity: 0.55; }

.blend-zone.red-blue {
    background: radial-gradient(circle, var(--pos-a), var(--pos-b) 70%);
    top: 50%; left: 50%; transform: translate(-50%, -50%);
}
.blend-zone.blue-yellow {
    background: radial-gradient(circle, var(--pos-b), var(--pos-c) 70%);
    top: 50%; left: 50%; transform: translate(-50%, -10%);
}
.blend-zone.yellow-red {
    background: radial-gradient(circle, var(--pos-c), var(--pos-a) 70%);
    top: 50%; left: 50%; transform: translate(-50%, -90%);
}

.synthesis-readout {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.4s ease 0.4s;
    z-index: 3;
}
.synthesis-stage.converged .synthesis-readout { opacity: 1; }
.synthesis-readout p {
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--text-primary);
    background: rgba(255,255,255,0.85);
    padding: 6px 14px;
    margin: 4px 0;
    font-size: clamp(16px, 2vw, 22px);
    line-height: 1.45;
}
.synthesis-readout p:first-child {
    color: var(--pos-a);
}

/* =====================================================
   Section: RESOLUTION — single neutral cell
   ===================================================== */

.resolution {
    background: var(--synthesis);
    padding: clamp(64px, 10vw, 140px) clamp(24px, 5vw, 80px);
    border-top: 1px solid var(--frame-line);
    border-bottom: 1px solid var(--frame-line);
}
.resolution-cell {
    max-width: 1100px;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--frame-line);
    padding: clamp(40px, 6vw, 88px);
    display: grid;
    grid-template-columns: 1fr;
    gap: 36px;
    position: relative;
}

.resolution-mark {
    display: inline-flex;
    gap: 14px;
    align-items: center;
}
.rm {
    display: inline-block;
}
.rm.circle {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--pos-a);
}
.rm.square {
    width: 26px; height: 26px;
    background: var(--pos-b);
}
.rm.triangle {
    width: 0; height: 0;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-bottom: 26px solid var(--pos-c);
}

.resolution-label {
    display: inline-block;
    font-family: var(--font-label);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 18px;
}
.resolution-body h2 {
    font-size: clamp(26px, 3.6vw, 44px);
    line-height: 1.3;
    margin-bottom: 22px;
    color: var(--text-primary);
}
.resolution-body > p {
    font-size: 17px;
    color: var(--text-secondary);
    max-width: 64ch;
}

.next-debate {
    margin-top: 36px;
    padding: 28px;
    background: var(--bg-primary);
    border: 1px solid var(--frame-line);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 24px;
}
.next-label {
    font-family: var(--font-label);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--pos-b);
}
.next-topic {
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--text-primary);
    font-size: clamp(16px, 1.8vw, 20px);
}
.next-date {
    font-family: var(--font-label);
    font-size: 13px;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}
@media (max-width: 720px) {
    .next-debate {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.archive {
    margin-top: 24px;
    padding-top: 28px;
    border-top: 1px solid var(--frame-line);
}
.archive-label {
    display: inline-block;
    font-family: var(--font-label);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 18px;
}
.archive-list { list-style: none; }
.archive-list li {
    display: grid;
    grid-template-columns: 70px 1fr auto;
    gap: 24px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(196, 184, 160, 0.5);
    align-items: baseline;
}
.archive-list li:last-child { border-bottom: none; }
.ax-num {
    font-family: var(--font-label);
    font-size: 13px;
    font-weight: 700;
    color: var(--pos-a);
    letter-spacing: 0.06em;
}
.ax-title {
    font-family: var(--font-head);
    font-weight: 500;
    color: var(--text-primary);
    font-size: 16px;
}
.ax-date {
    font-family: var(--font-label);
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
}

/* =====================================================
   Floor Footer
   ===================================================== */

.floor-footer {
    padding: 36px clamp(24px, 4vw, 64px);
    border-top: 1px solid var(--frame-line);
    background: var(--bg-primary);
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
}
.ff-mark {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}
.ff-mark .rm.circle   { width: 12px; height: 12px; }
.ff-mark .rm.square   { width: 11px; height: 11px; }
.ff-mark .rm.triangle { border-left-width: 6px; border-right-width: 6px; border-bottom: 11px solid var(--pos-c); }

.ff-text, .ff-meta {
    font-family: var(--font-label);
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* =====================================================
   Reveal animation utility
   ===================================================== */

.reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

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

@media (max-width: 900px) {
    .opening-overlay { padding: 24px; }
    .synthesis-stage {
        height: 460px;
    }
    .synth-cell { width: 150px; height: 150px; }
    .synth-a { top: 24px; left: 24px; }
    .synth-b { top: 24px; right: 24px; }
    .synth-c { bottom: 24px; left: 50%; }

    .synthesis-stage.converged .synth-a { transform: translate(110px, 100px); }
    .synthesis-stage.converged .synth-b { transform: translate(-110px, 100px); }
    .synthesis-stage.converged .synth-c { transform: translateX(-50%) translateY(-130px); }

    .section-header {
        grid-template-columns: 60px 1fr;
        gap: 16px;
    }
}

@media (max-width: 600px) {
    .wordmark { top: 16px; left: 16px; padding: 6px 10px; font-size: 11px; }
    .lang-toggle { top: 16px; right: 16px; padding: 6px 10px; }
    .section-nav { bottom: 16px; left: 16px; padding: 8px; }
    .opening-overlay {
        background: rgba(255, 255, 255, 0.92);
        gap: 18px;
    }
    .opening-positions { gap: 8px; }
    .pos-pill { padding: 8px 12px; font-size: 11px; }
    .archive-list li {
        grid-template-columns: 60px 1fr;
        row-gap: 4px;
    }
    .ax-date { grid-column: 2; }
}
