/* The blog (/blog and its articles), loaded after site.css. The page is the site's own ruled sheet:
   the top bar, the frame, the hero with its lines and glow, sections, chips, prose, the contents
   card, the FAQ, the close and the footer all come from landing.css and site.css untouched. What's
   here is only the blog's: its 3D covers, the hero's hovering pictures, the topics' objects, the
   list of articles and the panels out of it. The motion is public/blog.js's; this file is complete
   without it. Every colour is a landing.css token. */

.blog-body {
  --r-cover: 20px;
}
/* The covers lean out past both edges of the frame while they hover. */
.blog-body main {
  overflow-x: clip;
}
.blog-body .site-content > .site-section {
  scroll-margin-top: 0;
}

/* A card's picture grows into its article's, and back. blog.js names the one that was clicked. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
  ::view-transition-group(article-cover) {
    animation-duration: 0.5s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }
  ::view-transition-old(article-cover),
  ::view-transition-new(article-cover) {
    height: 100%;
    object-fit: cover;
    border-radius: 20px;
  }
}

/* ---- The pause button, beside the topics ---- */
.motion-toggle svg {
  width: 14px;
  height: 14px;
}
.motion-toggle b {
  font-weight: inherit;
}
.topics-head + .topics {
  margin-top: 0;
  padding-top: 40px;
}
.motion-toggle__play,
[data-motion="off"] .motion-toggle__pause {
  display: none;
}
[data-motion="off"] .motion-toggle__play {
  display: inline;
}
.motion-toggle[hidden] {
  display: none;
}

/* ============================================================
   The hub's hero: the site's, with pictures adrift in it
   ============================================================ */
.blog-hero__words {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin-inline: auto;
}
/* Room over the glow for the covers to hover before they land: only where they do. */
.falls .frame > .blog-hero {
  padding-bottom: clamp(300px, 44vh, 420px);
}

/* Small pictures adrift at the hero's edges, at four depths. */
.drift {
  position: absolute;
  width: var(--w);
  transform: perspective(1200px)
    translate3d(
      calc(var(--mx, 0) * var(--z) * 1px),
      calc((var(--my, 0) + var(--sy, 0)) * var(--z) * 1px),
      0
    )
    rotateY(var(--ry)) rotateZ(var(--rz));
  transition: scale 0.4s var(--ease);
}
.drift img {
  width: 100%;
  height: auto;
  border-radius: clamp(12px, 1.4vw, 20px);
  box-shadow: var(--l-shadow);
}
.drift:nth-child(1) {
  --w: clamp(110px, 11.5vw, 170px);
  --ry: 16deg;
  --rz: -2deg;
  --z: 14;
  top: 84px;
  left: 11%;
}
.drift:nth-child(2) {
  --w: clamp(110px, 11.5vw, 170px);
  --ry: -16deg;
  --rz: 2deg;
  --z: 18;
  top: 62px;
  right: 11%;
}
.drift:nth-child(3) {
  --w: clamp(150px, 16vw, 250px);
  --ry: 20deg;
  --rz: 3deg;
  --z: 34;
  top: 250px;
  left: -4.5%;
}
.drift:nth-child(4) {
  --w: clamp(150px, 16vw, 250px);
  --ry: -20deg;
  --rz: -3deg;
  --z: 30;
  top: 226px;
  right: -4.5%;
}

/* One entrance, when the page loads: the words rise, and the pictures come forward. */
@media (prefers-reduced-motion: no-preference) {
  .blog-hero__words > * {
    animation: blog-rise 0.8s var(--ease) both;
  }
  .blog-hero__words > .site-lede {
    animation-delay: 0.07s;
  }
  .blog-hero__words > .site-hero__cta {
    animation-delay: 0.14s;
  }
  .drift img {
    animation: blog-come 0.9s 0.1s var(--ease) both;
  }
  .drift:nth-child(n + 3) img {
    animation-delay: 0.18s;
  }
  [data-fall] img {
    animation: blog-come 0.9s 0.24s var(--ease) both;
  }
}
@keyframes blog-rise {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
}
@keyframes blog-come {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.9);
  }
}

/* ============================================================
   Articles as cards
   ============================================================ */
.posts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 56px 24px;
}
.post {
  position: relative;
  display: flex;
  flex-direction: column;
}
.post__cover {
  position: relative;
  border-radius: var(--r-cover);
}
[data-fall] {
  z-index: 2;
  will-change: transform;
}
.post__cover img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: inherit;
  transition: scale 0.5s var(--ease);
}
/* The shadow belongs to the hovering, so it goes as the cover lands. */
[data-fall]::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 50px 80px -20px rgba(15, 23, 42, 0.38);
  opacity: var(--air, 0);
}
.post__topic {
  margin-top: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--l-text);
}
.post__title {
  margin-top: 6px;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.028em;
  color: var(--l-head);
  text-wrap: pretty;
}
.post__title a::after,
.read__title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: var(--r-cover);
}
.post__title a:focus-visible,
.read__title a:focus-visible {
  outline: none;
}
.post__title a:focus-visible::after,
.read__title a:focus-visible::after {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
}
.post__lede {
  display: -webkit-box;
  margin-top: 8px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  font-size: 15px;
  line-height: 1.55;
  color: var(--l-text);
}
.post__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--l-text);
}
@media (hover: hover) {
  .post:hover .post__cover img {
    scale: 1.015;
  }
}

/* ---- Topics: an object standing out of the top of each card ---- */
.topics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 56px 16px;
  margin: 72px 0 0;
  padding: 0;
  list-style: none;
}
.topic {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 252px;
  padding: 112px 28px 26px;
  border: 1px solid var(--l-panel-line);
  border-radius: 20px;
  background: var(--l-panel);
  transition: border-color 0.2s;
}
.topic__art {
  position: absolute;
  top: -48px;
  right: 14px;
  width: min(216px, 60%);
  height: auto;
  transition: scale 0.45s var(--ease);
}
.topic__name {
  margin-top: auto;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.04em;
  color: var(--l-head);
}
.topic__text {
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--l-text);
}
.topic__count {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--l-text);
}
@media (hover: hover) {
  .topic:hover {
    border-color: var(--line-3);
  }
  .topic:hover .topic__art {
    scale: 1.06;
  }
}
@keyframes blog-float {
  from {
    transform: translateY(2.4%) rotate(-0.8deg);
  }
  to {
    transform: translateY(-2.4%) rotate(0.8deg);
  }
}
@media (prefers-reduced-motion: no-preference) {
  .topic__art,
  .bento__art {
    animation: blog-float 3.4s ease-in-out infinite alternate;
  }
  li:nth-child(2n) .topic__art,
  .bento__card + .bento__card .bento__art {
    animation-delay: -1.7s;
  }
  li:nth-child(3n) .topic__art {
    animation-delay: -2.6s;
  }
  [data-motion="off"] .topic__art,
  [data-motion="off"] .bento__art {
    animation-play-state: paused;
  }
}

/* ---- Every article, as rows in two columns ---- */
.reads-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
  margin-bottom: 32px;
}
.reads-head > .site-h2 {
  margin: 0;
}
.reads {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 72px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.read {
  position: relative;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding-block: 18px;
  border-top: 1px solid var(--line);
}
.read[hidden] {
  display: none;
}
.read__cover {
  width: 112px;
  height: 112px;
  object-fit: cover;
  border-radius: 16px;
}
.read .post__topic {
  margin-top: 0;
}
.read__title {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.025em;
  color: var(--l-head);
  text-wrap: pretty;
}
.read .post__meta {
  margin-top: 6px;
}
.blog-body .reads__more {
  display: flex;
  margin: 40px auto 0;
}
.blog-body .reads__more[hidden] {
  display: none;
}

/* ---- Two panels out of the blog, in the site's indigo and its grey ---- */
.bento {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.bento__card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(24px, 3vw, 40px);
  padding-top: clamp(190px, 19vw, 260px);
  border: 1px solid var(--l-panel-line);
  border-radius: 28px;
  background: var(--l-panel);
}
.bento__card--indigo {
  border-color: transparent;
  background: color-mix(in srgb, var(--accent-bg) 55%, var(--bg));
}
.bento__art {
  position: absolute;
  top: 8px;
  right: clamp(12px, 3vw, 44px);
  width: clamp(190px, 20vw, 280px);
  height: auto;
}
.bento__title {
  font-size: clamp(26px, 2.8vw, 38px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.04em;
  color: var(--l-head);
}
.bento__card--indigo .soft {
  color: color-mix(in srgb, var(--accent-fg) 60%, var(--accent-bg));
}
.bento__card > p {
  max-width: 420px;
  margin-top: 12px;
  color: var(--l-text);
}
.bento__card > .chips {
  margin: 20px 0 28px;
  padding: 0;
  list-style: none;
}
.bento__card > .btn {
  margin-top: auto;
}

/* ============================================================
   An article: the site's hero with its cover standing on the glow, then the prose beside the
   site's contents card
   ============================================================ */
a.eyebrow:hover {
  border-color: var(--line-3);
}
.article-hero__note {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
}
.article-cover {
  width: 100%;
  max-width: 1160px;
  height: auto;
  margin-top: clamp(36px, 5vw, 64px);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: clamp(16px, 2.4vw, 28px);
  box-shadow: var(--l-shadow);
}
.article-body {
  display: grid;
  grid-template-columns: minmax(0, 720px) minmax(220px, 300px);
  justify-content: space-between;
  align-items: start;
  column-gap: clamp(40px, 6vw, 96px);
}
.article-side {
  position: sticky;
  top: 96px;
}
.article-side > .guide-toc {
  max-height: calc(100vh - 184px);
  margin: 0 0 16px;
  overflow-y: auto;
  scrollbar-width: none;
}
.article-side > .guide-toc ol {
  columns: auto;
}
.article-side .guide-toc a[aria-current] {
  font-weight: 600;
  color: var(--brand);
}
.article-share {
  display: flex;
  gap: 8px;
}
.article-share :is(a, button) {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--l-head);
  transition: background 0.2s;
}
.article-share button[hidden] {
  display: none;
}
.article-share :is(a, button):hover {
  background: var(--l-panel);
}
.article-share .copied {
  border-color: transparent;
  background: var(--mint-bg);
  color: var(--mint-ink);
}
.article-share svg {
  width: 19px;
  height: 19px;
}

/* ============================================================
   Narrower screens
   ============================================================ */
@media (max-width: 1100px) {
  .posts,
  .topics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  /* Beside the prose there's no room: the contents go above it, and sharing below. */
  .article-body {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  .article-side {
    display: contents;
  }
  .article-side > .guide-toc {
    order: -1;
    max-height: none;
    margin-bottom: 40px;
  }
  .article-side > .guide-toc ol {
    columns: 2 260px;
  }
  .article-share {
    margin-top: 40px;
  }
  .reads {
    column-gap: 40px;
  }
  .drift {
    display: none;
  }
}
@media (max-width: 960px) {
  .reads {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 700px) {
  .posts,
  .topics,
  .bento {
    grid-template-columns: minmax(0, 1fr);
  }
  .topics-head {
    margin-bottom: 12px;
  }
  .posts {
    gap: 44px;
  }
  .falls .frame > .blog-hero {
    padding-bottom: 250px;
  }
  .read {
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 16px;
  }
  .read__cover {
    width: 84px;
    height: 84px;
    border-radius: 12px;
  }
  .picks {
    flex-wrap: nowrap;
    width: calc(100% + 2 * var(--pad));
    margin-inline: calc(-1 * var(--pad));
    padding-inline: var(--pad);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .picks .chip {
    flex: none;
  }
  .topic {
    min-height: 220px;
  }
  .article-cover {
    aspect-ratio: 3 / 2;
  }
}
