/*
Theme Name: WPA
Author: Dan
Version: 1.0.0
Text Domain: wpa
*/

:root {
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-serif: Georgia, "Times New Roman", serif;
    --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --max-width: 820px;
    --max-width-wide: 1200px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    height: 100%;
}

.single-article h2 {
    scroll-margin-top: 1rem;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
    width: 100%;
}

.site-header,
.site-footer {
    flex-shrink: 0;
}

a { color: var(--color-link); text-decoration: none; }
a:hover { color: var(--color-link-hover); text-decoration: underline; }

/* Layout */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1rem; }
.container-wide { max-width: var(--max-width-wide); margin: 0 auto; padding: 0 1rem; }

/* Opt-in vertical padding for full-width page containers */
.container-wide--padded {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* Accent block — reusable colored rounded bar on any heading (via ::before) */
.accent-block {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}
.accent-block::before {
    content: "";
    display: inline-block;
    width: 0.5rem;
    height: 1.1em;
    background: var(--color-accent);
    border-radius: 3px;
    flex: 0 0 auto;
}

/* Header */
.site-header {
    position: relative;
    background: var(--color-header-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.site-header .container-wide {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo img {
  max-height: 100%;
  width: auto;
  object-fit: contain;
}

/* Brand block — logo + optional site identity text */
.site-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    padding-right: 1rem;
}
.site-identity {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    text-align: left;
}
.site-identity-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--color-text);
    white-space: nowrap;
}
.site-identity-tagline {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

/* Light logo is shown by default; dark logo swapped in for dark themes.
   If no dark logo is set, only the light logo is rendered.
   The swap rules are emitted dynamically in functions.php, gated on both
   the dark-theme feature AND a configured dark logo. */
.site-logo a {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--color-text);
    text-decoration: none;
    flex-shrink: 1;
    display: flex;
}

.site-logo a:hover { color: var(--color-accent); }

.site-header-nav {
  flex-grow: 1;
}
.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  padding: 0 1rem;
}
.nav-links a {
    color: var(--color-text);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
}
.nav-links a:hover { color: var(--color-accent); text-decoration: none; }

/* Extra pages menu (front page, below header) */
.extra-pages-menu {
    padding: 0.25rem 0;
}
.extra-pages-links {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25rem;
    padding: 0.5rem 1rem;
    margin: 0;
}
.extra-pages-links a {
    color: var(--color-text);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.25rem 0;
}
.extra-pages-links a:hover { color: var(--color-accent); text-decoration: none; }

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}

.site-header-buttons {
  display: flex;
  justify-items: center;
  gap: 8px;
}

/* Search form */
.search-form {
  display: flex;
  align-items: center;
}

.search-form .search-label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--color-bg);
  transition: border-color 0.2s;
  margin-bottom: 0;
}

.search-form .search-label:focus-within {
  border-color: var(--color-accent);
}

.search-label .search-icon {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
  color: var(--color-text);
}

.search-form .search-field {
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.9rem;
  color: var(--color-text);
  width: 160px;
  padding: 0;
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    transition: border-color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.theme-toggle .theme-icon {
    display: block;
}

.theme-toggle:hover {
    border-color: var(--color-accent);
    background: var(--color-category-badge-bg);
}

/* Article */
#crumbs {
  font-size: 0.9rem;
  opacity: 0.65;
  margin: 1rem 0;
}
/*.single-article { padding: 2rem 0 4rem; }*/

.article-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}

.article-meta .category-badge {
    background: var(--color-category-badge-bg);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
}

.article-meta a.category-badge:hover {
    color: var(--color-accent);
}

.article-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--color-text-muted);
}

.article-meta-item a {
    color: var(--color-text-muted);
    text-decoration: none;
}

.article-meta-item a:hover {
    color: var(--color-accent);
    text-decoration: underline;
}

.meta-icon {
    display: block;
    flex-shrink: 0;
}

/* Featured image between meta and content */
.article-featured-image {
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.article-featured-image img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 20px;
    object-fit: cover;
}

/* Reading progress bar (fixed top) */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 200;
    background: transparent;
    pointer-events: none;
}
.reading-progress__fill {
    display: block;
    height: 100%;
    width: 0;
    background: var(--color-accent);
    transition: width 0.1s linear;
}

/* Scroll-to-top button */
.scroll-top {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    background: var(--color-accent);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 150;
}
.scroll-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.scroll-top:hover { opacity: 0.9; }

.single-article h1 {
    font-size: 3rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    font-family: var(--font-display);
}

.single-article h2 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
    line-height: 1.3;
    font-family: var(--font-display);
    color: var(--color-accent);
}

.single-article h3 {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem;
    line-height: 1.4;
    font-family: var(--font-display);
}

.single-article h4,
.single-article h5,
.single-article h6 {
    font-family: var(--font-display);
}

.single-article p {
    margin-bottom: 1.25rem;
    font-size: 1.05rem;
}

.wp-block-paragraph {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.single-article ul, .single-article ol {
    margin: 0 0 1.25rem 1.5rem;
}

.single-article li {
    margin-bottom: 0.5rem;
}

.single-article img {
    max-width: 100%;
    height: auto;
}

.single-article table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    border-spacing: 0;
}

.single-article th,
.single-article td {
    padding: 0.75rem 1rem;
    text-align: left;
    white-space: nowrap;
    border: none;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.single-article th:last-child,
.single-article td:last-child {
    border-right: none;
}

.single-article thead th {
    background: var(--color-category-badge-bg);
    font-weight: 600;
}

.single-article thead th:first-child {
    border-top-left-radius: 7px;
}

.single-article thead th:last-child {
    border-top-right-radius: 7px;
}

.single-article tbody tr:last-child td {
    border-bottom: none;
}

.single-article tbody tr:hover td {
    background: var(--color-category-badge-bg);
}

@media (max-width: 768px) {
    .single-article th,
    .single-article td {
        padding: 0.75rem 1.25rem;
    }
}

.single-article strong { font-weight: 700; }

.share-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: var(--color-bg);
    color: var(--color-text);
    text-decoration: none;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.share-link:hover {
    border-color: var(--color-accent);
    background: var(--color-category-badge-bg);
    color: var(--color-accent);
}

.share-link.is-copied {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.share-link .share-icon {
    display: block;
}

/* Generic card */
.card {
    background: var(--color-card-bg);
    border-radius: 20px;
    padding: 1rem;
}

/* Author card */
.author-card {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    margin-top: 2rem;
}

.author-card-avatar {
    flex-shrink: 0;
}

.author-card .avatar {
    border-radius: 50%;
}

.author-card-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

.author-card-name {
    font-size: 1.25rem;
    font-family: var(--font-display);
    margin-bottom: 0.5rem;
}

.author-card-name a {
    color: var(--color-text);
    text-decoration: none;
}

.author-card-name a:hover {
    color: var(--color-accent);
}

.author-card-bio {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--color-text-muted);
    margin: 0;
}

/* Author hero (author archive page) */
.author-hero {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 2rem;
    margin: 2rem 0;
}

.author-hero .avatar {
    border-radius: 50%;
    width: 128px;
    height: 128px;
}

.author-hero-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.author-hero-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.author-hero-name {
    font-size: 2rem;
    font-family: var(--font-display);
    margin: 0;
}

.author-hero-count {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.author-hero-bio {
    max-width: 720px;
    line-height: 1.6;
    color: var(--color-text-muted);
    margin: 0;
}

@media (max-width: 768px) {
    .author-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.5rem;
    }

    .author-hero .avatar {
        width: 96px;
        height: 96px;
    }
}

/* Homepage grid */
.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

/* Hero grid — carousel fallback: 1 featured spanning 3 cols, 3 stacked on the right */
.hero-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    grid-auto-flow: dense;
    gap: 1rem;
}

.hero-grid-featured {
    min-height: 400px;
    grid-column: span 3;
    grid-row: span 3;
}

/* Make the media fill the card height so the overlay sits at the bottom */
.hero-grid-post {
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
    background: var(--color-card-bg);
}

.hero-grid-post > a {
    display: flex;
    flex-direction: column;
    flex: 1;
    color: inherit;
    text-decoration: none;
}

.hero-grid-media {
    position: relative;
    flex: 1;
    min-height: 0;
}

.hero-grid-media .card-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-grid-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 3rem 1.25rem 1.25rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.hero-grid-overlay .card-category {
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-grid-overlay .card-title {
    color: #fff;
    font-size: 1.05rem;
    line-height: 1.3;
    margin: 0;
}

.hero-grid-featured .hero-grid-overlay {
    padding: 4rem 1.5rem 1.5rem;
}

.hero-grid-featured .hero-grid-overlay .card-title {
    font-size: 1.75rem;
    line-height: 1.25;
}

/* Non-featured items are narrow on desktop — smaller type */
@media (min-width: 901px) {
    .hero-grid-item .hero-grid-overlay .card-category {
        font-size: 0.65rem;
    }

    .hero-grid-item .hero-grid-overlay .card-title {
        font-size: 0.85rem;
        line-height: 1.3;
    }
}

.hero-grid-featured .card-body {
    padding: 1rem 1.25rem;
}

.hero-grid-featured .card-excerpt {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #fff;
}

@media (max-width: 768px) {
    /* Carousel takes over on mobile; hide the hero-grid */
    .hero-grid { display: none; }
}

.home-card {
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}

.home-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-4px);
}

.home-card a { color: inherit; text-decoration: none; display: block; }

.home-card .card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #f5f5f5;
    border-radius: 20px;
}

.home-card .card-body { padding: 1rem 0; }
.home-card .card-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-accent);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.home-card .card-title {
    font-size: 1.15rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    font-family: var(--font-display);
}

.home-card .card-excerpt {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.home-card .card-date {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.home-card .card-date-icon {
    display: inline-block;
    vertical-align: middle;
    color: var(--color-accent);
}

/* Homepage remaining articles — column of rows */
.latest-news-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.5rem;
    font-family: var(--font-display);
    margin: 1rem 0;
}

.home-rows {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 0 0 2rem;
}

.home-row {
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}
.home-row:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-4px);
}
.home-row a {
    display: flex;
    gap: 1.25rem;
    color: inherit;
    text-decoration: none;
    align-items: stretch;
}
.home-row .card-image {
    width: 240px;
    flex-shrink: 0;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #f5f5f5;
    border-radius: 20px;
}
.home-row .card-body {
    flex: 1;
    padding: 0.25rem 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.home-row .card-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-accent);
    font-weight: 600;
    margin-bottom: 0.4rem;
}
.home-row .card-title {
    font-size: 1.25rem;
    line-height: 1.3;
    margin-bottom: 0.4rem;
    font-family: var(--font-display);
}
.home-row .card-excerpt {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin-bottom: 0.4rem;
}
.home-row .card-date {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}
.home-row .card-date-icon {
    display: inline-block;
    vertical-align: middle;
    color: var(--color-accent);
}

/* Stack rows vertically on small screens */
@media (max-width: 640px) {
    .home-row a { flex-direction: column; }
    .home-row .card-image { width: 100%; }
}

/* Hero intro block (homepage) — subtle color shift to separate from the grid */
.hero-intro {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    padding: 3.5rem 0;
    margin: 0;
    overflow: hidden;
}

/* Translucent overlay + cover image when a background image is set */
.hero-intro .container-wide {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    padding: 0 2rem;
}

.hero-intro-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
}

.hero-intro .homepage-heading {
    font-size: 2.75rem;
    line-height: 1.2;
    font-family: var(--font-display);
    margin: 0 0 0.5rem;
    color: var(--color-text);
}

.hero-intro .homepage-intro {
    max-width: 720px;
    margin: 0;
    padding: 0;
}

.hero-intro .homepage-intro p {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    line-height: 1.7;
}

.hero-cta {
    display: inline-block;
    margin-top: 1.5rem;
    background: var(--color-accent);
    color: #fff;
    border-radius: 8px;
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}

.hero-cta:hover {
    opacity: 0.85;
    color: #fff;
}

/* Homepage intro */
.homepage-intro {
    text-align: center;
    padding: 3rem 1rem 2rem;
    max-width: 700px;
    margin: 0 auto;
}

.homepage-intro p {
    font-size: 1.1rem;
    color: var(--color-text-muted);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem 0;
}

.pagination .page-numbers {
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    color: var(--color-text);
}

.pagination .page-numbers.current { background: var(--color-accent); color: white; border-color: var(--color-accent); }

/* Category blocks */
.category-block {
    padding: 1rem 0;
}

/* Alt background variant — subtle tint for contrast (works in light & dark) */
.category-block--alt-bg {
    background: rgba(0, 0, 0, 0.05);
}

.category-block-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.category-block-title {
    font-size: 1.5rem;
    margin: 0;
    font-family: var(--font-display);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.category-block-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-accent);
    text-decoration: none;
}

.category-block-link:hover {
    text-decoration: underline;
}

.category-block .home-grid {
    padding: 0;
}

/* Single post layout — 70/30 split */
.single-layout {
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: 2rem;
}

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

.single-aside {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Aside */
.aside-title {
    font-size: 1.25rem;
    font-family: var(--font-display);
    margin-bottom: 1rem;
}

/* Aside share block */
.aside-share .share {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.aside-share .share-link {
    width: 32px;
    height: 32px;
}

.aside-trending-list {
    list-style: none;
    padding: 0;
    counter-reset: trending;
}

.aside-trending-list li {
    counter-increment: trending;
    margin-bottom: 0.75rem;
}

.aside-trending-list li a {
    color: var(--color-text);
    text-decoration: none;
    display: block;
}

.aside-trending-list li a:hover {
    color: var(--color-accent);
    text-decoration: underline;
}

/* Aside compact post row */
.aside-post {
    margin-bottom: 1rem;
}

.aside-trending-list .aside-post-link {
    display: flex;
    align-items: flex-start;
    flex-direction: row;
    gap: 0.75rem;
    color: var(--color-text);
    text-decoration: none;
}

.aside-trending-list .aside-post-link:hover {
    color: var(--color-text);
    text-decoration: none;
}

.aside-post-thumb {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 6px;
    overflow: hidden;
}

.aside-post-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.aside-post-img-placeholder {
    background: var(--color-category-badge-bg);
}

.aside-post-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.aside-post-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--color-accent);
}

.aside-post-title {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--color-text);
    margin: 0;
    transition: color 0.2s;
}

.aside-trending-list .aside-post-link:hover .aside-post-title {
    color: var(--color-accent);
}

.aside-post-date {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Aside table of contents */
/* Sticky only while the aside/TOC is in view, and only on desktop.
   The sticky element stays in flow until scrolling reaches it, then pins
   to the top offset and releases once its container bottom is reached. */
@media (min-width: 769px) {
    .aside-toc {
        position: sticky;
        top: 1rem;
    }
}

.aside-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.aside-toc-list a {
    display: block;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.4;
    padding: 0.1rem 0 0.1rem 0.9rem;
    border-left: 2px solid var(--color-border);
    transition: color 0.2s, border-color 0.2s;
}

.aside-toc-list a:hover {
    color: var(--color-accent);
    border-left-color: var(--color-accent);
}

/* Aside extra-pages menu */
.aside-extra-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.aside-extra-menu-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.4;
    transition: color 0.2s;
}
.aside-extra-menu-item a:hover {
    color: var(--color-accent);
}
.aside-extra-menu-icon {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}
.aside-extra-menu-title {
    font-weight: 500;
}

.aside-ad {
    text-align: center;
    min-height: 100px;
    border: 1px dashed var(--color-border);
    background: var(--color-bg);
}

.aside-extra {
    min-height: 100px;
    border: 1px dashed var(--color-border);
    background: var(--color-bg);
}

/* Comments */
.comments-area {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.comments-title {
    font-size: 1.25rem;
    font-family: var(--font-display);
    margin-bottom: 1.5rem;
}

.comment-list {
    list-style: none;
    margin: 0 0 2rem;
    padding: 0;
}

.comment-list .comment {
    border-bottom: 1px solid var(--color-border);
    padding: 1.5rem 0 1.25rem;
}

.comment-list .comment-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.comment-list .comment-author .fn {
    font-style: normal;
}

.comment-list .comment-author .avatar {
    border-radius: 50%;
}

.comment-list .comment-metadata {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin: 0.25rem 0 0.75rem;
}

.comment-list .comment-metadata a {
    color: var(--color-text-muted);
    text-decoration: none;
}

.comment-list .comment-metadata a:hover {
    color: var(--color-accent);
}

.comment-list .comment-content {
    line-height: 1.6;
}

.comment-list .comment-content p {
    margin-bottom: 0.5rem;
}

.comment-list .comment-content > :last-child {
    margin-bottom: 0;
}

.comment-list .reply {
    margin-top: 0.5rem;
}

.comment-list .reply .comment-reply-link {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-accent);
    text-decoration: none;
}

.comment-list .reply .comment-reply-link:hover {
    text-decoration: underline;
}

.comment-list .children {
    list-style: none;
    margin: 1.5rem 0 0;
    padding-left: 1.5rem;
    border-left: 2px solid var(--color-border);
}

.comment-navigation {
    margin: 1rem 0 2rem;
}

.comment-navigation .nav-links {
    display: flex;
    justify-content: space-between;
}

/* Comment form */
.comment-form .comment-notes,
.comment-form .logged-in-as {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.comment-form .comment-notes a,
.comment-form .logged-in-as a {
    color: var(--color-accent);
}

.comment-form p {
    margin-bottom: 1rem;
}

.comment-form label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    max-width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: inherit;
    font-size: 1rem;
}

.comment-form input[type="text"]:focus,
.comment-form input[type="email"]:focus,
.comment-form input[type="url"]:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--color-accent);
}

.comment-form textarea {
    resize: vertical;
    min-height: 120px;
}

.comment-form .form-submit {
    margin-bottom: 0;
}

.comment-form .submit {
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.6rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.comment-form .submit:hover {
    opacity: 0.85;
}

/* Progressive disclosure — hide name/email/consent/submit until the
   comment textarea is focused, keeping the form compact. */
.comment-form .comment-form-author,
.comment-form .comment-form-email,
.comment-form .comment-form-cookies-consent,
.comment-form .form-submit {
    display: none;
}

.comment-form:focus-within .comment-form-author,
.comment-form:focus-within .comment-form-email,
.comment-form:focus-within .comment-form-cookies-consent,
.comment-form:focus-within .form-submit {
    display: block;
}

/* Similar articles */
.related-posts {
    padding: 2rem 0;
}

.related-title {
    font-size: 1.5rem;
    font-family: var(--font-display);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.related-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Ad slots */
.ad-incontent {
    margin: 2rem 0;
    text-align: center;
    min-height: 100px;
}

/* Footer — slate background regardless of theme */
.site-footer {
    --footer-bg: #1e293b;
    --footer-fg: #cbd5e1;
    --footer-muted: #94a3b8;
    --footer-heading: #f1f5f9;
    --footer-border: rgba(255, 255, 255, 0.08);
    background: var(--footer-bg);
    color: var(--footer-fg);
    font-size: 0.9rem;
    padding: 3rem 0 2.5rem;
    border-top: 0;
}

/* Keep footer text light on the slate bg in both themes */
.site-footer,
.site-footer a {
    color: var(--footer-fg);
}
.site-footer a:hover { color: #ffffff; }

/* On slate, always show the light-on-dark logo variant */
.site-footer .logo--dark { display: block; }
.site-footer .logo--light { display: none; }

/* Grid (variable columns — adapts to how many menu columns are present) */
.site-footer .container-wide {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

/* About column brand */
.footer-brand-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    margin-bottom: 0.75rem;
}
.footer-brand-name {
    font-size: 1.4rem;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--footer-heading);
}
.footer-logo {
    height: 44px;
    width: auto;
    object-fit: contain;
}

.footer-col-title {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--footer-heading);
    margin: 0 0 1rem;
}

.footer-menu,
.legal-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}
.footer-menu li,
.legal-menu li {
    margin-bottom: 0.5rem;
}
.footer-menu a,
.legal-menu a {
    text-decoration: none;
    color: var(--footer-muted);
}
.footer-menu a:hover,
.legal-menu a:hover {
    color: #ffffff;
}

.footer-col--about {
    color: var(--footer-muted);
    line-height: 1.6;
}
.footer-text { margin-bottom: 0.5rem; }
.footer-copy { margin: 0; }

/* Responsive */
@media (max-width: 768px) {
    .site-footer .container-wide {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .menu-toggle { display: flex; }
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--color-bg);
        border-bottom: 1px solid var(--color-border);
        flex-direction: column;
        gap: 0;
        padding: 1rem;
    }
    .nav-links.active { display: flex; }
    .nav-links li { padding: 0.5rem 0; }

    /* Search form hidden on mobile */
    .search-form { display: none; }

    .single-article h1 { font-size: 2rem; }
    .home-grid { grid-template-columns: 1fr; }
    .hero-intro .homepage-heading { font-size: 1.9rem; }

    /* Stack main + aside on mobile */
    .single-layout { grid-template-columns: 1fr; }
}
