/* FROM — the blog's list of stories: one row per story, filtered by the topic chips (blog.css), and on wide screens
   a photo of the story you point at that follows the pointer (the "peek"). ts/blog.ts runs it. */

/* ---------- The list ---------- */

.posts {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1.5px solid var(--ink);
}

.posts li[hidden] {
  display: none;
}

.post-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 72px 44px;
  align-items: center;
  gap: 24px;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
  transition: opacity 0.35s var(--ease-out);
}

.post-row__thumb {
  display: none;
}

.post-row__topic,
.post-row__time {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
}

.post-row__main {
  display: grid;
  gap: 6px;
  max-width: 600px;
  transition: transform 0.45s var(--ease-out);
}

.post-row__title {
  font-size: clamp(22px, 2.2vw, 32px);
  line-height: 1.15;
  font-weight: 720;
  letter-spacing: -0.035em;
}

.post-row__text {
  font-size: 16px;
  color: var(--ink-3);
}

.post-row__go {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--line);
  transition: background-color 0.3s, box-shadow 0.3s, color 0.3s;
}

.post-row__go .icon {
  width: 18px;
  height: 18px;
}

/* Pointing at one story quietens the others. */
.posts:has(.post-row:hover) .post-row:not(:hover) {
  opacity: 0.4;
}

.post-row:hover .post-row__main {
  transform: translateX(10px);
}

.post-row:hover .post-row__go,
.post-row:focus-visible .post-row__go {
  background: var(--orange);
  box-shadow: none;
  color: #fff;
}

/* ---------- The peek: a photo of the story you point at, in the space on the right of the list ---------- */

.peek {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  width: 260px;
  aspect-ratio: 4 / 3;
  margin: 0;
  border-radius: 20px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 30px 60px -20px rgba(7, 13, 23, 0.4);
  transition: opacity 0.3s var(--ease-out);
}

.peek img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  scale: 0.9;
  transition: scale 0.5s var(--ease-out);
}

.peek.is-on {
  opacity: 1;
}

.peek.is-on img {
  scale: 1;
}

@media (hover: none), (max-width: 1080px) {
  .peek {
    display: none;
  }
}

/* ---------- Tablet and phone ---------- */

@media (max-width: 900px) {
  .post-row {
    grid-template-columns: 88px minmax(0, 1fr);
    grid-template-areas:
      "thumb topic"
      "thumb main";
    align-items: start;
    gap: 6px 16px;
    padding: 22px 0;
  }

  .post-row__thumb {
    grid-area: thumb;
    display: block;
    width: 88px;
    height: 88px;
    border-radius: 16px;
    object-fit: cover;
  }

  .post-row__topic {
    grid-area: topic;
  }

  .post-row__main {
    grid-area: main;
  }

  .post-row__time,
  .post-row__go {
    display: none;
  }

  .post-row__title {
    font-size: 20px;
  }

  .post-row__text {
    font-size: 15px;
  }

  .posts:has(.post-row:hover) .post-row:not(:hover) {
    opacity: 1;
  }

  .post-row:hover .post-row__main {
    transform: none;
  }
}
