/* ============================================================
   The DJ
   Newspaper components on top of damianpickett.com's site.css.
   Same tokens, same glass menu, same San Francisco. Mobile first.
   ============================================================ */

:root {
  --menu-w: 208px;
}

html {
  scroll-behavior: smooth;
}

body {
  overscroll-behavior-y: auto;
}

main {
  max-width: 680px;
  padding: calc(72px + env(safe-area-inset-top, 0px)) 24px 170px;
}

/* ---------- Masthead ---------- */

.masthead {
  margin-bottom: 48px;
}

.masthead-kicker,
.section-h {
  font-size: 13px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--sage-deep);
}

.masthead-kicker {
  margin-bottom: 14px;
}

.masthead-kicker a {
  color: inherit;
  font-weight: inherit;
}

.masthead-kicker a:hover {
  color: var(--ink);
  text-decoration: none;
}

.masthead .page-title {
  margin-bottom: 4px;
}

.dateline {
  font-size: 21px;
  line-height: 1.35;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--muted);
}

.standfirst {
  margin-top: 16px;
  font-size: 18px;
  line-height: 1.55;
  color: var(--body);
  text-wrap: pretty;
}

/* ---------- Sections ---------- */

.section {
  margin-bottom: 56px;
  scroll-margin-top: 20px;
}

.section-h {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.group-h {
  margin: 30px 0 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.004em;
  color: var(--ink);
}

.group-h:first-of-type {
  margin-top: 22px;
}

.group-h + .stories .story:first-child {
  padding-top: 12px;
}

/* ---------- Stories ---------- */

.stories {
  list-style: none;
  padding: 0;
  margin: 0;
}

.story {
  position: relative;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.story:last-child {
  border-bottom: 0;
}

.story-title {
  font-size: 19px;
  line-height: 1.32;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-wrap: pretty;
}

main .story-title a {
  font-weight: inherit;
  color: inherit;
  transition: color 160ms ease;
}

/* The title carries the link; the whole row is its tap target. */
.story-title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.story:hover .story-title a {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--sage);
  text-decoration-skip-ink: none;
}

/* Read stories quieten down. */
main .story-title a:visited {
  color: var(--muted);
}

.story-tldr {
  margin-top: 7px;
  font-size: 17px;
  line-height: 1.52;
  color: var(--body);
  text-wrap: pretty;
}

.story-meta {
  margin-top: 9px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0 10px;
}

.story-source {
  color: var(--sage-deep);
  font-weight: 550;
}

.front .story-title {
  font-size: 23px;
  line-height: 1.25;
  letter-spacing: -0.016em;
}

.front .story-lead .story-title {
  font-size: 27px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.front .story-tldr {
  font-size: 18px;
}

.front .story {
  padding: 24px 0;
}

.finally .story-title {
  font-size: 21px;
}

/* ---------- Pictures ---------- */

.story.has-media {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 156px;
  gap: 22px;
  align-items: start;
}

.story-media {
  margin: 4px 0 0;
  width: 156px;
  aspect-ratio: 3 / 2;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.story-media img,
.pick-media img,
.pick-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* The front page, the first story of each section and the closing
   story carry their pictures wide. */
.front .story.has-media,
.finally .story.has-media,
.section .story-lead.has-media {
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.front .story-media,
.finally .story-media,
.section .story-lead .story-media {
  order: -1;
  width: 100%;
  margin: 0;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
}

/* ---------- Picks: today's read and listen ---------- */

.picks-grid {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.picks-listen {
  display: grid;
  gap: 16px;
}

.pick {
  position: relative;
  padding: 24px 26px 22px;
}

.pick-body {
  min-width: 0;
}

.pick-media {
  margin: 0 0 18px;
  aspect-ratio: 3 / 2;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.pick-listen {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px 18px;
  align-items: start;
  align-content: start;
}

.pick-listen:not(.has-art) {
  grid-template-columns: minmax(0, 1fr);
}

.pick-art {
  width: 72px;
  height: 72px;
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.pick-head {
  min-width: 0;
}

.pick-listen .pick-why,
.pick-listen .pick-meta {
  grid-column: 1 / -1;
}

.pick-listen .pick-why {
  margin-top: 0;
}

.pick-listen .pick-meta {
  margin-top: 0;
}

.pick-kicker {
  font-size: 12.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sage-deep);
  margin-bottom: 12px;
}

.pick-head .pick-kicker {
  margin-bottom: 7px;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.pick-listen .pick-art {
  margin-top: 2px;
}

.pick-title {
  font-size: 20px;
  line-height: 1.28;
  font-weight: 650;
  letter-spacing: -0.014em;
  color: var(--ink);
  text-wrap: pretty;
}

main .pick-title a {
  font-weight: inherit;
  color: inherit;
}

.pick-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.pick:hover .pick-title a {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--sage);
  text-decoration-skip-ink: none;
}

.pick-sub {
  margin-top: 6px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--muted);
  text-wrap: pretty;
}

.pick-why {
  margin-top: 12px;
  font-size: 16.5px;
  line-height: 1.5;
  color: var(--body);
  text-wrap: pretty;
}

.pick-meta {
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

main .pick-meta a {
  position: relative;
  z-index: 1;
  color: var(--sage-deep);
  font-weight: 550;
}

main .pick-meta a:hover {
  color: var(--ink);
}

.tag {
  display: inline-block;
  padding: 1px 8px 2px;
  border-radius: 9px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 550;
  letter-spacing: 0.02em;
  color: var(--muted);
  vertical-align: 1px;
}

/* Wider screens: the read is a feature with its cover beside the text,
   the listens sit side by side. */
@media (min-width: 660px) {
  .pick-read.has-cover {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    gap: 26px;
    align-items: start;
  }

  .pick-read.has-cover .pick-media {
    margin: 2px 0 0;
  }
}

/* ---------- Colophon ---------- */

.colophon {
  margin-top: 12px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
}

.colophon a {
  color: var(--sage-deep);
  font-weight: 550;
}

.colophon a:hover {
  color: var(--ink);
}

.colophon-links {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

main .colophon p + p {
  margin-top: 14px;
}

/* ---------- Archive ---------- */

.editions {
  list-style: none;
  padding: 0;
  margin: 0;
}

.edition-row {
  position: relative;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.edition-row:last-child {
  border-bottom: 0;
}

.edition-date {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink);
}

main .edition-date a {
  color: inherit;
  font-weight: inherit;
}

.edition-date a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.edition-row:hover .edition-date a {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--sage);
}

.edition-lead {
  margin-top: 4px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--muted);
  text-wrap: pretty;
}

/* ---------- Sources ---------- */

.source-group + .source-group {
  margin-top: 8px;
}

.source-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}

.source-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
}

.source-list li:last-child {
  border-bottom: 0;
}

.source-host {
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- Menu ---------- */

.menu {
  bottom: max(30px, calc(env(safe-area-inset-bottom) + 14px));
}

/* ---------- Mobile ---------- */

@media (max-width: 780px) {
  main {
    padding: calc(52px + env(safe-area-inset-top, 0px)) 20px 150px;
  }

  .masthead {
    margin-bottom: 40px;
  }

  .masthead .page-title {
    font-size: 40px;
  }

  .dateline {
    font-size: 19px;
  }

  .standfirst {
    font-size: 17px;
  }

  .section {
    margin-bottom: 46px;
  }

  .story {
    padding: 18px 0;
  }

  .story-title {
    font-size: 18.5px;
  }

  .story-tldr {
    font-size: 16.5px;
  }

  .front .story {
    padding: 20px 0;
  }

  .front .story-title {
    font-size: 21px;
  }

  .front .story-lead .story-title {
    font-size: 24px;
  }

  .front .story-tldr {
    font-size: 17px;
  }

  .pick {
    padding: 22px 22px 20px;
    border-radius: 16px;
  }

  .story.has-media {
    grid-template-columns: minmax(0, 1fr) 108px;
    gap: 16px;
  }

  .story-media {
    width: 108px;
    margin-top: 3px;
  }

  .pick-listen {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px 14px;
  }

  .pick-art {
    width: 64px;
    height: 64px;
    border-radius: 12px;
  }

  .menu {
    bottom: max(22px, calc(env(safe-area-inset-bottom) + 10px));
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ---------- A paper to open by section ---------- */

[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.edition-reader { scroll-behavior: auto; }
/* Section changes are instant. Avoid cross-page snapshots fighting a
   changed viewport or a deep link when moving through the archive. */
@view-transition { navigation: none; }
.picker-open { overflow: hidden; }
.heading-count {
  float: right;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}
.edition-sections { margin: -14px 0 30px; }
.section-index-label, .picker-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.section-shortcuts { display: flex; flex-wrap: wrap; gap: 7px; }
.section-shortcuts a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 550;
}
.section-count { font-size: 12px; font-weight: 500; color: var(--sage-deep); }
.section-shortcuts a:hover, .section-grid a:hover, .team-links a:hover { background: var(--glass-bg-strong); }
.edition-dock {
  --active-tab: 0;
  position: fixed;
  z-index: 20;
  bottom: max(16px, calc(env(safe-area-inset-bottom, 0px) + 8px));
  left: 50%;
  transform: translateX(-50%);
  width: min(440px, calc(100% - 32px));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 5px;
  border: 1px solid var(--glass-border);
  border-radius: 29px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  backdrop-filter: blur(24px) saturate(150%);
  box-shadow: var(--glass-shadow), var(--glass-inset);
  isolation: isolate;
}
.edition-reader .edition-dock::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 5px auto 5px 5px;
  width: calc((100% - 10px) / 3);
  border-radius: 24px;
  background: var(--glass-bg-strong);
  box-shadow: inset 0 0 0 1px var(--glass-border), 0 2px 8px #0001;
  transform: translateX(calc(var(--active-tab) * 100%));
}
.edition-dock.is-ready::before {
  transition: transform 540ms var(--spring-w-expand);
}
.edition-dock a, .edition-dock button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 550;
  color: var(--muted);
  text-align: center;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  transition: transform 540ms var(--spring-w-expand), color 160ms ease;
}
.edition-dock [aria-current], .edition-dock .is-current, .edition-dock [aria-expanded="true"] {
  color: var(--ink);
}
.edition-dock a:hover, .edition-dock button:hover { color: var(--ink); }
.edition-dock a:active, .edition-dock button:active {
  transform: translateY(2px) scale(.92);
  transition-duration: 70ms;
  transition-timing-function: ease-out;
}
.section-picker {
  position: fixed;
  --picker-bottom: max(88px, calc(env(safe-area-inset-bottom, 0px) + 80px));
  inset: auto 0 var(--picker-bottom);
  margin: 0 auto;
  width: min(440px, calc(100% - 32px));
  max-width: 100%;
  max-height: calc(100dvh - var(--picker-bottom) - max(24px, env(safe-area-inset-top, 0px)));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(32px) saturate(150%);
  backdrop-filter: blur(32px) saturate(150%);
  color: var(--ink);
  box-shadow: var(--glass-shadow-lift), var(--glass-inset);
  transform-origin: bottom right;
}
.section-picker::backdrop { background: #0004; animation: picker-backdrop-in 180ms ease both; }
.section-picker.is-opening > * { animation: picker-content-in 320ms 90ms ease both; }
.section-picker.is-closing { pointer-events: none; }
.section-picker.is-closing > * { opacity: 0; transition: opacity 100ms ease; }
.section-picker.is-closing::backdrop { animation: picker-backdrop-out 240ms ease both; }
@keyframes picker-content-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes picker-backdrop-in { from { background: #0000; } to { background: #0004; } }
@keyframes picker-backdrop-out { from { background: #0004; } to { background: #0000; } }
.picker-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 20px; }
.picker-head .masthead-kicker { margin: 0 0 4px; font-size: 11px; }
.picker-head h2 { font-size: 26px; line-height: 1.25; letter-spacing: -.02em; }
.picker-close { min-height: 44px; min-width: 60px; border-radius: 999px; font-size: 14px; color: var(--sage-deep); }
.picker-primary { display: flex; gap: 4px; margin: 0 -12px 16px; }
.picker-primary a { min-height: 44px; display: flex; align-items: center; padding: 0 12px; border-radius: 999px; font-size: 15px; }
.section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.section-grid a { display: flex; justify-content: space-between; gap: 8px; align-items: center; min-height: 54px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 999px; font-size: 16px; }
.section-grid a, .picker-primary a, .team-links a, .picker-close {
  transition: transform 540ms var(--spring-w-expand), background-color 160ms ease;
}
.section-grid a:active, .picker-primary a:active, .team-links a:active, .picker-close:active {
  transform: scale(.95);
  transition-duration: 70ms;
  transition-timing-function: ease-out;
}
.section-picker [aria-current] { background: var(--glass-bg-strong); border-color: var(--sage-deep); color: var(--sage-deep); }
.picker-label { margin-top: 22px; }
.team-links { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 -8px; }
.team-links a { display: flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 8px; font-size: 14px; border-radius: 999px; }
.picks-listen > .section-index-label { margin: 20px 0 0; }
.picker-footer { display: flex; flex-wrap: wrap; gap: 4px 22px; border-top: 1px solid var(--line); margin-top: 20px; padding-top: 14px; }
.picker-footer a { display: flex; align-items: center; min-height: 44px; color: var(--muted); font-size: 14px; }
.group-h[id] { scroll-margin-top: 24px; }

/* One lead image; supporting highlights retain pictures at row scale. */
.front .story.has-media:not(.story-lead) { grid-template-columns: minmax(0, 1fr) 108px; gap: 16px; }
.front .story:not(.story-lead) .story-media { order: 0; width: 108px; aspect-ratio: 3 / 2; margin-top: 4px; border-radius: 10px; }
.front .story:not(.story-lead) .story-title { font-size: 20px; }
.front .story:not(.story-lead) .story-tldr { font-size: 16.5px; }

@media (max-width: 420px) {
  .edition-dock a, .edition-dock button { font-size: 13px; }
  .section-picker { padding-left: 20px; padding-right: 20px; }
  .front .story.has-media:not(.story-lead) { grid-template-columns: minmax(0, 1fr) 88px; gap: 13px; }
  .front .story:not(.story-lead) .story-media { width: 88px; }
}
@media print {
  [data-edition-panel][hidden] { display: block !important; }
  .edition-dock, .section-picker, .edition-sections { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .edition-dock::before, .edition-dock a, .edition-dock button,
  .section-picker, .section-picker > *, .section-picker::backdrop,
  .section-grid a, .picker-primary a, .team-links a, .picker-close {
    animation: none !important;
    transition: none !important;
  }
  .edition-dock a:active, .edition-dock button:active,
  .section-grid a:active, .picker-primary a:active, .team-links a:active, .picker-close:active { transform: none; }
}
