:root {
    --paper: #f5f0e6;
    --card: #fffdf8;
    --ink: #20201d;
    --muted: #716e66;
    --line: #ded8cc;
    --accent: #1d6f5f;
    --accent-dark: #155448;
    --accent-soft: #e7f2ee;
    --product: #f1ede4;
    --max: 1040px;
}

* { box-sizing: border-box; }

html {
    color-scheme: light;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
    line-height: 1.62;
    text-rendering: optimizeLegibility;
}

button, a { -webkit-tap-highlight-color: transparent; }

a { color: inherit; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(245, 240, 230, .96);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    width: min(calc(100% - 36px), var(--max));
    min-height: 86px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    flex-direction: column;
    text-decoration: none;
    line-height: 1.1;
}

.brand-name {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-weight: 800;
    font-size: 25px;
    letter-spacing: -.045em;
}

.brand-name span { color: var(--accent); }

.brand-tagline {
    margin-top: 6px;
    color: var(--muted);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 12px;
    letter-spacing: .01em;
}

.topic-menu { position: relative; }

.topics-button {
    border: 0;
    border-radius: 10px;
    padding: 12px 17px;
    background: var(--accent);
    color: white;
    font: 700 15px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    cursor: pointer;
    box-shadow: 0 2px 0 rgba(0,0,0,.08);
}

.topics-button:hover,
.topics-button:focus-visible { background: var(--accent-dark); }

.topics-button:focus-visible,
.topic-choice:focus-visible,
.product-link:focus-visible,
.brand:focus-visible {
    outline: 3px solid #e8a23a;
    outline-offset: 3px;
}

.topics-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 240px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    box-shadow: 0 16px 36px rgba(45, 40, 30, .14);
}

.topic-choice {
    width: 100%;
    border: 0;
    border-radius: 8px;
    padding: 11px 12px;
    background: transparent;
    color: var(--ink);
    text-align: left;
    font: 600 15px/1.25 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    cursor: pointer;
}

.topic-choice:hover,
.topic-choice.is-active { background: var(--accent-soft); color: var(--accent-dark); }

.feed {
    width: min(calc(100% - 36px), var(--max));
    margin: 0 auto;
    padding: 58px 0 76px;
}

.intro {
    max-width: 760px;
    margin: 0 0 42px;
}

.eyebrow,
.entry-topic,
.product-kicker,
.panel-kicker {
    margin: 0 0 8px;
    color: var(--accent);
    font: 800 12px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.intro h1 {
    margin: 0;
    max-width: 760px;
    font-size: clamp(38px, 6vw, 68px);
    line-height: .98;
    letter-spacing: -.045em;
    font-weight: 700;
}

.intro > p:last-child {
    max-width: 680px;
    margin: 22px 0 0;
    color: #56534d;
    font-size: 20px;
}

.entry-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 44px;
    align-items: start;
    margin: 0 0 28px;
    padding: 38px 40px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 5px 18px rgba(57, 50, 39, .045);
}

.entry-card[hidden] { display: none; }

.entry-copy h2 {
    margin: 0 0 18px;
    font-size: clamp(27px, 3.6vw, 38px);
    line-height: 1.08;
    letter-spacing: -.025em;
}

.entry-copy p:not(.entry-topic) { margin: 0 0 16px; }
.entry-copy p:last-child { margin-bottom: 0; }

.side-panel {
    padding: 22px;
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.product-panel {
    background: var(--product);
}

.editorial-panel {
    background: var(--accent-soft);
}

.side-panel h3 {
    margin: 0 0 12px;
    font-size: 18px;
    line-height: 1.25;
}

.panel-text {
    margin: 0;
    color: #4f564f;
    font-size: 15px;
    line-height: 1.5;
}


.product-panel ul {
    margin: 0 0 16px;
    padding-left: 19px;
    color: #555149;
    font-size: 15px;
    line-height: 1.45;
}

.product-link {
    display: inline-block;
    color: var(--accent-dark);
    font-size: 16px;
    font-weight: 750;
    text-underline-offset: 3px;
}

.paid-link {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}

.empty-state,
.no-results {
    padding: 28px;
    border: 1px dashed var(--line);
    background: var(--card);
}

.site-footer {
    width: min(calc(100% - 36px), var(--max));
    margin: 0 auto;
    padding: 34px 0 52px;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 50px;
    color: var(--muted);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 13px;
    line-height: 1.5;
}

.site-footer strong { color: var(--ink); font-size: 16px; }
.site-footer p { margin: 4px 0 0; }
.footer-notes p + p { margin-top: 8px; }

@media (max-width: 760px) {
    body { font-size: 18px; line-height: 1.58; }

    .header-inner {
        width: min(calc(100% - 28px), var(--max));
        min-height: 76px;
        gap: 12px;
    }

    .brand-name { font-size: 23px; }
    .brand-tagline { display: none; }
    .topics-button { padding: 12px 15px; font-size: 15px; }
    .topics-panel { position: fixed; left: 14px; right: 14px; top: 84px; width: auto; }

    .feed {
        width: min(calc(100% - 24px), var(--max));
        padding: 38px 0 52px;
    }

    .intro { margin-bottom: 30px; }
    .intro h1 { font-size: clamp(38px, 12vw, 54px); }
    .intro > p:last-child { margin-top: 18px; font-size: 18px; }

    .entry-card {
        grid-template-columns: 1fr;
        gap: 24px;
        margin-bottom: 18px;
        padding: 27px 23px;
        border-radius: 11px;
    }

    .entry-copy h2 {
        font-size: clamp(26px, 8vw, 32px);
        line-height: 1.09;
    }

    .side-panel {
        padding: 19px;
        border-left-width: 3px;
    }

    .side-panel h3 { font-size: 18px; }
    .panel-text { font-size: 16px; }
    .product-panel ul { font-size: 16px; }
    .product-link { font-size: 17px; }

    .site-footer {
        width: min(calc(100% - 28px), var(--max));
        grid-template-columns: 1fr;
        gap: 18px;
        padding-bottom: 38px;
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* Stage 2: permanent entry URLs, topic routes, and crawlable pagination. */
.entry-title-link {
    color: inherit;
    text-decoration: none;
}

.entry-title-link:hover {
    color: var(--accent-dark);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 5px;
}

.entry-title-link:focus-visible,
.article-back a:focus-visible,
.pagination a:focus-visible,
.sources a:focus-visible {
    outline: 3px solid #e8a23a;
    outline-offset: 3px;
}

.topic-choice {
    display: block;
    text-decoration: none;
}

.topic-intro h1 {
    text-transform: none;
}

.article-view {
    padding-top: 34px;
}

.article-back {
    margin: 0 0 18px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}

.article-back a {
    color: var(--accent-dark);
    text-underline-offset: 3px;
}

.entry-card-standalone {
    margin-bottom: 10px;
}

.sources {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 13px;
}

.sources summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--accent-dark);
}

.sources ul {
    margin: 12px 0 0;
    padding-left: 20px;
}

.sources a {
    color: var(--accent-dark);
    text-underline-offset: 3px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 34px 0 0;
    padding: 18px 0;
    border-top: 1px solid var(--line);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}

.pagination a {
    color: var(--accent-dark);
    font-weight: 700;
    text-underline-offset: 3px;
}

.pagination-prev { margin-right: auto; }
.pagination-next { margin-left: auto; }
.page-count { color: var(--muted); }

.infinite-sentinel {
    height: 1px;
}

.infinite-status {
    min-height: 24px;
    margin: 8px 0 0;
    color: var(--muted);
    text-align: center;
    font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.infinite-enabled:not(.infinite-failed) .pagination {
    display: none;
}

.infinite-enabled.infinite-failed .pagination {
    display: flex;
}

@media (max-width: 760px) {
    .article-view { padding-top: 24px; }

    .pagination {
        flex-wrap: wrap;
        font-size: 14px;
    }

    .page-count {
        order: 3;
        width: 100%;
        text-align: center;
    }
}

/* Stage 3: lightweight public search. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-search {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: var(--card);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.site-search input {
    width: 190px;
    min-width: 0;
    border: 0;
    outline: 0;
    padding: 10px 11px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
}

.site-search input::placeholder { color: #8a867d; }

.site-search button {
    border: 0;
    border-left: 1px solid var(--line);
    padding: 0 12px;
    background: #ebe6dc;
    color: var(--ink);
    font: 700 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    cursor: pointer;
}

.site-search button:hover,
.site-search button:focus-visible {
    background: #dfd8cb;
}

.site-search:focus-within {
    outline: 3px solid #e8a23a;
    outline-offset: 2px;
}

.search-intro h1 { max-width: 850px; }
.search-prompt { margin-top: 4px; }

@media (max-width: 760px) {
    .header-inner {
        flex-wrap: wrap;
        padding: 10px 0 11px;
    }

    .header-actions {
        width: 100%;
        order: 3;
    }

    .site-search {
        flex: 1 1 auto;
    }

    .site-search input {
        width: 100%;
        font-size: 16px;
        padding: 11px 12px;
    }

    .site-search button {
        font-size: 14px;
        padding: 0 14px;
    }

    .topic-menu { flex: 0 0 auto; }
    .topics-panel { top: 128px; }
}

/* Kabudi v4: lightweight search refinement */
.search-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; }
.search-tools select, .search-tools button { border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); padding: 8px 10px; font: inherit; }
.search-tools label { color: var(--muted); font-weight: 700; }
.product-link { overflow-wrap: anywhere; }
.paid-link { opacity: .72; font-size: 11px; }
