/* lrx.wiki - Goblincore Field Guide / Bento Wiki */

:root {
    --ink-black: #0D0D0D;
    --charcoal: #1A1A1A;
    --graphite: #2E2E2E;
    --slate: #444444;
    --pewter: #6B6B6B;
    --ash: #888888;
    --fog: #B0B0B0;
    --bone: #D4D4D4;
    --parchment: #E8E4DF;
    --cream: #F5F3EF;
    --paper-white: #FAFAF8;
    --type-xs: 0.65rem;
    --type-sm: 0.8rem;
    --type-base: 1rem;
    --type-md: 1.333rem;
    --type-lg: 1.777rem;
    --type-xl: 2.369rem;
    --type-2xl: 3.157rem;
    --type-hero: clamp(2.5rem, 6vw, 5rem);
}

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

body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    color: var(--graphite);
    background: var(--paper-white);
    overflow-x: hidden;
    position: relative;
}

/* Paper texture */
.paper-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='6' seed='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23p)' opacity='0.15'/%3E%3C/svg%3E");
}

/* Fold lines */
.fold-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background:
        repeating-linear-gradient(0deg, transparent, transparent calc(33.33vh - 1px), var(--bone) 33.33vh),
        repeating-linear-gradient(90deg, transparent, transparent calc(25vw - 1px), var(--bone) 25vw);
    opacity: 0.3;
}

/* Ink blots */
.ink-blot {
    position: absolute;
    border-radius: 50%;
    background: var(--charcoal);
    opacity: 0.06;
    z-index: 0;
    pointer-events: none;
}
.ink-blot-1 { width: 80px; height: 60px; top: 15%; left: 70%; transform: rotate(20deg) scaleX(1.3); }
.ink-blot-2 { width: 50px; height: 40px; top: 55%; left: 12%; transform: rotate(-15deg) scaleY(1.4); }
.ink-blot-3 { width: 65px; height: 55px; top: 82%; left: 55%; transform: rotate(45deg) scaleX(1.2); }

/* Masthead */
.masthead {
    width: 100%;
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--parchment);
    border-bottom: 1px solid var(--slate);
    position: relative;
    z-index: 2;
}

.masthead-inner {
    text-align: center;
    padding: 2rem;
}

.masthead-title {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: var(--type-hero);
    color: var(--charcoal);
    letter-spacing: 0.08em;
    line-height: 1.1;
    min-height: 1.2em;
}

.masthead-title::after {
    content: '|';
    animation: blink 1.06s step-end infinite;
    color: var(--charcoal);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.masthead-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    color: var(--slate);
    letter-spacing: 0.08em;
    margin-top: 1.5rem;
    min-height: 1.4em;
}

.masthead-subtitle::after {
    content: '|';
    animation: blink 1.06s step-end infinite;
    color: var(--slate);
    opacity: 0;
}

.masthead-subtitle.typing::after {
    opacity: 1;
}

/* Specimen Grid */
.specimen-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(120px, auto);
    gap: 6px;
    padding: 6px;
    position: relative;
    z-index: 2;
}

.bento-cell {
    border: 1px solid var(--slate);
    padding: 1.5rem;
    position: relative;
    background: var(--cream);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 400ms ease-out, transform 400ms ease-out, border-width 200ms ease;
    transition-delay: calc(var(--stagger, 0) * 80ms);
}

.bento-cell.visible {
    opacity: 1;
    transform: translateY(0);
}

.bento-cell::before {
    content: attr(data-label);
    position: absolute;
    top: 8px;
    left: 12px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: var(--type-xs);
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ash);
    opacity: 0;
}

.bento-cell.typed::before {
    opacity: 1;
}

.cell-glyph {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 16px;
    height: 16px;
    transition: transform 300ms ease;
}

.dark-cell {
    background: var(--charcoal);
    color: var(--cream);
}

.dark-cell:hover {
    border: 2px solid var(--parchment);
}

.dark-cell:hover .cell-glyph {
    transform: rotate(90deg);
}

.dark-cell .cell-body { color: var(--bone); }
.dark-cell .cell-subheading { color: var(--cream); }

.cell-large {
    grid-column: span 7;
    grid-row: span 2;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.cell-tall {
    grid-column: span 5;
    grid-row: span 2;
    min-height: 280px;
}

.cell-sm {
    grid-column: span 3;
    min-height: 140px;
}

.cell-hex {
    grid-column: span 3;
    min-height: 140px;
    padding: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hex-pattern { opacity: 0.6; }

.cell-heading {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, var(--type-xl));
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.1;
    color: var(--cream);
    margin-bottom: 1rem;
}

.cell-subheading {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 700;
    font-size: var(--type-lg);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.1;
    color: var(--charcoal);
    margin-bottom: 0.8rem;
    margin-top: 2.5rem;
}

.cell-body {
    font-family: 'Source Sans 3', sans-serif;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.85;
    letter-spacing: 0.01em;
    color: var(--graphite);
    max-width: 65ch;
    margin-top: 0.5rem;
}

/* Dot grid for select cells */
.cell-sm:nth-child(3),
.appendix-cell:nth-child(1) {
    background-image: radial-gradient(circle, var(--bone) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Index Strip */
.index-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    border-top: 1px solid var(--slate);
    border-bottom: 1px solid var(--slate);
    margin: 6px;
    background: var(--parchment);
    position: relative;
    z-index: 2;
}

.index-link {
    font-family: 'IBM Plex Mono', monospace;
    font-size: var(--type-sm);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--charcoal);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 300ms ease;
}

.index-link.visible { opacity: 1; }

.index-sep {
    font-family: 'IBM Plex Mono', monospace;
    font-size: var(--type-sm);
    color: var(--fog);
    opacity: 0;
    transition: opacity 200ms ease;
}

.index-sep.visible { opacity: 1; }

/* Folio */
.folio {
    max-width: 65ch;
    margin: 4rem auto;
    padding: 0 2rem;
    position: relative;
    z-index: 2;
}

.folio-inner p {
    font-family: 'Source Sans 3', sans-serif;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.85;
    letter-spacing: 0.01em;
    color: var(--graphite);
    margin-bottom: 1.5rem;
}

.divider {
    text-align: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    color: var(--ash);
    letter-spacing: 1em;
    padding: 1.5rem 0;
}

/* Appendix Grid */
.appendix-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 6px;
    padding: 6px;
    position: relative;
    z-index: 2;
}

.appendix-cell {
    grid-column: span 4;
    min-height: 120px;
}

.cell-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: var(--type-xs);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--slate);
    line-height: 2;
    margin-top: 2rem;
}

.dark-cell .cell-meta { color: var(--fog); }

/* Colophon */
.colophon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 30vh;
    min-height: 250px;
    padding: 2rem;
    position: relative;
    z-index: 2;
}

.colophon-svg {
    margin-bottom: 2rem;
}

.draw-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 3.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.draw-path.drawn {
    stroke-dashoffset: 0;
}

.circle-mid { transition-delay: 400ms; }
.circle-inner { transition-delay: 800ms; }
.triangle-path { transition-delay: 2s; transition-duration: 1.2s; }

.colophon-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: var(--type-sm);
    letter-spacing: 0.08em;
    color: var(--pewter);
}

/* Print */
@media print {
    .paper-texture, .fold-lines, .ink-blot, .colophon-svg { display: none; }
    body { background: white; color: #000; }
    .bento-cell { opacity: 1; transform: none; border: 1px solid #000; }
    .masthead-title::after, .masthead-subtitle::after { display: none; }
    @keyframes blink { 0%, 100% { opacity: 0; } }
}

/* Responsive */
@media (max-width: 768px) {
    .specimen-grid, .appendix-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .cell-large, .cell-tall, .cell-sm, .cell-hex, .appendix-cell {
        grid-column: span 4;
        grid-row: span 1;
        min-height: 160px;
    }
    .index-strip { flex-wrap: wrap; }
}

@media (max-width: 480px) {
    .specimen-grid, .appendix-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .cell-large, .cell-tall, .cell-sm, .cell-hex, .appendix-cell {
        grid-column: span 2;
    }
    .masthead { height: 100vh; }
}
