/* View switcher (header) */
.view-switcher { display: flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin-right: 12px; }
.view-switcher form { margin: 0; }
.view-option { font: inherit; font-size: .8rem; padding: 4px 12px; border: 0; background: transparent; color: var(--muted); cursor: pointer; min-height: 30px; }
.view-option.is-current { background: var(--text); color: var(--bg); }

/* Digest: big cards, thumbnail left */
.reader-digest { grid-template-columns: var(--sidebar-width) 1fr; } /* same sidebar width as the Reader */
.digest-list { border-right: 0; }
.cards { list-style: none; margin: 0 auto; padding: 8px 16px 32px; max-width: 52rem; }
/* minmax(0, 1fr) and overflow-wrap: feed text can hold long unbroken strings
   ("<someone@list.example.gov>Sent:") that would otherwise widen the whole list. */
.card-row { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.card-thumb { display: block; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb-placeholder { display: grid; place-items: center; height: 100%; font: 700 1.3rem var(--font-serif); color: var(--muted); }
.card-title { font: 700 1.05rem/1.25 var(--font-serif); margin: 0 0 2px; overflow-wrap: anywhere; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:hover { text-decoration: underline; }
.card-row.is-read .card-title a { color: var(--muted); font-weight: 400; }
.card-summary { margin: 4px 0; color: var(--text); font-size: .9rem; line-height: 1.45; overflow-wrap: anywhere; }
.card-actions { display: flex; gap: 12px; font-size: .8rem; }
.card-actions form { margin: 0; }
.card-actions .link-button { color: var(--muted); text-decoration: none; }
.card-actions .link-button.is-on { color: var(--accent); }

/* Newspaper: print-style front page */
.paper { font-family: var(--font-serif); }
.site-main:has(.paper) { max-width: 88rem; } /* the newspaper uses a wide screen's room */
.masthead { text-align: center; border-bottom: 4px double var(--text); padding-bottom: 12px; margin-bottom: 20px; }
.masthead-date { font: .8rem var(--font-sans); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0; }
.masthead-title { font: 900 clamp(1.6rem, 4.2vw, 2.6rem)/1.05 var(--font-serif); letter-spacing: -.01em; margin: 2px 0 10px; }
.sections { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; font: .85rem var(--font-sans); border-top: 1px solid var(--text); border-bottom: 1px solid var(--text); padding: 6px 0; }
.sections a { color: var(--text); text-decoration: none; }
.sections a.is-current { font-weight: 700; text-decoration: underline; }
.paper-controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 12px; margin-top: 10px; font-family: var(--font-sans); }
.paper-controls form { margin: 0; }
.paper-controls .button { margin: 0; }
.paper-note { font-family: var(--font-sans); font-size: .85rem; }

/* Story sizes. Pictures are cropped to fixed boxes so a huge or tiny source image
   never dominates the page. */
.story a { color: var(--text); text-decoration: none; }
.story-headline a:hover, .brief-headline a:hover { text-decoration: underline; }
.story.is-read .story-headline a, .brief.is-read .brief-headline a { color: var(--muted); }
/* Full width, fixed height per size: an aspect-ratio plus max-height would narrow the box instead. */
.story-figure { display: block; width: 100%; overflow: hidden; background: var(--bg); margin-bottom: 10px; }
.story-image { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-byline { font: .72rem var(--font-sans); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 4px 0 6px; }
.story-dek { margin: 0; line-height: 1.5; }

.story-lead .story-figure { height: clamp(10rem, 22vw, 14rem); }
.story-lead .story-headline { font: 800 clamp(1.4rem, 2.6vw, 1.9rem)/1.12 var(--font-serif); margin: 0; }
.story-lead .story-dek { font-size: 1rem; }
.layout-text .story-lead .story-headline { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
.layout-text .story-lead .story-dek { columns: 2 16rem; column-gap: 24px; font-size: 1rem; }

.story-banner { display: grid; grid-template-columns: 7fr 5fr; gap: 24px; align-items: start; }
.story-banner .story-figure { height: clamp(9rem, 19vw, 12.5rem); margin: 0; }
.story-banner .story-headline { font: 800 clamp(1.35rem, 2.4vw, 1.8rem)/1.12 var(--font-serif); margin: 0; }

.story-feature .story-figure { height: 7rem; }
.story-feature .story-headline, .story-plain .story-headline { font: 700 1.02rem/1.22 var(--font-serif); margin: 0; }
.story-feature .story-dek, .story-plain .story-dek { font-size: .88rem; }

.story-compact.has-image { display: grid; grid-template-columns: 1fr 4rem; gap: 10px; align-items: start; }
.story-compact .story-figure { order: 2; width: 4rem; height: 4rem; margin: 0; }
.story-compact .story-headline { font: 700 .95rem/1.22 var(--font-serif); margin: 0; }
.story-compact .story-dek { font-size: .84rem; }

/* Layouts */
.front { display: grid; grid-template-columns: repeat(12, 1fr); gap: 20px 24px; }
.front > * > .story + .story { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }

.layout-classic .slot-lead { grid-column: 1 / 9; grid-row: 1; padding-right: 24px; border-right: 1px solid var(--border); }
.layout-classic .slot-rail { grid-column: 9 / 13; grid-row: 1 / span 2; }
.layout-classic .slot-below { grid-column: 1 / 9; grid-row: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; border-top: 1px solid var(--border); padding-top: 16px; }
.layout-classic .slot-below > .story + .story { margin: 0; padding: 0; border: 0; }

.layout-banner .slot-lead { grid-column: 1 / -1; border-bottom: 1px solid var(--border); padding-bottom: 20px; }
.layout-banner .slot-row, .layout-duo .slot-row { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 24px; }
.layout-duo .slot-pair { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 32px; border-bottom: 1px solid var(--border); padding-bottom: 20px; }
.layout-duo .slot-pair .story-figure { height: clamp(8rem, 16vw, 10.5rem); }
.layout-duo .slot-pair .story-headline { font-size: 1.25rem; }
.slot-row > .story + .story, .slot-pair > .story + .story { margin: 0; padding: 0; border: 0; }
.slot-row > .story + .story { border-left: 1px solid var(--border); padding-left: 24px; margin-left: -12px; }

.layout-text .slot-lead { grid-column: 1 / 8; padding-right: 24px; border-right: 1px solid var(--border); }
.layout-text .slot-grid { grid-column: 8 / 13; }

/* More stories: a second band of smaller stories with pictures above the briefs.
   12 stories: full rows at 4, 3, 2 or 1 across. */
.more-stories { margin-top: 24px; border-top: 2px solid var(--text); padding-top: 12px;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 24px; align-items: start; }
.more-stories .section-label { grid-column: 1 / -1; margin: 0; }
.more-stories .story-figure { height: 8rem; }
@media (max-width: 1100px) { .more-stories { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .more-stories { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .more-stories { grid-template-columns: 1fr; gap: 14px; }
  /* phones: a thumbnail beside the headline instead of a full-width picture, and a shorter summary */
  .more-stories .story.has-image { display: grid; grid-template-columns: minmax(0, 1fr) 5rem; gap: 10px; align-items: start; }
  .more-stories .story-figure { order: 2; width: 5rem; height: 5rem; margin: 0; }
  .more-stories .story-dek { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
}
.section-label, .briefs-heading { font: 700 .8rem var(--font-sans); text-transform: uppercase; letter-spacing: .1em; }

.briefs { margin-top: 24px; columns: 3 16rem; column-gap: 32px; column-rule: 1px solid var(--border); border-top: 2px solid var(--text); padding-top: 12px; }
.briefs-heading { column-span: all; margin: 0 0 8px; }
.brief { break-inside: avoid; padding: 0 0 12px; }
.brief-headline { font: 700 .93rem/1.25 var(--font-serif); margin: 0 0 2px; }
.brief-line { margin: 0; font-size: .84rem; line-height: 1.45; color: var(--muted); }
.brief-source { font-weight: 700; color: var(--text); }

/* Phones and narrow tablets */
@media (max-width: 767px) {
  .view-switcher { order: 2; margin: 0; }
  .view-option { padding: 4px 8px; }
  .card-row { grid-template-columns: 4rem minmax(0, 1fr); gap: 12px; }
  .card-title { font-size: 1rem; }
  .front, .front > * { display: block; padding: 0 !important; border: 0 !important; }
  .front > * + * { margin-top: 16px; padding-top: 16px !important; border-top: 1px solid var(--border) !important; }
  .slot-row > .story + .story, .slot-pair > .story + .story, .slot-below > .story + .story { margin: 16px 0 0; padding: 16px 0 0; border-left: 0; border-top: 1px solid var(--border); }
  .story-banner { display: block; }
  .story-banner .story-figure { margin-bottom: 10px; }
  .story-lead .story-figure, .story-banner .story-figure, .layout-duo .slot-pair .story-figure { height: 10rem; }
  .layout-text .story-lead .story-dek { columns: 1; }
  .briefs { columns: 1; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .layout-classic .slot-lead, .layout-text .slot-lead { grid-column: 1 / -1; border-right: 0; padding-right: 0; }
  .layout-classic .slot-rail, .layout-text .slot-grid { grid-column: 1 / -1; grid-row: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
  .layout-classic .slot-below { grid-column: 1 / -1; grid-row: auto; }
  .slot-rail > .story + .story, .slot-grid > .story + .story { margin: 0; padding: 0; border: 0; }
}

/* Header and sidebar actions: icon buttons (tooltips from title, names from aria-label). */
.site-nav { gap: 2px; }
.nav-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: var(--radius); background: transparent; color: var(--muted); cursor: pointer; }
.nav-icon-button:hover, .nav-icon-button:focus-visible { background: var(--bg); color: var(--text); }
.nav-icon-button .tree-icon { width: 20px; height: 20px; }
@media (pointer: coarse) { .nav-icon-button { width: 44px; height: 44px; } }

/* Header on phones: [wordmark | search | settings] then a full-width view switcher. */
@media (max-width: 767px) {
  .site-header { flex-wrap: wrap; height: auto; row-gap: 8px; column-gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .site-header .brand { order: 1; }
  .site-search { order: 2; flex: 1 1 0; min-width: 0; margin: 0; }
  .site-nav { order: 3; gap: 0; }
  .view-switcher { order: 4; flex-basis: 100%; }
  .view-switcher form { flex: 1; }
  .view-switcher .view-option { width: 100%; justify-content: center; }
  .nav-signout { display: none; }
  .nav-icon-button { width: 44px; height: 44px; }
}
@media (pointer: coarse) {
  .view-switcher .view-option { min-height: 44px; display: inline-flex; align-items: center; }
}
/* Add feed / Organize live in the sidebar below desktop widths (beats the touch-target display rule). */
@media (max-width: 1023px) { .site-nav a.nav-secondary { display: none; } }
