/* Blog index and article pages.
 *
 * Loaded after styles.css, which supplies the tokens plus the shared pieces
 * both pages reuse as-is: .lang (the switcher), .btn, .link-underline.
 *
 * The blog chrome deliberately differs from the home page's: the header here
 * scrolls with the page (sticky, not fixed) and is a little shorter, because
 * these pages are for reading rather than for a first impression.
 */

.blog-page {
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
}

/* The index tints the whole page with the texture; the article does not, so its
 * long body copy sits on flat black. */
.blog-page--index {
  background: var(--bg) url('assets/img/background.webp') center top / 100% auto no-repeat;
}

.blog-wrap {
  max-width: 1366px;
  margin: 0 auto;
}

/* ---------------------------------------------------------- blog header */

.blog-header {
  position: sticky;
  top: 16px;
  margin: 16px auto 0;
  width: min(1206px, calc(100% - 24px));
  min-height: 72px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  gap: 12px;
  padding: 7px clamp(12px, 3vw, 24px);
  justify-content: space-between;
  align-items: center;
  z-index: 20;
}

.blog-header__logo {
  display: block;
  width: 111px;
  height: 51px;
  flex-shrink: 0;
}

.blog-header__logo img {
  width: 111px;
  height: 51px;
}

.blog-nav {
  display: flex;
  gap: 32px;
  align-items: center;
}

.blog-nav a { font-size: 16px; }

/* The current page is named, not just highlighted. */
.blog-nav a[aria-current='page'] {
  font-weight: 700;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--fg);
}

.blog-header__actions {
  display: flex;
  gap: clamp(10px, 2vw, 20px);
  align-items: center;
}

/* Shorter than the home page's 52px CTA — this header is 72px, not 80px. */
.btn--compact {
  height: 44px;
  padding: 0 20px;
  font-size: 15px;
}

/* -------------------------------------------------------- breadcrumbs */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--fg-muted);
}

.breadcrumb a { color: var(--fg-muted); }
.breadcrumb [aria-current='page'] { color: var(--fg); }

/* ------------------------------------------------------------ index hero */

.blog-hero {
  padding: clamp(56px, 9vw, 112px) var(--gutter) 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.blog-hero h1 {
  margin: 0;
  font-weight: 900;
  font-size: clamp(32px, 7vw, 56px);
  line-height: 1;
  text-transform: uppercase;
  text-wrap: balance;
}

.blog-hero__intro {
  margin: 0;
  max-width: 640px;
  font-size: 16px;
  line-height: 1.8;
  color: var(--fg-body);
  text-wrap: pretty;
}

.blog-cats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.blog-cat {
  height: 40px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 40px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--fg);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.3s, color 0.3s, border-color 0.3s, transform 0.2s;
}

.blog-cat:hover { transform: translateY(-2px); }

.blog-cat[aria-selected='true'] {
  background: var(--fg);
  color: #000;
  border-color: var(--fg);
}

/* -------------------------------------------------------------- featured */

.featured-wrap { padding: 16px var(--gutter); }

.featured {
  display: flex;
  flex-wrap: wrap;
  border-radius: 24px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.45s var(--ease), box-shadow 0.45s;
}

.featured:hover {
  transform: translateY(-6px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 30px 60px rgba(0, 0, 0, 0.5);
  color: var(--fg);
}

.featured__image {
  flex: 1 1 420px;
  min-height: clamp(240px, 34vw, 440px);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.featured__body {
  flex: 1 1 360px;
  padding: clamp(24px, 4vw, 48px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  justify-content: center;
}

.featured__body h2 {
  margin: 0;
  font-weight: 800;
  font-size: clamp(24px, 3.4vw, 36px);
  line-height: 1.15;
  text-wrap: balance;
}

.featured__body p {
  margin: 0;
  font-size: 15px;
  line-height: 1.75;
  color: rgb(200, 200, 200);
  text-wrap: pretty;
}

.featured__more {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
}

/* The metadata line: category pill, date, reading time. */
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  font-size: 12px;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}

.meta time { white-space: nowrap; }

.meta__pill {
  height: 26px;
  padding: 0 12px;
  border-radius: 26px;
  background: var(--fg);
  color: #000;
  display: flex;
  align-items: center;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ----------------------------------------------------------- post grid */

.posts-wrap { padding: 32px var(--gutter) 96px; }

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 24px;
}

.post-card {
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.45s var(--ease), box-shadow 0.45s;
}

.post-card:hover {
  transform: translateY(-6px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 24px 48px rgba(0, 0, 0, 0.5);
  color: var(--fg);
}

.post-card__image {
  aspect-ratio: 16 / 10;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.post-card__body {
  padding: 20px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.post-card__body h3 {
  margin: 0;
  font-weight: 700;
  font-size: 19px;
  line-height: 1.3;
  text-wrap: balance;
}

.post-card__body p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: rgb(190, 190, 190);
  text-wrap: pretty;
}

.post-card .meta {
  gap: 4px 10px;
  white-space: nowrap;
}

.post-card .meta__cat {
  font-weight: 700;
  color: var(--fg);
}

.blog-empty {
  padding: 48px 0 96px;
  font-size: 16px;
  color: var(--fg-muted);
}

/* ------------------------------------------------------- article page */

/* Reading progress. Fixed to the very top, above the sticky header. */
.progress {
  position: fixed;
  left: 0;
  top: 0;
  height: 3px;
  width: 0;
  background: var(--fg);
  z-index: 30;
}

.article-hero {
  padding: clamp(48px, 8vw, 96px) var(--gutter) 32px;
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.article-hero h1 {
  margin: 0;
  font-weight: 900;
  font-size: clamp(30px, 5.6vw, 52px);
  line-height: 1.08;
  text-wrap: balance;
}

.article-hero__excerpt {
  margin: 0;
  font-size: 18px;
  line-height: 1.7;
  color: rgb(200, 200, 200);
  text-wrap: pretty;
}

.article-hero .meta {
  gap: 12px;
  font-size: 13px;
}

.article-hero .meta__pill {
  height: 28px;
  border-radius: 28px;
}

.article-cover-wrap {
  padding: 0 var(--gutter);
  max-width: 1366px;
  margin: 0 auto;
}

.article-cover {
  height: clamp(260px, 42vw, 560px);
  border-radius: 24px;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.article-layout {
  padding: clamp(40px, 6vw, 72px) var(--gutter);
  max-width: 1166px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: clamp(32px, 5vw, 64px);
  align-items: flex-start;
}

/* Table of contents. Tracks the section you are reading. */
.toc {
  flex: 0 1 240px;
  position: sticky;
  top: 120px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toc__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.toc a {
  font-size: 14px;
  line-height: 1.4;
  color: rgb(150, 150, 150);
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  transition: color 0.3s, border-color 0.3s;
}

.toc a.is-active {
  color: var(--fg);
  border-left-color: var(--fg);
}

.article-body {
  flex: 1 1 520px;
  min-width: 0;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.article-body section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-margin-top: 120px;
}

.article-body h2 {
  margin: 0;
  font-weight: 800;
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.2;
}

.article-body p {
  margin: 0;
  font-size: 17px;
  line-height: 1.85;
  color: rgb(215, 215, 215);
  text-wrap: pretty;
}

.article-cta {
  margin-top: 12px;
  border-radius: 24px;
  padding: clamp(24px, 4vw, 36px);
  background: url('assets/img/background.webp') center / cover no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.article-cta h2 {
  margin: 0;
  font-weight: 800;
  font-size: 24px;
  line-height: 1.2;
  text-transform: uppercase;
}

.article-cta p {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--fg-body);
}

.article-cta__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.article-cta .btn { padding: 0 24px; }

.article-cta .btn--ghost {
  padding: 0 24px 0 16px;
  gap: 10px;
}

.article-cta .btn--ghost img {
  width: 22px;
  height: 22px;
}

/* -------------------------------------------------------------- related */

.related {
  padding: 0 var(--gutter) 96px;
  max-width: 1366px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.related h2 {
  margin: 0;
  font-weight: 700;
  font-size: clamp(22px, 3vw, 28px);
  text-transform: uppercase;
}

.related__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 24px;
}

.related-card {
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.45s var(--ease);
}

.related-card:hover {
  transform: translateY(-6px);
  color: var(--fg);
}

.related-card__image {
  aspect-ratio: 16 / 10;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.related-card__body {
  padding: 18px 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.related-card__cat {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-muted);
}

.related-card__body h3 {
  margin: 0;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.3;
}

/* --------------------------------------------------------------- footer */

.blog-footer {
  background: var(--bg-raised);
  padding: 40px var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.blog-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

/* --------------------------------------------------------------- mobile */

@media (max-width: 900px) {
  .blog-nav { display: none; }
  .toc { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .featured,
  .post-card,
  .related-card,
  .blog-cat { transition: none; }
}
