:root {
    --bg: #f5f0e7;
    --bg-alt: #ebe4d8;
    --surface: #fffaf4;
    --ink: #1d2a24;
    --muted: #5d6a62;
    --sage: #3d5649;
    --sage-deep: #2a3c33;
    --clay: #b45c45;
    --clay-deep: #9a4b37;
    --line: #ddd3c5;
    --gold: #c2a06a;
    --shadow: 0 18px 50px rgba(29, 42, 36, 0.07);
    --radius: 1.35rem;
    --font: "Source Sans 3", "Segoe UI", sans-serif;
    --serif: "Fraunces", Georgia, serif;
    --header: 6.25rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: hidden; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
    font-size: 1.05rem;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, .logo, .hero-mark {
    font-family: var(--serif);
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1.15;
}
h1 { font-size: clamp(2rem, 5vw, 3.4rem); margin: 0 0 .8rem; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0 0 .6rem; }
h3 { font-size: 1.2rem; margin: 0 0 .4rem; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
.skip-link {
    position: absolute; left: 1rem; top: -4rem; background: var(--sage-deep); color: #fff;
    padding: .6rem 1rem; z-index: 100; border-radius: 8px;
}
.skip-link:focus { top: 1rem; }

.site-header {
    position: sticky; top: 0; z-index: 40;
    background: rgba(245, 240, 231, .45);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(196, 178, 154, .22);
}
.site-header.is-scrolled {
    background: rgba(245, 240, 231, .45);
    border-bottom-color: rgba(196, 178, 154, .22);
}
.header-inner {
    max-width: 1240px; margin: 0 auto; padding: .85rem 1.25rem;
    display: flex; align-items: center; gap: 1.5rem;
    min-height: var(--header);
}
.logo {
    display: flex; align-items: center; gap: .85rem; text-decoration: none; font-size: 1.55rem;
}
.logo-mark {
    width: 72px; height: 72px; border-radius: 20px; overflow: hidden; flex-shrink: 0;
    background: var(--sage); display: grid; place-items: center;
}
.logo-mark img {
    width: 100%; height: 100%; max-width: none; object-fit: contain; display: block;
}
.logo-mark.has-photo {
    background: var(--bg);
    box-shadow: 0 0 0 1px var(--line);
    border-radius: 22px;
    overflow: hidden;
}
.logo-mark.has-photo img {
    object-fit: contain;
}
.logo-mark.is-dark-src img {
    mix-blend-mode: multiply;
}
.site-header .logo-mark,
.site-header .logo-mark.has-photo {
    width: 96px;
    height: 96px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}
.site-header .logo-mark img {
    width: 96px;
    height: 96px;
    object-fit: contain;
}
.logo-word span { font-weight: 600; color: var(--sage); }
.logo-light .logo-mark { background: rgba(255,255,255,.12); }
.logo-light .logo-mark.has-photo { background: #f3eee6; }
.logo-light .logo-mark.is-dark-src img { mix-blend-mode: multiply; }
.nav-desktop { display: none; margin-left: auto; align-items: stretch; gap: 0; }
.nav-item { position: relative; display: flex; align-items: center; }
.nav-item > a, .nav-link {
    display: block; padding: .55rem .8rem; text-decoration: none; font-weight: 500; font-size: .95rem;
    color: var(--sage-deep);
}
.nav-item > a[aria-current="page"] { color: var(--clay); }
.nav-sub {
    display: none; position: absolute; top: 100%; left: 0; min-width: 230px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
    padding: .5rem; box-shadow: var(--shadow);
}
.nav-item:hover .nav-sub, .nav-item:focus-within .nav-sub { display: grid; }
.nav-sub a {
    padding: .55rem .7rem; text-decoration: none; border-radius: 10px; font-size: .92rem; color: var(--ink);
}
.nav-sub a:hover { background: var(--bg-alt); }
.header-actions { margin-left: auto; display: flex; gap: .35rem; }
.icon-btn {
    width: 42px; height: 42px; border: 0; background: transparent; border-radius: 12px; cursor: pointer; color: var(--ink);
}
.icon-btn:hover { background: var(--bg-alt); }
.menu-toggle { display: grid; place-items: center; gap: 6px; }
.menu-toggle span { display: block; width: 18px; height: 1.5px; background: currentColor; }
.nav-mobile {
    padding: .5rem 1.25rem 1.25rem; display: grid; gap: .35rem; border-top: 1px solid var(--line);
}
.nav-mobile[hidden] { display: none !important; }
.nav-mobile details { background: var(--surface); border-radius: 12px; padding: .3rem .8rem; }
.nav-mobile summary { cursor: pointer; font-weight: 600; padding: .55rem 0; }
.nav-mobile a { display: block; padding: .4rem 0; text-decoration: none; color: var(--muted); }
.mobile-plain { padding: .7rem .8rem; text-decoration: none; font-weight: 600; }

.search-overlay {
    position: fixed; inset: 0; background: rgba(29,42,36,.45); z-index: 60;
    display: grid; place-items: start center; padding-top: 12vh;
}
.search-overlay[hidden] { display: none !important; }
.search-box {
    width: min(640px, calc(100% - 2rem)); background: var(--surface); border-radius: 18px;
    padding: 1.2rem; display: grid; gap: .7rem; box-shadow: var(--shadow);
}
.search-box input, .search-inline input, .stack-form input, .stack-form textarea, .newsletter input {
    width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: .85rem 1rem;
    font: inherit; background: #fff;
}
.search-box button[type="submit"] {
    border: 0; background: var(--sage); color: #fff; border-radius: 12px; padding: .85rem; font: inherit; cursor: pointer;
}

html { overflow-x: hidden; }
main { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; position: relative; z-index: 1; }

.home-art {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    user-select: none;
    background: #f5f0e7 url("../img/bg-home.png") center top / cover no-repeat;
}

@media (max-width: 768px) {
    .home-art {
        background-position: 30% top;
        background-size: cover;
        opacity: .4;
    }
}
.hero {
    display: grid; gap: 2rem; padding: 1.5rem 0 3rem;
}
.hero-copy h1 { max-width: 16ch; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 42rem; }
.eyebrow {
    text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 700;
    color: var(--clay); margin: 0 0 .7rem; font-family: var(--font);
}
.hero-cta { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.5rem; }
.pub-masthead {
    margin: 1.4rem 0 0;
    padding-top: 1rem;
    border-top: 1px solid rgba(196, 178, 154, .4);
    color: var(--muted);
    font-size: .95rem;
    max-width: 42rem;
}
.pub-masthead a { font-weight: 600; text-decoration: none; color: var(--sage-deep); }
.btn {
    display: inline-flex; align-items: center; justify-content: center; min-height: 48px;
    padding: 0 1.25rem; border-radius: 999px; text-decoration: none; font-weight: 600; border: 1px solid transparent;
    cursor: pointer; font: inherit;
}
.btn-primary { background: var(--clay); color: #fff; }
.btn-primary:hover { background: var(--clay-deep); }
.btn-ghost { background: transparent; border-color: var(--ink); color: var(--ink); }
.hero-aside {
    position: relative; min-height: 220px; border-radius: 32px; overflow: hidden;
    background: linear-gradient(145deg, #d7e0d6, #ead7c8 55%, #f3eee6);
}
.orb { position: absolute; border-radius: 50%; filter: blur(2px); }
.orb-a { width: 180px; height: 180px; background: rgba(61,86,73,.28); top: -20px; right: 20px; }
.orb-b { width: 140px; height: 140px; background: rgba(180,92,69,.2); bottom: 10px; left: 30px; }
.hero-mark {
    position: absolute; right: 1.5rem; bottom: 1.2rem; font-size: 2rem; color: var(--sage-deep); opacity: .7;
}
.hero-photo {
    width: 100%; height: 100%; min-height: 280px; object-fit: cover; display: block;
}

.section { padding: 2.5rem 0; }
.section-alt {
    background: rgba(245, 240, 231, .45);
    border: 1px solid rgba(196, 178, 154, .22);
    margin: 0 -1.25rem;
    padding: 2.5rem 1.25rem;
    border-radius: 28px;
}
.section-head { margin-bottom: 1.5rem; max-width: 40rem; }
.cat-grid, .card-grid, .tool-grid { display: grid; gap: 1rem; }
.cat-tile, .card, .tool-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.25rem; text-decoration: none; box-shadow: var(--shadow);
}
.cat-tile:hover, .tool-card:hover { transform: translateY(-2px); }
.card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.card-media { aspect-ratio: 16/10; background: #d9cfc2; display: block; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media-empty { background: linear-gradient(135deg, #d7e0d6, #ead7c8); }
.card-body { padding: 1.1rem 1.15rem 1.25rem; }
.card-body h3 a { text-decoration: none; }
.card-body p, .card-body time, .card-meta { color: var(--muted); font-size: .95rem; }
.card-meta { display: flex; flex-wrap: wrap; gap: .45rem 1rem; margin: .35rem 0 0; }
.week-grid {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: .45rem;
}
.week-cell {
    aspect-ratio: 1; display: grid; place-items: center; border-radius: 14px;
    background: var(--surface); color: var(--muted); font-weight: 600; text-decoration: none;
    border: 1px solid var(--line);
}
.week-cell.is-ready { background: var(--sage); color: #fff; border-color: var(--sage); }
.week-grid.is-sparse {
    grid-template-columns: repeat(auto-fill, minmax(52px, 72px));
    max-width: 28rem;
}
.section-cta { margin-top: .9rem; }
.section-cta a { font-weight: 600; }
.section-sub { font-size: 1.2rem; margin: 1.5rem 0 .8rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .7rem; }
.text-link { font-weight: 600; }
.section-split { display: grid; gap: 1.5rem; }
.stack-list { display: grid; gap: .7rem; }
.stack-list a {
    display: grid; gap: .15rem; padding: 1rem 1.1rem; background: var(--surface);
    border-radius: 16px; text-decoration: none; border: 1px solid var(--line);
}
.stack-list span { font-size: .8rem; color: var(--clay); font-weight: 600; }
.city-row, .chip-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.city-row a, .chip {
    background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
    padding: .65rem 1rem; text-decoration: none; font-weight: 600;
}
.empty-note { color: var(--muted); background: var(--surface); border: 1px dashed var(--line); padding: 1.2rem; border-radius: 16px; }
.newsletter {
    display: grid; gap: 1.2rem; padding: 2rem 1.4rem; background: var(--sage-deep); color: #f7f3ec;
    border-radius: 28px; margin-top: 1rem;
}
.newsletter .eyebrow { color: #e2c2b4; }
.newsletter form { display: grid; gap: .7rem; }
.site-footer {
    position: relative;
    z-index: 1;
    background: #1c2621; color: #d8d2c8; padding: 3rem 1.25rem 1.5rem; margin-top: 2rem;
}
.footer-grid { max-width: 1180px; margin: 0 auto; display: grid; gap: 2rem; }
.footer-grid h2 { font-size: 1rem; color: #fff; }
.footer-grid a { display: block; color: #d8d2c8; text-decoration: none; padding: .2rem 0; }
.footer-bottom { max-width: 1180px; margin: 2rem auto 0; border-top: 1px solid #314038; padding-top: 1rem; font-size: .9rem; }
.logo-light { color: #fff; }

.article-page { max-width: 760px; }
.article-page > h1 { margin-top: .4rem; }
.article-meta { display: flex; flex-wrap: wrap; gap: 1rem; color: var(--muted); font-size: .92rem; margin: 1rem 0 1.5rem; }
.author-chip { display: flex; align-items: center; gap: .6rem; text-decoration: none; }
.author-chip img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.article-hero { margin: 0 0 1.8rem; border-radius: 20px; overflow: hidden; }
.article-hero img { width: 100%; }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.1rem 1.2rem; margin-bottom: 1.8rem; }
.toc ol { margin: 0; padding-left: 1.1rem; }
.toc .lvl-3 { margin-left: 1rem; }
.prose { font-size: 1.08rem; }
.prose p { margin: 0 0 1rem; }
.prose h2, .prose h3 { margin-top: 1.8rem; }
.prose ul, .prose ol { margin: 0.6rem 0 1.2rem 1.25rem; }
.prose li { margin: 0.35rem 0; }
.prose a { color: var(--sage); }
.prose img { border-radius: 14px; margin: 1rem 0; }
.prose table { width: 100%; border-collapse: collapse; }
.prose th, .prose td { border: 1px solid var(--line); padding: .5rem .6rem; text-align: left; }
.prose > :last-child { margin-bottom: 0; }
.faq { margin-top: 2.75rem; }
.faq > h2, .sources > h2 { margin-bottom: .8rem; }
.faq details { background: var(--surface); border-radius: 14px; padding: .8rem 1rem; margin: .6rem 0; border: 1px solid var(--line); }
.sources { margin-top: 2.5rem; }
.related {
    margin-top: 3.4rem;
    padding-top: 2.2rem;
    border-top: 1px solid var(--line);
}
.related > h2 {
    margin-bottom: 1rem;
}
.publisher-box {
    margin-top: 2.6rem;
    padding: 1.1rem 1.2rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    font-size: .95rem;
}
.publisher-box p { margin: 0 0 .45rem; }
.publisher-box p:last-child { margin-bottom: 0; }
.publisher-box a { color: var(--sage); font-weight: 600; text-decoration: none; }
.footer-id { font-size: .9rem; color: #b7c0ba; }
.footer-id a { color: #e2c2b4; }
.note, .note-soft {
    margin-top: 1.5rem; padding: 1rem 1.1rem; border-radius: 14px; background: #f6e7df; color: var(--sage-deep);
}
.note-soft { background: #e4eee7; }
.crumbs { font-size: .88rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; }
.crumbs a { color: var(--sage); }
.page-hero { margin-bottom: 1.6rem; }
.author-photo {
    width: 120px; height: 120px; border-radius: 50%; object-fit: cover; margin: 0 0 1rem;
    border: 1px solid var(--line);
}
.subhead { margin: 1.6rem 0 .8rem; }
.search-inline { display: grid; gap: .6rem; }
.stack-form { display: grid; gap: .9rem; max-width: 520px; }
.stack-form label { display: grid; gap: .35rem; font-weight: 600; }
.hp { position: absolute; left: -9999px; }
.form-ok { color: var(--sage); }
.form-err, .form-err-list { color: var(--clay-deep); }
.tool-layout { display: grid; gap: 1.2rem; margin: 1.5rem 0; }
.tool-result {
    background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.2rem;
}
.tool-result[hidden] { display: none !important; }
.error-page { padding: 3rem 0 5rem; max-width: 36rem; }
.cookie-bar {
    position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 70;
    background: var(--sage-deep); color: #f4eee6; padding: 1rem 1.1rem; border-radius: 18px;
    display: grid; gap: .8rem; box-shadow: var(--shadow);
}
.cookie-bar[hidden] { display: none !important; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.text-link, .text-btn { background: none; border: 0; color: var(--clay); font: inherit; cursor: pointer; text-decoration: underline; }
.or { color: var(--muted); margin: 0; }

@media (min-width: 800px) {
    .menu-toggle { display: none; }
    .nav-desktop { display: flex; margin-left: auto; }
    .nav-desktop .nav-item + .nav-item,
    .nav-desktop .nav-item + .nav-link {
        border-left: 1px solid rgba(196, 178, 154, .48);
    }
    .nav-item > a, .nav-desktop > .nav-link {
        padding: .7rem 1.2rem;
        letter-spacing: .045em;
        font-size: .98rem;
    }
    .header-actions {
        margin-left: 0;
        padding-left: .55rem;
        border-left: 1px solid rgba(196, 178, 154, .48);
    }
    .hero { grid-template-columns: 1.2fr .8fr; align-items: center; padding: 2.5rem 0 4rem; }
    .cat-grid { grid-template-columns: repeat(3, 1fr); }
    .card-grid { grid-template-columns: repeat(3, 1fr); }
    .card-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .tool-grid { grid-template-columns: repeat(2, 1fr); }
    .week-grid { grid-template-columns: repeat(10, 1fr); }
    .week-grid.is-sparse { grid-template-columns: repeat(auto-fill, minmax(52px, 72px)); }
    .section-split { grid-template-columns: .8fr 1.2fr; align-items: start; }
    .newsletter, .footer-grid { grid-template-columns: 1.3fr 1fr 1fr; }
    .search-inline { grid-template-columns: 1fr auto; }
    .cookie-bar { left: auto; right: 1.5rem; width: min(420px, calc(100% - 2rem)); }
    .tool-layout { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1100px) {
    .card-grid-4 { grid-template-columns: repeat(4, 1fr); }
    .cat-grid { grid-template-columns: repeat(5, 1fr); }
}
