/* ============================================================
   Articles & Essays — list and detail
   ============================================================ */

/* ---- List container ---- */
.articles-list {
  border-top: var(--border);
  display: flex;
  flex-direction: column;
  gap: 80px;
  padding-bottom: 80px;
  /* full-width — items control their own layout */
}

/* ---- Shared text elements ---- */
.article-item-cat {
  font-size: 16px;
  letter-spacing: 0.18em;
}

.article-item-subtitle {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 10px;
}

.article-item-excerpt {
  font-size: 14px;
  color: var(--text-body);
  line-height: 2.0;
  margin-top: 18px;
  letter-spacing: 0.01em;
}

.article-item-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
}

.article-item-date {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.article-item-read {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--pink);
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 0.5px solid var(--pink);
  padding-bottom: 2px;
  transition: opacity 0.2s;
}

.article-item-read:hover {
  opacity: 0.65;
}

/* ---- No-image typographic placeholder ---- */
.article-no-image-initial {
  font-family: var(--font-serif);
  font-size: clamp(120px, 18vw, 240px);
  color: var(--text-dim);
  font-weight: 400;
  line-height: 1;
  user-select: none;
  letter-spacing: -0.04em;
}

/* ============================================================
   Hero article — first item, full-width, image-left
   ============================================================ */
.article-hero {
  display: flex;
  min-height: 70vh;
  max-height: 100vh;
  border-top: var(--border);
  border-bottom: var(--border);
}

.article-hero-image-link {
  display: flex;
  flex: 1;
  min-width: 0;
  padding: 72px 48px;
  background: var(--bg-s2);
  overflow: hidden;
}

.article-hero-no-image {
  flex: 1;
  min-width: 0;
  padding: 72px 48px;
  background: var(--bg-s2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.article-hero-image-wrap {
  height: 100%;
  overflow: hidden;
}

.article-hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.article-hero-image-link:hover .article-hero-image {
  transform: scale(1.04);
}

.article-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 4px;
  height: 100%;
  background: #1c1418;
  overflow: hidden;
}

.article-preview-grid-image {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  display: block;
  transition: transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.article-preview-grid-image:hover {
  transform: scale(1.04);
}

.article-hero-body {
  width: min(540px, 60%);
  flex: none;
  padding: 72px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: var(--border);
}


.article-hero-title {
  font-family: var(--font-serif);
  font-size: clamp(32px, 4vw, 62px);
  color: var(--text-primary);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin-top: 18px;
}

.article-hero-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.25s;
}

.article-hero-title a:hover {
  color: var(--pink);
}

/* ============================================================
   Split articles — subsequent items, alternating sides
   ============================================================ */
.article-split {
  display: flex;
  min-height: 70vh;
  max-height: 100vh;
  border-top: var(--border);
  border-bottom: var(--border);
}

/* Reverse: push image to the right */
.article-split--reverse .article-split-image-link,
.article-split--reverse .article-split-no-image-panel {
  order: 2;
}

.article-split--reverse .article-split-body {
  order: 1;
  border-left: none;
  border-right: var(--border);
}

.article-split-image-link {
  display: flex;
  flex: 1;
  min-width: 0;
  padding: 72px 48px;
  background: var(--bg-s2);
  overflow: hidden;
}

.article-split-no-image-panel {
  flex: 1;
  min-width: 0;
  padding: 72px 48px;
  background: var(--bg-s2);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.article-split-image-wrap {
  height: 100%;
  overflow: hidden;
}

.article-split-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.article-split-image-link:hover .article-split-image {
  transform: scale(1.04);
}

.article-split-body {
  width: min(540px, 60%);
  flex: none;
  padding: 72px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: var(--border);
}

.article-split-title {
  font-family: var(--font-serif);
  font-size: clamp(24px, 3vw, 48px);
  color: var(--text-primary);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin-top: 14px;
}

.article-split-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.25s;
}

.article-split-title a:hover {
  color: var(--pink);
}

/* Keep the writing and projects grids aligned on large desktop displays. */
@media (min-width: 1600px) {
  .article-hero-body,
  .article-split-body {
    width: min(810px, 60%);
  }
}

/* ============================================================
   Responsive — stack vertically below 900px
   ============================================================ */
@media (max-width: 900px) {
  .articles-list {
    gap: 48px;
    padding-bottom: 48px;
  }

  .article-hero,
  .article-split {
    flex-direction: column;
    height: auto; /* let the stacked image and text set the row height */
    min-height: auto;
    max-height: none;
  }

  .article-hero-image-link,
  .article-hero-no-image {
    flex: none;
    aspect-ratio: 4 / 3;
    height: auto;
    padding: 40px 24px;
  }

  .article-hero-image-wrap {
    height: 100%;
  }

  .article-hero-body {
    width: 100%;
    border-left: none;
    border-top: var(--border);
    padding: 40px 24px;
  }

  .article-split-image-link,
  .article-split-no-image-panel {
    flex: none;
    aspect-ratio: 4 / 3;
    min-height: auto;
    padding: 40px 24px;
    order: 0 !important;
  }

  .article-split-body {
    width: 100%;
    border-left: none;
    border-right: none !important;
    border-top: var(--border);
    padding: 40px 24px;
    order: 1 !important;
  }
}

/* ============================================================
   Detail page
   ============================================================ */
body.writing-detail main {
  min-height: 100vh;
}

.article-detail {
  max-width: 680px;
  margin: 0 auto;
  padding: 56px 32px 96px;
}

.article-detail-back {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  text-transform: uppercase;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 52px;
  transition: color 0.2s;
}

.article-detail-back:hover {
  color: var(--pink);
}

.article-detail-cat {
  margin-bottom: 16px;
}

.article-detail-title {
  font-family: var(--font-serif);
  font-size: clamp(40px, 6vw, 76px);
  color: var(--text-primary);
  font-weight: 400;
  line-height: 0.93;
  letter-spacing: -0.02em;
}

.article-detail-subtitle {
  font-family: var(--font-serif);
  font-size: clamp(15px, 2vw, 20px);
  color: var(--text-muted);
  font-style: italic;
  margin-top: 14px;
  line-height: 1.5;
}

.article-detail-date {
  display: block;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: #dbbdca;
  text-transform: uppercase;
  margin-top: 24px;
}

.article-detail-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  margin: 48px 0;
  border: var(--border);
}

.article-detail-rule {
  height: 0.5px;
  background: #1c1418;
  margin: 48px 0;
}

.article-detail-body {
  font-family: var(--font-serif);
  font-size: clamp(16px, 2vw, 19px);
  color: var(--text-body);
  line-height: 1.85;
  letter-spacing: 0.01em;
}

.article-detail-body p {
  margin-bottom: 1.6em;
}

.article-detail-body p:last-child {
  margin-bottom: 0;
}

/* Italic personal-reflection paragraphs (Substack-style memoir passages) */
.article-detail-body .article-reflection {
  font-style: italic;
  color: var(--text-muted);
}

/* Sub-headings within the body ("## " paragraphs) */
.article-detail-body .article-heading {
  font-family: var(--font-serif);
  font-size: clamp(22px, 3vw, 30px);
  color: var(--text-primary);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 2.2em 0 1.2em;
}

/* Bare URLs and inline links in body text */
.article-detail-body a {
  color: var(--pink);
  text-decoration: none;
  border-bottom: 0.5px solid var(--pink);
  word-break: break-all;
  transition: opacity 0.2s;
}

.article-detail-body a:hover {
  opacity: 0.65;
}

/* ---- Image rows: 1–3 images side by side with a shared caption ---- */
.article-img-row {
  margin: 56px 0;
}

.article-img-row-grid {
  display: grid;
  gap: 4px;
}

.article-img-row--2 .article-img-row-grid {
  grid-template-columns: repeat(2, 1fr);
}

.article-img-row--3 .article-img-row-grid {
  grid-template-columns: repeat(3, 1fr);
}

.article-img-row-grid img {
  width: 100%;
  display: block;
  border: var(--border);
}

/* Multi-image rows crop to a shared ratio so the row lines up.
   The format class comes from the section's image_format field. */
.article-img-row--portrait .article-img-row-grid img,
.article-img-row--landscape .article-img-row-grid img,
.article-img-row--square .article-img-row-grid img {
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.article-img-row--landscape .article-img-row-grid img {
  aspect-ratio: 4 / 3;
}

.article-img-row--square .article-img-row-grid img {
  aspect-ratio: 1 / 1;
}

/* Consecutive image rows read as one continuous grid (e.g. a 3×3 gallery
   split across sections) — collapse the gap down to the grid gap. */
.article-img-row + .article-img-row {
  margin-top: -44px;
}

.article-img-row figcaption {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  text-transform: uppercase;
  text-align: center;
  margin-top: 14px;
}

@media (max-width: 767px) {
  .article-detail {
    padding: 40px 24px 72px;
  }

  .article-img-row {
    margin: 40px 0;
  }

  .article-img-row + .article-img-row {
    margin-top: -32px;
  }

  .article-img-row-grid {
    gap: 4px;
  }
}
