/* ==========================================================
   xanadu.wiki -- street-style nature encyclopedia
   Palette (strictly monochrome):
     Concrete White  #f2f0eb  -- background wall
     Graphite        #2d2d2d  -- primary text / borders
     Charcoal        #4a4a4a  -- secondary text
     Paper Gray      #d9d5ce  -- hexagon fill
     Ink Black       #0d0d0d  -- mural display
     Smoke           #8a8580  -- ghost/tertiary
   ========================================================== */

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

:root {
    --concrete-white: #f2f0eb;
    --graphite: #2d2d2d;
    --charcoal: #4a4a4a;
    --paper-gray: #d9d5ce;
    --paper-gray-dark: #cbc7bf;
    --ink-black: #0d0d0d;
    --smoke: #8a8580;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--concrete-white);
    color: var(--graphite);
    font-family: "Work Sans", "Inter", sans-serif;
    font-size: 0.95rem;
    line-height: 1.65;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* ---------- Grain / concrete overlay ---------- */
.grain-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    pointer-events: none;
    opacity: 0.5;
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.17 0 0 0 0 0.17 0 0 0 0 0.17 0 0 0 0.08 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    mix-blend-mode: multiply;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(74,74,74,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(74,74,74,0.05) 0%, transparent 60%),
        radial-gradient(ellipse at 60% 10%, rgba(138,133,128,0.06) 0%, transparent 40%);
}

/* ---------- Opening mural ---------- */
.opening-mural {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 2rem;
    border-bottom: 1px solid var(--graphite);
    overflow: hidden;
}

.opening-mural::before,
.opening-mural::after {
    content: "";
    position: absolute;
    border: 1px solid var(--graphite);
    pointer-events: none;
}

.opening-mural::before {
    top: 24px; left: 24px;
    width: 48px; height: 48px;
    border-right: none;
    border-bottom: none;
}

.opening-mural::after {
    bottom: 24px; right: 24px;
    width: 48px; height: 48px;
    border-left: none;
    border-top: none;
}

.mural-inner {
    text-align: center;
    position: relative;
}

.mural-title {
    font-family: "Anton", "Work Sans", sans-serif;
    font-weight: 400;
    font-size: 20vw;
    line-height: 0.85;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--ink-black);
    text-shadow:
        1px 0 0 var(--ink-black),
        -1px 0 0 var(--ink-black),
        0 1px 0 var(--ink-black),
        0 -1px 0 var(--ink-black);
}

.mural-subtitle {
    font-family: "Courier Prime", "Courier New", monospace;
    font-size: 2rem;
    color: var(--graphite);
    margin-top: 0.5rem;
    min-height: 2.4rem;
    letter-spacing: 0.02em;
}

.cursor-blink {
    display: inline-block;
    width: 3px;
    height: 1.8rem;
    background: var(--graphite);
    margin-left: 4px;
    vertical-align: middle;
    animation: blink 530ms steps(1) infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.mural-meta {
    font-family: "Courier Prime", "Courier New", monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--smoke);
    margin-top: 2rem;
}

.scroll-indicator {
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: "Courier Prime", "Courier New", monospace;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: var(--charcoal);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    animation: bob 2s ease-in-out infinite;
}

.scroll-arrow {
    font-size: 1.1rem;
    color: var(--graphite);
}

@keyframes bob {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(6px); }
}

/* ---------- Tag nav ---------- */
.tag-nav {
    position: sticky;
    top: 0;
    z-index: 500;
    background: var(--concrete-white);
    border-bottom: 1px solid var(--graphite);
    padding: 0.9rem 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    font-family: "Courier Prime", "Courier New", monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.tag-nav-label {
    color: var(--smoke);
}

.tag-link {
    color: var(--graphite);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
    transition: border-color 200ms, color 200ms;
}

.tag-link:hover {
    color: var(--ink-black);
    border-bottom-color: var(--graphite);
}

/* ---------- Honeycomb cluster ---------- */
.honeycomb-cluster {
    padding: 5rem 2rem 3rem;
    position: relative;
}

.cluster-header {
    max-width: 1120px;
    margin: 0 auto 3rem;
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    position: relative;
}

.cluster-tag {
    font-family: "Courier Prime", "Courier New", monospace;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--smoke);
    white-space: nowrap;
}

.cluster-title {
    font-family: "Anton", "Work Sans", sans-serif;
    font-weight: 400;
    font-size: clamp(3rem, 8vw, 6rem);
    line-height: 1;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--ink-black);
}

.cluster-rule {
    flex: 1;
    height: 1px;
    background: var(--graphite);
}

/* Honeycomb grid */
.honeycomb {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hex-row {
    display: flex;
    gap: 4px;
    justify-content: center;
}

/* Offset pattern: second row tucks up into first */
.hex-row-3 + .hex-row-2 {
    margin-top: -84px;
}

.hex-row-2 + .hex-row-3 {
    margin-top: -84px;
}

.hex {
    width: 320px;
    height: 340px;
    background: var(--paper-gray);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    position: relative;
    cursor: default;
    transition: background 280ms ease, transform 280ms ease;
    flex-shrink: 0;
}

/* Border simulation via filter layers */
.hex::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--graphite);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    z-index: 0;
    transition: inset 200ms ease;
}

.hex::after {
    content: "";
    position: absolute;
    inset: 1px;
    background: var(--paper-gray);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    z-index: 1;
    transition: background 280ms ease, inset 200ms ease;
}

.hex:hover::before {
    inset: 0;
}

.hex:hover::after {
    inset: 3px;
    background: var(--paper-gray-dark);
}

.hex.hex-ringed::after {
    background:
        radial-gradient(circle at 50% 50%, transparent 0, transparent 40px, rgba(45,45,45,0.08) 40px, rgba(45,45,45,0.08) 41px, transparent 41px, transparent 60px, rgba(45,45,45,0.08) 60px, rgba(45,45,45,0.08) 61px, transparent 61px, transparent 84px, rgba(45,45,45,0.08) 84px, rgba(45,45,45,0.08) 85px, transparent 85px),
        var(--paper-gray);
}

.hex.hex-ringed:hover::after {
    background:
        radial-gradient(circle at 50% 50%, transparent 0, transparent 40px, rgba(45,45,45,0.12) 40px, rgba(45,45,45,0.12) 41px, transparent 41px, transparent 60px, rgba(45,45,45,0.12) 60px, rgba(45,45,45,0.12) 61px, transparent 61px, transparent 84px, rgba(45,45,45,0.12) 84px, rgba(45,45,45,0.12) 85px, transparent 85px),
        var(--paper-gray-dark);
}

.hex-inner {
    position: relative;
    z-index: 2;
    height: 100%;
    padding: 56px 42px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    gap: 0.6rem;
}

.hex-cat {
    font-family: "Courier Prime", "Courier New", monospace;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--smoke);
}

.hex-title {
    font-family: "Anton", "Work Sans", sans-serif;
    font-weight: 400;
    font-size: 3.2rem;
    line-height: 0.95;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--ink-black);
}

.hex-body {
    font-family: "Work Sans", "Inter", sans-serif;
    font-weight: 400;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--graphite);
    min-height: 4.5rem;
    position: relative;
}

.hex-body.typing::after {
    content: "";
    display: inline-block;
    width: 2px;
    height: 0.9rem;
    background: var(--graphite);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 530ms steps(1) infinite;
}

.hex-meta {
    font-family: "Courier Prime", "Courier New", monospace;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--charcoal);
    margin-top: 0.4rem;
}

/* Art-only hex */
.hex-art .hex-inner {
    padding: 40px;
}

.hex-botanical {
    width: 100%;
    height: 100%;
    max-width: 220px;
    max-height: 220px;
    margin: 0 auto;
    transition: transform 400ms ease;
}

.hex:hover .hex-botanical {
    transform: rotate(5deg) scale(1.04);
}

.hex:hover .hex-botanical .leaf,
.hex:hover .hex-botanical .stem {
    stroke: var(--ink-black);
}

/* Reveal animation (staggered by JS) */
.hex.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease, transform 600ms ease;
}

.hex.reveal.is-outlined::after {
    background: transparent;
}

.hex.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.hex.reveal.is-filled::after {
    background: var(--paper-gray);
    transition: background 400ms ease;
}

.hex.reveal.hex-ringed.is-filled::after {
    background:
        radial-gradient(circle at 50% 50%, transparent 0, transparent 40px, rgba(45,45,45,0.08) 40px, rgba(45,45,45,0.08) 41px, transparent 41px, transparent 60px, rgba(45,45,45,0.08) 60px, rgba(45,45,45,0.08) 61px, transparent 61px, transparent 84px, rgba(45,45,45,0.08) 84px, rgba(45,45,45,0.08) 85px, transparent 85px),
        var(--paper-gray);
}

/* ---------- Mural breakout ---------- */
.mural-breakout {
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    padding: 6rem 0;
    border-top: 1px solid var(--graphite);
    border-bottom: 1px solid var(--graphite);
    background:
        radial-gradient(circle at 15% 30%, rgba(74,74,74,0.08) 0%, transparent 18%),
        radial-gradient(circle at 85% 70%, rgba(74,74,74,0.06) 0%, transparent 20%),
        radial-gradient(circle at 40% 80%, rgba(74,74,74,0.05) 0%, transparent 12%),
        var(--concrete-white);
}

.breakout-text {
    font-family: "Anton", "Work Sans", sans-serif;
    font-weight: 400;
    font-size: clamp(5rem, 18vw, 18rem);
    line-height: 0.85;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: var(--ink-black);
    text-align: center;
    white-space: nowrap;
    will-change: transform;
    text-shadow:
        1px 0 0 var(--ink-black),
        -1px 0 0 var(--ink-black),
        0 1px 0 var(--ink-black),
        0 -1px 0 var(--ink-black);
}

/* ---------- Field notes ---------- */
.field-notes {
    padding: 6rem 2rem;
    background: var(--concrete-white);
    border-top: 1px solid var(--graphite);
}

.field-notes-inner {
    max-width: 1120px;
    margin: 0 auto;
}

.field-tag {
    font-family: "Courier Prime", "Courier New", monospace;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--smoke);
    display: block;
    margin-bottom: 0.8rem;
}

.field-title {
    font-family: "Anton", "Work Sans", sans-serif;
    font-weight: 400;
    font-size: clamp(3rem, 7vw, 5rem);
    line-height: 1;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--ink-black);
    margin-bottom: 1rem;
}

.field-intro {
    font-family: "Work Sans", sans-serif;
    max-width: 38rem;
    color: var(--charcoal);
    margin-bottom: 3rem;
    font-size: 1rem;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    border-top: 1px solid var(--graphite);
    padding-top: 2.5rem;
}

.note {
    padding: 1rem 0;
    border-left: 2px solid var(--graphite);
    padding-left: 1.5rem;
    transition: border-color 200ms, transform 200ms;
}

.note:hover {
    border-left-color: var(--ink-black);
    transform: translateX(4px);
}

.note-date {
    font-family: "Courier Prime", "Courier New", monospace;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    color: var(--smoke);
    display: block;
    margin-bottom: 0.6rem;
}

.note-text {
    font-family: "Work Sans", sans-serif;
    font-size: 0.98rem;
    line-height: 1.6;
    color: var(--graphite);
    margin-bottom: 0.8rem;
}

.note-sig {
    font-family: "Courier Prime", "Courier New", monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: var(--charcoal);
}

/* ---------- Colophon ---------- */
.colophon {
    background: var(--graphite);
    color: var(--concrete-white);
    padding: 4rem 2rem 2rem;
    position: relative;
    overflow: hidden;
}

.colophon-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 3rem;
    border-bottom: 1px solid var(--smoke);
    padding-bottom: 3rem;
}

.colophon-block {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.colophon-tag {
    font-family: "Courier Prime", "Courier New", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--smoke);
}

.colophon-text {
    font-family: "Work Sans", sans-serif;
    color: var(--concrete-white);
    font-size: 0.92rem;
    line-height: 1.6;
}

.colophon-mark {
    font-family: "Anton", sans-serif;
    font-size: clamp(4rem, 14vw, 14rem);
    line-height: 1;
    letter-spacing: -0.02em;
    text-align: center;
    margin-top: 2rem;
    color: var(--concrete-white);
    opacity: 0.08;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .hex {
        width: 280px;
        height: 300px;
    }

    .hex-row-3 + .hex-row-2,
    .hex-row-2 + .hex-row-3 {
        margin-top: -74px;
    }

    .hex-title {
        font-size: 2.6rem;
    }

    .hex-body {
        font-size: 0.82rem;
    }

    .cluster-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .cluster-rule {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .honeycomb-cluster {
        padding: 3rem 1rem 2rem;
    }

    .hex-row {
        flex-direction: column;
        gap: 8px !important;
        margin-top: 0 !important;
    }

    .hex-row-3 + .hex-row-2,
    .hex-row-2 + .hex-row-3 {
        margin-top: 8px !important;
    }

    .hex {
        width: 88vw;
        height: 90vw;
        max-width: 340px;
        max-height: 360px;
    }

    .mural-title {
        font-size: 28vw;
    }

    .mural-subtitle {
        font-size: 1.3rem;
    }

    .cursor-blink {
        height: 1.2rem;
    }

    .breakout-text {
        font-size: 22vw;
    }

    .tag-nav {
        padding: 0.8rem 1rem;
        gap: 0.9rem;
        font-size: 0.7rem;
    }

    .field-notes,
    .colophon {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
