/* Journal article: the record writes itself as you read. */
.page-article ::selection { background: var(--signal); color: #fff; }

/* Reading progress: one signal line that fills with the page. */
.read-progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60; pointer-events: none; }
.read-progress span { display: block; height: 100%; background: var(--signal); transform-origin: 0 50%; transform: scaleX(var(--read, 0)); box-shadow: 0 1px 10px rgba(255, 77, 28, 0.45); }

/* Hero */
.phero-article { min-height: min(92svh, 980px); padding: 170px 0 72px; align-items: end; isolation: isolate; }
.article-field { position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(rgba(242, 239, 232, 0.16) 1px, transparent 1.2px); background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(120% 90% at 78% 30%, #000 0%, rgba(0,0,0,0.5) 38%, transparent 72%); mask-image: radial-gradient(120% 90% at 78% 30%, #000 0%, rgba(0,0,0,0.5) 38%, transparent 72%); }
.article-field::before { content: ""; position: absolute; width: 70vmax; height: 70vmax; right: -18vmax; top: -30vmax; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 77, 28, 0.34), rgba(255, 77, 28, 0.08) 55%, transparent 72%); filter: blur(10px); animation: article-glow 14s var(--ease) infinite alternate; }
.article-field::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 77, 28, 0.9) 1.1px, transparent 1.4px); background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(circle at var(--px, 78%) var(--py, 30%), #000 0, transparent 160px); mask-image: radial-gradient(circle at var(--px, 78%) var(--py, 30%), #000 0, transparent 160px); opacity: 0.55; transition: opacity 0.4s var(--ease-out); }
@keyframes article-glow { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-8vmax, 6vmax, 0) scale(1.12); } }

.phero-article .phero-inner { max-width: none; }
.phero-title-article { font-size: clamp(2.5rem, 1rem + 4.4vw, 6rem); max-width: 20ch; line-height: 0.96; letter-spacing: -0.035em; text-wrap: balance; }
.phero-title-article .line { display: inline-block; vertical-align: top; }
.phero-article .hero-lead { max-width: none; font-size: clamp(1.0625rem, 1rem + 0.45vw, 1.375rem); margin-top: 32px; color: #c9ccd2; }
.article-meta { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-top: clamp(40px, 6vw, 72px); padding-top: 24px; }
.article-signal { position: absolute; inset: 0 0 auto 0; height: 1px; background: var(--hair-ink); overflow: hidden; }
.article-signal::after { content: ""; position: absolute; inset: 0; background: var(--signal); transform-origin: 0 50%; transform: scaleX(1); transition: transform 1.6s var(--ease-out) 0.7s; }
.article-meta .byline { margin-top: 0; }
.article-back { display: inline-flex; align-items: center; gap: 10px; font-size: 0.9375rem; color: #c9ccd2; transition: color 0.2s var(--ease-out); }
.article-back::before { content: ""; width: 18px; height: 1px; background: currentColor; transition: width 0.3s var(--ease-out); }
.article-back:hover { color: var(--bone); }
.article-back:hover::before { width: 30px; }
.js.motion .phero-article .hero-lead, .js.motion .article-meta .byline, .js.motion .article-back { opacity: 0; transform: translateY(14px); }
.js.motion .article-signal:not(.is-in)::after { transform: scaleX(0); }

/* Body */
.article { padding-top: clamp(72px, 8vw, 130px); }
.article-grid { grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: clamp(40px, 6vw, 120px); }
.article .prose { max-width: none; font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem); line-height: 1.7; }
.article .prose > p:first-of-type { font-size: 1.18em; line-height: 1.55; color: var(--ink); }
.article .prose > p:first-of-type::first-letter { float: left; font-family: var(--display); font-weight: 800; font-size: 4.1em; line-height: 0.82; margin: 0.06em 0.1em 0 0; color: var(--signal); }
.article .prose h2 { position: relative; font-size: clamp(1.75rem, 1.2rem + 1.6vw, 3rem); line-height: 1.02; letter-spacing: -0.03em; margin: clamp(64px, 7vw, 104px) 0 22px; padding-top: 26px; scroll-margin-top: 110px; text-wrap: balance; }
.article .prose h2::before { content: ""; position: absolute; left: 0; top: 0; width: 64px; height: 3px; border-radius: 2px; background: var(--signal); transform-origin: 0 50%; transition: transform 0.8s var(--ease-out) 0.05s; }
.js.motion .article .prose h2:not(.is-in)::before { transform: scaleX(0); }
.article .prose h3 { font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem); letter-spacing: -0.015em; }
.article .prose strong { font-weight: 700; }
.article .prose a { text-decoration-color: var(--signal); text-decoration-thickness: 2px; text-underline-offset: 0.2em; transition: color 0.2s var(--ease-out), text-decoration-color 0.2s var(--ease-out); }
.article .prose a:hover { color: var(--signal); }
.article .prose ul { list-style: none; padding-left: 0; gap: 10px; }
.article .prose ul li { position: relative; padding-left: 28px; }
.article .prose ul li::before { content: ""; position: absolute; left: 4px; top: 0.72em; width: 10px; height: 2px; background: var(--signal); }
.article .prose blockquote { position: relative; margin: 48px 0; padding: 8px 0 8px 36px; border-left: 0; font-family: var(--serif); font-style: italic; font-size: clamp(1.375rem, 1.1rem + 1vw, 2rem); line-height: 1.3; letter-spacing: -0.01em; }
.article .prose blockquote::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 1px; background: var(--signal); transform-origin: 50% 0; transition: transform 0.9s var(--ease-out); }
.js.motion .article .prose blockquote:not(.is-in)::before { transform: scaleY(0); }
.article .prose blockquote p { margin: 0 0 12px; }

/* Figures and video unmask from the bottom edge. */
.article-figure, .article-video { position: relative; margin: 0 0 40px; border-radius: 24px; overflow: hidden; background: var(--ink); box-shadow: 0 30px 60px -28px rgba(12, 13, 16, 0.45); clip-path: inset(0 0 0 0 round 24px); transition: clip-path 1.1s var(--ease-out); }
.js.motion .article-figure:not(.is-in), .js.motion .article-video:not(.is-in) { clip-path: inset(14% 6% 0 6% round 24px); }
.article-figure img { transform: scale(1); transition: transform 1.6s var(--ease-out); }
.js.motion .article-figure:not(.is-in) img { transform: scale(1.12); }
.article-video { margin: 40px 0 48px; }
.article-video video { display: block; width: 100%; height: auto; max-height: min(78svh, 820px); object-fit: contain; background: var(--ink); }
.article-video figcaption { display: flex; align-items: center; gap: 12px; padding: 18px 24px; background: var(--ink); color: var(--bone); font-family: var(--text); font-size: 0.9375rem; font-weight: 500; }
.article-video figcaption::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 0 rgba(255, 77, 28, 0.6); animation: article-live 2s var(--ease-out) infinite; }
@keyframes article-live { 70% { box-shadow: 0 0 0 10px rgba(255, 77, 28, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 77, 28, 0); } }

/* Conversations: each turn lands like a message. */
.chat { display: grid; gap: 14px; margin: 40px 0 44px; padding: clamp(20px, 3vw, 36px); border-radius: 28px; background: var(--ink); color: var(--bone); box-shadow: 0 30px 60px -30px rgba(12, 13, 16, 0.55); font-family: var(--text); font-style: normal; }
.chat-turn { display: grid; gap: 6px; justify-items: start; max-width: 78%; }
.chat-turn p { margin: 0; padding: 14px 18px; border-radius: 20px 20px 20px 6px; background: rgba(242, 239, 232, 0.08); box-shadow: inset 0 0 0 1px var(--hair-ink); font-size: 1rem; line-height: 1.45; color: var(--bone); }
.chat-who { font-size: 0.8125rem; font-weight: 500; color: var(--mute-on-ink); padding: 0 6px; }
.chat-turn-them { justify-self: end; justify-items: end; }
.chat-turn-them p { background: var(--signal); color: #fff; box-shadow: 0 10px 24px -12px rgba(255, 77, 28, 0.8); border-radius: 20px 20px 6px 20px; }
.chat-turn:not(.chat-turn-them) .chat-who::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: var(--signal); vertical-align: 1px; }
.js.motion .chat:not(.is-in) .chat-turn { opacity: 0; transform: translateY(16px) scale(0.98); filter: blur(4px); }
.chat .chat-turn { transition: opacity 0.5s var(--ease-out), transform 0.6s var(--ease-out), filter 0.5s var(--ease-out); transition-delay: calc(var(--i, 0) * 0.42s); transform-origin: 0 100%; }
.chat .chat-turn-them { transform-origin: 100% 100%; }

/* Aside: chapter rail fills as the reader moves through it. */
.article-aside { top: 104px; gap: 20px; }
.article-toc { padding: 24px 24px 18px; border-radius: 22px; background: #fff; box-shadow: 0 18px 40px -26px rgba(12, 13, 16, 0.35), inset 0 0 0 1px var(--hair-bone); }
.article-toc strong { display: block; font-size: 0.875rem; font-weight: 700; margin-bottom: 12px; }
.article-toc ol { position: relative; display: grid; list-style: none; padding: 0; margin: 0; }
.article-toc ol::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: var(--hair-bone); }
.article-toc ol::after { content: ""; position: absolute; left: 0; top: 6px; width: 2px; height: calc((100% - 12px) * var(--toc, 0)); border-radius: 2px; background: var(--signal); transition: height 0.4s var(--ease-out); }
.article-toc a { display: block; padding: 8px 0 8px 18px; font-size: 0.9375rem; line-height: 1.3; color: var(--mute-on-bone); transition: color 0.25s var(--ease-out), transform 0.3s var(--ease-out); }
.article-toc a:hover { color: var(--ink); }
.article-toc a.is-current { color: var(--ink); font-weight: 600; transform: translateX(4px); }
.aside-author { grid-template-columns: auto 1fr; align-items: center; column-gap: 14px; }
.aside-author img { width: 52px; height: 52px; margin: 0; }
.aside-author > div { display: grid; gap: 2px; }
.aside-author p { grid-column: 1 / -1; margin-top: 10px; }
.aside-card { position: relative; overflow: hidden; }
.aside-card::after { content: ""; position: absolute; width: 220px; height: 220px; right: -90px; top: -110px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 77, 28, 0.45), transparent); pointer-events: none; transition: transform 0.8s var(--ease-out); }
.aside-card:hover::after { transform: translate(-20px, 20px) scale(1.2); }
.aside-card > * { position: relative; z-index: 1; }
.aside-card .btn { background: var(--signal); color: #fff; box-shadow: 0 12px 24px -12px rgba(255, 77, 28, 0.8); transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out); }
.aside-card .btn:hover { transform: translateY(-2px); box-shadow: 0 16px 28px -12px rgba(255, 77, 28, 0.9); }

/* Keep reading */
.article-next { background: var(--bone); color: var(--ink); padding: 0 0 clamp(80px, 9vw, 140px); }
.article-next-title { font-size: clamp(2rem, 1.2rem + 2.6vw, 4rem); letter-spacing: -0.035em; line-height: 0.95; padding-top: clamp(48px, 6vw, 80px); border-top: 1px solid var(--hair-bone); }
.article-next-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2vw, 32px); margin-top: clamp(32px, 4vw, 56px); list-style: none; padding: 0; }
.article-next-list a { display: grid; gap: 12px; align-content: start; }
.article-next-list figure { margin: 0 0 8px; aspect-ratio: 4 / 3; border-radius: 22px; overflow: hidden; background: var(--ink); }
.article-next-list img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease-out); }
.article-next-list figure.no-image { position: relative; background-image: radial-gradient(rgba(242, 239, 232, 0.16) 1px, transparent 1.2px); background-size: 18px 18px; background-color: var(--ink); }
.article-next-list figure.no-image span { position: absolute; left: 24px; right: 24px; bottom: 24px; height: 3px; border-radius: 2px; background: var(--signal); transform-origin: 0 50%; transform: scaleX(0.3); transition: transform 0.9s var(--ease-out); }
.article-next-list time { font-size: 0.8125rem; color: var(--mute-on-bone); }
.next-title { font-family: var(--display); font-weight: 700; font-size: clamp(1.25rem, 1rem + 0.6vw, 1.625rem); line-height: 1.1; letter-spacing: -0.02em; text-wrap: balance; transition: color 0.25s var(--ease-out); }
.article-next-list a:hover img { transform: scale(1.06); }
.article-next-list a:hover figure.no-image span { transform: scaleX(1); }
.article-next-list a:hover .next-title { color: var(--signal); }
.article-next-list a:focus-visible, .article-toc a:focus-visible, .article-back:focus-visible { outline: 2px solid var(--signal); outline-offset: 4px; border-radius: 6px; }

@media (max-width: 1024px) {
  .article-grid { grid-template-columns: 1fr; }
  .article-toc { display: none; }
  .article-next-list { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .phero-article { min-height: 0; padding: 128px 0 48px; }
  .phero-title-article { font-size: clamp(2.125rem, 9.5vw, 3rem); }
  .chat-turn { max-width: 92%; }
  .article .prose blockquote { padding-left: 22px; }
  .article-figure, .article-video { border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .article-field::before { animation: none; }
  .article-video figcaption::before { animation: none; }
  .article-figure, .article-video, .article-figure img, .chat .chat-turn, .article .prose h2::before, .article .prose blockquote::before { transition: none; }
}
