:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --text: #1a2433;
  --muted: #5a6b85;
  --primary: #204f9e;
  --border: #dbe4f0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: min(980px, 92vw);
  margin: 0 auto;
}

.site-header {
  background: #0f1c32;
  border-bottom: 1px solid #21314e;
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
}

.brand {
  color: #f8fbff;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.nav a {
  color: #dce7ff;
  font-size: 0.95rem;
}

.content {
  padding: 2rem 0 3rem;
}

.page {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
}

.breadcrumb {
  margin: 0 0 0.9rem;
}

.breadcrumb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
}

.breadcrumb-item {
  min-width: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  margin-right: 0.35rem;
  color: #8ea1bf;
}

.breadcrumb-item a {
  color: #45618d;
}

.breadcrumb-item [aria-current="page"] {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  color: #2b3f62;
  font-weight: 600;
}

.breadcrumb-item:last-child {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.post-breadcrumb-list .breadcrumb-item + .breadcrumb-item::before {
  content: none;
}

.post-breadcrumb-list .breadcrumb-sep {
  flex: 0 0 auto;
  color: #8ea1bf;
}

.post-breadcrumb-list .breadcrumb-item:last-child {
  flex: 1 1 auto;
}

.page-header h1 {
  margin: 0 0 0.4rem;
  font-size: 1.95rem;
}

.lead {
  color: var(--muted);
  margin: 0 0 1rem;
}

.home-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.2rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem;
}

.panel h2 {
  margin-top: 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  padding: 1rem 0 2rem;
}

.notice {
  border-left: 4px solid var(--primary);
  background: #edf3ff;
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  color: #2d4260;
}

/* Keep legacy WordPress media proportional and within content width. */
.content img {
  max-width: 100%;
  height: auto;
}

.content figure {
  margin: 1rem 0;
}

.two-figures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
  align-items: start;
}

.two-figures > figure {
  margin: 0;
}

.two-figures > figure img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #eef3fb;
}

.three-figures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
  align-items: end;
}

.three-figures > figure {
  margin: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #eef3fb;
}

.three-figures > figure img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

@media (max-width: 700px) {
  .two-figures {
    grid-template-columns: 1fr;
  }

  .three-figures {
    grid-template-columns: 1fr;
  }
}

.wp-block-image.alignright {
  float: right;
  margin: 0 0 1rem 1rem;
  max-width: min(320px, 45%);
}

.wp-block-image.alignleft {
  float: left;
  margin: 0 1rem 1rem 0;
  max-width: min(320px, 45%);
}

.wp-block-image.aligncenter {
  text-align: center;
}

.wp-block-image.aligncenter img {
  margin-inline: auto;
}

.wp-block-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin: 1rem 0;
}

.wp-block-gallery > .wp-block-image {
  flex: 1 1 300px;
  margin: 0;
}

.wp-block-gallery > .wp-block-image img {
  width: 100%;
  height: auto;
  display: block;
}

.wp-element-caption {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.content::after {
  content: "";
  display: block;
  clear: both;
}

.home-logo {
  float: right;
  margin: 0 0 1rem 1rem;
}

.home-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.home-logo-wide {
  max-width: min(250px, 42%);
}

.home-logo-compact {
  max-width: min(170px, 35%);
}

.post-featured {
  margin: 0 0 1rem;
}

.post-featured img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #eef3fb;
}

/* In blog posts, do not upscale small featured images beyond original width. */
.post-featured-post img {
  width: auto;
  max-width: 100%;
  margin-inline: auto;
}

.youtube-embed {
  margin: 1rem 0 1.25rem;
}

.youtube-embed-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.youtube-embed-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.youtube-embed-caption {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.post-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1rem 0;
}

.post-cards-compact {
  gap: 0.85rem;
}

.post-card {
  display: grid;
  grid-template-columns: 173px minmax(0, 1fr);
  gap: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.post-card--no-image {
  grid-template-columns: 1fr;
}

.post-card-image-link {
  display: block;
  height: 100%;
}

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

.post-card-body {
  padding: 0.85rem 0.95rem 0.95rem 0;
  min-width: 0;
}

.post-card--no-image .post-card-body {
  padding: 0.85rem 0.95rem 0.95rem;
}

.post-card-title {
  margin: 0;
  font-size: 1.1rem;
}

.post-card-date {
  margin: 0.28rem 0 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.post-card-excerpt {
  margin: 0;
  color: #33435c;
}

.blog-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.blog-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  position: sticky;
  top: 1rem;
}

.blog-sidebar h2 {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
}

.category-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.category-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.38rem 0.5rem;
  border-radius: 8px;
  color: #24344f;
}

.category-list a:hover {
  background: #eef4ff;
  text-decoration: none;
}

.category-list a.is-active {
  background: #dce9ff;
  color: #173f81;
  font-weight: 600;
}

.category-count {
  color: var(--muted);
  font-size: 0.86rem;
}

.blog-filter-status {
  margin: 0.2rem 0 0.85rem;
  color: var(--muted);
}

.blog-empty-message {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  margin: 0 0 1rem;
  color: #41536f;
  background: #f8fbff;
}

.post-card-categories,
.post-meta-categories {
  margin: 0.2rem 0 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.category-chip {
  display: inline-block;
  font-size: 0.8rem;
  line-height: 1.2;
  padding: 0.2rem 0.5rem;
  border: 1px solid #bfd1ef;
  border-radius: 999px;
  background: #f0f6ff;
  color: #1d4f95;
}

.category-chip:hover {
  background: #e0edff;
  text-decoration: none;
}

.post-pagination {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.75rem;
  align-items: stretch;
}

.post-pagination-top {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
  margin: 0 0 0.5rem;
  position: sticky;
  top: 0.5rem;
  z-index: 20;
  width: fit-content;
  margin-left: auto;
  padding: 0.2rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(2px);
}

.post-nav-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: #2a3f64;
  background: #f8fbff;
  font-size: 0.95rem;
  line-height: 1;
}

.post-nav-icon-link:hover {
  text-decoration: none;
  background: #eef5ff;
}

.post-nav-icon-link.is-empty {
  pointer-events: none;
  opacity: 0.45;
}

.post-nav-link {
  display: block;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fbff;
  min-width: 0;
}

.post-nav-link:hover {
  text-decoration: none;
  background: #eef5ff;
}

.post-nav-link.is-empty {
  pointer-events: none;
  background: #f8fbff;
}

.post-nav-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.post-nav-title {
  display: block;
  margin-top: 0.15rem;
  color: #253755;
  font-size: 0.92rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-nav-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  white-space: nowrap;
}

.post-nav-back:hover {
  text-decoration: none;
  background: #f7faff;
}

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

  .wp-block-image.alignright,
  .wp-block-image.alignleft {
    float: none;
    margin: 1rem 0;
    max-width: 100%;
  }

  .home-logo,
  .home-logo-wide,
  .home-logo-compact {
    float: right;
    margin: 0 0 0.75rem 0.75rem;
  }

  .home-logo-wide {
    max-width: min(220px, 68vw);
  }

  .home-logo-compact {
    max-width: min(150px, 50vw);
  }

  .post-card {
    grid-template-columns: 1fr;
  }

  .post-card-image-link,
  .post-card-image {
    min-height: 0;
  }

  .post-card-body {
    padding: 0 0.9rem 0.9rem;
  }

  .home-post-cards .post-card-image-link {
    display: none;
  }

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

  .blog-sidebar {
    position: static;
  }

  .post-pagination {
    grid-template-columns: 1fr;
  }
}

/* Keep ordered-list numbering continuous across sections on /papers/. */
.page.page-papers .page-body {
  counter-reset: papers-item;
}

.page.page-papers .page-body > ol {
  list-style: none;
  margin-left: 0;
  padding-left: 2.4rem;
}

.page.page-papers .page-body > ol > li {
  counter-increment: papers-item;
  position: relative;
}

.page.page-papers .page-body > ol > li::before {
  content: counter(papers-item) ". ";
  position: absolute;
  left: -2.4rem;
  width: 2rem;
  text-align: right;
  color: var(--muted);
}
