/* style.css - Base stylesheet for PHP JSON flat-file sites
   Design tokens are injected as CSS custom properties via site_tokens_css().
   Add site-specific overrides below the base layer. */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding-top: var(--header-height, 64px);
    background:
        radial-gradient(circle at 3% 10%, rgba(249, 115, 22, 0.11) 0, transparent 30rem),
        radial-gradient(circle at 97% 22%, rgba(37, 99, 235, 0.10) 0, transparent 34rem),
        linear-gradient(180deg, #ffffff 0%, #fbfcff 58%, #fffaf6 100%);
    background-attachment: fixed;
    color: var(--color-text, #1a1a1a);
    font-family: var(--font-body, system-ui, sans-serif);
    font-size: 1rem;
    line-height: 1.65;
}

a {
    color: var(--color-accent, #2563eb);
    text-decoration: underline;
}

a:hover {
    color: var(--color-accent-strong, #1d4ed8);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ── Header ────────────────────────────────────────────────────────────────── */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height, 64px);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    z-index: 100;
}

.site-header__inner {
    max-width: var(--content-width, 1200px);
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.site-logo a {
    font-family: var(--font-display, system-ui, sans-serif);
    font-weight: 300;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    text-decoration: none;
    color: var(--color-text, #1a1a1a);
}

.site-logo__accent {
    color: var(--color-accent-alt, #f97316);
}

/* ── Navigation ────────────────────────────────────────────────────────────── */

.site-nav {
    margin-left: auto;
}

.site-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.75rem;
    align-items: center;
}

.site-nav__list a {
    color: var(--color-text, #1a1a1a);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s;
}

.site-nav__list a:hover,
.site-nav__list a.is-active {
    color: var(--color-accent, #2563eb);
}

.site-nav__item--has-dropdown {
    position: relative;
}

.nav-chevron::after {
    content: ' \25BE';
    font-size: 0.75em;
}

.nav-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-small, 6px);
    padding: 0.5rem 0;
    min-width: 200px;
    list-style: none;
    margin: 0;
    box-shadow: var(--shadow-card);
    z-index: 200;
}

.site-nav__item--has-dropdown:hover .nav-dropdown {
    display: block;
}

.nav-dropdown li a {
    display: block;
    padding: 0.5rem 1rem;
    white-space: nowrap;
    font-size: 0.875rem;
}

/* Hamburger */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    margin-left: auto;
}

.nav-hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text, #1a1a1a);
    border-radius: 2px;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */

.page-wrapper {
    max-width: var(--content-width, 1200px);
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.content-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2.5rem;
    align-items: start;
}

.content-layout--single {
    grid-template-columns: 1fr;
    max-width: 760px;
}

.content-main {
    min-width: 0;
}

.content-sidebar {
    position: sticky;
    top: calc(var(--header-height, 64px) + 1.5rem);
}

/* ── Breadcrumbs ─────────────────────────────────────────────────────────────── */

.breadcrumbs {
    margin-bottom: 1.5rem;
}

.breadcrumbs__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--color-text-muted, #6b7280);
}

.breadcrumbs__item + .breadcrumbs__item::before {
    content: '/';
    margin-right: 0.5rem;
}

.breadcrumbs__item.is-current {
    color: var(--color-text, #1a1a1a);
}

/* ── Sidebar blocks ───────────────────────────────────────────────────────── */

.sidebar-block {
    background: var(--color-surface, #f8f9fa);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-medium, 10px);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.sidebar-block__title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted, #6b7280);
}

.sidebar-block__links {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sidebar-block__links a {
    font-size: 0.875rem;
}

.cta-btn {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--color-accent, #2563eb);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius-small, 6px);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */

.site-footer {
    border-top: 1px solid var(--color-border, #e5e7eb);
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
    background: var(--color-surface, #f8f9fa);
}

.site-footer__inner {
    max-width: var(--content-width, 1200px);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.site-footer__top {
    display: flex;
    gap: 3rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.site-footer__brand-name {
    font-family: var(--font-display, system-ui, sans-serif);
    font-weight: 300;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
    margin-bottom: 0.4rem;
}

.site-footer__tagline {
    margin: 0 0 0.5rem;
    color: var(--color-text-muted, #6b7280);
    font-size: 0.875rem;
}

.site-footer__contact a {
    color: var(--color-text-muted, #6b7280);
    font-size: 0.875rem;
}

.site-footer__col-heading {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted, #6b7280);
    margin-bottom: 0.75rem;
}

.site-footer__links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.site-footer__links a {
    color: var(--color-text, #1a1a1a);
    text-decoration: none;
    font-size: 0.875rem;
}

.site-footer__links a:hover {
    color: var(--color-accent, #2563eb);
}

.site-footer__bottom {
    border-top: 1px solid var(--color-border, #e5e7eb);
    padding-top: 1rem;
    font-size: 0.8rem;
    color: var(--color-text-muted, #6b7280);
}

/* ── Utility ─────────────────────────────────────────────────────────────────── */

.text-muted {
    color: var(--color-text-muted, #6b7280);
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-small, 6px);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.btn--primary {
    background: var(--color-accent, #2563eb);
    color: #fff;
}

.btn--primary:hover {
    background: var(--color-accent-strong, #1d4ed8);
    color: #fff;
}

.btn--outline {
    border: 1px solid var(--color-accent, #2563eb);
    color: var(--color-accent, #2563eb);
    background: transparent;
}

/* ── Error page ─────────────────────────────────────────────────────────────── */

.error-page {
    text-align: center;
    padding: 5rem 1rem;
}

.error-page h1 {
    font-size: 6rem;
    font-weight: 200;
    margin: 0 0 0.5rem;
    color: var(--color-text-muted, #6b7280);
}

.error-page p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

/* ── Mobile ─────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .nav-hamburger {
        display: flex;
    }

    .site-nav {
        display: none;
        position: fixed;
        top: var(--header-height, 64px);
        left: 0;
        right: 0;
        background: var(--color-surface, #fff);
        border-bottom: 1px solid var(--color-border, #e5e7eb);
        padding: 1rem 1.5rem;
        z-index: 99;
    }

    .site-nav.is-open {
        display: block;
    }

    .site-nav__list {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .nav-dropdown {
        position: static;
        box-shadow: none;
        border: none;
        padding: 0 0 0 1rem;
    }

    .site-nav__item--has-dropdown:hover .nav-dropdown {
        display: none;
    }

    .site-nav.is-open .nav-dropdown {
        display: block;
    }

    .content-layout {
        grid-template-columns: 1fr;
    }

    .content-sidebar {
        position: static;
    }

    .site-footer__top {
        flex-direction: column;
        gap: 1.5rem;
    }
}

/* ── Site-specific: home, category index, contact form ─────────────────── */

.home-hero {
    max-width: 760px;
    margin: 2rem 0 3rem;
}

.home-hero__eyebrow {
    font-family: var(--font-display, system-ui, sans-serif);
    font-size: 0.8125rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-accent-alt, #f97316);
    margin: 0 0 0.75rem;
}

.home-hero__title {
    font-family: var(--font-display, system-ui, sans-serif);
    font-weight: 300;
    letter-spacing: -0.02em;
    line-height: 1.2;
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    margin: 0 0 1rem;
}

.home-hero__lead {
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--color-text-muted, #6b7280);
}

.home-lanes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin: 0 0 3rem;
}

.home-lane {
    display: block;
    padding: 1.5rem;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-medium, 10px);
    text-decoration: none;
    color: var(--color-text, #1a1a1a);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.home-lane:hover {
    box-shadow: var(--shadow-card, 0 4px 16px rgba(0,0,0,0.08));
    border-color: var(--color-accent, #2563eb);
}

.home-lane__hook {
    display: block;
    font-family: var(--font-display, system-ui, sans-serif);
    font-size: 0.8125rem;
    color: var(--color-accent, #2563eb);
    margin-bottom: 0.5rem;
}

.home-lane__title {
    font-family: var(--font-display, system-ui, sans-serif);
    font-weight: 400;
    font-size: 1.375rem;
    margin: 0 0 0.5rem;
}

.home-lane__body {
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--color-text-muted, #6b7280);
    margin: 0;
}

.home-recent, .home-relationship {
    margin: 0 0 3rem;
}

.home-recent__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1.5rem;
}

.home-recent__item h3 {
    margin: 0 0 0.35rem;
    font-family: var(--font-display, system-ui, sans-serif);
    font-weight: 400;
}

.home-recent__item a {
    text-decoration: none;
    color: var(--color-text, #1a1a1a);
}

.home-recent__item p {
    margin: 0;
    color: var(--color-text-muted, #6b7280);
}

.category-index__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1.75rem;
}

.category-index__item a {
    text-decoration: none;
    color: var(--color-text, #1a1a1a);
}

.category-index__item h2 {
    font-family: var(--font-display, system-ui, sans-serif);
    font-weight: 400;
    margin: 0 0 0.35rem;
}

.category-index__excerpt {
    color: var(--color-text-muted, #6b7280);
    margin: 0 0 0.25rem;
}

.category-index__date {
    font-size: 0.8125rem;
    color: var(--color-text-muted, #6b7280);
    margin: 0;
}

.article__eyebrow {
    margin: 0 0 0.75rem;
    font-family: var(--font-display, system-ui, sans-serif);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    line-height: 1.35;
    text-transform: uppercase;
    color: var(--color-accent-alt, #f97316);
}

.article__title {
    margin: 0 0 1rem;
    font-family: var(--font-display, system-ui, sans-serif);
    font-size: clamp(1.9rem, 4vw, 2.75rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.article__excerpt {
    font-size: 1.125rem;
    color: var(--color-text-muted, #6b7280);
    line-height: 1.5;
}

.article__meta {
    font-size: 0.875rem;
    color: var(--color-text-muted, #6b7280);
}

.article__meta span + span::before {
    content: "·";
    margin: 0 0.5rem;
}

.article__body h2 {
    font-family: var(--font-display, system-ui, sans-serif);
    font-weight: 300;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-top: 2.25rem;
}

.article__body h3 {
    font-family: var(--font-display, system-ui, sans-serif);
    font-weight: 400;
    line-height: 1.3;
}

.article-answer {
    margin: 1.75rem 0 2.25rem;
    padding: 1.25rem 1.4rem;
    border-left: 3px solid var(--color-accent-alt, #f97316);
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--color-accent-alt, #f97316) 9%, var(--color-surface, #fff)),
        color-mix(in srgb, var(--color-accent, #2563eb) 7%, var(--color-surface, #fff))
    );
}

.article-answer p {
    margin: 0;
    font-size: 1.08rem;
}

.article-numbered {
    list-style: none;
    margin: 1.5rem 0 2rem;
    padding: 0;
    display: grid;
    gap: 1rem;
}

.article-numbered__item {
    display: grid;
    grid-template-columns: 3rem minmax(0, 1fr);
    gap: 1rem;
    padding: 1.15rem;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-small, 6px);
    background: var(--color-surface, #fff);
}

.article-numbered__number {
    font-family: var(--font-display, system-ui, sans-serif);
    font-size: 2rem;
    font-weight: 200;
    line-height: 1;
    color: var(--color-accent, #2563eb);
}

.article-numbered__item h3,
.article-numbered__item p {
    margin-top: 0;
}

.article-numbered__item p:last-child {
    margin-bottom: 0;
}

.article-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 2rem;
}

.article-card {
    padding: 1.2rem;
    border: 1px solid var(--color-border, #e5e7eb);
    border-top: 3px solid var(--color-accent, #2563eb);
    border-radius: var(--radius-small, 6px);
    background: var(--color-surface, #fff);
}

.article-card:nth-child(even) {
    border-top-color: var(--color-accent-alt, #f97316);
}

.article-card h3,
.article-card p {
    margin-top: 0;
}

.article-card p:last-child {
    margin-bottom: 0;
}

.article-table-wrap {
    margin: 1.5rem 0 2rem;
    overflow-x: auto;
    min-width: 0;
    max-width: 100%;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-small, 6px);
}

.article-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.article-table th,
.article-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    text-align: left;
    vertical-align: top;
}

.article-table th {
    background: color-mix(in srgb, var(--color-accent, #2563eb) 7%, var(--color-surface, #fff));
    font-size: 0.78rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.article-table tr:last-child td {
    border-bottom: 0;
}

.article-scorecard {
    margin: 1.5rem 0 2rem;
    display: grid;
    gap: 0.75rem;
}

.article-scorecard__overall {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
    padding: 1.3rem;
    border-left: 4px solid var(--color-accent, #2563eb);
    background: color-mix(in srgb, var(--color-accent, #2563eb) 9%, var(--color-surface, #fff));
}

.article-scorecard__score {
    font-family: var(--font-display, system-ui, sans-serif);
    font-size: 3rem;
    font-weight: 200;
    line-height: 1;
    color: var(--color-accent, #2563eb);
}

.article-scorecard__overall strong,
.article-scorecard__overall span {
    display: block;
}

.article-scorecard__rows {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.article-scorecard__row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--color-border, #e5e7eb);
    background: var(--color-surface, #fff);
}

.article-scorecard__row strong {
    font-family: var(--font-display, system-ui, sans-serif);
    font-size: 1.35rem;
    font-weight: 300;
    color: var(--color-accent, #2563eb);
}

.article-action {
    margin: 2rem 0;
    padding: 1.3rem 1.4rem;
    border: 1px solid var(--color-border, #e5e7eb);
    border-left: 3px solid var(--color-accent, #2563eb);
    background: var(--color-surface, #fff);
}

.article-action h2,
.article-action h3 {
    margin-top: 0;
}

.article-action p:last-child {
    margin-bottom: 0;
}

.article-action-link {
    background: var(--color-accent, #2563eb);
    color: #fff;
}

.article-action-link:hover {
    background: var(--color-accent-strong, #1d4ed8);
    color: #fff;
}

.article__sources {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border, #e5e7eb);
}

.article__sources h2 {
    font-family: var(--font-display, system-ui, sans-serif);
    font-weight: 300;
    font-size: 1.125rem;
    margin: 0 0 0.75rem;
}

.article__sources-list {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--color-text-muted, #6b7280);
}

.article__sources-list li {
    margin-bottom: 0.5rem;
}

.article__sources-list a {
    color: var(--color-accent, #2563eb);
}

.article__sources-note {
    color: var(--color-text-muted, #6b7280);
}

.article__tags {
    margin-top: 2rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.article__tag {
    display: inline-flex;
    align-items: center;
    padding: 0.05rem 0 0.05rem 0.5rem;
    border: 0;
    border-left: 2px solid currentColor;
    border-radius: 0;
    background: none;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--color-text-muted, #6b7280);
}

.contact-form {
    display: grid;
    gap: 1rem;
    max-width: 480px;
    margin-top: 1.5rem;
}

.contact-form__field {
    display: grid;
    gap: 0.35rem;
}

.contact-form__field label {
    font-size: 0.875rem;
    font-weight: 600;
}

.contact-form__field input,
.contact-form__field textarea {
    font: inherit;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-small, 6px);
}

.contact-form__honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.contact-form__success {
    color: #15803d;
    font-weight: 600;
}

.contact-form__error {
    color: #b91c1c;
    font-weight: 600;
}

@media (max-width: 800px) {
    .home-lanes {
        grid-template-columns: 1fr;
    }

    .article-card-grid,
    .article-scorecard__rows {
        grid-template-columns: 1fr;
    }

    .content-layout,
    .content-layout--single {
        grid-template-columns: minmax(0, 1fr);
        min-width: 0;
    }

    .article__body,
    .article__sources {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .article-numbered__item {
        grid-template-columns: 2.4rem minmax(0, 1fr);
        gap: 0.75rem;
    }

    .article-scorecard__overall {
        align-items: start;
    }

    .site-logo a {
        font-size: 1.05rem;
        white-space: nowrap;
    }
}
