:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --text: #151922;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
}

* {
  box-sizing: border-box;
}

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

body.viewer-open {
  overflow: hidden;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 22px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: block;
  width: 150px;
  height: 58px;
  border-radius: 0;
  object-fit: cover;
  object-position: center 38%;
}

.brand-copy {
  display: block;
  min-width: 0;
  padding-left: 4px;
  padding-top: 15px;
}

.brand strong {
  display: block;
  line-height: 1.1;
  letter-spacing: 0;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 64px;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.toolbar h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: 0;
}

.toolbar p {
  margin: 8px 0 0;
  max-width: 620px;
  color: var(--muted);
  line-height: 1.6;
}

.pill {
  flex: 0 0 auto;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #1d4ed8;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.post-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.05);
  transition: transform 160ms ease, border-color 160ms ease;
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: #b7c2d4;
}

.cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: linear-gradient(135deg, #111827, #1d4ed8);
}

.cover-placeholder {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  overflow: hidden;
  padding: clamp(16px, 4vw, 30px);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(135deg, #101828 0%, #183463 52%, #0f766e 100%);
  background-size: 38px 38px, 38px 38px, auto;
  color: #fff;
}

.cover-placeholder::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  pointer-events: none;
}

.cover-placeholder strong,
.cover-placeholder span,
.cover-kicker {
  position: relative;
  z-index: 1;
}

.cover-placeholder strong {
  display: -webkit-box;
  overflow: hidden;
  max-width: 880px;
  font-size: clamp(24px, 5vw, 54px);
  line-height: 1.04;
  letter-spacing: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.post-card .cover-placeholder strong {
  font-size: clamp(18px, 1.8vw, 25px);
  line-height: 1.1;
  -webkit-line-clamp: 3;
}

.post-card .cover-placeholder {
  padding: 18px;
}

.cover-placeholder span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cover-kicker {
  align-self: flex-start;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #d9f99d;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.post-card-body {
  padding: 18px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}

.tag {
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  padding: 4px 8px;
  font-weight: 700;
}

.publisher-byline {
  margin: -2px 0 10px;
  color: #315d9c;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

.post-card h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

.post-card p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 780px) minmax(260px, 320px);
  align-items: start;
  gap: 28px;
}

.article {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
}

.article h1 {
  margin: 0;
  max-width: 900px;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.04;
  letter-spacing: 0;
}

.article > div > .publisher-byline {
  margin-top: 12px;
  font-size: 15px;
}

.article .cover {
  border-radius: 8px;
  border: 1px solid var(--line);
}

.cover-button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: zoom-in;
  text-align: inherit;
}

.cover-button .cover {
  transition: border-color 160ms ease, filter 160ms ease, transform 160ms ease;
}

.cover-button:hover .cover,
.cover-button:focus-visible .cover {
  border-color: #9db0cc;
  filter: brightness(0.96);
}

.cover-button:focus-visible {
  border-radius: 8px;
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 4px;
}

.article-body {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: clamp(20px, 4vw, 38px);
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.05);
}

.article-body :first-child {
  margin-top: 0;
}

.article-body p,
.article-body li {
  color: #344054;
  line-height: 1.75;
}

.article-body pre {
  overflow-x: auto;
  border-radius: 8px;
  background: #101828;
  color: #f9fafb;
  padding: 16px;
}

.empty {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #fff;
  padding: 42px;
  text-align: center;
  color: var(--muted);
}

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.9);
  padding: 28px;
}

.image-viewer[aria-hidden="false"] {
  display: flex;
}

.image-viewer-image {
  display: block;
  max-width: min(1120px, 100%);
  max-height: calc(100vh - 56px);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.44);
  object-fit: contain;
}

.image-viewer-close {
  position: fixed;
  top: 18px;
  right: 18px;
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #ffffff;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.image-viewer-close:hover,
.image-viewer-close:focus-visible {
  background: rgba(255, 255, 255, 0.16);
}

.recommendations {
  position: sticky;
  top: 108px;
  display: grid;
  gap: 14px;
}

.recommendations-header {
  display: grid;
  gap: 4px;
}

.recommendations-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.recommendations-header strong {
  font-size: 22px;
  line-height: 1.1;
}

.recommendation-list {
  display: grid;
  gap: 12px;
}

.recommendation-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: inherit;
  padding: 12px;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.04);
  transition: transform 160ms ease, border-color 160ms ease;
}

.recommendation-card:hover {
  transform: translateY(-2px);
  border-color: #b7c2d4;
}

.recommendation-card .cover {
  height: 74px;
  min-height: 74px;
  border-radius: 6px;
  border: 1px solid var(--line);
  aspect-ratio: auto;
}

.recommendation-card .cover-placeholder {
  padding: 9px;
}

.recommendation-card .cover-placeholder::after,
.recommendation-card .cover-kicker,
.recommendation-card .cover-placeholder span {
  display: none;
}

.recommendation-card .cover-placeholder strong {
  font-size: 13px;
  line-height: 1.12;
  -webkit-line-clamp: 4;
}

.recommendation-card .meta {
  gap: 6px;
  margin-bottom: 7px;
}

.recommendation-card .tag {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recommendation-card h2 {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  font-size: 15px;
  line-height: 1.28;
  letter-spacing: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.recommendation-card p {
  display: -webkit-box;
  overflow: hidden;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

@media (max-width: 720px) {
  .toolbar {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 980px) {
  .article-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .recommendations {
    position: static;
  }

  .recommendation-list {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

@media (max-width: 520px) {
  .recommendation-card {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .recommendation-card .cover {
    height: 68px;
    min-height: 68px;
  }
}
