/* ronri.day - A Goblincore Field Notebook of Logic */
/* Palette: Coastal Blend */

:root {
    --bg-primary: #f2ebe0;
    --bg-alternate: #e8dfd2;
    --text-primary: #2d3b36;
    --text-display: #1a3a3a;
    --accent-primary: #5b8c7e;
    --accent-secondary: #c4784a;
    --accent-tertiary: #8a7b9e;
    --decorative: #b8a462;
    --surface: #faf7f2;
    --sage: #6a7b72;
    --fern: #3d5a4e;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='noise'%3E%3CfeTurbulence baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
}

/* ===== CANOPY (F top bar) ===== */
.canopy {
    padding: clamp(3rem, 8vh, 6rem) clamp(2rem, 5vw, 6rem);
    background-color: var(--bg-primary);
    position: relative;
}

.canopy-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.canopy-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: clamp(3rem, 7vw, 6rem);
    letter-spacing: -0.03em;
    line-height: 0.95;
    color: var(--text-display);
    margin-bottom: 1.5rem;
}

.kanji-accent {
    display: block;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.35em;
    letter-spacing: 0.15em;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
    font-weight: 400;
}

.canopy-thesis {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    line-height: 1.6;
    color: var(--sage);
    max-width: 700px;
}

.canopy-branch {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--decorative) 0%,
        var(--accent-primary) 40%,
        var(--decorative) 70%,
        transparent 100%
    );
}

/* ===== UNDERSTORY (F second bar) ===== */
.understory {
    padding: clamp(2rem, 4vh, 3rem) clamp(2rem, 5vw, 6rem);
    background-color: var(--bg-alternate);
    position: relative;
    max-width: 70%;
}

.understory-inner {
    max-width: 900px;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.topic-card {
    flex: 1;
    min-width: 140px;
    max-width: 220px;
    padding: 1.2rem 1rem;
    background: var(--surface);
    border: 1px solid var(--decorative);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    position: relative;
    overflow: hidden;
}

.topic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.topic-card:hover::before {
    transform: scaleX(1);
}

.topic-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 2px 8px rgba(26, 58, 58, 0.08);
}

.topic-card-symbol {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.4rem;
    color: var(--accent-primary);
    margin-bottom: 0.2rem;
}

.topic-card-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: 1.1rem;
    color: var(--text-display);
}

.topic-card-desc {
    font-family: 'Caveat', cursive;
    font-size: 0.95rem;
    color: var(--sage);
}

.understory-branch {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg,
        var(--decorative) 0%,
        var(--accent-primary) 50%,
        transparent 100%
    );
}


/* ===== PAGE BODY (F-pattern grid) ===== */
.page-body {
    display: grid;
    grid-template-columns: minmax(160px, 20%) 1fr;
    gap: 0;
    max-width: 1400px;
}

/* ===== ROOT SPINE (F vertical) ===== */
.root-spine {
    position: sticky;
    top: 2rem;
    height: calc(100vh - 4rem);
    overflow-y: auto;
    border-right: 2px solid var(--decorative);
    padding: 2rem 1rem 2rem 1.5rem;
    background-color: var(--bg-primary);
    scrollbar-width: none;
}

.root-spine::-webkit-scrollbar {
    display: none;
}

.root-spine-inner {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

.annotation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    text-align: center;
}

.annotation-symbol {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.6rem;
    color: var(--accent-primary);
    line-height: 1;
}

.annotation-text {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    color: var(--sage);
    font-weight: 400;
}

.spine-diagram {
    width: 80px;
    margin: 0.5rem auto;
}

.spine-diagram svg {
    width: 100%;
    height: auto;
}

/* ===== SPECIMEN DRAWERS ===== */
.specimen-drawers {
    padding: 2rem clamp(2rem, 4vw, 4rem);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.drawer {
    position: relative;
    padding: clamp(2rem, 4vw, 3rem);
    border: 1px solid var(--decorative);
    border-radius: 3px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.drawer.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Texture variations */
.drawer[data-texture="sand"] {
    background-color: var(--bg-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='sand'%3E%3CfeTurbulence baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23sand)' opacity='0.03'/%3E%3C/svg%3E");
}

.drawer[data-texture="moss"] {
    background-color: var(--bg-alternate);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='moss'%3E%3CfeTurbulence baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23moss)' opacity='0.04'/%3E%3C/svg%3E");
}

.drawer[data-texture="bark"] {
    background-color: var(--bg-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='bark'%3E%3CfeTurbulence baseFrequency='0.4' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23bark)' opacity='0.035'/%3E%3C/svg%3E");
}

.drawer[data-texture="water"] {
    background-color: var(--bg-alternate);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='water'%3E%3CfeTurbulence baseFrequency='0.5' numOctaves='3' stitchTiles='stitch' type='turbulence'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23water)' opacity='0.03'/%3E%3C/svg%3E");
}

/* Kanji watermarks */
.drawer-kanji-watermark {
    position: absolute;
    top: 50%;
    right: 5%;
    transform: translateY(var(--parallax-offset, -50%));
    font-size: clamp(15rem, 25vw, 25rem);
    color: rgba(26, 58, 58, 0.04);
    font-family: serif;
    line-height: 1;
    pointer-events: none;
    user-select: none;
    z-index: 0;
}

.drawer-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.drawer-diagram {
    width: clamp(80px, 15vw, 140px);
    height: auto;
    flex-shrink: 0;
}

.drawer-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    letter-spacing: -0.03em;
    line-height: 0.95;
    color: var(--text-display);
}

.underline-draw {
    position: relative;
    display: inline;
}

.underline-draw::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--accent-secondary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.drawer.visible .underline-draw::after {
    transform: scaleX(1);
}

.drawer-content {
    position: relative;
    z-index: 1;
}

.drawer-content p {
    margin-bottom: 1.2rem;
    max-width: 700px;
}

.drawer-content p:last-child {
    margin-bottom: 0;
}


/* ===== CODE & LOGIC NOTATION ===== */
code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    font-weight: 400;
    color: var(--fern);
    background: rgba(26, 58, 58, 0.06);
    border-radius: 3px;
    padding: 0.1em 0.4em;
}

.logic-block {
    background: var(--surface);
    border-left: 3px solid var(--accent-primary);
    padding: 1.2rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 4px 4px 0;
    max-width: 700px;
}

.logic-block-label {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.logic-block p {
    margin-bottom: 0.8rem;
}

.logic-example {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    line-height: 1.8;
    color: var(--text-primary);
    margin-top: 0.5rem;
}

.logic-example code {
    background: none;
    padding: 0;
}

.annotation-inline {
    font-family: 'Caveat', cursive;
    font-size: 0.95em;
    color: var(--sage);
}

.logic-therefore {
    font-size: 1.2em;
    margin-right: 0.3em;
    color: var(--accent-primary);
}

.logic-therefore.logic-invalid {
    color: var(--accent-secondary);
}

.logic-struck {
    text-decoration: line-through;
    text-decoration-color: var(--accent-secondary);
    opacity: 0.7;
}

.truth-value {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8em;
    font-weight: 400;
    padding: 0.1em 0.5em;
    border-radius: 3px;
    margin-left: 0.5em;
}

.truth-value.truth-true {
    background: rgba(91, 140, 126, 0.15);
    color: var(--accent-primary);
}

.truth-value.truth-false {
    background: rgba(196, 120, 74, 0.15);
    color: var(--accent-secondary);
}

/* ===== TRUTH TABLE ===== */
.truth-table-wrapper {
    margin: 1.5rem 0;
    overflow-x: auto;
    max-width: 700px;
}

.truth-table {
    border-collapse: collapse;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    width: auto;
}

.truth-table th,
.truth-table td {
    padding: 0.6rem 1.2rem;
    text-align: center;
    border-bottom: 1px solid var(--decorative);
}

.truth-table th {
    font-weight: 400;
    color: var(--text-display);
    border-bottom: 2px solid var(--decorative);
    background: rgba(184, 164, 98, 0.08);
}

.truth-table td.truth-true {
    color: var(--accent-primary);
}

.truth-table td.truth-false {
    color: var(--accent-secondary);
}

.truth-table tbody tr:hover {
    background: rgba(91, 140, 126, 0.05);
}

/* ===== DRAWER BORDER PATTERN ===== */
.drawer-border-pattern {
    margin-top: 2rem;
    width: 100%;
    opacity: 0.6;
}

.drawer-border-pattern svg {
    width: 100%;
    height: 12px;
}

/* ===== FOOTER ===== */
.forest-floor {
    padding: 3rem clamp(2rem, 5vw, 6rem);
    text-align: center;
    border-top: 1px solid var(--decorative);
    background: var(--bg-alternate);
}

.floor-text {
    font-family: 'Caveat', cursive;
    font-size: 1.1rem;
    color: var(--sage);
    margin-bottom: 1rem;
}

.floor-text .kanji-accent {
    display: inline;
    font-family: inherit;
    font-size: inherit;
    color: var(--accent-primary);
}

.floor-symbols {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    color: var(--decorative);
    opacity: 0.5;
}

/* ===== LINKS ===== */
a {
    color: var(--accent-primary);
    text-decoration: none;
    position: relative;
}

a::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

a:hover::after {
    transform: scaleX(1);
}

a:hover {
    color: var(--accent-tertiary);
}

/* ===== STRONG / EM ===== */
strong {
    font-weight: 600;
    color: var(--text-display);
}

em {
    font-style: italic;
    color: var(--sage);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .page-body {
        grid-template-columns: 1fr;
    }

    .root-spine {
        position: relative;
        top: 0;
        height: auto;
        border-right: none;
        border-bottom: 2px solid var(--decorative);
        overflow-y: visible;
    }

    .root-spine-inner {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
        padding: 1rem;
    }

    .spine-diagram {
        display: none;
    }

    .annotation {
        flex-direction: row;
        gap: 0.4rem;
    }

    .understory {
        max-width: 100%;
    }

    .understory-inner {
        flex-direction: column;
    }

    .topic-card {
        max-width: none;
    }

    .drawer-header {
        flex-direction: column;
    }

    .drawer-kanji-watermark {
        font-size: 10rem;
    }
}
