/* Blog article layout: hero, sticky contents, readable prose. Uses the site tokens from style.css. */

.post {
  --prose: rgba(26, 26, 46, 0.86);
  --rule: rgba(26, 26, 46, 0.12);
  --tint: #f7f7f8;
  --measure: 720px;
}

/* Reading progress */
.post-progress {
  position: fixed;
  inset: 0 0 auto;
  height: 3px;
  z-index: 30;
  pointer-events: none;
}

.post-progress span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--white);
  transform-origin: 0 50%;
  transform: scaleX(var(--read, 0));
}

/* Hero */
.post-hero {
  padding: clamp(48px, 7vw, 96px) 0 clamp(56px, 7vw, 88px);
  background: var(--academy-black);
  color: var(--white);
}

.post-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  align-items: end;
  gap: clamp(40px, 6vw, 88px);
}

.post-hero h1 {
  max-width: 17ch;
  margin: 0;
  font-size: clamp(2.1rem, 4.4vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.post-lede {
  max-width: 62ch;
  margin: 24px 0 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  line-height: 1.65;
}

.post-meta {
  margin-top: 32px;
  padding-top: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.post-avatar {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--light-grey);
  color: var(--academy-black);
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 1.2rem;
}

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

.post-meta-author {
  display: grid;
  line-height: 1.3;
}

.post-meta-author a {
  color: var(--white);
  font-weight: 600;
  text-decoration: none;
}

.post-meta-author a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-meta-author span,
.post-meta-facts {
  color: rgba(255, 255, 255, 0.62);
  font-family: var(--font-label);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.post-meta-facts {
  display: flex;
  gap: 16px;
  margin-left: auto;
}

.post-meta-facts span + span::before {
  content: "·";
  margin-right: 16px;
}

.post-hero-media {
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.post-hero-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  filter: grayscale(1) contrast(1.05);
}

.post-hero-media figcaption {
  padding: 14px 16px;
  display: grid;
  gap: 4px;
  background: var(--white);
  color: var(--academy-black);
}

.post-hero-media figcaption span {
  color: var(--mid-grey);
  font-family: var(--font-label);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post-hero-media figcaption strong {
  font-family: var(--font-headline);
  font-size: 1.05rem;
}

/* Layout: contents rail + article */
.post-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, var(--measure));
  justify-content: center;
  gap: clamp(48px, 6vw, 96px);
  padding-block: clamp(48px, 7vw, 96px);
}

.post-toc details {
  position: sticky;
  top: calc(var(--header-height) + 32px);
}

.post-toc summary {
  margin-bottom: 16px;
  list-style: none;
  cursor: pointer;
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mid-grey);
}

.post-toc summary::-webkit-details-marker {
  display: none;
}

.post-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--rule);
}

.post-toc a {
  display: block;
  margin-left: -1px;
  padding: 8px 0 8px 16px;
  border-left: 2px solid transparent;
  color: var(--mid-grey);
  font-size: 0.9rem;
  line-height: 1.4;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s;
}

.post-toc a:hover,
.post-toc a[aria-current="true"] {
  color: var(--academy-black);
  border-left-color: var(--academy-black);
}

.post-toc a[aria-current="true"] {
  font-weight: 600;
}

/* Prose */
.post-body {
  min-width: 0;
  color: var(--prose);
  font-size: 1.125rem;
  line-height: 1.75;
}

.post-section {
  scroll-margin-top: calc(var(--header-height) + 24px);
}

.post-section + .post-section {
  margin-top: clamp(48px, 6vw, 72px);
  padding-top: clamp(40px, 5vw, 56px);
  border-top: 1px solid var(--rule);
}

.post-body .post-kicker {
  margin: 0 0 12px;
  color: var(--mid-grey);
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-body h2 {
  margin: 0 0 20px;
  color: var(--academy-black);
  font-size: clamp(1.6rem, 2.6vw, 2.15rem);
  line-height: 1.18;
}

.post-body h3 {
  margin: 36px 0 10px;
  color: var(--academy-black);
  font-family: var(--font-headline);
  font-size: 1.3rem;
  line-height: 1.3;
}

.post-body p {
  margin: 0 0 1.1em;
  max-width: none;
  color: inherit;
  font-size: inherit;
}

/* Answer-first opening line of each section */
.post-body h2 + p {
  color: var(--academy-black);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.6;
}

.post-body a {
  color: var(--academy-black);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgba(26, 26, 46, 0.35);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.2s;
}

.post-body a:hover {
  text-decoration-color: var(--academy-black);
}

.post-body strong {
  color: var(--academy-black);
}

/* Numbered lists */
.post-body ol {
  margin: 8px 0 1.4em;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.post-body ol > li {
  counter-increment: step;
  position: relative;
  padding: 14px 0 14px 52px;
  border-bottom: 1px solid var(--rule);
}

.post-body ol > li:first-child {
  border-top: 1px solid var(--rule);
}

.post-body ol > li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 16px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--academy-black);
  color: var(--white);
  font-family: var(--font-label);
  font-size: 0.74rem;
}

/* Check lists (older posts) */
.post-body .check-list {
  margin: 8px 0 1.4em;
  border-top: 1px solid var(--rule);
}

.post-body .check-list li {
  padding: 12px 0 12px 32px;
  position: relative;
  border-bottom: 1px solid var(--rule);
}

.post-body .check-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 21px;
  width: 12px;
  height: 7px;
  border-left: 2px solid var(--academy-black);
  border-bottom: 2px solid var(--academy-black);
  transform: rotate(-45deg);
}

/* Tables */
.post-body .table-wrap {
  margin: 8px 0 12px;
  overflow-x: auto;
  border: 1px solid var(--rule);
  -webkit-overflow-scrolling: touch;
}

.post-body .compare-table {
  min-width: 560px;
  font-size: 0.94rem;
  line-height: 1.5;
}

.post-body .compare-table th,
.post-body .compare-table td {
  padding: 14px 16px !important;
  border-bottom: 1px solid var(--rule) !important;
  vertical-align: top;
  text-align: left;
}

.post-body .compare-table thead th {
  background: var(--academy-black);
  color: var(--white);
  font-family: var(--font-label);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 0 !important;
}

.post-body .compare-table tbody tr:nth-child(even) {
  background: var(--tint);
}

.post-body .compare-table tbody tr:last-child td {
  border-bottom: 0 !important;
}

.post-body .compare-table td:first-child {
  color: var(--academy-black);
}

.post-body .table-wrap + p {
  color: var(--mid-grey);
  font-size: 0.86rem !important;
  margin-top: 0 !important;
}

/* FAQ */
.post-body .faq-list {
  border-top: 1px solid var(--rule);
}

.post-body .faq-list details {
  border-bottom: 1px solid var(--rule);
}

.post-body .faq-list summary {
  min-height: 0;
  padding: 20px 48px 20px 0;
  font-family: var(--font-body);
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--academy-black);
  cursor: pointer;
}

.post-body .faq-list summary::after {
  top: 50%;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  transform: translateY(-50%);
  font-size: 1rem;
  right: 0;
}

.post-body .faq-list details[open] summary::after {
  background: var(--academy-black);
  color: var(--white);
  border-color: var(--academy-black);
}

.post-body .faq-list details > div {
  padding: 0 48px 22px 0;
  color: var(--prose);
  font-size: 1.02rem;
}

.post-body .faq-list details > div p {
  margin: 0;
}

.post-body .faq-list summary:focus-visible {
  outline: 2px solid var(--academy-black);
  outline-offset: 4px;
}

/* Author box */
.post-author {
  margin-top: clamp(48px, 6vw, 72px);
  padding: 24px;
  display: flex;
  gap: 18px;
  align-items: flex-start;
  background: var(--tint);
  border-left: 3px solid var(--academy-black);
}

.post-author p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
}

@media (max-width: 1100px) {
  .post-layout {
    grid-template-columns: minmax(0, var(--measure));
  }

  .post-toc details {
    position: static;
    padding: 16px 20px;
    border: 1px solid var(--rule);
    background: var(--tint);
  }

  .post-toc summary {
    margin: 0;
    display: flex;
    justify-content: space-between;
    color: var(--academy-black);
  }

  .post-toc summary::after {
    content: "+";
  }

  .post-toc details[open] summary {
    margin-bottom: 12px;
  }

  .post-toc details[open] summary::after {
    content: "−";
  }
}

@media (max-width: 900px) {
  .post-hero-grid {
    grid-template-columns: 1fr;
  }

  .post-hero-media {
    max-width: 480px;
  }

  .post-meta-facts {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 600px) {
  .post-body {
    font-size: 1.05rem;
  }

  .post-body h2 + p {
    font-size: 1.1rem;
  }

  .post-hero-media {
    display: none;
  }

  .post-author {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .post-related .info-card,
  .post-toc a {
    transition: none;
  }
}

@media print {
  .post-toc,
  .post-progress,
  .post-related {
    display: none;
  }

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

/* Blog hub + related: image card grid */
.blog-index-head {
  margin-bottom: clamp(32px, 4vw, 48px);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 48px;
}

.blog-index-head h2 {
  max-width: 16ch;
  margin: 0;
  font-size: clamp(2rem, 3.6vw, 3rem);
}

.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.blog-filters button {
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid rgba(26, 26, 46, 0.2);
  background: var(--white);
  color: var(--academy-black);
  font-family: var(--font-label);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.blog-filters button:hover {
  border-color: var(--academy-black);
}

.blog-filters button[aria-pressed="true"] {
  background: var(--academy-black);
  border-color: var(--academy-black);
  color: var(--white);
}

.blog-filters button:focus-visible {
  outline: 2px solid var(--academy-black);
  outline-offset: 3px;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 2.4vw, 32px);
}

.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid rgba(26, 26, 46, 0.12);
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}

.post-card[hidden] {
  display: none;
}

.post-card-media {
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--academy-black);
}

.post-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.post-card-body {
  flex: 1;
  padding: 24px 24px 22px;
  display: flex;
  flex-direction: column;
}

.post-card-tag {
  margin: 0 0 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--mid-grey);
  font-family: var(--font-label);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-card-tag span {
  padding: 4px 8px;
  background: var(--academy-black);
  color: var(--white);
}

.post-card h3 {
  margin: 0 0 10px;
  font-size: clamp(1.25rem, 1.6vw, 1.45rem);
  line-height: 1.25;
}

.post-card h3 a {
  color: var(--academy-black);
  text-decoration: none;
}

.post-card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.post-card-excerpt {
  margin: 0;
  color: rgba(26, 26, 46, 0.72);
  font-size: 0.98rem;
  line-height: 1.6;
}

.post-card-meta {
  margin: auto 0 0;
  padding-top: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--mid-grey);
  font-family: var(--font-label);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post-card-meta span + span::before {
  content: "·";
  margin-right: 12px;
}

.post-card-meta::after {
  content: "Read →";
  margin-left: auto;
  color: var(--academy-black);
}

.post-card:hover {
  transform: translateY(-4px);
  border-color: var(--academy-black);
  box-shadow: 0 18px 40px rgba(26, 26, 46, 0.1);
}

.post-card:hover .post-card-media img {
  transform: scale(1.04);
}

.post-card:hover h3 a {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

.post-card:focus-within {
  outline: 2px solid var(--academy-black);
  outline-offset: 3px;
}

@media (max-width: 1000px) {
  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .blog-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    padding-bottom: 4px;
  }

  .blog-filters button {
    flex: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .post-card,
  .post-card-media img,
  .blog-filters button {
    transition: none;
  }

  .post-card:hover,
  .post-card:hover .post-card-media img {
    transform: none;
  }
}

.blog-hub .section-dark h2 {
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
}

@media (max-width: 600px) {
  .blog-hub .page-hero-media {
    display: none;
  }
}
