:root {
    --bg: #f3ecdf;
    --ink: #1c1712;
    --ink-soft: #5e554c;
    --palm: #1b4636;
    --palm-deep: #102e24;
    --gold: #a67c3d;
    --gold-soft: #e7d3a4;
    --clay: #9c3f2c;
    --card: rgba(255, 250, 243, 0.94);
    --line: rgba(28, 23, 18, 0.12);
    --serif: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
    --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
    --shadow: 0 24px 50px rgba(48, 32, 14, 0.08);
    --radius: 28px;
    --max: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 1.05rem;
    line-height: 1.65;
    background:
        radial-gradient(900px 420px at 110% -10%, rgba(196, 149, 74, 0.28), transparent 60%),
        radial-gradient(720px 380px at -15% -5%, rgba(27, 70, 54, 0.16), transparent 55%),
        var(--bg);
}
img { max-width: 100%; height: auto; }
a { color: var(--palm); }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, .tagline, .footer-brand {
    font-family: var(--serif);
    font-weight: 560;
    letter-spacing: -0.03em;
    line-height: 1.08;
}
h1 { font-size: clamp(3.2rem, 8vw, 6.4rem); margin: 0.1em 0; }
h2 { font-size: clamp(2rem, 4vw, 3rem); margin: 0 0 0.3em; }
h3 { font-size: 1.45rem; margin: 0 0 0.35em; }
p { margin: 0 0 0.8em; }

.skip {
    position: absolute;
    left: 1rem;
    top: -4rem;
    background: var(--ink);
    color: var(--bg);
    padding: 0.5rem 0.8rem;
    z-index: 20;
}
.skip:focus { top: 1rem; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.site-header, .hero, .band, .page-wrap, .site-footer, .app-band {
    width: min(var(--max), calc(100% - 2rem));
    margin-inline: auto;
}
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(243, 236, 223, 0.9);
    backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; color: inherit; }
.brand-mark {
    width: 2.5rem;
    height: 2.5rem;
    display: grid;
    place-items: center;
    border-radius: 0.8rem;
    background: var(--palm);
    color: #f6efe4;
    font-family: var(--serif);
    font-size: 1.4rem;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-size: 1rem; letter-spacing: -0.03em; }
.brand-text em { font-style: normal; color: var(--ink-soft); font-size: 0.82rem; }
.site-nav { display: flex; align-items: center; gap: 0.3rem 1rem; }
.site-nav a { text-decoration: none; color: var(--ink); font-weight: 500; }
.site-nav a[aria-current="page"] { color: var(--palm); box-shadow: inset 0 -2px 0 var(--gold); }
.nav-youtube {
    background: var(--palm);
    color: #f6efe4 !important;
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    box-shadow: none !important;
}
.nav-toggle {
    display: none;
    width: 2.8rem;
    height: 2.8rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    padding: 0;
    position: relative;
}
.nav-toggle span:not(.sr-only) {
    position: absolute;
    left: 0.7rem;
    right: 0.7rem;
    height: 2px;
    background: var(--ink);
}
.nav-toggle span:nth-of-type(2) { top: 1.05rem; }
.nav-toggle span:nth-of-type(3) { top: 1.55rem; }

.kicker {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gold);
    margin-bottom: 0.4rem;
}
.kicker a { color: inherit; }
.hero {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 3rem;
    align-items: end;
    padding: 1.5rem 0 3rem;
}
.tagline {
    font-size: clamp(1.5rem, 3vw, 2.15rem);
    font-style: italic;
    font-weight: 520;
    color: var(--palm);
    margin: 0 0 1rem;
}
.bio p { color: var(--ink-soft); font-size: 1.08rem; max-width: 42rem; }
.hero-actions, .social-row { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; }
.hero-actions { margin: 1.2rem 0 1rem; }
.social-row { list-style: none; padding: 0; margin: 0.4rem 0 0; }
.social-row a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    color: var(--ink);
    border-bottom: 1px solid transparent;
}
.social-row a:hover { border-bottom-color: var(--gold); }
.social-row svg, .btn svg { width: 1.15rem; height: 1.15rem; fill: currentColor; display: block; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-radius: 999px;
    padding: 0.8rem 1.15rem;
    text-decoration: none;
    border: 1px solid transparent;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
}
.btn-primary { background: var(--palm); color: #f7f1e6; }
.btn-primary:hover { background: var(--palm-deep); }
.btn-clay { background: var(--clay); color: #fffaf6; }
.btn-clay:hover { filter: brightness(1.06); }
.btn-ghost { border-color: var(--line); background: rgba(255, 250, 243, 0.7); color: var(--ink); }
.btn-danger { background: #7d2e2e; color: white; }
.btn-small { padding: 0.4rem 0.75rem; font-size: 0.92rem; }

.portrait { margin: 0; position: relative; z-index: 0; }
.portrait img, .portrait-fallback {
    position: relative;
    z-index: 1;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: 2rem 2rem 5rem 2rem;
    background: var(--palm);
    display: block;
    box-shadow: var(--shadow);
}
.portrait-fallback {
    display: grid;
    place-items: center;
    color: var(--gold-soft);
    font-family: var(--serif);
    font-size: 7rem;
    background:
        radial-gradient(circle at 30% 20%, rgba(231, 211, 164, 0.35), transparent 40%),
        linear-gradient(160deg, #245743, #102e24 70%);
}
.portrait figcaption {
    position: absolute;
    z-index: 2;
    left: 1rem;
    bottom: 1rem;
    background: rgba(255, 250, 243, 0.92);
    border-radius: 1rem;
    padding: 0.7rem 0.9rem;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.portrait figcaption span { color: var(--ink-soft); font-size: 0.9rem; }
.portrait::after {
    content: "";
    position: absolute;
    inset: 1.2rem -0.8rem -0.8rem 1.2rem;
    border: 1px solid var(--gold);
    border-radius: 2rem 2rem 5rem 2rem;
    pointer-events: none;
    z-index: 0;
}

.band { padding: 1rem 0 2.5rem; }
.section-head {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.2rem;
}
.section-index {
    font-family: var(--serif);
    font-size: 1.4rem;
    color: var(--gold);
    margin: 0;
}
.section-head p:last-child { color: var(--ink-soft); margin: 0; max-width: 40rem; }
.text-link { font-weight: 600; white-space: nowrap; }

.video-grid, .post-grid { display: grid; gap: 1rem; }
.video-grid { grid-template-columns: repeat(3, 1fr); }
.post-grid { grid-template-columns: 1.4fr 1fr; }
.post-grid-archive { grid-template-columns: repeat(3, 1fr); }
.post-card.is-feature { grid-row: span 2; }
.video-card, .post-card, .empty-panel, .panel, .narrow-card, .install-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.video-card { overflow: hidden; }
.yt-facade {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: #1a1a1a;
    position: relative;
    cursor: pointer;
    aspect-ratio: 16 / 10;
}
.yt-facade img, .yt-frame { width: 100%; height: 100%; object-fit: cover; display: block; border: 0; aspect-ratio: 16 / 10; }
.play {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 3.4rem;
    height: 3.4rem;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(255, 250, 243, 0.94);
}
.play::before {
    content: "";
    position: absolute;
    left: 1.35rem;
    top: 1.05rem;
    border-style: solid;
    border-width: 0.65rem 0 0.65rem 1rem;
    border-color: transparent transparent transparent var(--palm);
}
.video-copy { padding: 0.95rem 1rem 1.1rem; }
.video-copy h3 { font-size: 1.15rem; }
.video-copy p, .post-card p { color: var(--ink-soft); margin: 0; }
.post-card-link { display: flex; flex-direction: column; gap: 0.45rem; padding: 1rem; color: inherit; text-decoration: none; height: 100%; }
.post-cover, .post-cover-empty {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 1.1rem;
    background: var(--palm);
}
.post-cover-empty {
    display: grid;
    place-items: center;
    color: var(--gold-soft);
    font-family: var(--serif);
    font-size: 3rem;
}
.is-feature .post-cover, .is-feature .post-cover-empty { aspect-ratio: 16 / 11; }
.post-meta { color: var(--ink-soft); font-size: 0.92rem; margin: 0; }
.empty-panel { padding: 1.5rem; }
.app-band {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: center;
    background: var(--palm-deep);
    color: #f6efe4;
    border-radius: 2rem;
    padding: 1.6rem;
    margin-bottom: 3rem;
}
.app-band .kicker { color: var(--gold-soft); }
.app-band p { color: rgba(246, 239, 228, 0.82); max-width: 38rem; }
.app-band .btn-clay { background: #f3ecdf; color: var(--palm-deep); }

.page-wrap { padding-bottom: 3rem; }
.page-intro { padding: 1.5rem 0 1rem; max-width: 44rem; }
.essay { max-width: 46rem; }
.essay-head { margin-bottom: 1.2rem; }
.essay-cover { width: 100%; border-radius: 1.4rem; margin-top: 1rem; max-height: 460px; object-fit: cover; }
.prose { font-size: 1.08rem; }
.prose h2, .prose h3 { margin-top: 1.4em; }
.prose h2 { font-size: 1.8rem; }
.prose ul, .prose ol { padding-left: 1.2rem; }
.prose li { margin: 0.35rem 0; }
.prose blockquote {
    margin: 1.2rem 0;
    padding: 0.2rem 0 0.2rem 1rem;
    border-left: 3px solid var(--gold);
    color: var(--palm);
    font-family: var(--serif);
    font-size: 1.35rem;
    line-height: 1.35;
}
.prose code { background: rgba(27, 70, 54, 0.08); padding: 0.1rem 0.3rem; border-radius: 0.3rem; }
.prose pre { overflow: auto; background: var(--palm-deep); color: #f6efe4; padding: 1rem; border-radius: 1rem; }
.prose pre code { background: transparent; color: inherit; }
.related { margin-top: 2.5rem; }
.pager { display: flex; gap: 1rem; align-items: center; margin-top: 1.2rem; }
.contact-layout { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 2rem; align-items: start; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

.site-footer {
    background: var(--palm-deep);
    color: #f6efe4;
    border-radius: 2rem 2rem 0 0;
    padding: 2rem 1.2rem 1.2rem;
    width: min(var(--max), calc(100% - 1rem));
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 1.5rem; }
.footer-brand { font-size: 2rem; margin: 0 0 0.4rem; }
.footer-label { letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.75rem; color: var(--gold-soft); }
.site-footer a { display: block; color: #f6efe4; text-decoration: none; margin: 0.25rem 0; }
.footer-end { border-top: 1px solid rgba(246, 239, 228, 0.15); margin-top: 1.4rem; padding-top: 0.8rem; color: rgba(246, 239, 228, 0.75); font-size: 0.92rem; }
.fine-print { color: var(--ink-soft); font-size: 0.92rem; }
.site-footer .fine-print { color: rgba(246, 239, 228, 0.72); }

.plain-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.narrow-card, .install-card { padding: 1.5rem; width: min(640px, 100%); }
.install-card { width: min(760px, 100%); }
.stack-form, .check-list { display: grid; gap: 0.8rem; }
.stack-form label, .link-row label { display: grid; gap: 0.3rem; font-weight: 600; font-size: 0.95rem; }
.stack-form input, .stack-form textarea, .stack-form select,
.link-row input, .link-row select {
    width: 100%;
    border: 1px solid var(--line);
    background: white;
    border-radius: 0.8rem;
    padding: 0.7rem 0.8rem;
    font-weight: 400;
}
fieldset { border: 1px solid var(--line); border-radius: 1rem; padding: 1rem; }
legend { padding: 0 0.4rem; font-family: var(--serif); font-size: 1.3rem; }
.choice-row, .choice { display: flex; gap: 0.8rem; align-items: center; font-weight: 500; }
.choice input { width: auto; }
.check-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.check-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.is-ok strong { color: var(--palm); }
.is-bad strong { color: var(--clay); }
.steps { margin: 0; padding-left: 1.2rem; }
.steps li { margin: 0.35rem 0; }
.flash { border-radius: 1rem; padding: 0.8rem 1rem; margin: 0 0 1rem; }
.flash p { margin: 0.2rem 0; }
.flash-success { background: #e5f2ea; color: #145233; }
.flash-error { background: #fde8e2; color: #6d2418; }
.flash-info { background: #fff6df; }
.error-detail { white-space: pre-wrap; background: #fff; padding: 0.8rem; border-radius: 0.8rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

@media (max-width: 900px) {
    .hero, .post-grid, .post-grid-archive, .video-grid, .contact-layout, .footer-grid, .section-head, .app-band {
        grid-template-columns: 1fr;
        display: grid;
    }
    .app-band { display: grid; }
    .section-head { align-items: start; }
    .nav-toggle { display: inline-block; }
    .site-nav {
        display: none;
        position: absolute;
        top: 4.4rem;
        left: 1rem;
        right: 1rem;
        flex-direction: column;
        align-items: stretch;
        background: var(--card);
        border: 1px solid var(--line);
        border-radius: 1.2rem;
        padding: 0.8rem;
        box-shadow: var(--shadow);
    }
    body.nav-open .site-nav { display: flex; }
    .nav-youtube { text-align: center; }
    .portrait::after { display: none; }
    h1 { font-size: clamp(2.8rem, 14vw, 4.4rem); }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
}
