/* graphers.dev -- goblincore developer community
   Palette:
     #2C2416  loam
     #1A1208  bark
     #C0C0C0  chrome
     #7B8C3E  moss
     #A0522D  rust
     #E8E0D4  parchment
     #D4A84B  amber
*/

:root {
    --loam: #2C2416;
    --bark: #1A1208;
    --chrome: #C0C0C0;
    --moss: #7B8C3E;
    --rust: #A0522D;
    --parchment: #E8E0D4;
    --amber: #D4A84B;

    --display-font: "Archivo Black", "Work Sans", sans-serif;
    --body-font: "Work Sans", "Inter", sans-serif;
    --code-font: "JetBrains Mono", monospace;

    --max-w: 1400px;
}

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

html {
    scroll-behavior: smooth;
    background: var(--loam);
}

body {
    background: var(--loam);
    color: var(--parchment);
    font-family: var(--body-font);
    font-weight: 400;
    font-size: clamp(15px, 1.1vw, 18px);
    line-height: 1.8;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

code, .concept-tag, .hero-notation {
    font-family: var(--code-font);
    font-size: 14px;
    color: var(--amber);
}

a {
    color: var(--amber);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--moss);
}

/* =====================================================
   WATERMARKS (background graph notation)
   ===================================================== */
.watermark {
    position: absolute;
    font-family: var(--display-font);
    color: var(--parchment);
    opacity: 0.04;
    pointer-events: none;
    user-select: none;
    z-index: 0;
    letter-spacing: -0.03em;
    line-height: 1;
}

.watermark-one {
    top: 12%;
    right: -4%;
    font-size: clamp(140px, 22vw, 340px);
    transform: rotate(-4deg);
}

.watermark-two {
    top: 42%;
    left: -3%;
    font-size: clamp(100px, 14vw, 220px);
    transform: rotate(3deg);
}

.watermark-three {
    top: 74%;
    right: 5%;
    font-size: clamp(100px, 14vw, 220px);
    transform: rotate(-2deg);
}

/* =====================================================
   HERO
   ===================================================== */
.hero {
    position: relative;
    min-height: 100vh;
    background: var(--loam);
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
}

.hero-graph {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: 0 6vw;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    /* Golden-ratio off-center placement */
    display: grid;
    grid-template-columns: 38% 62%;
    align-items: center;
    gap: 3vw;
}

.hero-logotype {
    grid-column: 1 / 2;
    justify-self: start;
    position: relative;
    padding: 0.4em 0.6em 0.5em;
    font-family: var(--display-font);
    font-weight: 400;
    color: var(--parchment);
    font-size: clamp(36px, 6vw, 88px);
    letter-spacing: -0.03em;
    line-height: 1;
    grid-row: 1;
}

.logotype-text {
    opacity: 0;
    display: inline-block;
    animation: logotype-text-in 600ms ease 1500ms forwards;
}

.hero-logotype .logotype-border {
    position: absolute;
    background: var(--chrome);
    opacity: 0.9;
}

.logotype-top {
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    animation: border-top-draw 380ms ease forwards;
}
.logotype-right {
    top: 0;
    right: 0;
    width: 2px;
    height: 0;
    animation: border-right-draw 380ms ease 380ms forwards;
}
.logotype-bottom {
    bottom: 0;
    right: 0;
    height: 2px;
    width: 0;
    animation: border-bottom-draw 380ms ease 760ms forwards;
}
.logotype-left {
    bottom: 0;
    left: 0;
    width: 2px;
    height: 0;
    animation: border-left-draw 380ms ease 1140ms forwards;
}

@keyframes border-top-draw { to { width: 100%; } }
@keyframes border-right-draw { to { height: 100%; } }
@keyframes border-bottom-draw { to { width: 100%; } }
@keyframes border-left-draw { to { height: 100%; } }
@keyframes logotype-text-in { to { opacity: 1; } }

.hero-descriptor {
    grid-column: 2 / 3;
    justify-self: start;
    max-width: 36ch;
    color: var(--chrome);
    font-size: clamp(14px, 1.1vw, 18px);
    letter-spacing: 0.02em;
    opacity: 0;
    animation: fade-up 700ms ease 1700ms forwards;
}

.hero-meta {
    grid-column: 1 / 3;
    margin-top: 3vw;
    opacity: 0;
    animation: fade-up 700ms ease 1900ms forwards;
}

.hero-notation {
    color: var(--amber);
    font-family: var(--code-font);
    font-size: 13px;
    letter-spacing: 0.04em;
}

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

.hero-scroll-indicator {
    position: absolute;
    bottom: 3vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    animation: fade-up 700ms ease 2100ms forwards;
}

.scroll-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--amber);
    animation: pulse 2.4s ease-in-out infinite;
}

.scroll-label {
    color: var(--chrome);
    font-family: var(--code-font);
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: lowercase;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.6); opacity: 1; }
}

/* Hero graph nodes/edges */
.hero-graph .hero-edge {
    stroke: var(--chrome);
    stroke-width: 1;
    opacity: 0;
    fill: none;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke 300ms ease, opacity 300ms ease;
}

.hero-graph .hero-edge.hero-edge-glow {
    stroke: var(--amber);
    opacity: 0.9;
}

.hero-graph .hero-node {
    fill: var(--moss);
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
    transition: fill 240ms ease, r 240ms ease;
}

.hero-graph .hero-node.hero-node-bright {
    fill: var(--amber);
}

/* =====================================================
   MYCELIUM DIVIDERS
   ===================================================== */
.mycelium-divider {
    display: block;
    width: 100%;
    height: 80px;
    margin: 2rem 0;
    overflow: visible;
    position: relative;
    z-index: 1;
}

.mycelium-branch {
    fill: none;
    stroke: var(--moss);
    stroke-width: 1.5;
    opacity: 0.7;
    stroke-dasharray: 1600;
    stroke-dashoffset: 1600;
    transition: stroke-dashoffset 1400ms ease;
}

.mycelium-branch.mycelium-secondary {
    stroke: var(--rust);
    stroke-width: 1;
    opacity: 0.6;
    stroke-dasharray: 120;
    stroke-dashoffset: 120;
}

.mycelium-divider.is-visible .mycelium-branch {
    stroke-dashoffset: 0;
}

.mycelium-node {
    fill: var(--amber);
    opacity: 0.85;
}

/* =====================================================
   CONCEPTS SECTION
   ===================================================== */
.concepts {
    position: relative;
    padding: 6rem 6vw 5rem;
    max-width: var(--max-w);
    margin: 0 auto;
    z-index: 2;
}

.section-label {
    font-family: var(--display-font);
    font-weight: 400;
    color: var(--parchment);
    font-size: clamp(28px, 3.4vw, 52px);
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin-bottom: 3rem;
    max-width: 22ch;
}

.section-label-inverse {
    color: var(--parchment);
}

.section-label-num {
    display: inline-block;
    color: var(--amber);
    font-family: var(--code-font);
    font-weight: 400;
    font-size: 0.35em;
    letter-spacing: 0.2em;
    vertical-align: middle;
    margin-right: 1em;
    transform: translateY(-0.4em);
}

.concepts-grid {
    display: grid;
    grid-template-columns: 40% 25% 35%;
    gap: 2vw 2vw;
    align-items: start;
}

.concept-card {
    position: relative;
    background: rgba(26, 18, 8, 0.55);
    padding: 2.2rem 1.8rem 2rem;
    border: 2px solid var(--moss);
    color: var(--parchment);
}

.concept-card-trees {
    /* Torn-edge top-right */
    clip-path: polygon(0 2%, 18% 0, 46% 3%, 78% 0, 100% 4%, 98% 38%, 100% 74%, 97% 100%, 62% 98%, 28% 100%, 4% 97%, 2% 58%);
    border-color: var(--moss);
    transform: translateY(0.5rem);
}

.concept-card-dags {
    clip-path: polygon(2% 0, 34% 2%, 68% 0, 100% 3%, 98% 28%, 100% 62%, 97% 100%, 70% 96%, 42% 100%, 12% 98%, 0 72%, 3% 38%);
    margin-top: 3rem;
    border-color: var(--rust);
}

.concept-card-hyper {
    clip-path: polygon(0 4%, 28% 0, 56% 2%, 100% 0, 97% 32%, 100% 60%, 96% 98%, 72% 100%, 38% 96%, 8% 100%, 3% 68%, 0 30%);
    margin-top: 1.5rem;
    border-color: var(--amber);
}

.concept-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px rgba(123, 140, 62, 0.35));
}

.concept-icon svg {
    width: 100%;
    height: 100%;
}

.svg-node {
    fill: var(--moss);
    stroke: var(--parchment);
    stroke-width: 0.5;
    transition: fill 240ms ease, r 240ms ease;
}

.svg-edge {
    stroke: var(--chrome);
    stroke-width: 1.2;
    opacity: 0.6;
}

.svg-edge-dir {
    stroke: var(--chrome);
    stroke-width: 1.2;
    opacity: 0.75;
    fill: none;
}

.svg-arrow {
    fill: var(--chrome);
}

.svg-hyperedge {
    fill: rgba(123, 140, 62, 0.18);
    stroke: var(--moss);
    stroke-width: 1.5;
    stroke-dasharray: 4 3;
}

.concept-card:hover .svg-node {
    fill: var(--amber);
}

.concept-card:hover .svg-edge,
.concept-card:hover .svg-edge-dir {
    stroke: var(--amber);
    opacity: 1;
}

.concept-title {
    font-family: var(--display-font);
    font-weight: 400;
    font-size: clamp(26px, 2.4vw, 38px);
    letter-spacing: -0.03em;
    color: var(--parchment);
    margin-bottom: 0.8rem;
}

.concept-body {
    color: var(--parchment);
    opacity: 0.88;
    margin-bottom: 1rem;
}

.concept-tag {
    display: inline-block;
    padding: 4px 10px;
    border: 1px dashed var(--rust);
    border-radius: 2px;
    color: var(--amber);
    font-size: 12px;
    letter-spacing: 0.05em;
}

/* Reveal */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease, transform 600ms cubic-bezier(0.2, 0.7, 0.3, 1);
    position: relative;
}

.reveal[data-reveal-from="left"] {
    transform: translateX(-40px);
}

.reveal[data-reveal-from="right"] {
    transform: translateX(40px);
}

.reveal[data-reveal-from="bottom"] {
    transform: translateY(40px);
}

.reveal.is-visible {
    opacity: 1;
    transform: translate(0, 0);
}

/* Text block left-edge accent line */
.reading-block {
    position: relative;
    padding-left: 1.6rem;
    margin-bottom: 3rem;
}

.reading-block::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 0;
    background: var(--moss);
    transition: height 700ms ease 150ms;
}

.reading-block.is-visible::before {
    height: 100%;
}

/* Margin decorations */
.margin-mushroom,
.margin-moss {
    position: absolute;
    pointer-events: none;
    opacity: 0.9;
}

.margin-mushroom-a {
    top: 3.5rem;
    right: 3vw;
    width: 44px;
    height: 66px;
}

.margin-moss-a {
    bottom: 1.5rem;
    left: 4vw;
    width: 90px;
    height: 42px;
    opacity: 0.8;
}

.mushroom-cap {
    fill: var(--rust);
    stroke: var(--parchment);
    stroke-width: 1.5;
}

.mushroom-stem {
    fill: var(--parchment);
    stroke: var(--loam);
    stroke-width: 1;
}

.mushroom-spot {
    fill: var(--parchment);
}

.moss-tuft {
    fill: none;
    stroke: var(--moss);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* =====================================================
   TIMELINE BAND
   ===================================================== */
.timeline-band {
    position: relative;
    background: var(--bark);
    padding: 5rem 0 5rem;
    width: 100%;
    overflow: hidden;
    z-index: 2;
}

.timeline-band .section-label,
.timeline-band .timeline-lede {
    padding: 0 6vw;
    max-width: var(--max-w);
    margin-left: auto;
    margin-right: auto;
}

.timeline-lede {
    color: var(--chrome);
    max-width: 60ch;
    margin-bottom: 2rem;
    font-style: italic;
}

.timeline-track {
    display: flex;
    gap: 2rem;
    padding: 1rem 6vw 2rem;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: var(--moss) var(--bark);
}

.timeline-track::-webkit-scrollbar {
    height: 8px;
}

.timeline-track::-webkit-scrollbar-track {
    background: var(--loam);
}

.timeline-track::-webkit-scrollbar-thumb {
    background: var(--moss);
    border-radius: 4px;
}

.timeline-card {
    flex: 0 0 260px;
    scroll-snap-align: center;
    background: var(--loam);
    border: 1px solid rgba(192, 192, 192, 0.18);
    padding: 1.4rem 1.2rem 1.2rem;
    transition: border-color 300ms ease, transform 300ms ease, box-shadow 300ms ease;
    position: relative;
}

.timeline-card.is-center {
    border-color: var(--amber);
    transform: translateY(-6px);
    box-shadow: 0 0 32px rgba(212, 168, 75, 0.18);
}

.timeline-card.is-center .svg-node {
    fill: var(--amber);
}

.timeline-thumb {
    width: 100%;
    height: 100px;
    margin-bottom: 0.8rem;
    display: block;
}

.timeline-title {
    font-family: var(--display-font);
    font-weight: 400;
    font-size: 16px;
    color: var(--parchment);
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.timeline-meta {
    font-family: var(--code-font);
    font-size: 12px;
    color: var(--chrome);
    opacity: 0.8;
}

/* =====================================================
   READING SECTION (asymmetric 55/35)
   ===================================================== */
.reading {
    position: relative;
    padding: 6rem 6vw 5rem;
    max-width: var(--max-w);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 55% 35%;
    gap: 10%;
    z-index: 2;
}

.reading-column-primary {
    grid-column: 1 / 2;
}

.reading-subhead {
    font-family: var(--display-font);
    font-weight: 400;
    color: var(--parchment);
    font-size: clamp(20px, 2vw, 30px);
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 1rem;
}

.reading-block p {
    color: var(--parchment);
    opacity: 0.88;
    margin-bottom: 1rem;
}

.reading-block p code {
    background: rgba(123, 140, 62, 0.12);
    padding: 2px 6px;
    border-radius: 2px;
    color: var(--amber);
    font-size: 13px;
}

.reading-sidebar {
    grid-column: 2 / 3;
    position: relative;
}

.sidebar-inner {
    position: sticky;
    top: 3rem;
    background: rgba(26, 18, 8, 0.55);
    padding: 1.6rem 1.3rem 1.4rem;
    border: 1px solid rgba(192, 192, 192, 0.15);
}

.sidebar-label {
    font-family: var(--code-font);
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: lowercase;
    color: var(--amber);
    margin-bottom: 0.6rem;
}

.sidebar-graph {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 0.8rem;
}

.sidebar-caption {
    font-family: var(--code-font);
    font-size: 12px;
    color: var(--chrome);
    min-height: 1.4em;
    margin-bottom: 1rem;
}

.sidebar-legend {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-family: var(--code-font);
    font-size: 12px;
    color: var(--parchment);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--moss);
}

.legend-dot-dags { background: var(--rust); }
.legend-dot-hyper { background: var(--amber); }

/* Sidebar graph node class grouping */
.sidebar-graph .side-edge {
    stroke: var(--chrome);
    stroke-width: 1;
    opacity: 0.35;
    transition: stroke 300ms ease, opacity 300ms ease, stroke-width 300ms ease;
}

.sidebar-graph .side-edge.is-highlight {
    stroke: var(--amber);
    opacity: 0.95;
    stroke-width: 1.5;
}

.sidebar-graph .side-node {
    fill: var(--moss);
    stroke: var(--parchment);
    stroke-width: 0.5;
    transition: fill 300ms ease, r 300ms ease;
}

.sidebar-graph .side-node.is-highlight {
    fill: var(--amber);
}

.sidebar-graph .side-node.group-dags {
    fill: var(--rust);
}

.sidebar-graph .side-node.group-hyper {
    fill: var(--amber);
    opacity: 0.9;
}

.sidebar-graph .side-node.group-trees {
    fill: var(--moss);
}

.sidebar-graph .side-node.pulse {
    animation: node-pulse 1600ms ease-in-out infinite;
}

@keyframes node-pulse {
    0%, 100% { r: 6; filter: drop-shadow(0 0 0 transparent); }
    50% { r: 8.5; filter: drop-shadow(0 0 6px var(--amber)); }
}

/* =====================================================
   FOOTER
   ===================================================== */
.site-footer {
    position: relative;
    padding: 4rem 6vw 3rem;
    background: var(--bark);
    color: var(--parchment);
    z-index: 2;
}

.footer-root {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 24px;
}

.footer-root-line {
    fill: none;
    stroke: var(--moss);
    stroke-width: 1.2;
    opacity: 0.85;
}

.footer-inner {
    max-width: var(--max-w);
    margin: 2rem auto 0;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 2rem;
    align-items: center;
}

.footer-mark {
    font-family: var(--display-font);
    font-weight: 400;
    font-size: clamp(22px, 2vw, 34px);
    letter-spacing: -0.03em;
    color: var(--parchment);
}

.footer-tag {
    font-family: var(--code-font);
    font-size: 12px;
    color: var(--chrome);
    margin-top: 0.3rem;
}

.footer-nav {
    display: flex;
    gap: 1.3rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.footer-link {
    font-family: var(--code-font);
    font-size: 13px;
    color: var(--chrome);
    letter-spacing: 0.04em;
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
    transition: color 250ms ease, border-color 250ms ease;
}

.footer-link:hover {
    color: var(--amber);
    border-bottom-color: var(--amber);
}

.footer-mushroom-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    gap: 0.2rem;
}

.footer-mushroom {
    width: 42px;
    height: 58px;
    transform-origin: bottom center;
    transition: transform 600ms cubic-bezier(0.2, 0.8, 0.3, 1.4);
}

.footer-mushroom-wrap:hover .footer-mushroom {
    transform: scale(1.35) rotate(-3deg);
}

.footer-mushroom-label {
    font-family: var(--code-font);
    font-size: 10px;
    letter-spacing: 0.2em;
    color: var(--chrome);
    opacity: 0.6;
    text-transform: lowercase;
    transition: opacity 300ms ease;
}

.footer-mushroom-wrap:hover .footer-mushroom-label {
    opacity: 1;
    color: var(--amber);
}

.footer-fineprint {
    max-width: var(--max-w);
    margin: 2.5rem auto 0;
    font-family: var(--code-font);
    font-size: 11px;
    color: var(--chrome);
    opacity: 0.55;
    letter-spacing: 0.06em;
    text-align: left;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 900px) {
    .hero-content {
        grid-template-columns: 1fr;
        padding: 0 5vw;
    }
    .hero-logotype,
    .hero-descriptor,
    .hero-meta {
        grid-column: 1 / 2;
    }
    .hero-descriptor {
        margin-top: 1rem;
    }
    .concepts-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .concept-card-dags,
    .concept-card-hyper {
        margin-top: 0;
    }
    .reading {
        grid-template-columns: 1fr;
    }
    .reading-sidebar {
        grid-column: 1 / 2;
    }
    .sidebar-inner {
        position: relative;
        top: 0;
    }
    .footer-inner {
        grid-template-columns: 1fr;
    }
    .footer-nav {
        justify-content: flex-start;
    }
}

@media (max-width: 600px) {
    .section-label {
        font-size: clamp(24px, 8vw, 40px);
    }
    .concepts,
    .reading,
    .site-footer {
        padding-left: 5vw;
        padding-right: 5vw;
    }
    .timeline-card {
        flex: 0 0 230px;
    }
}
