/**
 * BAUHAUS theme — Blueprint Atelier v0.1
 * Design spec: docs/theme-v1-design-spec.md
 */

:root {
  --paper: #FAFAF8;
  --ink: #1C1C1A;
  --muted: #6B7280;
  --rule: #E8E6E1;
  --hr: rgba(28, 28, 26, 0.1);
  --accent: #8FA63A;
  --accent-solid: #728B2A;
  --accent-hover: #657824;
  --accent-light: #EEF2D6;
  --surface: #F3F2EF;
  --card-bg: #FFFFFF;
  --code-bg: #1E1E1E;
  --hero-overlay: rgba(28, 28, 26, 0.15);
  --dot-grid: #E8E6E1;
  --header-bg: rgba(250, 250, 248, 0.62);
  --header-border: rgba(28, 28, 26, 0.1);
  --header-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset, 0 8px 32px rgba(28, 28, 26, 0.06);
  --font-sans: "Meiryo", "メイリオ", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", sans-serif;
  --font-mono: "JetBrains Mono", "Meiryo UI", monospace;
  --content: 720px;
  --wide: 1120px;
  --narrow: 640px;
  --hero-img-contrast: 1.6;
  --hero-img-saturate: 1.06;
}

[data-theme="dark"] {
  --paper: #121210;
  --ink: #E8E6E3;
  --muted: #9CA3AF;
  --rule: #2E2E2C;
  --hr: rgba(232, 230, 227, 0.12);
  --accent: #A3BC4A;
  --accent-solid: #8FA63A;
  --accent-hover: #7A9229;
  --accent-light: #2A3020;
  --surface: #1C1C1A;
  --card-bg: #181816;
  --code-bg: #0C0C0C;
  --hero-overlay: rgba(143, 166, 58, 0.12);
  --dot-grid: #2A2A28;
  --header-bg: rgba(18, 18, 16, 0.72);
  --header-border: rgba(255, 255, 255, 0.08);
  --header-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 32px rgba(0, 0, 0, 0.35);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(16px, 4vw, 17px);
  line-height: 1.85;
  color: var(--ink);
  background: var(--paper);
  background-image: radial-gradient(circle, var(--dot-grid) 0.6px, transparent 0.6px);
  background-size: 24px 24px;
  overflow-x: clip;
}

a { color: var(--accent-solid); }
a:hover { color: var(--accent-hover); }

a.btn--primary,
a.btn--primary:hover {
  color: #fff;
}

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

.site-wrap {
  width: 100%;
  max-width: var(--wide);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2rem);
}

.site-wrap--narrow { max-width: var(--narrow); }

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Reading progress */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 200;
  pointer-events: none;
}

.admin-bar .reading-progress {
  top: 32px;
}

@media screen and (max-width: 782px) {
  .admin-bar .reading-progress {
    top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reading-progress { display: none; }
}

/* Header glass */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: var(--header-bg);
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  border-bottom: 1px solid var(--header-border);
  box-shadow: var(--header-shadow);
}

.admin-bar .site-header {
  top: 32px;
}

@media screen and (max-width: 782px) {
  /* WP admin bar is position:absolute on mobile (scrolls away) — no sticky offset */
  .admin-bar .site-header {
    top: 0;
  }
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.site-logo {
  color: var(--ink);
  font-weight: bold;
  letter-spacing: 0.14em;
  font-size: 14px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav ul,
.nav.nav--fallback {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
  justify-content: center;
}

.nav a,
.nav__link {
  color: var(--ink);
  opacity: 0.78;
  text-decoration: none;
  font-size: 14px;
  transition: opacity 0.15s, color 0.15s;
}

.nav a:hover,
.nav__link:hover {
  opacity: 1;
  color: var(--accent-solid);
}

.nav .current-menu-item > a,
.nav a.is-primary,
.nav__link.is-primary {
  color: var(--accent-solid);
  opacity: 1;
  font-weight: bold;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.theme-toggle {
  border: 1px solid var(--header-border);
  background: color-mix(in srgb, var(--paper) 40%, transparent);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}

.search-form {
  display: flex;
  align-items: center;
  margin: 0;
}

.search-form__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.search-form__submit {
  width: 34px;
  height: 34px;
  border: 1px solid var(--header-border);
  background: color-mix(in srgb, var(--paper) 40%, transparent);
  color: var(--ink);
  cursor: pointer;
  font-size: 15px;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header { background: color-mix(in srgb, var(--paper) 94%, transparent); }
}

/* Buttons */
.btn {
  display: inline-block;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.btn--primary {
  background: var(--accent-solid);
  color: #fff;
  padding: 0.85rem 2rem;
  border-radius: 999px;
}

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

.btn--ghost {
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 0.5rem 1rem;
  border-radius: 0;
  background: transparent;
}

.btn--block { display: block; text-align: center; width: 100%; }

/* Hero — overlay layout (copy on image) */
.hero { padding-block: 2rem 3.5rem; }

.hero--overlay .hero__inner {
  position: relative;
  display: block;
  min-height: clamp(320px, 52vh, 520px);
  border: 1px solid var(--rule);
  overflow: hidden;
}

.hero__visual {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #2A2E24, #1C1C1A 45%, #3D4A28);
}

.hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: contrast(var(--hero-img-contrast)) saturate(var(--hero-img-saturate));
}

.hero__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    rgba(28, 28, 26, 0.8) 0%,
    rgba(28, 28, 26, 0.66) 45%,
    rgba(28, 28, 26, 0.4) 100%
  );
}

.hero__copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: inherit;
  max-width: 38rem;
  padding: clamp(1.75rem, 4vw, 3rem);
  color: #fff;
}

.hero__eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  margin: 0 0 0.75rem;
}

.hero__title {
  font-size: clamp(1.75rem, 3.6vw, 2.65rem);
  font-weight: bold;
  line-height: 1.28;
  margin: 0 0 0.85rem;
  color: #fff;
}

.hero__lead {
  color: rgba(255, 255, 255, 0.82);
  margin: 0 0 1.5rem;
  font-size: clamp(0.95rem, 1.6vw, 1.05rem);
  line-height: 1.65;
}

.btn--on-dark {
  align-self: flex-start;
  background: var(--accent-solid);
  color: #fff;
  border-color: var(--accent-solid);
}

.btn--on-dark:hover,
.btn--on-dark:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Sections & cards */
.section { padding-block: 2rem; }

.section--series {
  padding-block: 3rem 2rem;
  margin-top: 0.5rem;
}

.section__header { margin-bottom: 1.5rem; }

.section__intro {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  max-width: 42rem;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.card-grid {
  display: grid;
  gap: 1.25rem;
}

.card-grid--series { grid-template-columns: repeat(3, 1fr); }
.card-grid--archive { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--card-bg);
  border: 1px solid var(--rule);
  border-radius: 0;
  overflow: hidden;
}

/* Series cover cards (home) */
.card--series {
  border: none;
  background: transparent;
}

.card__cover {
  position: relative;
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border: 1px solid var(--rule);
  text-decoration: none;
  color: #fff;
}

.card__cover-img,
.card__cover-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: brightness(0.75);
  transition: filter 0.25s ease, transform 0.25s ease;
}

.card__cover:hover .card__cover-img,
.card__cover:focus-visible .card__cover-img {
  filter: brightness(0.9);
  transform: scale(1.02);
}

.card__cover-fallback {
  background: linear-gradient(145deg, #3D4A28, #1C1C1A);
  filter: none;
}

.card__cover-fallback--nextjs {
  background: linear-gradient(145deg, #1C1C1A 0%, #2A3140 55%, #3D4A28 100%);
}

.card__cover-fallback--react {
  background: linear-gradient(145deg, #1C1C1A 0%, #1a2a3a 55%, #2d4a5e 100%);
}

.card__cover-fallback--ai-dev {
  background: linear-gradient(145deg, #1C1C1A 0%, #2A2E24 50%, #4a3d28 100%);
}

.card__cover-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(28, 28, 26, 0.15) 0%,
    rgba(28, 28, 26, 0.55) 55%,
    rgba(28, 28, 26, 0.92) 100%
  );
  transition: background 0.25s ease;
}

.card__cover-main {
  position: absolute;
  inset: auto 0 0;
  z-index: 1;
  padding: 1.1rem 1.15rem 1.25rem;
}

.card__pill {
  display: inline-block;
  margin: 0 0 0.45rem;
  padding: 0.2rem 0.55rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(143, 166, 58, 0.9);
  color: #fff;
}

.card__cover-title {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
  font-weight: bold;
  line-height: 1.25;
  color: #fff;
}

.card__cover-meta {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
}

.card__cover-detail {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.15rem;
  background: rgba(28, 28, 26, 0.88);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.card__cover-desc {
  margin: 0 0 0.85rem;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
}

.card__cover-cta {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.card__cover:hover .card__cover-scrim,
.card__cover:focus-visible .card__cover-scrim {
  background: rgba(28, 28, 26, 0.2);
}

.card__cover:hover .card__cover-detail,
.card__cover:focus-visible .card__cover-detail {
  opacity: 1;
  transform: translateY(0);
}

@media (hover: none) {
  .card__cover-detail {
    opacity: 1;
    transform: none;
    background: linear-gradient(180deg, transparent 35%, rgba(28, 28, 26, 0.92) 100%);
    justify-content: flex-end;
  }

  .card__cover-desc {
    font-size: 13px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* Archive cards */
.card--archive .card__thumb-link {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  text-decoration: none;
}

.card--hover-reveal .card__thumb-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1rem 1.1rem;
  background: linear-gradient(180deg, transparent 20%, rgba(28, 28, 26, 0.9) 100%);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.card--hover-reveal .card__thumb-title {
  margin: 0 0 0.35rem;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: #fff;
}

.card--hover-reveal .card__thumb-excerpt {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
}

.card--hover-reveal:hover .card__thumb-overlay,
.card--hover-reveal:focus-within .card__thumb-overlay {
  opacity: 1;
}

.card__excerpt {
  margin: 0.5rem 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Desktop: title/excerpt on hover overlay only (avoid duplication) */
@media (hover: hover) and (min-width: 769px) {
  .card--hover-reveal .card__title--reveal,
  .card--hover-reveal .card__excerpt--reveal {
    display: none;
  }
}

.card__thumb--fallback {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  width: 100%;
  height: 100%;
  padding: 1rem 1.1rem;
  background: linear-gradient(145deg, #3D4A28 0%, #2A2E24 45%, #1C1C1A 100%);
}

.card__thumb-fallback-label {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.88);
  letter-spacing: 0.03em;
}

.card-grid--archive {
  gap: 1.5rem;
}

@media (hover: none) {
  .card--hover-reveal .card__thumb-overlay {
    opacity: 1;
    background: linear-gradient(180deg, transparent 45%, rgba(28, 28, 26, 0.85) 100%);
  }

  .card--hover-reveal .card__thumb-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

.card__thumb {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--surface), var(--rule));
}

.card__thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__body { padding: 1rem 1.1rem 1.25rem; }

.card__title {
  font-size: 15px;
  margin: 0 0 0.35rem;
}

.card__title a {
  color: var(--ink);
  text-decoration: none;
}

.card__meta {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.posts-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.posts-split__heading {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-list li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
}

.post-list a {
  color: var(--ink);
  text-decoration: none;
}

.post-list a:hover { color: var(--accent-solid); }

.post-list__date {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 0.2rem;
}

/* Article */
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  padding-top: 1rem;
}

.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent-solid); }

.article { padding-bottom: 3rem; }

.article__header { margin: 1rem 0 1.5rem; }

.article__title {
  font-size: clamp(1.75rem, 4vw, 2rem);
  font-weight: bold;
  line-height: 1.3;
  margin: 0.5rem 0;
}

.entry-meta {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
}

.article__layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2.5rem;
  align-items: start;
  min-width: 0;
}

.article__layout > * {
  min-width: 0;
}

.article--short .article__layout { grid-template-columns: 1fr; max-width: var(--narrow); }

.article__toc {
  position: sticky;
  top: 5rem;
  align-self: start;
  max-height: 70vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 1rem;
  font-size: 13px;
  color: var(--muted);
}

.article__toc-heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.article__toc-body #toc_container,
.article__toc-body .toc_container {
  margin: 0;
  padding: 0;
  background: transparent !important;
  border: 0;
  width: 100% !important;
  float: none !important;
}

.article__toc-body .toc_title,
.article__toc-body .toc_toggle,
.toc-drawer__body .toc_title,
.toc-drawer__body .toc_toggle {
  display: none !important;
}

.article__toc-body .toc_list,
.toc-drawer__body .toc_list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.article__toc-body .toc_list li,
.toc-drawer__body .toc_list li {
  margin: 0;
  padding: 0;
}

.article__toc-body .toc_number,
.toc-drawer__body .toc_number {
  display: none;
}

.article__toc-body a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  padding: 0.3rem 0 0.3rem 0.5rem;
  border-left: 2px solid transparent;
  font-size: 13px;
  line-height: 1.45;
}

.article__toc-body a:hover,
.article__toc-body a.active {
  color: var(--accent-solid);
  border-left-color: var(--accent-solid);
}

.entry-content #toc_container {
  display: none !important;
}

.toc-fab,
.toc-drawer {
  display: none;
}

.article--long .entry-content {
  counter-reset: chapter;
}

.article--long .entry-content :is(h2, h2.wp-block-heading) {
  position: relative;
  padding-left: 3rem;
  counter-increment: chapter;
}

.article--long .entry-content :is(h2, h2.wp-block-heading)::before {
  content: counter(chapter, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.1rem;
  font-size: 1.5rem;
  font-weight: bold;
  line-height: 1;
  opacity: 0.15;
  color: var(--ink);
}

.admin-bar .article__toc {
  top: calc(5rem + 32px);
}

@media screen and (max-width: 782px) {
  .admin-bar .article__toc {
    top: 5rem;
  }
}

.entry-content {
  max-width: var(--content);
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Article body (long / short) */
.article .entry-content h2 {
  font-size: 1.5rem;
  font-weight: bold;
  margin: 2.5rem 0 1rem;
}

.article .entry-content h3 {
  font-size: 1.15rem;
  font-weight: bold;
  margin: 1.5rem 0 0.75rem;
}

.entry-content pre,
.entry-content code {
  font-family: var(--font-mono);
}

.entry-content img { margin: 1.25rem 0; }

/* Horizontal rules — subtle divider (classic hr + block separator) */
.entry-content :is(hr, .wp-block-separator, hr.wp-block-separator) {
  box-sizing: content-box;
  border: 0;
  border-top: 1px solid var(--hr);
  border-bottom: 0;
  height: 0;
  max-width: 100%;
  margin: 2rem 0;
  background: transparent !important;
  color: var(--hr);
  opacity: 1;
}

.entry-content .wp-block-separator.is-style-wide {
  max-width: 100%;
}

.entry-content .wp-block-separator.is-style-dots::before {
  color: var(--hr);
  letter-spacing: 0.75em;
}

/* blogcard plugin override */
.entry-content .blogcard,
.entry-content .wp-block-embed,
.entry-content figure {
  border-radius: 0;
}

/* pz-linkcard — plugin defaults to 500px; shrink to column on narrow viewports */
.entry-content .lkc-external-wrap {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box;
}

.entry-content .lkc-card,
.entry-content .lkc-unlink,
.entry-content .lkc-content {
  max-width: 100%;
  width: 100% !important;
  box-sizing: border-box;
}

.entry-content .lkc-url,
.entry-content .lkc-url strike {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.entry-content pre {
  overflow-x: auto;
  max-width: 100%;
}

.entry-content .wp-block-table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
}

/* Static pages — align with top page body tone (not hero scale) */
.page-content {
  padding-block: 1.5rem 3rem;
}

.page-content__header {
  margin-bottom: 0.5rem;
}

.page-content__title {
  font-size: 1.35rem;
  font-weight: bold;
  line-height: 1.35;
  margin: 0.5rem 0 0;
  color: var(--ink);
}

.page-content .entry-content {
  font-size: 17px;
  line-height: 1.85;
  color: var(--ink);
}

.page-content .entry-content > :is(p, .wp-block-paragraph):first-of-type {
  color: var(--muted);
  font-size: 16px;
  margin-top: 0;
}

.page-content .entry-content :is(h2, h2.wp-block-heading) {
  font-size: 1.125rem;
  font-weight: bold;
  line-height: 1.4;
  margin: 1.75rem 0 0.6rem;
  color: var(--ink);
}

.page-content .entry-content :is(h3, h3.wp-block-heading) {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  margin: 1.25rem 0 0.45rem;
  color: var(--ink);
}

.page-content .entry-content p,
.page-content .entry-content li {
  font-size: inherit;
  color: var(--ink);
}

.page-content .entry-content strong,
.page-content .entry-content b {
  font-weight: 600;
  color: var(--ink);
}

.page-content .entry-content a {
  color: var(--accent-solid);
  text-decoration: none;
}

.page-content .entry-content a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.page-content .entry-content :is(ul, ol).wp-block-list {
  padding-left: 1.25rem;
  margin: 0.5rem 0 1rem;
}

.page-content .entry-content :is(ul, ol).wp-block-list li {
  margin-bottom: 0.4rem;
}

.page-content .entry-content .wp-block-table {
  font-size: 15px;
  margin: 1rem 0 1.5rem;
}

.page-content .entry-content .wp-block-table th {
  font-weight: 600;
  font-size: 14px;
}

.page-content .entry-content .wp-block-table td,
.page-content .entry-content .wp-block-table th {
  padding: 0.65rem 0.85rem;
  border-color: var(--rule);
}

.page-content .entry-content .wp-block-image {
  margin: 1rem 0 1.25rem;
}

.series-rail {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.series-rail__label {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--ink);
}

.series-rail__bar {
  height: 4px;
  background: var(--rule);
  margin-bottom: 0.85rem;
  overflow: hidden;
}

.series-rail__bar-fill {
  display: block;
  height: 100%;
  background: var(--accent-solid);
}

.series-rail__stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.series-rail__step a {
  display: inline-block;
  font-size: 12px;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--rule);
  color: var(--muted);
  text-decoration: none;
}

.series-rail__step.is-current a {
  background: var(--accent-solid);
  color: #fff;
  border-color: var(--accent-solid);
}

.series-rail__step a:hover {
  color: var(--accent-solid);
  border-color: var(--accent-solid);
}

.series-rail__step.is-current a:hover {
  color: #fff;
}

.series-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2.5rem;
}

.series-nav a {
  display: block;
  padding: 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
}

.series-nav__dir {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.series-nav__title {
  display: block;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.series-nav__prev--empty {
  visibility: hidden;
  pointer-events: none;
}

.series-nav a.btn--primary,
.series-nav a.btn--primary:hover,
.series-nav a.btn--primary:focus-visible {
  color: #fff;
  background: var(--accent-solid);
  border-color: var(--accent-solid);
}

.series-nav a.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.series-nav a.btn--primary .series-nav__title {
  color: rgba(255, 255, 255, 0.88);
}

.series-nav__next.btn--primary {
  text-align: center;
}

.series-nav__archive {
  margin: 0.75rem 0 0;
  font-size: 13px;
  text-align: center;
}

.series-nav__archive a {
  color: var(--muted);
  text-decoration: none;
}

.series-nav__archive a:hover {
  color: var(--accent-solid);
}

.series-nav--sticky {
  display: none;
}

.cta-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 1.25rem;
  margin-top: 2rem;
  max-width: var(--narrow);
}

.cta-card__label {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

/* Widget areas (Phase 2-4) */
.section--widgets {
  padding-top: 0;
}

.widget-area--home .widget {
  margin: 0;
}

.widget__title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.widget__title--footer {
  margin-bottom: 0.75rem;
}

.widget-area--home :is(.widget_recent_entries ul, .wp-block-latest-posts) {
  list-style: none;
  margin: 0;
  padding: 0;
}

.widget-area--home :is(.widget_recent_entries li, .wp-block-latest-posts li) {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
}

.widget-area--home :is(.widget_recent_entries a, .wp-block-latest-posts a) {
  color: var(--ink);
  text-decoration: none;
}

.widget-area--home :is(.widget_recent_entries a:hover, .wp-block-latest-posts a:hover) {
  color: var(--accent-solid);
}

.widget-area--home .wp-block-latest-posts__post-date {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 0.2rem;
}

.widget-area--footer {
  text-align: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.widget-area--footer .widget {
  margin: 0 0 1rem;
}

.widget-area--footer .widget:last-child {
  margin-bottom: 0;
}

.widget-area--footer .textwidget {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.widget-area--footer .textwidget a {
  color: var(--muted);
  text-decoration: none;
}

.widget-area--footer .textwidget a:hover {
  color: var(--accent-solid);
}

.widget-area--footer .wp-block-group {
  margin: 0 auto;
  max-width: 728px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: 2rem 3rem;
  margin-top: 2rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 13px;
  margin-bottom: 1rem;
}

.footer-nav a {
  color: var(--muted);
  text-decoration: none;
}

.footer-nav a:hover { color: var(--accent-solid); }

.site-footer__copy {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

/* Pagination */
.navigation.pagination {
  margin: 2rem 0;
}

.navigation.pagination .nav-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.navigation.pagination a,
.navigation.pagination span {
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
}

@media (max-width: 1024px) {
  .hero--overlay .hero__inner { min-height: clamp(280px, 46vh, 440px); }
  .card-grid--series { grid-template-columns: repeat(2, 1fr); }
  .card-grid--archive { grid-template-columns: 1fr 1fr; }
  .article__layout { grid-template-columns: 1fr; }
  .article__toc { display: none; }
  .article--long .entry-content :is(h2, h2.wp-block-heading) { padding-left: 0; }
  .article--long .entry-content :is(h2, h2.wp-block-heading)::before { display: none; }
  .posts-split { grid-template-columns: 1fr; }

  .toc-fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 90;
    min-height: 44px;
    padding: 0.65rem 1rem;
    border: 1px solid var(--header-border);
    background: var(--card-bg);
    color: var(--ink);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(28, 28, 26, 0.12);
  }

  .toc-drawer.is-open {
    display: block;
  }

  .toc-drawer {
    position: fixed;
    inset: 0;
    z-index: 120;
    background: rgba(28, 28, 26, 0.35);
  }

  .toc-drawer__panel {
    position: absolute;
    inset: 0;
    background: var(--paper);
    padding: 3.25rem 1.25rem 2rem;
    overflow: auto;
  }

  .toc-drawer__heading {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 0.75rem;
  }

  .toc-drawer__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 40px;
    height: 40px;
    border: 1px solid var(--rule);
    background: var(--surface);
    font-size: 1.25rem;
    cursor: pointer;
  }

  .toc-drawer__body #toc_container,
  .toc-drawer__body .toc_container {
    margin: 0;
    padding: 0;
    width: 100% !important;
    background: transparent !important;
    border: 0;
  }

  .toc-drawer__body a {
    display: block;
    padding: 0.45rem 0 0.45rem 0.5rem;
    color: var(--muted);
    text-decoration: none;
    border-left: 2px solid transparent;
    border-bottom: 0;
    font-size: 14px;
    line-height: 1.45;
  }

  .toc-drawer__body a:hover,
  .toc-drawer__body a.active {
    color: var(--accent-solid);
    border-left-color: var(--accent-solid);
  }
}

@media (max-width: 782px) {
  .site-header__inner {
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }

  .nav ul {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
  }
}

@media (max-width: 640px) {
  .site-header__inner { flex-wrap: wrap; }
  .nav ul { justify-content: flex-start; }
  .card-grid--series,
  .card-grid--archive { grid-template-columns: 1fr; }
  .series-nav { grid-template-columns: 1fr; }
  .series-nav__next { order: -1; }
  .hero--overlay .hero__inner { min-height: 300px; }
  .hero__copy { max-width: none; }
}
