/* ==========================================================================
   Blog index, Forty-Five theme: ideas, divided.
   The title over the lede is a fraction (one rule, two square dots), and the
   posts are a ledger, one hairline row each. On hover devices a framed
   preview of the post image follows the cursor; elsewhere each row carries
   its own framed thumbnail.
   ========================================================================== */

/* Hero: the divide sign
   ========================================================================== */
.blog-hero {
  padding-top: calc(var(--nav-height) + clamp(1.5rem, 3vw, 2.5rem));
  padding-bottom: clamp(3.5rem, 7vw, 6rem);
}
.blog-hero .section-head { margin-bottom: clamp(3.5rem, 8vw, 7rem); }

.blog-fraction {
  display: grid;
  justify-items: center;
  text-align: center;
}
.blog-title {
  max-width: 14ch;
  font: 600 clamp(3.1rem, 8.6vw, 9.75rem)/0.9 var(--font-display);
  letter-spacing: -0.052em;
  text-wrap: balance;
}

.blog-bar {
  display: grid;
  justify-items: center;
  gap: clamp(1rem, 1.8vw, 1.6rem);
  width: 100%;
  margin: clamp(2.25rem, 4.5vw, 4rem) 0;
}
.blog-bar-rule {
  position: relative;
  width: 100%;
  height: 1px;
  background: var(--white-25);
}
/* registration crosshairs at both ends of the rule */
.blog-bar-rule::before,
.blog-bar-rule::after {
  content: "";
  position: absolute;
  top: -6px;
  width: 13px;
  height: 13px;
  background:
    linear-gradient(var(--white-60), var(--white-60)) center / 1px 100% no-repeat,
    linear-gradient(var(--white-60), var(--white-60)) center / 100% 1px no-repeat;
}
.blog-bar-rule::before { left: -6px; }
.blog-bar-rule::after { right: -6px; }

/* the dots of the sign: square, like the beams */
.blog-bar-dot {
  width: clamp(0.7rem, 1.05vw, 1.05rem);
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--indigo-soft), var(--indigo) 58%);
}
.js-motion .blog-bar-rule { transform: scaleX(0); }
.js-motion .blog-bar-dot { opacity: 0; }
.reveal-all .blog-bar-rule { transform: none; }
.reveal-all .blog-bar-dot { opacity: 1; }

.blog-lede {
  max-width: 30ch;
  font: 400 clamp(1.1rem, 0.5vw + 1rem, 1.4rem)/1.5 var(--font-display);
  color: var(--white-75);
  text-wrap: balance;
}

/* Ledger: one hairline row per post
   ========================================================================== */
.blog-ledger {
  --blog-cols: clamp(3rem, 6vw, 6rem) clamp(10rem, 15vw, 14rem) minmax(0, 1fr) auto auto;
  padding-top: 0;
}
.blog-ledger-head {
  display: grid;
  grid-template-columns: var(--blog-cols);
  column-gap: clamp(1rem, 2vw, 2rem);
  padding-bottom: 1rem;
  border-bottom: var(--line);
  font: 500 0.68rem/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--white-40);
}
.blog-list > li { border-bottom: var(--line); }

.blog-row {
  display: grid;
  grid-template-columns: var(--blog-cols);
  grid-template-areas: "index meta title thumb arrow";
  column-gap: clamp(1rem, 2vw, 2rem);
  align-items: baseline;
  padding: clamp(1.6rem, 2.8vw, 2.6rem) 0;
  transition: opacity var(--dur) var(--ease);
}
.blog-row-index {
  grid-area: index;
  font: 500 0.72rem/1 var(--font-mono);
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
  color: var(--white-40);
}
.blog-row-meta {
  grid-area: meta;
  display: grid;
  gap: 0.55rem;
  font: 500 0.7rem/1.2 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--white-75);
}
.blog-row-terms { color: var(--white-40); }
.blog-row-title {
  grid-area: title;
  max-width: 24ch;
  font: 600 clamp(1.6rem, 2.7vw, 3rem)/1.04 var(--font-display);
  letter-spacing: -0.038em;
  text-wrap: balance;
  transition: transform 0.6s var(--ease);
}
.blog-row-thumb {
  grid-area: thumb;
  align-self: center;
  width: clamp(6rem, 12vw, 9.5rem);
  aspect-ratio: 4 / 3;
}
.blog-row-thumb .frame-clip { display: block; }
.blog-row-thumb .frame-clip img { transform: none; will-change: auto; }
.blog-row-arrow {
  grid-area: arrow;
  align-self: center;
  width: clamp(1.4rem, 2vw, 2rem);
  height: auto;
  color: var(--white-60);
  transition: transform 0.6s var(--ease);
}

/* hover and focus: the row steps forward, the rest of the ledger steps back
   (hover only where it is real, so a tap never leaves the ledger dimmed) */
@media (hover: hover) {
  .blog-list:has(.blog-row:hover) .blog-row:not(:hover) { opacity: 0.32; }
  .blog-row:hover .blog-row-title { transform: translateX(0.6rem); }
  .blog-row:hover .blog-row-arrow { transform: translate(0.3rem, -0.3rem); color: var(--paper); }
}
.blog-list:has(.blog-row:focus-visible) .blog-row:not(:focus-visible) { opacity: 0.32; }
.blog-row:focus-visible .blog-row-title { transform: translateX(0.6rem); }
.blog-row:focus-visible .blog-row-arrow { transform: translate(0.3rem, -0.3rem); color: var(--paper); }
.blog-row:focus-visible { outline: 1px solid var(--paper); outline-offset: 6px; }

/* the follower owns the image where it can run; the row thumbs stand down */
@media (hover: hover) and (min-width: 901px) and (prefers-reduced-motion: no-preference) {
  .blog-row-thumb { display: none; }
}

@media (max-width: 900px) {
  .blog-ledger-head, .blog-row-arrow, .blog-row-terms { display: none; }
  .blog-row {
    grid-template-columns: auto minmax(0, 1fr) clamp(5.5rem, 26vw, 8rem);
    grid-template-areas:
      "index meta thumb"
      "title title thumb";
    column-gap: 0.9rem;
    row-gap: 0.85rem;
    align-items: start;
    padding: 1.5rem 0;
  }
  .blog-row-title { max-width: none; font-size: clamp(1.3rem, 4.6vw, 1.8rem); line-height: 1.1; }
  .blog-row-thumb { align-self: start; width: 100%; }
  .blog-row:focus-visible .blog-row-title { transform: none; }
}

/* Preview: a framed image that follows the cursor over the ledger
   ========================================================================== */
.blog-preview {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 15;
  width: clamp(15rem, 21vw, 22rem);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s var(--ease);
  will-change: transform;
}
.blog-preview--on { opacity: 1; }
.blog-preview .frame { aspect-ratio: 3 / 2; background: var(--night-2); }
.blog-preview .blog-preview-img {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1.08);
  transition: opacity 0.45s var(--ease), transform 0.9s var(--ease);
  will-change: auto;
}
.blog-preview .blog-preview-img--on { opacity: 1; transform: none; }

@media not all and (hover: hover) and (min-width: 901px) {
  .blog-preview { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .blog-preview { display: none; }
  .blog-row, .blog-row-title, .blog-row-arrow { transition: none; }
}
