/* ============================================================
   logical.day — Swiss Typography Clean
   ============================================================ */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: #FAFAFA;
    color: #0A0A0A;
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.8;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* --- Grid Dots Background --- */
#grid-dots {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.grid-dot {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background-color: #CCCCCC;
}

/* --- Grid Container --- */
.grid-container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 40px 0 40px;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: auto 1fr auto;
    gap: 0 20px;
    min-height: 100vh;
}

/* --- Date Header --- */
.date-header {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0 20px;
    align-items: start;
    padding-bottom: 40px;
}

.date-header-left {
    grid-column: 1 / 9;
}

.date-numeral {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: 120px;
    line-height: 1;
    letter-spacing: 0.02em;
    color: #0A0A0A;
}

.date-rule {
    height: 1px;
    background-color: #CCCCCC;
    width: 100%;
    margin-top: 8px;
}

.date-header-right {
    grid-column: 9 / 13;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    padding-bottom: 12px;
}

.day-name {
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: 14px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #555555;
}

.difficulty-indicator {
    display: flex;
    gap: 4px;
    margin-top: 12px;
}

.diff-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid #0A0A0A;
    background: transparent;
}

.diff-dot.filled {
    background: #0A0A0A;
}

/* --- Main Content Area --- */
.main-content {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0 20px;
    align-items: start;
}

/* --- Puzzle Area --- */
.puzzle-area {
    grid-column: 2 / 10;
    padding-right: 40px;
}

.puzzle-title {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: 32px;
    letter-spacing: 0.05em;
    color: #0A0A0A;
    margin-bottom: 8px;
}

.puzzle-meta {
    display: flex;
    gap: 24px;
    margin-bottom: 40px;
}

.puzzle-number {
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #999999;
    letter-spacing: 0.05em;
}

.puzzle-category {
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #999999;
    letter-spacing: 0.05em;
}

.puzzle-body {
    margin-bottom: 48px;
}

.premise {
    padding: 16px 0 16px 2em;
    display: flex;
    gap: 12px;
    align-items: baseline;
}

.premise-label {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 14px;
    color: #999999;
    flex-shrink: 0;
    min-width: 32px;
}

.premise-text {
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.8;
    color: #0A0A0A;
}

.premise.conclusion .premise-text {
    font-weight: 600;
}

.premise-rule {
    height: 0.5px;
    background-color: #CCCCCC;
    margin: 0 0 0 2em;
}

.conclusion-rule {
    height: 2px;
    background-color: #0A0A0A;
    margin: 24px 0 8px 2em;
}

/* --- Working Space --- */
.working-space {
    margin-top: 48px;
    margin-bottom: 24px;
}

.working-space-label {
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #999999;
    margin-bottom: 16px;
}

.working-grid {
    width: 100%;
    height: 200px;
    position: relative;
    border: 1px solid #F0F0F0;
}

.working-grid-line-h,
.working-grid-line-v {
    position: absolute;
    background-color: #F0F0F0;
}

.working-grid-line-h {
    width: 100%;
    height: 1px;
}

.working-grid-line-v {
    width: 1px;
    height: 100%;
}

/* --- Think Buffer --- */
.think-buffer {
    height: 200px;
}

/* --- Solution --- */
.solution {
    padding-bottom: 80px;
}

.solution-rule {
    height: 1px;
    background-color: #CCCCCC;
    margin-bottom: 32px;
}

.solution-title {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: 24px;
    letter-spacing: 0.05em;
    color: #0A0A0A;
    margin-bottom: 24px;
}

.solution-body {
    padding-left: 2em;
}

.solution-step {
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 2;
    color: #555555;
    margin-bottom: 4px;
}

.solution-step strong {
    font-weight: 600;
    color: #0A0A0A;
}

.solution-conclusion {
    font-family: 'Work Sans', sans-serif;
    font-weight: 600;
    font-size: 18px;
    line-height: 2;
    color: #0A0A0A;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #CCCCCC;
}

.solution-rule-name {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 13px;
    color: #999999;
    margin-top: 16px;
}

/* --- Notation Sidebar --- */
.notation-sidebar {
    grid-column: 10 / 13;
    position: sticky;
    top: 80px;
    padding-left: 20px;
    border-left: 1px solid #F0F0F0;
}

.notation-label {
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #999999;
    margin-bottom: 24px;
}

.notation-block {
    margin-bottom: 20px;
    transition: color 200ms ease;
}

.notation-line {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 14px;
    line-height: 2.0;
    color: #555555;
    transition: color 200ms ease;
}

.notation-block.highlighted .notation-line {
    color: #0A0A0A;
}

.notation-separator {
    width: 40px;
    height: 1px;
    background-color: #CCCCCC;
    margin: 16px 0;
}

.notation-derivation {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid #F0F0F0;
}

.derivation-label {
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #999999;
    margin-bottom: 16px;
}

.derivation-step {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 13px;
    line-height: 2.2;
    color: #555555;
}

.derivation-conclusion {
    color: #0A0A0A;
    font-weight: 400;
    border-top: 1px solid #CCCCCC;
    padding-top: 4px;
    margin-top: 4px;
}

/* --- Archive Strip --- */
.archive-strip {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    padding: 24px 0;
    margin-top: 40px;
    border-top: 1px solid #CCCCCC;
    height: 120px;
    align-items: center;
    overflow-x: auto;
}

.archive-card {
    flex-shrink: 0;
    width: 100px;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    border: 1px solid #CCCCCC;
    cursor: pointer;
    transition: background-color 100ms ease-in-out, color 100ms ease-in-out;
}

.archive-card .archive-date {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: 28px;
    color: #0A0A0A;
    line-height: 1;
    transition: color 100ms ease-in-out;
}

.archive-card .archive-diff {
    display: flex;
    gap: 3px;
}

.archive-card .archive-diff-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #CCCCCC;
    transition: background-color 100ms ease-in-out;
}

.archive-card .archive-diff-dot.filled {
    background-color: #0A0A0A;
}

/* Archive card hover inversion */
.archive-card:hover {
    background-color: #0A0A0A;
}

.archive-card:hover .archive-date {
    color: #FAFAFA;
}

.archive-card:hover .archive-diff-dot {
    background-color: #555555;
}

.archive-card:hover .archive-diff-dot.filled {
    background-color: #FAFAFA;
}

/* Active card (today) */
.archive-card.active {
    background-color: #0A0A0A;
}

.archive-card.active .archive-date {
    color: #FAFAFA;
}

.archive-card.active .archive-diff-dot {
    background-color: #555555;
}

.archive-card.active .archive-diff-dot.filled {
    background-color: #FAFAFA;
}

/* --- Premise highlight state (for notation sync) --- */
.premise.in-view {
    background-color: rgba(10, 10, 10, 0.02);
}

/* --- Error / Contradiction accent --- */
.error-text {
    color: #E53E3E;
}

/* --- Responsive: Tablet (<1024px) --- */
@media (max-width: 1024px) {
    .grid-container {
        padding: 40px 24px 0 24px;
    }

    .main-content {
        display: flex;
        flex-direction: column;
    }

    .puzzle-area {
        padding-right: 0;
    }

    .notation-sidebar {
        position: static;
        border-left: none;
        border-top: 1px solid #F0F0F0;
        padding-left: 0;
        padding-top: 32px;
        margin-top: 32px;
        display: flex;
        flex-wrap: wrap;
        gap: 16px 32px;
        align-items: flex-start;
    }

    .notation-label {
        width: 100%;
        margin-bottom: 8px;
    }

    .notation-separator {
        display: none;
    }

    .notation-derivation {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
        margin-left: 32px;
    }
}

/* --- Responsive: Mobile (<640px) --- */
@media (max-width: 640px) {
    .grid-container {
        padding: 24px 16px 0 16px;
        display: flex;
        flex-direction: column;
    }

    .date-header {
        display: flex;
        flex-direction: column;
    }

    .date-header-left {
        width: 100%;
    }

    .date-numeral {
        font-size: 72px;
    }

    .date-header-right {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 0;
        margin-top: 8px;
    }

    .puzzle-area {
        padding-right: 0;
    }

    .premise {
        padding-left: 1em;
    }

    .premise-rule,
    .conclusion-rule {
        margin-left: 1em;
    }

    .working-grid {
        height: 140px;
    }

    .archive-strip {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: 16px;
    }

    .archive-card {
        width: 80px;
        height: 64px;
    }

    .archive-card .archive-date {
        font-size: 22px;
    }

    .notation-sidebar {
        flex-direction: column;
    }

    .notation-derivation {
        margin-left: 0;
    }
}
