/* ── Tokens ──────────────────────────────────────────────────────────────── */
:root {
    --bg:           #f5f2ed;
    --paper:        #efece6;
    --text:         #2d3436;
    --text-dim:     #636e72;
    --accent:       #2d5a27;
    --accent-light: #e8f0e7;
    --border:       #d1ccc0;
    --white:        rgba(255, 255, 255, 0.55);
    --nav-h:        52px;
}

/* ── Reset & base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg);
    background-image: radial-gradient(var(--paper) 0.5px, transparent 0.5px);
    background-size: 10px 10px;
    color: var(--text);
    line-height: 1.7;
    margin: 0;
    padding: 0;
}

a { color: inherit; }

/* ── Navigation ──────────────────────────────────────────────────────────── */
.site-nav {
    position: sticky;
    top: 0;
    height: var(--nav-h);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    display: flex;
    align-items: center;
}

.site-nav-inner {
    width: 100%;
    max-width: 950px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    align-items: center;
}

.nav-logo {
    font-weight: 800;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text);
    text-decoration: none;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    list-style: none;
    margin: 0 0 0 32px;
    padding: 0;
    gap: 24px;
    flex: 1;
}

.nav-links a {
    text-decoration: none;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    font-weight: 600;
    transition: color 0.1s;
}

.nav-links a:hover,
.nav-links a.active { color: var(--accent); }

.lang-toggle {
    position: relative;
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    flex-shrink: 0;
}

.lang-current {
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    font-family: inherit;
    font-size: inherit;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.lang-arrow { font-size: 0.65rem; }

.lang-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--bg);
    border: 1px solid var(--border);
    list-style: none;
    margin: 0;
    padding: 2px 0;
    min-width: 100%;
    z-index: 100;
}

.lang-toggle:hover .lang-dropdown,
.lang-toggle:focus-within .lang-dropdown { display: block; }

.lang-dropdown a {
    display: block;
    text-decoration: none;
    color: var(--text-dim);
    padding: 4px 12px;
    text-transform: uppercase;
    white-space: nowrap;
    transition: color 0.1s;
}

.lang-dropdown a:hover { color: var(--accent); }

/* ── Page container ──────────────────────────────────────────────────────── */
.container {
    max-width: 850px;
    margin: 0 auto;
    padding: 60px 30px;
}

/* ── Landing hero ────────────────────────────────────────────────────────── */
.hero {
    min-height: calc(62vh - var(--nav-h));
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 0 50px;
    border-bottom: 2px solid var(--text);
}

.hero-name {
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 4px;
    line-height: 1;
    margin: 0;
}

.hero-role {
    font-family: 'Courier New', monospace;
    font-size: clamp(0.95rem, 2.2vw, 1.3rem);
    color: var(--accent);
    margin: 14px 0 0;
    font-weight: 700;
}

.hero-role::before { content: '> '; opacity: 0.4; }

.hero-sub {
    margin-top: 28px;
    max-width: 540px;
}

.hero-sub p { margin: 0 0 6px; font-size: 1.1rem; line-height: 1.5; }
.hero-sub .location { font-size: 0.9rem; color: var(--text-dim); font-style: italic; }

.hero-intro {
    margin-top: 28px;
    max-width: 600px;
    font-size: 0.95rem;
    color: var(--text-dim);
    line-height: 1.7;
}

.hero-intro p { margin: 0 0 8px; }
.hero-intro a { color: var(--accent); font-weight: 600; }

.landing-featured { margin-top: 60px; }

/* Landing nav cards */
.nav-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 18px;
    padding: 48px 0 0;
}

.nav-card {
    border: 1px solid var(--border);
    padding: 22px 18px 20px;
    background: var(--white);
    box-shadow: 3px 3px 0 var(--border);
    text-decoration: none;
    color: var(--text);
    display: block;
    transition: box-shadow 0.12s, transform 0.12s;
}

.nav-card:hover {
    box-shadow: 5px 5px 0 var(--accent);
    transform: translate(-1px, -1px);
}

.nav-card-num {
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-bottom: 8px;
    display: block;
}

.nav-card h3 {
    margin: 0 0 6px;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
}

.nav-card p {
    margin: 0;
    font-size: 0.84rem;
    color: var(--text-dim);
    line-height: 1.4;
}

/* ── Section headings ────────────────────────────────────────────────────── */
h1 { font-size: 2.8rem; margin: 0; text-transform: uppercase; letter-spacing: 2px; }

h2 {
    font-size: 1.4rem;
    text-transform: uppercase;
    background: var(--text);
    color: var(--bg);
    display: inline-block;
    padding: 2px 15px;
    margin-top: 50px;
    letter-spacing: 1px;
}

header { border-bottom: 2px solid var(--text); padding-bottom: 30px; margin-bottom: 50px; }

.subtitle { font-size: 1.3rem; color: var(--accent); font-weight: 700; margin-top: 5px; }

.intro { margin-top: 25px; font-size: 1.1rem; max-width: 680px; }

/* ── Project cards ───────────────────────────────────────────────────────── */
.project-card {
    border: 1px solid var(--border);
    padding: 30px;
    margin-top: 20px;
    background: var(--white);
    box-shadow: 3px 3px 0 var(--border);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    margin-bottom: 15px;
    padding-bottom: 10px;
}

.project-header h3 { margin: 0; color: var(--accent); font-size: 1.5rem; }

.tag { font-family: 'Courier New', monospace; font-size: 0.85rem; color: var(--text-dim); font-weight: bold; }

.impact-highlight {
    background-color: var(--accent-light);
    border-left: 5px solid var(--accent);
    padding: 15px;
    margin: 20px 0;
    font-weight: 500;
}

.impact-highlight strong { color: var(--accent); font-size: 1.15rem; }

/* ── Images ──────────────────────────────────────────────────────────────── */
.image-container {
    margin-top: 20px;
    border: 1px solid var(--border);
    background: #fff;
    padding: 5px;
}

.image-container img {
    width: 100%;
    height: auto;
    display: block;
    filter: sepia(10%) contrast(95%);
}

.caption {
    font-size: 0.85rem;
    color: var(--text-dim);
    text-align: center;
    margin-top: 8px;
    font-style: italic;
}

/* ── Stack grid ──────────────────────────────────────────────────────────── */
.stack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-top: 20px; }

.stack-box { border: 1px solid var(--border); padding: 15px; }

.stack-box h4 { margin: 0 0 10px; text-transform: uppercase; font-size: 0.9rem; color: var(--accent); }

.stack-box ul { list-style: square; padding-left: 18px; margin: 0; font-size: 0.95rem; }

/* ── Gallery ─────────────────────────────────────────────────────────────── */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.gallery-item { background: #fff; border: 1px solid var(--border); padding: 10px; box-shadow: 2px 2px 0 var(--border); }

.gallery-item img { width: 100%; height: 180px; object-fit: cover; filter: sepia(5%); display: block; }

.gallery-desc { font-size: 0.8rem; margin-top: 10px; line-height: 1.3; color: var(--text-dim); }

/* ── Post / Conf list items ──────────────────────────────────────────────── */
.post-list { margin-top: 24px; display: flex; flex-direction: column; gap: 14px; }

.post-item {
    border: 1px solid var(--border);
    padding: 20px 24px;
    background: var(--white);
    box-shadow: 3px 3px 0 var(--border);
    text-decoration: none;
    color: var(--text);
    display: block;
    transition: box-shadow 0.12s, transform 0.12s;
}

.post-item:hover {
    box-shadow: 4px 4px 0 var(--accent);
    transform: translate(-1px, -1px);
}

.post-item h3 { margin: 0 0 4px; color: var(--accent); font-size: 1.1rem; }

.post-meta {
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-bottom: 8px;
    display: block;
}

.post-excerpt { font-size: 0.88rem; color: var(--text-dim); margin: 0; line-height: 1.5; }

.empty-state {
    border: 1px dashed var(--border);
    padding: 40px;
    text-align: center;
    color: var(--text-dim);
    margin-top: 24px;
    font-style: italic;
}

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.breadcrumb { font-family: 'Courier New', monospace; font-size: 0.82rem; color: var(--text-dim); margin-bottom: 28px; }
.breadcrumb a { color: var(--text-dim); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }

/* ── Article content (rendered Markdown) ─────────────────────────────────── */
.article-header { border-bottom: 2px solid var(--text); padding-bottom: 24px; margin-bottom: 40px; }
.article-header h1 { font-size: 2rem; }

.article-content h2 { font-size: 1.2rem; }
.article-content h3 { color: var(--accent); }

.article-content p:has(> img) {
    border: 1px solid var(--border);
    background: #fff;
    padding: 5px;
    margin: 24px 0 0;
}

.article-content p:has(> img) img {
    width: 100%;
    height: auto;
    display: block;
    filter: sepia(10%) contrast(95%);
}

/* Italic paragraph immediately after an image = caption */
.article-content p:has(> img) + p > em:only-child {
    display: block;
    font-size: 0.85rem;
    color: var(--text-dim);
    text-align: center;
    margin: 6px 0 20px;
    font-style: italic;
}

.article-content blockquote {
    border-left: 4px solid var(--accent);
    margin: 20px 0;
    padding: 10px 20px;
    background: var(--accent-light);
    color: var(--text-dim);
}

.article-content code {
    font-family: 'Courier New', monospace;
    background: var(--paper);
    padding: 2px 5px;
    font-size: 0.88em;
}

.article-content pre {
    background: var(--text);
    color: var(--bg);
    padding: 20px;
    overflow-x: auto;
    border: none;
}

.article-content pre code { background: none; padding: 0; color: inherit; font-size: 0.9rem; }

.article-content video {
    max-width: 100%;
    display: block;
    margin: 24px 0;
}

.article-content .video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    margin: 24px 0;
}

.article-content .video-embed iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

.landing-content { margin-top: 60px; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer { margin-top: 80px; padding-top: 36px; border-top: 2px solid var(--text); }

.contact-grid { display: flex; gap: 30px; flex-wrap: wrap; }

.contact-item a {
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 2px solid var(--accent);
}

.contact-item a:hover { background: var(--accent-light); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 650px) {
    .container { padding: 30px 16px; }
    .hero { min-height: 50vh; padding: 40px 0 36px; }
    h1 { font-size: 2rem; letter-spacing: 1px; }
    h2 { font-size: 1.1rem; }
    .nav-links { display: none; }
    .site-nav-inner { justify-content: space-between; }
    .nav-cards { grid-template-columns: 1fr 1fr; }
}

/* ── Audio player ────────────────────────────────────────────────────────── */
.audio-player {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    border: 1px solid var(--border);
    background: var(--white);
    padding: 16px 20px;
    margin: 28px 0;
    box-shadow: 3px 3px 0 var(--border);
}

.audio-player audio {
    flex: 1;
    min-width: 200px;
    height: 36px;
}

.audio-download {
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    border-bottom: 1px solid var(--accent);
    white-space: nowrap;
}

.audio-download:hover { background: var(--accent-light); }

/* ── Admonitions ─────────────────────────────────────────────────────────── */
.admonition {
    border: 1px solid var(--border);
    padding: 15px 18px;
    margin: 20px 0;
    background: var(--white);
}

.admonition-title {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 8px;
    color: var(--text-dim);
}

/* hide empty title (from !!! type "") */
.admonition-title:empty { display: none; }

.admonition.impact {
    background-color: var(--accent-light);
    border-left: 5px solid var(--accent);
    font-weight: 500;
    border-top: none;
    border-right: none;
    border-bottom: none;
}

.admonition.impact .admonition-title { display: none; }
.admonition.impact strong { color: var(--accent); font-size: 1.1rem; }

.admonition.note { border-left: 4px solid var(--text-dim); background: var(--paper); }
.admonition.warning { border-left: 4px solid #b8860b; background: #fefae8; }
.admonition.tip { border-left: 4px solid var(--accent); background: var(--accent-light); }

/* About page: restore full h2 size inside article-content */
.about-content h2 { font-size: 1.4rem; }
