:root {
    --bg-color: #0d0e11; 
    --bg-panel: #16171d;
    --text-main: #e0e0e0;
    --text-dim: #707580;
    --accent: #7aa2f7;
    --border: rgba(255,255,255,0.06);
    --font-serif: 'Shippori Mincho', serif;
    --font-mono: 'JetBrains Mono', monospace;
    --spacing-page: 5vw;
}

/* Base */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-serif);
    line-height: 1.8;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
body.loading { opacity: 0; }

a { text-decoration: none; color: inherit; transition: opacity 0.3s; }
a:hover { opacity: 0.7; }

/* Background */
#p5-container {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: -1;
    pointer-events: none;
}

/* Navigation */
.fixed-ui {
    position: fixed;
    top: 0; left: 0; width: 100%;
    padding: 2rem;
    display: flex;
    justify-content: flex-end;
    z-index: 1000;
    pointer-events: none;
}

.logo-mark {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 300;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    display: none; /* User requested removal */
}

.ui-right { display: flex; gap: 2rem; pointer-events: auto; }
.nav-links { display: flex; gap: 2rem; font-family: var(--font-mono); font-size: 0.8rem; }
.nav-anchor { color: var(--text-dim); }
.nav-anchor:hover { color: var(--text-main); }

.lang-toggle { display: flex; gap: 0.8rem; font-family: var(--font-mono); font-size: 0.8rem; }
.lang-opt { color: var(--text-dim); cursor: pointer; transition: color 0.3s; }
.lang-opt.active { color: var(--text-main); font-weight: 500; }

/* Grid Views */
.view-section {
    min-height: 100vh;
    padding: 0 var(--spacing-page) 10vh;
    transition: opacity 0.4s;
}
.view-section.hidden { display: none; opacity: 0; }

.hero-section { height: 60vh; display: flex; align-items: center; padding: 0; }
.hero-title { font-size: clamp(2.5rem, 5vw, 4.5rem); font-weight: 400; line-height: 1.2; margin-bottom: 2rem; }
.hero-bio-text { max-width: 600px; color: var(--text-dim); }

.pins-container {
    display: flex; flex-wrap: wrap; gap: 1rem;
    margin-bottom: 4rem; border-top: 1px solid var(--border); padding-top: 2rem;
}
.pin-pill {
    background: transparent; border: 1px solid var(--border); color: var(--text-dim);
    padding: 0.4rem 1.4rem; border-radius: 20px; font-family: var(--font-mono); font-size: 0.75rem;
    cursor: pointer; transition: all 0.3s;
}
.pin-pill.active { background: var(--text-main); color: var(--bg-color); border-color: var(--text-main); }

/* Uniform Grid */
.uniform-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Force 3 columns on large screens */
    gap: 2.5rem;
}

@media (max-width: 1200px) {
    .uniform-grid { grid-template-columns: repeat(2, 1fr); } /* 2 columns */
}

@media (max-width: 700px) {
    .uniform-grid { grid-template-columns: 1fr; } /* 1 column */
}

.node-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    display: flex; flex-direction: column;
    /* aspect-ratio: 1 / 1.414; Removed fixed aspect ratio to allow content to flow naturally, or user requested specific layout? User just said change size. */
    /* User said "Date Type -> Title -> Image", implying vertical stack. */
    /* Let's keep a consistent height or ratio? User previously hated empty look. */
    /* Let's stick to Silver Ratio but rearrange content */
    aspect-ratio: 1 / 1; 
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer; overflow: hidden;
    position: relative;
}
.node-card:hover { border-color: var(--accent); transform: translateY(-8px); }
.node-card.featured { border-left: 2px solid var(--accent); }

.card-content { 
    padding: 1.5rem; 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    /* Order: Meta (Date/Type), Title, ... Image is separate div? */
}

/* Reordering via Flexbox */
.node-meta { 
    order: 1; 
    font-family: var(--font-mono); font-size: 0.7rem; color: var(--accent); opacity: 0.8;
    margin-bottom: 0.5rem; display: flex; justify-content: space-between; 
}
.node-title { 
    order: 2;
    font-size: 1.2rem; 
    margin-bottom: 1rem; 
    font-weight: 500; 
    line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* Image styling - User wants it at bottom? or just visible? "Date/Type -> Title -> Image" */
.card-thumb { 
    order: 3;
    width: 100%; 
    flex-grow: 1; /* Take remaining space */
    min-height: 0; /* Allow shrinking */
    background: #000; 
    overflow: hidden; 
    margin-top: auto; /* Push to bottom if space exists */
    display: none; /* Hidden by default, shown if src exists */
}
.card-thumb.has-image { display: block; }

.card-thumb img { width: 100%; height: 100%; object-fit: cover; opacity: 0.8; transition: opacity 0.3s; }
.node-card:hover .card-thumb img { opacity: 1; }

.node-tags { display: none; } /* User said "mysteriously tags visible... problem". Hiding tags in card for clean look requested */

/* Link Styling */
.auto-link, .markdown-body a { 
    color: var(--accent); 
    text-decoration: underline; 
    text-underline-offset: 4px;
    font-weight: 500;
}
.auto-link:hover, .markdown-body a:hover { color: #fff; }

/* Node Page */
.page-container { max-width: 860px; margin: 0 auto; padding-top: 12rem; }
.page-nav { margin-bottom: 4rem; }
.back-btn {
    background: none; border: 1px solid var(--border); color: var(--text-dim);
    font-family: var(--font-mono); font-size: 0.8rem; padding: 0.6rem 1.6rem;
    cursor: pointer; transition: 0.3s;
}
.back-btn:hover { border-color: var(--text-main); color: var(--text-main); }

.node-page h2 { font-size: 3.5rem; margin-bottom: 2rem; line-height: 1.1; }
.page-meta { border-bottom: 1px solid var(--border); padding-bottom: 2rem; margin-bottom: 3rem; font-family: var(--font-mono); color: var(--text-dim); font-size: 0.9rem; }
.markdown-body { font-size: 1.15rem; line-height: 2; margin-bottom: 8rem; }
.markdown-body img { max-width: 100%; margin: 3rem 0; border: 1px solid var(--border); }
.video-embed { width: 100%; aspect-ratio: 16/9; margin: 3rem 0; }
.video-embed iframe { width: 100%; height: 100%; border: none; }
.markdown-body iframe { width: 100%; aspect-ratio: 16/9; margin: 3rem 0; border: none; } /* Fallback for raw iframes */

.wiki-link { text-decoration: underline; color: var(--accent); cursor: pointer; }
.external-link-hint { margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--text-dim); }

.page-footer { margin-top: 6rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.external-link { margin-bottom: 2rem; }
.tag-list-label { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-dim); margin-bottom: 1rem; }
.page-tags-list { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.page-tag { 
    font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-main); 
    background: var(--bg-panel); border: 1px solid var(--border); padding: 0.4rem 0.8rem; 
    border-radius: 4px; cursor: pointer; transition: all 0.3s;
}
.page-tag:hover { border-color: var(--accent); color: var(--accent); }

/* Tables */
table { width: 100%; border-collapse: collapse; margin: 3rem 0; font-size: 0.95rem; }
th, td { border-bottom: 1px solid var(--border); padding: 1rem; text-align: left; vertical-align: top; }
th { color: var(--text-dim); font-weight: 400; font-family: var(--font-mono); font-size: 0.8rem; }
td:first-child { width: 80px; font-family: var(--font-mono); color: var(--accent); } /* Year column styling */

.related-section { border-top: 1px solid var(--border); padding-top: 6rem; margin-top: 4rem; }
.section-label { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent); margin-bottom: 3rem; text-transform: uppercase; letter-spacing: 0.1em; }
.uniform-grid.mini { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.5rem; }
.uniform-grid.mini .card-content { padding: 1.5rem; }

/* Site Footer */
.site-footer { padding: 6rem var(--spacing-page); border-top: 1px solid var(--border); font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-dim); }

@media (max-width: 1000px) { .uniform-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }
@media (max-width: 700px) {
    .hero-title { font-size: 2.2rem; }
    .node-page h2 { font-size: 2.5rem; }
    .page-container { padding-top: 8rem; }
}
