/* Content pages: light glass technology layer */
.content-shell {
  min-height: 100vh;
  background-color: #f7f8fb;
  background-image:
    radial-gradient(circle at 12% 10%, rgba(14, 165, 233, 0.16), transparent 30%),
    radial-gradient(circle at 82% 8%, rgba(168, 85, 247, 0.12), transparent 28%),
    radial-gradient(circle at 70% 88%, rgba(20, 184, 166, 0.12), transparent 34%),
    linear-gradient(135deg, #fbfcff 0%, #f3f6fb 52%, #f8fafc 100%);
}

.content-shell::before {
  opacity: 0.55;
}

.content-frame {
  position: relative;
}

.content-frame::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 82%);
  z-index: -1;
}

.content-glass {
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.36));
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(22px) saturate(1.25);
}

.content-nav {
  border: 1px solid rgba(255, 255, 255, 0.68);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(18px) saturate(1.25);
}

.content-eyebrow {
  letter-spacing: 0.16em;
}

.filter-rail {
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.46);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(18px) saturate(1.18);
}

.tag-filter-btn {
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(255, 255, 255, 0.6);
  color: #475569;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.tag-filter-btn:hover {
  border-color: rgba(14, 165, 233, 0.38);
  color: #0369a1;
  transform: translateY(-1px);
}

.tag-chip-active,
.tag-filter-btn[aria-pressed="true"] {
  border-color: rgba(14, 165, 233, 0.46);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.18), rgba(99, 102, 241, 0.14));
  color: #075985;
  box-shadow: 0 10px 28px rgba(14, 165, 233, 0.12);
}

.articles-bento-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: 92px;
  gap: 0.9rem;
}

.home-bento-grid,
.home-article-bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: 96px;
  gap: 0.9rem;
}

.home-bento-grid > a {
  position: relative;
  grid-column: span 4;
  grid-row: span 2;
  min-height: 0;
  overflow: hidden;
  border-radius: 20px;
  border-color: rgba(255, 255, 255, 0.68) !important;
  background:
    radial-gradient(circle at 88% 16%, rgba(56, 189, 248, 0.18), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.38)) !important;
  box-shadow: 0 18px 54px rgba(15, 23, 42, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px) saturate(1.2);
}

.home-bento-grid > a:nth-child(1) {
  grid-column: span 5;
  grid-row: span 3;
  background:
    radial-gradient(circle at 84% 8%, rgba(245, 158, 11, 0.24), transparent 34%),
    radial-gradient(circle at 18% 90%, rgba(14, 165, 233, 0.18), transparent 38%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(255, 251, 235, 0.45)) !important;
}

.home-bento-grid > a:nth-child(2),
.home-bento-grid > a:nth-child(7) {
  grid-column: span 7;
  grid-row: span 2;
}

.home-bento-grid > a:nth-child(3),
.home-bento-grid > a:nth-child(4),
.home-bento-grid > a:nth-child(6) {
  grid-column: span 3;
  grid-row: span 1;
}

.home-bento-grid > a:nth-child(5),
.home-bento-grid > a:nth-child(8) {
  grid-column: span 4;
  grid-row: span 2;
}

.home-bento-grid > a:nth-child(9) {
  grid-column: span 5;
  grid-row: span 2;
}

.home-bento-grid > a::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(56, 189, 248, 0.12), transparent 34%, rgba(168, 85, 247, 0.1)),
    linear-gradient(to top, rgba(15, 23, 42, 0.05), transparent 62%);
  opacity: 0;
  transition: opacity 260ms ease;
}

.home-bento-grid > a:hover::after {
  opacity: 1;
}

.home-bento-grid > a h3 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.home-bento-grid > a p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.home-bento-grid > a:nth-child(3) p,
.home-bento-grid > a:nth-child(4) p,
.home-bento-grid > a:nth-child(6) p,
.home-bento-grid > a:nth-child(3) > span:last-child,
.home-bento-grid > a:nth-child(4) > span:last-child,
.home-bento-grid > a:nth-child(6) > span:last-child {
  display: none;
}

.home-bento-grid > a:nth-child(3),
.home-bento-grid > a:nth-child(4),
.home-bento-grid > a:nth-child(6) {
  padding: 1rem !important;
  justify-content: center;
}

.home-article-bento {
  grid-auto-rows: 92px;
}

.article-card {
  position: relative;
  overflow: hidden;
  min-height: 0;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.34));
  box-shadow: 0 18px 54px rgba(15, 23, 42, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px) saturate(1.2);
  transform: translateY(0);
  transition: transform 260ms ease, border-color 260ms ease, box-shadow 260ms ease;
}

#articles-grid {
  transition: opacity 180ms ease, transform 180ms ease;
}

.article-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.16), transparent 34%, rgba(168, 85, 247, 0.1));
  opacity: 0;
  transition: opacity 260ms ease;
}

.article-card--feature {
  grid-column: span 4;
  grid-row: span 3;
}

.article-card--wide {
  grid-column: span 8;
  grid-row: span 2;
}

.article-card--compact {
  grid-column: span 4;
  grid-row: span 1;
}

.article-card--tall {
  grid-column: span 4;
  grid-row: span 2;
}

.article-card--text {
  grid-column: span 4;
  grid-row: span 2;
}

.article-card:hover {
  border-color: rgba(14, 165, 233, 0.34);
  box-shadow: 0 24px 76px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.86);
  transform: translateY(-4px);
}

.article-card:hover::before {
  opacity: 1;
}

.article-card-cover {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
  object-fit: cover;
  filter: saturate(0.96) contrast(1.02);
  transition: transform 560ms ease, filter 560ms ease;
}

.article-card:hover .article-card-cover {
  transform: scale(1.045);
  filter: saturate(1.08) contrast(1.04);
}

.article-card-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(15, 23, 42, 0.74), rgba(15, 23, 42, 0.22) 54%, rgba(15, 23, 42, 0.08)),
    linear-gradient(135deg, rgba(14, 165, 233, 0.18), transparent 42%, rgba(168, 85, 247, 0.16));
  z-index: 1;
}

.article-card-body {
  position: relative;
  z-index: 3;
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1rem;
  pointer-events: none;
}

.article-docx {
  pointer-events: auto;
}

.article-card--feature .article-card-body,
.article-card--wide .article-card-body {
  padding: 1rem;
}

.article-card-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.38);
}

.article-card-summary {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: rgba(255, 255, 255, 0.74);
}

.article-card--compact .article-card-summary,
.article-card--compact .article-card-tags,
.article-card--compact .article-docx,
.article-card--compact .article-card-meta iconify-icon {
  display: none;
}

.article-card--compact .article-card-title {
  -webkit-line-clamp: 1;
}

.article-card--text .article-card-cover {
  opacity: 0.14;
  filter: saturate(1.2) blur(1px);
}

.article-card--text .article-card-shade {
  background:
    radial-gradient(circle at 18% 18%, rgba(14, 165, 233, 0.18), transparent 38%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.46));
}

.article-card--text .article-card-title {
  color: #1e293b;
  text-shadow: none;
}

.article-card--text .article-card-summary {
  color: #64748b;
}

.article-card--text .article-tag,
.article-card--text .article-card-meta {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.58);
  color: #64748b;
}

.article-tag {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
}

.content-reveal {
  opacity: 0;
  transform: translateY(14px);
}

.content-ready .content-reveal {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 520ms ease, transform 520ms cubic-bezier(0.16, 1, 0.3, 1);
}

.page-fade-out {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.reader-panel {
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.52));
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(22px) saturate(1.2);
}

.reader-side-card {
  border: 1px solid rgba(255, 255, 255, 0.68);
  background: rgba(255, 255, 255, 0.48);
  box-shadow: 0 18px 56px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(18px) saturate(1.16);
}

.markdown-body pre {
  position: relative;
}

.code-copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: #475569;
  padding: 0.28rem 0.62rem;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 180ms ease, transform 180ms ease, background 180ms ease, color 180ms ease;
}

.markdown-body pre:hover .code-copy-btn,
.code-copy-btn:focus-visible {
  opacity: 1;
  transform: translateY(0);
}

.toc-link {
  border-radius: 999px;
  padding-right: 0.75rem;
}

.toc-link.active {
  background: rgba(14, 165, 233, 0.1);
  color: #0369a1;
  border-left-color: #0ea5e9;
}

html.dark .content-shell {
  background-color: #080b12;
  background-image:
    radial-gradient(circle at 16% 12%, rgba(59, 130, 246, 0.16), transparent 30%),
    radial-gradient(circle at 82% 10%, rgba(20, 184, 166, 0.11), transparent 30%),
    radial-gradient(circle at 58% 88%, rgba(124, 58, 237, 0.1), transparent 36%),
    linear-gradient(135deg, #080b12 0%, #0d1320 48%, #08111d 100%) !important;
}

html.dark .content-frame::before {
  background:
    linear-gradient(rgba(148, 163, 184, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.055) 1px, transparent 1px);
}

html.dark .content-glass,
html.dark .content-nav,
html.dark .filter-rail,
html.dark .article-card,
html.dark .reader-panel,
html.dark .reader-side-card {
  border-color: rgba(148, 163, 184, 0.18) !important;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.72), rgba(8, 13, 24, 0.5)) !important;
  box-shadow: 0 24px 76px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html.dark .article-card::before {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), transparent 36%, rgba(168, 85, 247, 0.1));
}

html.dark .tag-filter-btn,
html.dark .article-tag {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.5);
  color: #cbd5e1;
}

html.dark .article-card--text .article-card-shade {
  background:
    radial-gradient(circle at 18% 18%, rgba(14, 165, 233, 0.16), transparent 38%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.74), rgba(8, 13, 24, 0.56));
}

html.dark .article-card--text .article-card-title {
  color: #f8fafc;
}

html.dark .article-card--text .article-card-summary {
  color: #cbd5e1;
}

html.dark .article-card--text .article-tag,
html.dark .article-card--text .article-card-meta {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.5);
  color: #cbd5e1;
}

html.dark .tag-chip-active,
html.dark .tag-filter-btn[aria-pressed="true"] {
  border-color: rgba(103, 232, 249, 0.34) !important;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.16), rgba(99, 102, 241, 0.12)) !important;
  color: #a5f3fc !important;
}

html.dark .toc-link.active {
  background: rgba(14, 165, 233, 0.12);
  color: #67e8f9 !important;
  border-left-color: #67e8f9 !important;
}

html.dark .code-copy-btn {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.82);
  color: #cbd5e1;
}

@media (prefers-reduced-motion: reduce) {
  .content-reveal,
  .content-ready .content-reveal,
  .page-fade-out,
  .article-card,
  .article-card-cover {
    transition: none !important;
    transform: none !important;
  }
}

@media (max-width: 1023px) {
  .home-bento-grid,
  .home-article-bento {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-auto-rows: 104px;
  }

  .home-bento-grid > a,
  .home-bento-grid > a:nth-child(1),
  .home-bento-grid > a:nth-child(2),
  .home-bento-grid > a:nth-child(5),
  .home-bento-grid > a:nth-child(7),
  .home-bento-grid > a:nth-child(8),
  .home-bento-grid > a:nth-child(9) {
    grid-column: span 6;
    grid-row: span 2;
  }

  .home-bento-grid > a:nth-child(3),
  .home-bento-grid > a:nth-child(4),
  .home-bento-grid > a:nth-child(6) {
    grid-column: span 3;
    grid-row: span 2;
  }

  .articles-bento-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-auto-rows: 104px;
  }

  .article-card--feature,
  .article-card--wide,
  .article-card--text {
    grid-column: span 6;
    grid-row: span 2;
  }

  .article-card--compact,
  .article-card--tall {
    grid-column: span 3;
    grid-row: span 2;
  }
}

@media (max-width: 640px) {
  .home-bento-grid,
  .home-article-bento {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .home-bento-grid > a,
  .home-bento-grid > a:nth-child(1),
  .home-bento-grid > a:nth-child(2),
  .home-bento-grid > a:nth-child(3),
  .home-bento-grid > a:nth-child(4),
  .home-bento-grid > a:nth-child(5),
  .home-bento-grid > a:nth-child(6),
  .home-bento-grid > a:nth-child(7),
  .home-bento-grid > a:nth-child(8),
  .home-bento-grid > a:nth-child(9) {
    grid-column: span 1;
    grid-row: auto;
    min-height: 150px;
  }

  .articles-bento-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .article-card,
  .article-card--feature,
  .article-card--wide,
  .article-card--compact,
  .article-card--tall,
  .article-card--text {
    grid-column: span 1;
    grid-row: auto;
    min-height: 168px;
  }

  .article-card--compact .article-card-summary {
    display: -webkit-box;
  }
}
