:root {
    --c-cream: #f0ece4;
    --c-paper: #faf6f0;
    --c-teal: #3a8a7a;
    --c-orange: #d47840;
    --c-bamboo: #6a8a5a;
    --c-stone: #3a3632;
    --c-route: #8a6a4a;
    --f-head: "Archivo", "Helvetica Neue", Arial, sans-serif;
    --f-body: "Lora", Georgia, serif;
    --f-mono: "Space Mono", "Menlo", "Consolas", monospace;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--f-body);
    background: var(--c-cream);
    color: var(--c-stone);
    line-height: 1.85;
    overflow-x: hidden;
}

/* === HERO === */
.hero {
    position: relative;
    min-height: 100vh;
    background: var(--c-cream);
    padding: clamp(28px, 4vw, 56px);
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 18% 22%, rgba(58, 138, 122, 0.06) 0%, transparent 38%),
        radial-gradient(circle at 78% 76%, rgba(212, 120, 64, 0.05) 0%, transparent 42%);
    pointer-events: none;
}

.hero-grid {
    position: relative;
    width: 100%;
    height: calc(100vh - clamp(56px, 8vw, 112px));
    min-height: 620px;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(12, 1fr);
    gap: 12px;
}

.hero-supply {
    grid-column: 1 / 7;
    grid-row: 1 / 4;
    align-self: end;
    overflow: hidden;
}

.word-supply {
    display: block;
    font-family: var(--f-head);
    font-weight: 800;
    font-size: clamp(54px, 9vw, 138px);
    color: var(--c-stone);
    line-height: 0.9;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    transform: translateY(110%);
    opacity: 0;
    animation: word-rise 1.2s cubic-bezier(0.2, 0.7, 0.25, 1) forwards;
    animation-delay: 0.3s;
}

.hero-chain {
    grid-column: 6 / 13;
    grid-row: 9 / 12;
    overflow: hidden;
    text-align: right;
}

.word-chain {
    display: inline-block;
    font-family: var(--f-head);
    font-weight: 800;
    font-size: clamp(54px, 9vw, 138px);
    color: var(--c-orange);
    line-height: 0.9;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    transform: translateY(110%);
    opacity: 0;
    animation: word-rise 1.2s cubic-bezier(0.2, 0.7, 0.25, 1) forwards;
    animation-delay: 0.55s;
}

.hero-wiki {
    grid-column: 4 / 9;
    grid-row: 5 / 8;
    align-self: center;
    text-align: center;
    overflow: hidden;
    position: relative;
    z-index: 4;
}

.word-wiki {
    display: inline-block;
    font-family: var(--f-head);
    font-weight: 700;
    font-size: clamp(78px, 14vw, 220px);
    color: var(--c-teal);
    line-height: 0.86;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    transform: translateY(120%);
    opacity: 0;
    animation: word-rise 1.4s cubic-bezier(0.2, 0.7, 0.25, 1) forwards;
    animation-delay: 0.8s;
    position: relative;
}

.word-wiki::after {
    content: "";
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: 6%;
    height: 6px;
    background: var(--c-orange);
    transform: scaleX(0);
    transform-origin: left;
    animation: underline-draw 1s ease-out forwards;
    animation-delay: 1.6s;
}

@keyframes underline-draw {
    to { transform: scaleX(1); }
}

@keyframes word-rise {
    to { transform: translateY(0); opacity: 1; }
}

.hero-connectors {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.connector-1, .connector-2, .connector-3 {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    animation: line-draw 2s ease-out forwards;
}

.connector-1 { animation-delay: 1s; }
.connector-2 { animation-delay: 1.3s; }
.connector-3 { animation-delay: 1.6s; }

.connector-node {
    opacity: 0;
    animation: node-pop 0.6s cubic-bezier(0.2, 0.7, 0.25, 1) forwards;
}

.connector-node:nth-of-type(1) { animation-delay: 1.4s; }
.connector-node:nth-of-type(2) { animation-delay: 1.8s; }
.connector-node:nth-of-type(3) { animation-delay: 2.2s; }

@keyframes line-draw {
    to { stroke-dashoffset: 0; }
}

@keyframes node-pop {
    from { opacity: 0; transform: scale(0); transform-origin: center; }
    to { opacity: 1; transform: scale(1); }
}

.hero-meta {
    grid-column: 1 / 5;
    grid-row: 11 / 13;
    align-self: end;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-left: 2px solid var(--c-teal);
    padding-left: 14px;
    opacity: 0;
    animation: fade-up 1s ease-out forwards;
    animation-delay: 1.4s;
}

.meta-line {
    font-family: var(--f-mono);
    font-size: 12px;
    color: var(--c-stone);
    letter-spacing: 0.04em;
}

.meta-line:first-child { color: var(--c-teal); font-weight: 700; }

.hero-iso {
    grid-column: 9 / 13;
    grid-row: 1 / 5;
    z-index: 3;
    opacity: 0;
    animation: fade-up 1.2s ease-out forwards;
    animation-delay: 1.2s;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
}

.iso-art { width: 100%; max-width: 280px; height: auto; }

.hero-search {
    grid-column: 5 / 12;
    grid-row: 11 / 13;
    align-self: end;
    z-index: 5;
    opacity: 0;
    animation: fade-up 1s ease-out forwards;
    animation-delay: 1.6s;
}

.search-label {
    display: block;
    font-family: var(--f-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--c-orange);
    margin-bottom: 8px;
}

.search-row {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--c-stone);
    padding-bottom: 6px;
    margin-bottom: 12px;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: var(--f-body);
    font-size: 16px;
    color: var(--c-stone);
    padding: 8px 0;
    outline: none;
}

.search-input::placeholder { color: rgba(58, 54, 50, 0.4); font-style: italic; }

.search-btn {
    border: none;
    background: var(--c-stone);
    color: var(--c-cream);
    font-family: var(--f-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    padding: 8px 18px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-btn:hover { background: var(--c-teal); }

.search-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.search-tags span {
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--c-stone);
    background: var(--c-paper);
    padding: 4px 10px;
    border: 1px solid rgba(58, 54, 50, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-tags span:hover {
    background: var(--c-teal);
    color: var(--c-cream);
    border-color: var(--c-teal);
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 800px) {
    .hero-grid {
        display: flex;
        flex-direction: column;
        gap: 22px;
        height: auto;
        min-height: 0;
        padding-top: 30px;
    }
    .hero-supply, .hero-wiki, .hero-chain, .hero-meta, .hero-iso, .hero-search {
        grid-column: auto;
        grid-row: auto;
        align-self: stretch;
        text-align: left;
    }
    .word-supply, .word-chain { font-size: clamp(40px, 14vw, 80px); }
    .word-wiki { font-size: clamp(60px, 22vw, 120px); }
    .hero-connectors { display: none; }
}

/* === wiki sections === */
.wiki-section {
    position: relative;
    padding: clamp(60px, 9vw, 140px) clamp(20px, 5vw, 80px);
    background: var(--c-cream);
}

.wiki-section + .wiki-section { padding-top: clamp(40px, 6vw, 100px); }

.section-inner {
    max-width: 1240px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(28px, 4vw, 64px);
    align-items: start;
    position: relative;
    z-index: 2;
}

@media (min-width: 880px) {
    .section-left .section-inner {
        grid-template-columns: 1.4fr 1fr;
    }
    .section-right .section-inner {
        grid-template-columns: 1fr 1.4fr;
    }
}

.section-inner-narrow { max-width: 880px; }

.section-narrow .section-inner { grid-template-columns: 1fr; }

.entry {
    background: var(--c-paper);
    padding: clamp(28px, 4vw, 56px);
    box-shadow: 0 2px 0 rgba(58, 54, 50, 0.05), 0 16px 36px rgba(58, 54, 50, 0.08);
    position: relative;
    border-radius: 2px;
}

.section-right .entry {
    transform: translateY(36px);
}

.section-left .entry {
    transform: translateX(-12px);
}

@media (max-width: 880px) {
    .section-right .entry, .section-left .entry { transform: none; }
}

.entry-stamp {
    display: inline-block;
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--c-teal);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--c-orange);
    padding-bottom: 4px;
}

.entry-title {
    font-family: var(--f-head);
    font-weight: 700;
    font-size: clamp(28px, 4.5vw, 52px);
    line-height: 1.06;
    color: var(--c-stone);
    margin-bottom: 22px;
    letter-spacing: -0.005em;
}

.entry-lead {
    font-family: var(--f-body);
    font-weight: 500;
    font-size: clamp(17px, 1.6vw, 21px);
    line-height: 1.55;
    color: var(--c-teal);
    font-style: italic;
    margin-bottom: 26px;
    border-left: 3px solid var(--c-orange);
    padding-left: 18px;
}

.entry p {
    font-family: var(--f-body);
    font-size: clamp(15px, 1.15vw, 18px);
    line-height: 1.85;
    color: var(--c-stone);
    margin-bottom: 18px;
}

.entry-meta-list {
    list-style: none;
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid rgba(58, 54, 50, 0.18);
    display: flex;
    flex-wrap: wrap;
    gap: 14px 32px;
}

.entry-meta-list li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-family: var(--f-mono);
    font-size: 12px;
}

.meta-k { color: var(--c-orange); text-transform: uppercase; letter-spacing: 0.14em; font-size: 10px; }
.meta-v { color: var(--c-stone); }

.counterbalance {
    align-self: start;
    position: relative;
}

.counterbalance-right { transform: translateY(56px); }
.counterbalance-left { transform: translateY(-12px) translateX(-8px); }

@media (max-width: 880px) {
    .counterbalance-right, .counterbalance-left { transform: none; }
}

.frame {
    background: var(--c-paper);
    padding: 28px;
    box-shadow: 0 14px 36px rgba(58, 54, 50, 0.1);
    position: relative;
    transform: rotate(-1deg);
}

.frame-route { background: var(--c-cream); padding: 18px; transform: rotate(1.2deg); }

.frame::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(58, 54, 50, 0.12);
    pointer-events: none;
}

.iso-block, .iso-art, .route-pattern, .bullwhip-svg, .port-iso {
    width: 100%;
    height: auto;
    display: block;
}

.frame-caption {
    margin-top: 14px;
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--c-route);
    line-height: 1.6;
    text-align: left;
    padding: 0 6px;
}

/* section borders */
.section-border {
    position: absolute;
    inset: clamp(20px, 4vw, 60px);
    pointer-events: none;
    z-index: 1;
    opacity: 0.5;
}

.section-border svg {
    width: 100%;
    height: 100%;
    display: block;
}

.border-rect {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.2, 0.7, 0.25, 1);
}

.section-border.border-drawn .border-rect {
    stroke-dashoffset: 0;
}

/* categories */
.entry-narrow {
    text-align: left;
}

.categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 28px;
}

.cat-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 22px;
    background: var(--c-cream);
    border: 1px solid rgba(58, 54, 50, 0.16);
    text-decoration: none;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.cat-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--c-teal);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.3s ease;
}

.cat-card:hover {
    background: var(--c-paper);
    border-color: var(--c-teal);
    transform: translateY(-2px);
}

.cat-card:hover::before { transform: scaleY(1); }

.cat-id {
    font-family: var(--f-head);
    font-weight: 700;
    font-size: 32px;
    color: var(--c-orange);
    line-height: 1;
}

.cat-name {
    font-family: var(--f-head);
    font-weight: 700;
    font-size: 16px;
    color: var(--c-stone);
}

.cat-count {
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--c-route);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* footer */
.wiki-footer {
    background: var(--c-paper);
    border-top: 1px solid rgba(58, 54, 50, 0.12);
    padding: clamp(40px, 6vw, 80px) clamp(20px, 5vw, 80px);
}

.footer-inner {
    max-width: 1240px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
}

@media (min-width: 800px) {
    .footer-inner {
        grid-template-columns: 2fr 1fr 1fr;
    }
}

.foot-label {
    display: inline-block;
    font-family: var(--f-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--c-orange);
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(212, 120, 64, 0.3);
    padding-bottom: 4px;
}

.foot-block p {
    font-family: var(--f-body);
    font-size: 14px;
    line-height: 1.7;
    color: var(--c-stone);
}
