/* ==========================================================================
   techxpert — main.css
   Component and layout styles. Design tokens defined in style.css.
   ========================================================================== */

/* ── LAYOUT ────────────────────────────────────────────────────────────── */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.site {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-content {
  flex: 1;
  padding: var(--space-xl) 0;
}

/* Two-column layout: main + sidebar */
.content-area {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  gap: var(--space-xl);
  align-items: start;
}

/* Full-width (no sidebar) */
.content-area--full {
  grid-template-columns: 1fr;
}

/* ── READING PROGRESS BAR ──────────────────────────────────────────────── */

#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(to right, var(--color-accent), var(--color-accent-2));
  z-index: 1000;
  transition: width 0.1s linear;
}

/* ── SITE HEADER / NAV ─────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow var(--transition), background-color var(--transition);
}

.site-header.is-scrolled {
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.4);
}

.site-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 64px;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* Logo — left column of grid */
.site-branding {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  justify-self: start;
}

.site-title {
  font-family: var(--font-heading);
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.site-title a {
  color: inherit;
}

.site-title a:hover {
  color: var(--color-accent);
}

.custom-logo {
  height: 40px;
  width: auto;
}

/* Primary nav menu — centre column of grid */
.main-navigation {
  display: flex;
  justify-content: center;
}

#primary-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  list-style: none;
  margin: 0;
  padding: 0;
}

#primary-menu li a {
  display: block;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-muted);
  border-radius: var(--radius-sm);
  transition: color var(--transition), background-color var(--transition);
}

#primary-menu li a:hover,
#primary-menu li.current-menu-item > a {
  color: var(--color-text);
  background-color: var(--color-surface);
}

/* Nav right side controls — right column of grid */
.nav-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  justify-self: end;
}

/* Search form in nav */
#nav-search-form {
  display: flex;
  overflow: hidden;
  max-width: 0;
  opacity: 0;
  transition: max-width 0.3s ease, opacity 0.3s ease;
}

#nav-search-form.is-open {
  max-width: 220px;
  opacity: 1;
}

#nav-search-form input[type="search"] {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  padding: 6px var(--space-md);
  width: 100%;
  outline: none;
}

#nav-search-form input[type="search"]:focus {
  border-color: var(--color-accent);
}

/* Icon buttons (search toggle, theme toggle) */
.icon-btn {
  background: none;
  border: none;
  color: var(--color-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), background-color var(--transition);
  font-size: 1.1rem;
}

.icon-btn:hover {
  color: var(--color-text);
  background-color: var(--color-surface);
}

/* Hamburger toggle (mobile) */
#menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

#menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

#menu-toggle.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#menu-toggle.is-active span:nth-child(2) { opacity: 0; }
#menu-toggle.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── BREADCRUMBS ───────────────────────────────────────────────────────── */

.breadcrumbs {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-lg);
}

.breadcrumbs__list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--fs-sm);
  color: var(--color-muted);
}

.breadcrumbs__link {
  color: var(--color-muted);
}

.breadcrumbs__link:hover {
  color: var(--color-accent);
}

.breadcrumbs__sep {
  color: var(--color-border);
}

.breadcrumbs__current {
  color: var(--color-text);
}

/* ── CATEGORY BADGES ───────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #ffffff;
  line-height: 1.5;
}

.badge--security  { background: var(--badge-security); }
.badge--linux     { background: var(--badge-linux); }
.badge--windows   { background: var(--badge-windows);  color: #1e293b; }
.badge--windows[data-theme="light"] { color: #1e293b; }
.badge--malware   { background: var(--badge-malware); }
.badge--network   { background: var(--badge-network);  color: #1e293b; }
.badge--howto     { background: var(--badge-howto); }
.badge--default   { background: var(--badge-default); }

/* ── POST CARDS (homepage / archive grid) ──────────────────────────────── */

.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.post-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Card thumbnail */
.post-card__thumbnail {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-bg);
}

.post-card__thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.post-card:hover .post-card__thumbnail img {
  transform: scale(1.04);
}

.post-card__thumbnail .badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
}

/* Thumbnail fallback */
.post-thumb-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--fallback-color) 20%, var(--color-bg)) 0%, var(--color-bg) 100%);
}

.post-thumb-fallback__icon {
  font-size: 2rem;
  margin-bottom: 4px;
}

.post-thumb-fallback__brand {
  font-size: var(--fs-xs);
  color: var(--color-border);
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
}

/* Card body */
.post-card__body {
  padding: var(--space-md);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card__title {
  font-size: var(--fs-base);
  font-weight: 700;
  margin: var(--space-xs) 0;
  line-height: 1.4;
}

.post-card__title a {
  color: var(--color-text);
}

.post-card__title a:hover {
  color: var(--color-accent);
}

.post-card__meta {
  margin-top: auto;
  padding-top: var(--space-sm);
  font-size: var(--fs-xs);
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ── SINGLE POST — HERO ─────────────────────────────────────────────────── */

.post-hero {
  position: relative;
  overflow: hidden;
  aspect-ratio: 21 / 9;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-xl);
}

.post-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.55);
}

.post-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--color-bg) 0%, rgba(15, 23, 42, 0.4) 60%, transparent 100%);
}

.post-hero__content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-xl);
}

.post-hero__meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.post-hero__title {
  font-size: var(--fs-2xl);
  font-weight: 800;
  color: #f1f5f9;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  margin: 0;
  line-height: 1.2;
}

.post-hero__byline {
  color: var(--color-muted);
  font-size: var(--fs-sm);
  margin-top: var(--space-sm);
}

/* Hero fallback (no featured image) */
.post-hero--fallback {
  display: flex;
  align-items: flex-end;
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-bg) 100%);
}

/* ── SINGLE POST — CONTENT ──────────────────────────────────────────────── */

.entry-content {
  font-size: var(--fs-base);
  line-height: 1.8;
  color: var(--color-text);
  max-width: var(--content-width);
}

.entry-content p { margin: 0 0 var(--space-lg); }

.entry-content ul,
.entry-content ol {
  margin: 0 0 var(--space-lg);
  padding-left: var(--space-xl);
}

.entry-content li { margin-bottom: var(--space-xs); }

.entry-content blockquote {
  border-left: 4px solid var(--color-accent);
  margin: var(--space-lg) 0;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-surface);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--color-muted);
}

.entry-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-xl) 0;
}

/* Images inside content */
.entry-content figure { margin: var(--space-lg) 0; }

.entry-content img {
  border-radius: var(--radius-md);
  max-width: 100%;
}

.entry-content figcaption {
  font-size: var(--fs-sm);
  color: var(--color-muted);
  margin-top: var(--space-xs);
  font-style: italic;
  text-align: center;
}

.entry-content .alignleft  { float: left; margin: 0 var(--space-lg) var(--space-md) 0; }
.entry-content .alignright { float: right; margin: 0 0 var(--space-md) var(--space-lg); }
.entry-content .aligncenter { margin-left: auto; margin-right: auto; display: block; }
.entry-content .alignfull  { width: 100%; }

/* Inline code */
.entry-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  color: var(--color-accent-2);
}

/* Code blocks (styled further by prism.css) */
.code-block {
  background: #0a0e1a;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: var(--space-lg) 0;
}

.code-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px var(--space-md);
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--color-border);
}

.code-block__lang {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--color-accent-2);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.code-block__copy {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  font-size: var(--fs-xs);
  cursor: pointer;
  padding: 3px 8px;
  transition: color var(--transition), border-color var(--transition);
}

.code-block__copy:hover,
.code-block__copy.is-copied {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.code-block pre {
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
}

/* ── SHARE BUTTONS ──────────────────────────────────────────────────────── */

.share-buttons {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-xl);
}

.share-buttons__label {
  font-size: var(--fs-sm);
  color: var(--color-muted);
  font-weight: 600;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  transition: color var(--transition), border-color var(--transition), background-color var(--transition);
}

.share-btn:hover {
  color: var(--color-text);
  border-color: var(--color-accent);
  background-color: var(--color-surface);
}

/* ── AUTHOR BOX ─────────────────────────────────────────────────────────── */

.author-box {
  display: flex;
  gap: var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-top: var(--space-xl);
}

.author-box__avatar img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
}

.author-box__name {
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.author-box__bio {
  font-size: var(--fs-sm);
  color: var(--color-muted);
}

/* ── SIDEBAR ─────────────────────────────────────────────────────────────── */

.widget-area {
  position: sticky;
  top: 80px;
}

.widget {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.widget-title {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-accent);
}

/* Recent posts widget */
.widget ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.widget li {
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--fs-sm);
}

.widget li:last-child { border-bottom: none; }

.widget li a {
  color: var(--color-text);
}

.widget li a:hover {
  color: var(--color-accent);
}

/* ── NEWSLETTER WIDGET ──────────────────────────────────────────────────── */

.newsletter-widget__title {
  font-size: var(--fs-base);
  font-weight: 700;
  margin: 0 0 var(--space-xs);
}

.newsletter-widget__subtitle {
  font-size: var(--fs-sm);
  color: var(--color-muted);
  margin: 0 0 var(--space-md);
}

.newsletter-widget__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.newsletter-widget__input {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  padding: 8px var(--space-md);
  width: 100%;
  transition: border-color var(--transition);
}

.newsletter-widget__input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.newsletter-widget__btn {
  background: var(--color-accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #ffffff;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 700;
  padding: 8px var(--space-md);
  transition: opacity var(--transition);
  width: 100%;
}

.newsletter-widget__btn:hover { opacity: 0.85; }

.newsletter-widget__notice {
  font-size: var(--fs-xs);
  color: var(--color-muted);
  font-style: italic;
}

/* Newsletter footer banner */
.newsletter-banner {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-2xl) 0;
  margin-bottom: var(--space-xl);
  text-align: center;
}

.newsletter-banner__title {
  font-size: var(--fs-xl);
  font-weight: 800;
  margin: 0 0 var(--space-xs);
}

.newsletter-banner__subtitle {
  font-size: var(--fs-base);
  color: var(--color-muted);
  margin: 0 0 var(--space-lg);
}

.newsletter-banner__form {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  max-width: 480px;
  margin: 0 auto;
}

.newsletter-banner__form input[type="email"] {
  flex: 1;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  padding: 10px var(--space-md);
}

.newsletter-banner__form input[type="email"]:focus {
  outline: none;
  border-color: var(--color-accent);
}

.newsletter-banner__form button {
  background: var(--color-accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #ffffff;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: 700;
  padding: 10px var(--space-lg);
  white-space: nowrap;
  transition: opacity var(--transition);
}

.newsletter-banner__form button:hover { opacity: 0.85; }

/* ── FOOTER ──────────────────────────────────────────────────────────────── */

.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-2xl) 0 var(--space-lg);
}

.footer-widgets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.footer-widget-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  margin: 0 0 var(--space-md);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
  font-size: var(--fs-sm);
  color: var(--color-muted);
}

.footer-links {
  display: flex;
  gap: var(--space-lg);
}

.footer-links a {
  color: var(--color-muted);
}

.footer-links a:hover {
  color: var(--color-accent);
}

/* ── ARCHIVE / SEARCH HEADERS ───────────────────────────────────────────── */

.archive-header,
.search-header {
  padding: var(--space-xl) 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-xl);
}

.archive-title {
  font-size: var(--fs-xl);
  font-weight: 800;
  margin: 0 0 var(--space-sm);
}

.archive-description {
  color: var(--color-muted);
  margin: 0;
}

/* ── 404 ────────────────────────────────────────────────────────────────── */

.error-404 {
  text-align: center;
  padding: var(--space-3xl) 0;
}

.error-404__code {
  font-size: 8rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--color-border);
  line-height: 1;
  margin: 0;
}

.error-404__title {
  font-size: var(--fs-xl);
  margin: var(--space-md) 0 var(--space-sm);
}

.error-404__text {
  color: var(--color-muted);
  margin-bottom: var(--space-xl);
}

/* ── PAGINATION ─────────────────────────────────────────────────────────── */

.pagination,
.post-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--color-border);
}

.page-numbers,
.nav-links a {
  display: inline-flex;
  align-items: center;
  padding: 6px var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  transition: color var(--transition), border-color var(--transition);
}

.page-numbers.current,
.page-numbers:hover,
.nav-links a:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* ── ENTRY META ─────────────────────────────────────────────────────────── */

.entry-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
  font-size: var(--fs-sm);
  color: var(--color-muted);
  margin-bottom: var(--space-lg);
}

.entry-meta a {
  color: var(--color-muted);
}

.entry-meta a:hover {
  color: var(--color-accent);
}

.reading-time {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── SEARCH FORM ─────────────────────────────────────────────────────────── */

.search-form {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.search-field {
  flex: 1;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  padding: 10px var(--space-md);
}

.search-field:focus {
  outline: none;
  border-color: var(--color-accent);
}

.search-submit {
  background: var(--color-accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #ffffff;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: 700;
  padding: 10px var(--space-lg);
  transition: opacity var(--transition);
}

.search-submit:hover { opacity: 0.85; }

/* ── UTILITY CLASSES ─────────────────────────────────────────────────────── */

.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.screen-reader-text:focus {
  clip: auto;
  clip-path: none;
  height: auto;
  overflow: visible;
  position: static;
  white-space: normal;
  width: auto;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────────────── */

/* Tablet (768px) */
@media (max-width: 768px) {
  .content-area {
    grid-template-columns: 1fr;
  }

  .posts-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-widgets {
    grid-template-columns: repeat(2, 1fr);
  }

  .post-hero {
    aspect-ratio: 16 / 9;
  }

  .post-hero__title {
    font-size: var(--fs-xl);
  }

  .widget-area {
    position: static;
  }
}

/* Mobile (480px) */
@media (max-width: 480px) {
  .site-header__inner {
    padding: 0 var(--space-md);
  }

  #menu-toggle {
    display: flex;
  }

  #primary-menu {
    display: none;
    position: fixed;
    inset: 64px 0 0 0;
    background: var(--color-bg);
    flex-direction: column;
    align-items: flex-start;
    padding: var(--space-md);
    border-top: 1px solid var(--color-border);
    overflow-y: auto;
    z-index: 99;
  }

  #primary-menu.is-open {
    display: flex;
  }

  #primary-menu li {
    width: 100%;
  }

  #primary-menu li a {
    display: block;
    padding: var(--space-md);
    font-size: var(--fs-base);
    border-bottom: 1px solid var(--color-border);
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .footer-widgets {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }

  .newsletter-banner__form {
    flex-direction: column;
  }

  .post-hero__title {
    font-size: var(--fs-lg);
  }

  .post-hero__content {
    padding: var(--space-md);
  }
}

/* ═══════════════════════════════════════════════════════════
   FEATURED CAROUSEL
   ═══════════════════════════════════════════════════════════ */

.featured-carousel {
    padding: 28px 0 0;
}

.carousel-wrap {
    position: relative;
}

.carousel-viewport {
    overflow-x: scroll;
    overflow-y: hidden;
    scrollbar-width: none;          /* Firefox */
    -ms-overflow-style: none;       /* IE / Edge */
    scroll-snap-type: x mandatory;
    border-radius: var(--radius-lg, 10px);
    container-type: inline-size;    /* cqi resolves against visible viewport width */
}

.carousel-viewport::-webkit-scrollbar { display: none; }

.carousel-track {
    display: flex;
    gap: 14px;
    /* No transform needed — movement via scrollLeft */
}

/* ── Cards ── */
.carousel-card {
    /* cqi = viewport's visible width (container-type set on .carousel-viewport) */
    flex: none;
    width: calc( (100cqi - 14px * 2) / 3 );  /* 3 visible cards, 2 gaps */
    position: relative;
    border-radius: var(--radius-lg, 10px);
    overflow: hidden;
    aspect-ratio: 16 / 10;
    background: var(--color-bg-secondary);
    scroll-snap-align: start;
    /* inset shadow stays inside the border box — never clipped by parent overflow */
    box-shadow: inset 0 0 0 1px var(--color-border);
    transition: box-shadow var(--transition);
}

.carousel-card:hover {
    box-shadow: inset 0 0 0 2px var(--color-accent);
}

.carousel-card__link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.carousel-card__bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: transform 7s ease;
}

.carousel-card:hover .carousel-card__bg {
    transform: scale(1.05);
}

.carousel-card__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(6, 13, 26, .96) 0%,
        rgba(6, 13, 26, .50) 50%,
        rgba(6, 13, 26,  0 ) 100%
    );
    pointer-events: none;
}

.carousel-card__content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 14px 16px;
}

.carousel-card__title {
    font-size: var(--fs-sm);
    font-weight: 800;
    color: #fff;
    line-height: 1.3;
    margin: 6px 0 7px;
    text-shadow: 0 1px 8px rgba(0, 0, 0, .7);
}

.carousel-card__meta {
    font-size: var(--fs-xs);
    color: rgba(255, 255, 255, .45);
    display: flex;
    align-items: center;
    gap: 8px;
}

.carousel-card__sep {
    display: inline-block;
    width: 2px;
    height: 2px;
    background: rgba(255, 255, 255, .3);
    border-radius: 50%;
}

/* ── Arrows ── */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(15, 23, 42, .85);
    border: 1px solid rgba(59, 130, 246, .4);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    transition: background var(--transition), border-color var(--transition);
}

.carousel-arrow:hover,
.carousel-arrow:focus-visible {
    background: var(--color-accent);
    border-color: var(--color-accent);
}

.carousel-arrow--prev { left: -18px; }
.carousel-arrow--next { right: -18px; }

/* ── Dots + progress bar ── */
.carousel-footer {
    margin-top: 12px;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 10px;
}

.carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-border);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: width .3s ease, background .3s ease, border-radius .3s ease;
}

.carousel-dot--active,
.carousel-dot:focus-visible {
    width: 20px;
    border-radius: 3px;
    background: var(--color-accent);
    outline: none;
}

.carousel-progress-track {
    height: 2px;
    background: var(--color-border);
    border-radius: 1px;
    overflow: hidden;
}

.carousel-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--color-accent);
    border-radius: 1px;
    /* transition set dynamically by JS */
}

/* ═══════════════════════════════════════════════════════════
   POST STRIP (5 thumbnails below carousel)
   ═══════════════════════════════════════════════════════════ */

.post-strip {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-top: 16px;
}

/* Strip card: full-image with overlay. position:relative required for ::after + overlay */
.post-strip__card {
    display: block;
    position: relative;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color var(--transition), transform var(--transition);
}

.post-strip__card:hover {
    border-color: var(--color-accent);
    transform: translateY(-2px);
}

/* Background image fills the card */
.post-strip__thumb {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: transform 5s ease;
}

.post-strip__card:hover .post-strip__thumb {
    transform: scale(1.05);
}

.post-strip__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Gradient overlay */
.post-strip__card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(6, 13, 26, .95) 0%,
        rgba(6, 13, 26, .45) 55%,
        rgba(6, 13, 26, .0)  100%
    );
    pointer-events: none;
}

/* Fixed-height text overlay — ALWAYS same height so all cards align */
.post-strip__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    height: 52px;          /* fixed — guarantees uniform bottom alignment */
    padding: 0 8px 7px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 2px;
}

.post-strip__title-ov {
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 4px rgba(0, 0, 0, .7);
}

/* Badge inside strip — smaller than normal badges */
.post-strip__overlay .badge {
    font-size: 8px;
    padding: 1px 5px;
}

/* ── Divider before grid ── */
/* Divider hidden — spacing handled by .featured-carousel padding-bottom */
.featured-carousel__divider {
    display: none;
}

.featured-carousel {
    padding-bottom: 28px;
}

/* ── Responsive ── */
@media ( max-width: 1023px ) {
    .carousel-card {
        width: calc( (100cqi - 14px) / 2 );  /* 2 visible cards, 1 gap */
    }

    .post-strip {
        grid-template-columns: repeat(3, 1fr);
    }

    .post-strip__card:nth-child(n+4) {
        display: none;
    }
}

@media ( max-width: 767px ) {
    .carousel-card {
        width: 100cqi;  /* 1 visible card, full width */
    }

    .carousel-arrow {
        display: none;
    }

    .post-strip {
        grid-template-columns: repeat(2, 1fr);
    }

    .post-strip__card:nth-child(n+3) {
        display: none;
    }
}

/* ═══════════════════════════════════════════════════════════
   CATEGORY BOXES (homepage — fills space below post grid)
   ═══════════════════════════════════════════════════════════ */


/* ── Section label: separator line + small-caps heading ── */
.section-label {
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin: 0 0 var(--space-lg);
    padding-top: var(--space-lg);
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.category-boxes {
    margin-top: var(--space-xl);
    padding-top: var(--space-xl);
}

.category-boxes__heading {
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-boxes__heading::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.category-boxes__grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.category-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: var(--space-sm) 6px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md, 8px);
    text-decoration: none;
    color: var(--color-text);
    text-align: center;
    transition: border-color var(--transition), transform var(--transition), background var(--transition);
}

.category-box:hover {
    border-color: var(--color-accent);
    background: color-mix( in srgb, var(--color-accent) 8%, var(--color-bg-secondary) );
    transform: translateY(-2px);
}

.category-box__icon {
    font-size: 1.4rem;
    line-height: 1;
}

.category-box__name {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text);
}

.category-box__count {
    font-size: var(--fs-xs);
    color: var(--color-muted);
}

@media ( max-width: 1023px ) {
    .category-boxes__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media ( max-width: 767px ) {
    .category-boxes__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ═══════════════════════════════════════════════════════════
   DESTACADO — conditional breaking-news banner
   Renders only when a post exists in the 'destacado' category.
   ═══════════════════════════════════════════════════════════ */

.destacado {
    margin: 0 0 var(--space-lg);
    border-left: 3px solid var(--color-accent);
    background: var(--color-surface);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    border: 1px solid color-mix( in srgb, var(--color-accent) 30%, var(--color-border) );
    border-left-width: 4px;
    border-left-color: var(--color-accent);
    overflow: hidden;
    transition: border-color var(--transition);
}

.destacado:hover {
    border-color: var(--color-accent);
    border-left-color: var(--color-accent-2);
}

.destacado__inner {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
}

.destacado__label {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--color-accent);
    background: color-mix( in srgb, var(--color-accent) 12%, transparent );
    border: 1px solid color-mix( in srgb, var(--color-accent) 30%, transparent );
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.destacado__thumb {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.destacado__body {
    flex: 1;
    min-width: 0;
}

.destacado__title {
    display: block;
    font-size: var(--fs-md);
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
    line-height: 1.3;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.destacado__title:hover { color: var(--color-accent); }

.destacado__excerpt {
    font-size: var(--fs-xs);
    color: var(--color-muted);
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.destacado__meta {
    font-size: 11px;
    color: var(--color-muted);
}

.destacado__btn {
    flex-shrink: 0;
    padding: 8px 18px;
    background: var(--color-accent);
    color: #fff;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: var(--fs-xs);
    font-weight: 700;
    white-space: nowrap;
    transition: background var(--transition), transform var(--transition);
}

.destacado__btn:hover {
    background: var(--color-accent-2);
    color: #fff;
    transform: translateX(2px);
}

@media ( max-width: 767px ) {
    .destacado__inner {
        flex-wrap: wrap;
        gap: var(--space-sm);
    }
    .destacado__thumb { display: none; }
    .destacado__btn   { width: 100%; text-align: center; }
}
