/* FROM — the blog's reading panel. A story slides in from the right (from the bottom on phones) over a dimmed
   page, with a line along the top that fills as you read and the next story at the end. */

html.is-reading {
  overflow: hidden;
}

.read {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(760px, 100%);
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: -30px 0 80px -30px rgba(7, 13, 23, 0.35);
  transform: translateX(100%);
  transition: transform 0.55s var(--ease-out), overlay 0.55s allow-discrete, display 0.55s allow-discrete;
}

.read[open] {
  transform: none;
}

@starting-style {
  .read[open] {
    transform: translateX(100%);
  }
}

.read::backdrop {
  background: rgba(7, 13, 23, 0);
  -webkit-backdrop-filter: blur(0);
  backdrop-filter: blur(0);
  transition: background-color 0.45s, backdrop-filter 0.45s, overlay 0.45s allow-discrete, display 0.45s allow-discrete;
}

.read[open]::backdrop {
  background: rgba(7, 13, 23, 0.42);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

@starting-style {
  .read[open]::backdrop {
    background: rgba(7, 13, 23, 0);
    -webkit-backdrop-filter: blur(0);
    backdrop-filter: blur(0);
  }
}

.read__scroll {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 88px clamp(24px, 5vw, 64px) 48px;
}

/* ---------- Top bar: copy link, close, and how far you've read ---------- */

.read__bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  height: 72px;
  padding: 0 clamp(16px, 3vw, 28px);
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  backdrop-filter: saturate(1.6) blur(14px);
}

.read__copy {
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 14px;
  font-weight: 600;
  transition: box-shadow 0.2s;
}

.read__copy:hover {
  box-shadow: inset 0 0 0 1.5px var(--ink-3);
}

.read__close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
}

.read__close .icon {
  width: 20px;
  height: 20px;
}

.read__progress {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: var(--orange);
  transform: scaleX(var(--read, 0));
  transform-origin: left;
}

/* ---------- The story ---------- */

.read__post[hidden] {
  display: none;
}

.read__photo {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 22px;
  object-fit: cover;
  background: var(--orange-tint);
}

.read__meta {
  margin-top: 28px;
  font-size: 14px;
  font-weight: 600;
  color: var(--orange-ink);
}

.read__title {
  margin: 10px 0 0;
  font-size: clamp(32px, 4.4vw, 52px);
  line-height: 1.04;
  font-weight: 760;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.read__lede {
  margin-top: 16px;
  font-size: 20px;
  line-height: 1.5;
  color: var(--ink-2);
}

.read__body {
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.read__body p,
.read__body li {
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink-2);
}

.read__body p + p,
.read__body :is(ul, ol) + p {
  margin-top: 16px;
}

.read__body h3 {
  margin: 36px 0 10px;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 720;
  letter-spacing: -0.025em;
}

.read__body :is(ul, ol) {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 24px;
}

.read__body li::marker {
  color: var(--orange);
  font-weight: 700;
}

.read__body a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--orange);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* ---------- Next story ---------- */

.read__next {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 20px;
  margin-top: 56px;
  padding: 28px;
  border-radius: 22px;
  background: var(--paper-warm);
  transition: background-color 0.3s;
}

.read__next:hover {
  background: var(--orange-wash);
}

.read__next-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
}

.read__next-title {
  grid-column: 1;
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1.2;
  font-weight: 720;
  letter-spacing: -0.03em;
}

.read__next .icon {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 22px;
  height: 22px;
  color: var(--orange);
  transition: transform 0.3s var(--ease-out);
}

.read__next:hover .icon {
  transform: translateX(4px);
}

/* ---------- Phones: the panel rises from the bottom ---------- */

@media (max-width: 760px) {
  .read {
    inset: auto 0 0 0;
    width: 100%;
    height: calc(100% - 24px);
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
    overflow: hidden;
  }

  @starting-style {
    .read[open] {
      transform: translateY(100%);
    }
  }

  .read__bar {
    height: 64px;
  }

  .read__scroll {
    padding-top: 76px;
  }

  .read__photo {
    border-radius: 18px;
  }

  .read__body p,
  .read__body li {
    font-size: 17px;
  }

  .read__next {
    padding: 22px;
  }
}
