/* ==========================================================================
   Digest by Avi Flombaum
   The week's bookmarks on the talks.avi.nyc stage: a black room, burgundy,
   cyan and amber lights, Playfair Display beside DM Sans. Each topic in a
   week wears one light, the way each talk wears its own costume. The archive
   borrows avi.nyc's ruled writing list. Light mode is avi.nyc's Coastal Sprint.
   ========================================================================== */
@import url("./tokens.css");
@import url("./base.css");

/* --------------------------------------------------------------------------
   Skip link, wordmark, buttons (shared with the admin)
   -------------------------------------------------------------------------- */
.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  background: var(--amber);
  color: #000;
  font-weight: 700;
  text-decoration: none;
}
.skip:focus { top: 1rem; }

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 1.45rem;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.wordmark__mark {
  align-self: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin-right: -0.15rem;
  translate: 0 -3px;
}
.wordmark__by {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0;
  color: var(--ink-3);
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.7rem 1.35rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--dur-short) var(--ease), background-color var(--dur-short), border-color var(--dur-short), color var(--dur-short);
}
@media (hover: hover) {
  .btn:hover { transform: translateY(-2px); }
}
.btn:active { transform: translateY(0); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--burgundy); color: var(--on-accent); }
@media (hover: hover) {
  .btn--primary:hover { background: var(--burgundy-hover); color: var(--on-accent); }
}
.btn--ghost { border-color: var(--border-strong); color: var(--ink-2); }
@media (hover: hover) {
  .btn--ghost:hover { border-color: var(--ink-4); color: var(--ink); }
}
.btn--lg { min-height: 52px; padding: 0.95rem 1.75rem; font-size: 1.02rem; }
.btn__icon { flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }

.link-button {
  position: relative;
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font-size: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-button::before { content: ''; position: absolute; inset: -12px -8px; }
@media (hover: hover) {
  .link-button:hover { color: var(--ink); }
}

.pill {
  display: inline-block;
  padding: 0.22rem 0.65rem;
  border: 1px solid currentColor;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

/* Topic lights: each topic wears one, in order. */
.light-1 { --light: var(--light-1); }
.light-2 { --light: var(--light-2); }
.light-3 { --light: var(--light-3); }
.light-4 { --light: var(--light-4); }

/* --------------------------------------------------------------------------
   Bar
   -------------------------------------------------------------------------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.bar__inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0.75rem var(--gutter);
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 1.75rem;
}
.bar__nav { display: flex; align-items: center; gap: 1.5rem; margin-left: auto; }
.bar__nav a {
  position: relative;
  padding-block: 0.4rem;
  color: var(--ink-3);
  font-size: 0.95rem;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--dur-micro);
}
.bar__nav a[aria-current="page"] { color: var(--ink); }
.bar__nav a[aria-current="page"]::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.15rem;
  height: 2px;
  border-radius: 2px;
  background: var(--burgundy);
}
@media (hover: hover) {
  .bar__nav a:hover { color: var(--ink); }
}

.bar__search {
  position: relative;
  width: 15rem;
}
.bar__icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--ink-4);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}
.bar__search input {
  width: 100%;
  height: 40px;
  padding: 0 2.4rem 0 2.25rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-pill);
  background: var(--input-bg);
  color: var(--ink);
  font-size: 0.92rem;
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: border-color var(--dur-micro), background-color var(--dur-micro);
}
.bar__search input::placeholder { color: var(--ink-4); }
.bar__search input:focus-visible { outline-color: var(--focus); }
@media (hover: hover) {
  .bar__search input:hover { border-color: var(--ink-4); }
}
.bar__key {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  min-width: 1.4rem;
  padding: 0 0.3rem;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  color: var(--ink-4);
  font-size: 0.75rem;
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
}
.bar__search:focus-within .bar__key { opacity: 0; }

.theme-toggle {
  position: relative;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: color var(--dur-micro), border-color var(--dur-micro), transform var(--dur-short) var(--ease);
}
.theme-toggle::before { content: ''; position: absolute; inset: -4px; }
.theme-toggle svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.theme-toggle__moon { display: none; }
:root[data-theme="light"] .theme-toggle__sun { display: none; }
:root[data-theme="light"] .theme-toggle__moon { display: block; }
@media (hover: hover) {
  .theme-toggle:hover { color: var(--amber); border-color: var(--ink-4); }
}
.theme-toggle:active { transform: scale(0.94); }

/* Phones: wordmark, search and theme on one row; the nav as a second, quieter row. */
.bar__search-link {
  display: none;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--ink-2);
}
.bar__search-link svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
@media (max-width: 760px) {
  .bar__inner { flex-wrap: wrap; row-gap: 0; column-gap: 0.6rem; min-height: 0; padding-block: 0.55rem 0; }
  .bar__search { display: none; }
  .bar__search-link { display: inline-grid; margin-left: auto; }
  .wordmark { font-size: 1.3rem; }
  .wordmark__by { display: none; }
  .bar__nav { order: 3; width: 100%; margin: 0.35rem 0 0; gap: 1.4rem; }
  .bar__nav a { padding-block: 0.55rem 0.7rem; font-size: 0.95rem; }
  .bar__nav a[aria-current="page"]::after { bottom: 0; }
  /* The search page has no search link, so the toggle takes the right edge. */
  .bar__nav + .theme-toggle { margin-left: auto; }
}

/* --------------------------------------------------------------------------
   Stage: the hero every page opens on
   -------------------------------------------------------------------------- */
.stage {
  position: relative;
  display: flex;
  justify-content: center;
  text-align: center;
  padding: clamp(4.5rem, 11vh, 7.5rem) var(--gutter) clamp(3.5rem, 8vh, 5.5rem);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.stage--compact { padding-block: clamp(3.5rem, 8vh, 5.5rem) clamp(2.75rem, 6vh, 4rem); }
.stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, var(--glow-a) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 15% 85%, var(--glow-b) 0%, transparent 55%),
    radial-gradient(ellipse 40% 30% at 85% 70%, var(--glow-c) 0%, transparent 55%);
  animation: stageGlow 9s ease-in-out infinite alternate;
  pointer-events: none;
}
.stage::after {
  content: '';
  position: absolute;
  left: 50%;
  top: -10%;
  width: min(60vw, 900px);
  height: 120%;
  transform: translateX(-50%);
  background-image: radial-gradient(circle, var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, #000, transparent 85%);
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%);
  pointer-events: none;
}
@keyframes stageGlow {
  from { opacity: 0.7; transform: scale(1); }
  to { opacity: 1; transform: scale(1.06); }
}

.stage__content {
  position: relative;
  z-index: 1;
  max-width: 900px;
  min-width: 0;
}
.stage__kicker {
  margin-bottom: 1.5rem;
  font-weight: 700;
  font-size: clamp(0.95rem, 1.5vw, 1.05rem);
  color: var(--burgundy);
}
.stage__kicker--cyan { color: var(--cyan); }
.stage__kicker--amber { color: var(--amber); }

.stage__title {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}
.stage__line {
  display: block;
  font-size: clamp(1.9rem, 4.6vw, 3.4rem);
  font-weight: 400;
  font-style: italic;
  color: var(--ink-3);
}
.stage__line--big {
  margin-top: 0.12em;
  font-size: clamp(2.9rem, 8.4vw, 6.4rem);
  font-weight: 800;
  font-style: normal;
  color: var(--ink);
  max-width: 100%;
}
.stage__line--query {
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  overflow-wrap: anywhere;
}
.stage__amp {
  font-style: italic;
  font-weight: 400;
  font-size: 0.72em;
  color: var(--ink-3);
}
.stage__punct { color: var(--amber); }

.stage__lede {
  max-width: 34em;
  margin: 1.6rem auto 0;
  font-size: clamp(1.08rem, 1.8vw, 1.25rem);
  line-height: 1.5;
  color: var(--ink-2);
}
.stage__lede a { color: var(--link); }
@media (max-width: 560px) {
  .stage { padding-block: 3.25rem 2.75rem; }
  .stage--compact { padding-block: 2.75rem 2.25rem; }
  .stage__actions { flex-direction: column; align-items: stretch; width: min(20rem, 100%); margin-inline: auto; }
}
.stage__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 2.1rem;
}

.permalink {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.35rem 1rem;
  margin-top: 1.75rem;
  font-size: 0.88rem;
  color: var(--ink-4);
}
.permalink a { color: var(--ink-3); overflow-wrap: anywhere; }
@media (hover: hover) {
  .permalink a:hover { color: var(--ink); }
}
.permalink__copy { color: var(--cyan); }
.permalink__status:empty { display: none; }
.permalink__status { color: var(--cyan); }

/* One entrance, from a visible default: the content is there without it. */
@media (prefers-reduced-motion: no-preference) {
  .stage__content > * { animation: fadeUp 0.8s var(--ease) both; }
  .stage__content > :nth-child(2) { animation-delay: 0.08s; }
  .stage__content > :nth-child(3) { animation-delay: 0.16s; }
  .stage__content > :nth-child(4) { animation-delay: 0.24s; }
  .stage__content > :nth-child(5) { animation-delay: 0.32s; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   The program: this week's topics, numbered like acts
   -------------------------------------------------------------------------- */
.program {
  padding: clamp(3rem, 6vw, 4.5rem) var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.program__inner { max-width: 880px; margin: 0 auto; }
.program__label {
  margin-bottom: 1.25rem;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--cyan);
}
.program__list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: 2.5rem;
}
@media (min-width: 760px) {
  .program__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.program__list a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "pill name" ". count";
  align-items: baseline;
  column-gap: 0.9rem;
  row-gap: 0.15rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border-strong);
  color: var(--ink);
  text-decoration: none;
}
.program__list .pill { grid-area: pill; color: var(--light); }
.program__name {
  grid-area: name;
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 2vw, 1.4rem);
  font-weight: 700;
  line-height: 1.25;
  transition: color var(--dur-micro);
}
.program__count { grid-area: count; font-size: 0.88rem; color: var(--ink-3); }
@media (hover: hover) {
  .program__list a:hover .program__name { color: var(--light); }
}

/* --------------------------------------------------------------------------
   Topics and bookmarks
   -------------------------------------------------------------------------- */
.issue__body { padding: 0 var(--gutter); }

.topic {
  position: relative;
  max-width: 880px;
  margin: 0 auto;
  padding-top: clamp(4rem, 8vw, 6rem);
}
.topic__head {
  display: grid;
  justify-items: start;
  gap: 0.9rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--light);
}
.topic__head .pill { color: var(--light); }
.topic__title {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.topic__count {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink-3);
}

.item {
  padding: 2.1rem 0 2.3rem;
  border-bottom: 1px solid var(--border-strong);
}
.item article { display: grid; gap: 0.7rem; }

.item__title {
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.01em;
}
.item__title a {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--light, var(--burgundy)), var(--light, var(--burgundy)));
  background-size: 0% 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.35s var(--ease), color var(--dur-micro);
}
@media (hover: hover) {
  .item__title a:hover { background-size: 100% 2px; }
}

.item__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1.1rem;
  font-size: 0.88rem;
  color: var(--ink-3);
}
.item__host { color: var(--ink-2); font-weight: 500; overflow-wrap: anywhere; }
.item__meta a { color: var(--ink-3); }
.item__anchor { font-family: var(--font-mono); font-size: 0.8rem; text-decoration: none; }
@media (hover: hover) {
  .item__meta a:hover { color: var(--ink); }
}

.item__summary {
  max-width: 64ch;
  color: var(--ink-2);
  line-height: 1.7;
}

.item__why {
  max-width: 60ch;
  margin-top: 0.4rem;
  padding: 0.15rem 0 0.15rem 1.15rem;
  border-left: 2px solid var(--light, var(--burgundy));
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.12rem, 1.8vw, 1.28rem);
  line-height: 1.5;
  color: var(--ink);
}
.item__why-lead {
  display: block;
  margin-bottom: 0.2rem;
  font-family: var(--font-sans);
  font-style: normal;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--light, var(--burgundy));
}

.item:target { scroll-margin-top: 96px; }
.item:target article {
  border-radius: 6px;
  background: var(--surface-2);
  box-shadow: 0 0 0 1rem var(--surface-2);
}

/* Previous and next week */
.weeks {
  max-width: calc(880px + 2 * var(--gutter));
  margin: clamp(4rem, 8vw, 6rem) auto 0;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
}
.weeks a {
  display: grid;
  gap: 0.35rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-strong);
  color: var(--ink);
  text-decoration: none;
}
.weeks__dir { font-size: 0.88rem; color: var(--ink-3); }
.weeks__label {
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 2.6vw, 1.75rem);
  font-weight: 700;
  line-height: 1.2;
  transition: color var(--dur-micro);
}
.weeks__newer { grid-column: 2; text-align: right; }
@media (hover: hover) {
  .weeks a:hover .weeks__label { color: var(--cyan); }
}
@media (max-width: 560px) {
  .weeks { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
  .weeks__newer { grid-column: 1; text-align: left; }
}

/* --------------------------------------------------------------------------
   Archive rows, after avi.nyc's writing list
   -------------------------------------------------------------------------- */
.past {
  margin-top: clamp(5rem, 10vw, 7rem);
  padding: clamp(3.5rem, 7vw, 5rem) var(--gutter);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.past__inner { max-width: 880px; margin: 0 auto; }
.past__title,
.year__title {
  margin-bottom: 0.5rem;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.past__more { margin-top: 2rem; }

.shelf { max-width: calc(880px + 2 * var(--gutter)); margin: 0 auto; padding: clamp(2.5rem, 6vw, 4rem) var(--gutter) 0; }
.year + .year { margin-top: 3.5rem; }

.archive__row { border-bottom: 1px solid var(--border-strong); }
.archive__link {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1.5rem;
  padding: 1.35rem 0;
  color: var(--ink);
  text-decoration: none;
  transition: padding var(--dur-short) var(--ease), background-color var(--dur-short);
}
.archive__title {
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  font-weight: 400;
  line-height: 1.25;
  transition: color var(--dur-micro);
}
.archive__count {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (hover: hover) {
  .archive__link:hover { padding-left: 0.9rem; background: linear-gradient(90deg, var(--surface-2) 0%, transparent 60%); }
  .archive__link:hover .archive__title { color: var(--cyan); }
}

/* --------------------------------------------------------------------------
   Search
   -------------------------------------------------------------------------- */
.search { width: min(40rem, 100%); margin: 2rem auto 0; }
.search__row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.4rem 0.4rem 3rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-pill);
  background: var(--input-bg);
  transition: border-color var(--dur-micro);
}
.search__row:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }
.search__icon {
  position: absolute;
  left: 1.15rem;
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}
.search__row input {
  flex: 1;
  min-width: 0;
  height: 48px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.08rem;
  outline: none;
}
.search__row input::placeholder { color: var(--ink-4); }
@media (max-width: 480px) {
  .search__row { padding-left: 2.6rem; }
  .search__icon { left: 0.95rem; }
  .search__row .btn { padding-inline: 1rem; }
}

.results { max-width: calc(880px + 2 * var(--gutter)); margin: 0 auto; padding: clamp(2.5rem, 6vw, 4rem) var(--gutter) 0; }
.results__count,
.results__none {
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--amber);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--ink-2);
}
.results__none a { color: var(--link); }
.hits { --light: var(--amber); }

mark {
  padding: 0 0.15em;
  border-radius: 3px;
  background: var(--mark-bg);
  color: var(--mark-ink);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.foot {
  margin-top: clamp(5rem, 10vw, 7rem);
  padding: 3.5rem var(--gutter) 4rem;
  text-align: center;
  border-top: 1px solid var(--border);
}
main:has(> .past:last-child) + .foot { margin-top: 0; }
.foot__name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 800;
}
.foot__name::after { content: '.'; color: var(--amber); }
.foot__about {
  max-width: 36em;
  margin: 0.5rem auto 0;
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink-3);
}
.foot__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.75rem;
  margin-top: 1.25rem;
  font-size: 0.92rem;
}
.foot__links a { color: var(--ink-2); }
@media (hover: hover) {
  .foot__links a:hover { color: var(--cyan); }
}
