/* ==========================================================================
   Terrain — journal index, article, and accessory cards.
   ========================================================================== */

/* ---------- category pills ---------- */
.t-pills { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.t-pills a {
  font-size: 12px; font-weight: 650; letter-spacing: .03em;
  padding: 7px 13px; border-radius: 8px; border: 1px solid var(--b-12);
  color: var(--t-72); transition: border-color .2s, background .2s, color .2s;
}
.t-pills a:hover { border-color: var(--b-lime-hover); color: var(--lime); }
.t-pills a.is-active { background: var(--lime); color: #000; border-color: var(--lime); }

/* ---------- lead post ---------- */
.t-lead {
  display: flex; flex-wrap: wrap; gap: clamp(22px, 3vw, 40px);
  background: var(--panel); border: 1px solid var(--b-10); border-radius: 20px;
  padding: clamp(20px, 2.4vw, 28px); margin: 30px 0 var(--gap-card);
  transition: border-color .3s var(--ease);
}
.t-lead:hover { border-color: var(--b-lime-hover); }
.t-lead__media { flex: 1 1 320px; min-width: 0; aspect-ratio: 16 / 10; border-radius: 14px; overflow: hidden; background: var(--ink-alt); }
.t-lead__media img { width: 100%; height: 100%; object-fit: cover; }
.t-lead__body { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.t-lead__h { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.02; letter-spacing: -.025em; font-weight: 900; margin: 10px 0 12px; text-transform: none; }
.t-lead__x { font-size: 15px; line-height: 1.65; color: var(--t-65); max-width: 52ch; margin: 0 0 16px; }
.t-readmore { color: var(--lime); font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; }

/* ---------- post cards ---------- */
.t-posts { display: grid; gap: var(--gap-card); grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.t-post {
  display: flex; flex-direction: column; background: var(--panel);
  border: 1px solid var(--b-10); border-radius: 18px; overflow: hidden;
  transition: border-color .3s var(--ease), transform .3s var(--ease);
}
.t-post:hover { border-color: var(--b-lime-hover); transform: translateY(-4px); }
.t-post__media { aspect-ratio: 16 / 10; background: var(--ink-alt); overflow: hidden; }
.t-post__media img { width: 100%; height: 100%; object-fit: cover; }
.t-post__body { padding: 22px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.t-post__meta { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--t-42); }
.t-post__h { font-size: 19px; font-weight: 800; letter-spacing: -.015em; line-height: 1.2; margin: 0; text-transform: none; }
.t-post__x { font-size: 13.5px; line-height: 1.6; color: var(--t-55); margin: 0; }
.t-post__date { margin-top: auto; padding-top: 14px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--t-35); }

/* ---------- article ---------- */
.t-article__meta { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--t-42); margin-bottom: 14px; }
.t-article h1 { font-size: clamp(34px, 5vw, 60px); }
.t-article__hero { aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: var(--ink-alt); margin: 26px 0 30px; }
.t-article__hero img { width: 100%; height: 100%; object-fit: cover; }
.t-article__body { font-size: 16.5px; line-height: 1.78; color: var(--t-65); }
.t-article__body h2 { font-size: clamp(22px, 2.6vw, 30px); line-height: 1.08; margin: 34px 0 12px; color: var(--sand); }
.t-article__body p { margin: 0 0 18px; }
.t-article__body strong { color: var(--t-88); }
.t-article__body ul, .t-article__body ol { padding-left: 20px; margin: 0 0 18px; }
.t-article__body li { margin-bottom: 7px; }
/* Data tables in guides (dimensions, speeds, charge times) scroll inside themselves on phones instead of widening the page. */
.t-article__body table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-collapse: collapse; font-size: 14px; line-height: 1.45; margin: 0 0 22px; }
.t-article__body th, .t-article__body td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--b-07); }
.t-article__body thead th { font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--t-42); white-space: nowrap; }
.t-article__body tbody th { font-weight: 500; color: var(--t-88); }
.t-back { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--t-42); display: inline-block; margin-bottom: 20px; }
.t-back:hover { color: var(--lime); }

.t-related { background: var(--ink-alt); border-top: 1px solid var(--b-10); }

/* ---------- accessory card additions ---------- */
.t-card__fits { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--lime); }
.t-card__sku { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; color: var(--t-35); }

/* ---------- gallery: only as many slots as we can fill ---------- */
/* One photo: it takes the whole frame rather than sitting beside empty squares. */
.t-gallery--solo { grid-template-columns: 1fr; grid-template-rows: auto; }
.t-gallery--solo .t-gallery__hero { grid-row: auto; aspect-ratio: 4 / 3; }

/* Hero + 1 square: one row, hero no longer spans three. */
.t-gallery:has(.t-gallery__sq:nth-child(2):last-child) { grid-template-rows: 1fr; }
.t-gallery:has(.t-gallery__sq:nth-child(2):last-child) .t-gallery__hero { grid-row: 1; aspect-ratio: 1 / 1; }

/* Hero + 2 squares: two rows. */
.t-gallery:has(.t-gallery__sq:nth-child(3):last-child) { grid-template-rows: repeat(2, 1fr); }
.t-gallery:has(.t-gallery__sq:nth-child(3):last-child) .t-gallery__hero { grid-row: 1 / 3; aspect-ratio: 4 / 5; }

/* No photography yet: one honest well, not four empty boxes. */
.t-gallery--none { grid-template-columns: 1fr; grid-template-rows: auto; }
.t-gallery--none .t-gallery__hero {
  grid-row: auto; aspect-ratio: 4 / 3; display: flex;
  align-items: center; justify-content: center; border-radius: 16px;
}
