/* The Daily Ledger: "desk sheet" design.
   One idea: each desk has an ink, and that ink marks its stories everywhere. */

:root {
  --page: #F4F5F2;
  --sheet: #FBFBF9;
  --ink: #1A2533;
  --ink-2: #47515E;
  --ink-3: #6E7782;
  --rule: #DADDD8;
  --rule-2: #C5C9C3;
  --focus: #2E5FD0;

  --intl: #1D6A72;
  --natl: #34489A;
  --regl: #5F7326;
  --utah: #946410;
  --all: #1A2533;

  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Literata", Georgia, serif;

  --measure: 40rem; /* ~66 characters of Literata at 18px */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #14181D;
    --sheet: #191E24;
    --ink: #E6E8E4;
    --ink-2: #B9BEC4;
    --ink-3: #8C949D;
    --rule: #2A3038;
    --rule-2: #3A414B;
    --focus: #8AB0FF;
    --intl: #6FB7BF;
    --natl: #93A4EA;
    --regl: #AEC26E;
    --utah: #E0B357;
    --all: #E6E8E4;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 168px; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}
a { color: inherit; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--page); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
kbd { font-family: var(--sans); font-size: 12px; border: 1px solid var(--rule-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }

/* desk inks as a variable each element can pick up */
[data-desk="international"] { --desk: var(--intl); }
[data-desk="national"] { --desk: var(--natl); }
[data-desk="regional"] { --desk: var(--regl); }
[data-desk="utah"] { --desk: var(--utah); }
[data-desk="all"] { --desk: var(--all); }

/* ---------------- header ---------------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--page) 94%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  -webkit-backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--rule);
  padding: 0 max(16px, calc((100vw - 1180px) / 2));
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0 6px; }
.brand { font-weight: 800; font-size: 22px; letter-spacing: -0.02em; text-decoration: none; }
.view-switch { display: inline-flex; background: var(--rule); border-radius: 8px; padding: 3px; }
.view-switch button { border: 0; background: none; padding: 5px 16px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.view-switch button[aria-selected="true"] { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .12); }

/* day strip */
.days { display: flex; align-items: center; gap: 6px; padding: 4px 0 8px; }
.day-strip { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; scroll-behavior: smooth; }
.day-strip::-webkit-scrollbar { display: none; }
.day {
  flex: none; display: grid; justify-items: center;
  border: 0; background: none; cursor: pointer; border-radius: 8px;
  padding: 4px 10px; min-width: 58px; color: var(--ink-2);
}
.day .dow { font-size: 12px; }
.day .dom { font-size: 18px; font-weight: 700; line-height: 1.15; color: var(--ink); font-variant-numeric: tabular-nums; }
.day .n { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.day:hover { background: var(--rule); }
.day[aria-current="date"] { background: var(--ink); }
.day[aria-current="date"] .dow, .day[aria-current="date"] .dom, .day[aria-current="date"] .n { color: var(--page); }
.day-step { flex: none; width: 32px; height: 44px; border: 0; background: none; font-size: 22px; cursor: pointer; border-radius: 8px; color: var(--ink-2); }
.day-step:hover:not(:disabled) { background: var(--rule); }
.day-step:disabled { opacity: .3; cursor: default; }
.jump { flex: none; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); padding-left: 8px; }
.jump input { border: 1px solid var(--rule-2); background: var(--sheet); border-radius: 6px; padding: 4px 6px; font-size: 13px; }

/* desk tabs */
.desks { position: relative; }
.desk-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.desk-tabs::-webkit-scrollbar { display: none; }
.desk-tab {
  flex: none; border: 0; background: none; cursor: pointer;
  padding: 8px 14px 11px; font-size: 15px; font-weight: 600; color: var(--ink-2);
  display: inline-flex; align-items: baseline; gap: 7px;
}
.desk-tab .n { font-size: 13px; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.desk-tab::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--desk); align-self: center; }
.desk-tab[data-desk="all"]::before { display: none; }
.desk-tab[aria-selected="true"] { color: var(--desk); }
.desk-tab:hover { color: var(--ink); }
.desk-ink {
  position: absolute; bottom: -1px; left: 0; height: 3px; width: 0;
  background: var(--desk, var(--ink)); border-radius: 3px 3px 0 0;
  transition: transform .28s cubic-bezier(.3, .7, .2, 1), width .28s cubic-bezier(.3, .7, .2, 1), background-color .28s;
}
@media (prefers-reduced-motion: reduce) { .desk-ink { transition: none; } .day-strip { scroll-behavior: auto; } }

/* ---------------- list tools ---------------- */
.list-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  max-width: 1000px; margin: 0 auto; padding: 16px 16px 0;
  font-size: 14px; color: var(--ink-2);
}
.list-tools[hidden] { display: none; }
.list-tools label { display: inline-flex; align-items: center; gap: 6px; }
.list-tools select, #q { border: 1px solid var(--rule-2); background: var(--sheet); border-radius: 6px; padding: 6px 8px; }
#q { flex: 1 1 240px; min-width: 0; font-size: 15px; }
.active-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.active-tags:empty { display: none; }

/* tags */
.tag {
  border: 1px solid var(--rule-2); background: none; border-radius: 999px; cursor: pointer;
  padding: 1px 10px; font-size: 13px; color: var(--ink-2);
}
.tag:hover { border-color: var(--ink-3); color: var(--ink); }
.tag[aria-pressed="true"] { background: var(--ink); color: var(--page); border-color: var(--ink); }
.active-tags .tag::after { content: " ×"; }

/* ---------------- shared story parts ---------------- */
main { outline: none; }
.meta { font-size: 13px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.meta .place { color: var(--desk); font-weight: 600; }
.lede { font-family: var(--serif); font-size: 18px; line-height: 1.62; margin: 0 0 14px; }
.why-head, .conn-head { font-size: 14px; font-weight: 700; margin: 20px 0 6px; color: var(--ink); }
.why p { font-family: var(--serif); font-size: 17px; line-height: 1.66; margin: 0 0 12px; color: var(--ink); }
.conn { list-style: none; padding: 0; margin: 0 0 8px; }
.conn li { position: relative; padding-left: 22px; margin: 0 0 8px; font-family: var(--serif); font-size: 16px; line-height: 1.55; color: var(--ink-2); }
.conn li::before { content: ""; position: absolute; left: 2px; top: .5em; width: 9px; height: 9px; border-radius: 50%; background: var(--ink-2); }
.conn li.likely::before { background: none; border: 1.5px dashed var(--ink-3); }
.conn .k { font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--ink-3); margin-right: 4px; }
.sources { font-size: 14px; color: var(--ink-3); margin: 12px 0 0; }
.sources a { color: var(--ink-2); text-underline-offset: 2px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.state { max-width: var(--measure); margin: 0 auto; padding: 72px 16px; text-align: center; color: var(--ink-2); }
.state h2 { font-size: 22px; color: var(--ink); margin: 0 0 8px; }
.state p { margin: 0 0 18px; }
.btn { border: 1px solid var(--rule-2); background: var(--sheet); border-radius: 8px; padding: 7px 14px; cursor: pointer; font-weight: 600; font-size: 14px; }
.btn:hover { border-color: var(--ink-3); }
.loading { padding: 80px 16px; text-align: center; color: var(--ink-3); }

/* ---------------- read view: front page ---------------- */
.front { max-width: 1180px; margin: 0 auto; padding: 28px 16px 8px; }
.front-head { max-width: 52rem; margin-bottom: 26px; }
.dateline { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.coverage { font-family: var(--serif); font-style: italic; color: var(--ink-3); margin: 6px 0 0; font-size: 15px; line-height: 1.5; }

.front h2 a, .front h3 a, .more-stories a { text-decoration: none; }
.front h2 a:hover, .front h3 a:hover, .more-stories a:hover .hl { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* lead + seconds */
.top-stories { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 0 40px; padding-bottom: 32px; border-bottom: 1px solid var(--rule-2); }
.top-stories.solo { grid-template-columns: minmax(0, 1fr); }
.lead { border-top: 6px solid var(--desk); padding-top: 14px; }
.lead h2 { font-size: clamp(34px, 4.6vw, 54px); font-weight: 800; letter-spacing: -0.028em; line-height: 1.04; margin: 10px 0 16px; text-wrap: balance; }
.lead .lede { font-size: 20px; line-height: 1.55; max-width: 38rem; }
.lead-why { font-family: var(--serif); font-size: 17px; line-height: 1.62; color: var(--ink-2); max-width: 38rem; margin: 0 0 16px; }
.lead-why b { font-family: var(--sans); font-size: 15px; color: var(--ink); }
.lead > a:last-child { font-weight: 700; font-size: 15px; color: var(--desk); text-underline-offset: 3px; }
.seconds { display: flex; flex-direction: column; }
.second { border-top: 3px solid var(--desk); padding: 12px 0 20px; }
.second + .second { margin-top: 4px; }
.second h3 { font-size: 21px; font-weight: 700; letter-spacing: -0.012em; line-height: 1.22; margin: 6px 0 8px; text-wrap: balance; }
.second p { font-family: var(--serif); font-size: 15.5px; line-height: 1.55; color: var(--ink-2); margin: 0; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* grid of the next nine */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px 32px; padding: 30px 0 34px; border-bottom: 1px solid var(--rule-2); }
.card { border-top: 3px solid var(--desk); padding-top: 12px; }
.card h3 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; margin: 6px 0 8px; text-wrap: balance; }
.card p { font-family: var(--serif); font-size: 15px; line-height: 1.55; color: var(--ink-2); margin: 0; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* everything else, still in order of significance */
.more-stories { padding-top: 30px; }
.more-stories > h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.015em; margin: 0 0 12px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.more-stories > h2 small { font-size: 14px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.more-stories ol { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 40px; }
.more-stories li { break-inside: avoid; display: grid; grid-template-columns: 4px minmax(0, 1fr); gap: 2px 12px; padding: 9px 0; border-bottom: 1px solid var(--rule); }
.more-stories li::before { content: ""; grid-row: 1 / span 2; background: var(--desk); border-radius: 2px; }
.more-stories .hl { font-size: 15.5px; font-weight: 600; line-height: 1.32; }
.more-stories .place { grid-column: 2; font-size: 12.5px; color: var(--desk); font-weight: 600; }

.threads { margin-top: 48px; padding: 26px 28px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; max-width: 52rem; }
.threads h2 { font-size: 22px; font-weight: 800; margin: 0 0 4px; }
.threads > p { margin: 0 0 16px; font-size: 14px; color: var(--ink-3); }
.threads .conn li { color: var(--ink); }

.next-day { margin: 40px 0 0; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------------- article page ---------------- */
.article { max-width: var(--measure); margin: 0 auto; padding: 28px 16px 24px; box-sizing: content-box; }
.back { border: 0; background: none; padding: 4px 0; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.back::before { content: "‹ "; }
.back:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.desk-name { margin: 22px 0 0; font-weight: 700; font-size: 15px; color: var(--desk); padding-top: 12px; border-top: 6px solid var(--desk); }
.article h1 { font-size: clamp(30px, 4.4vw, 44px); font-weight: 800; letter-spacing: -0.025em; line-height: 1.08; margin: 10px 0 14px; text-wrap: balance; }
.article > .meta { margin-bottom: 22px; }
.article .lede { font-size: 20px; line-height: 1.6; }
.article-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--rule-2); }
.article-nav a { text-decoration: none; font-weight: 700; line-height: 1.3; display: block; padding-top: 10px; border-top: 3px solid var(--desk); }
.article-nav a:hover { text-decoration: underline; text-underline-offset: 3px; }
.article-nav small { display: block; font-size: 13px; font-weight: 500; color: var(--ink-3); margin-bottom: 4px; }
.article-nav .next { text-align: right; grid-column: 2; }
.position { font-size: 13px; color: var(--ink-3); margin: 18px 0 0; }

/* ---------------- list view ---------------- */
.list { max-width: 1000px; margin: 0 auto; padding: 18px 16px 40px; }
.list-summary { font-size: 14px; color: var(--ink-3); margin: 0 0 8px; }
.list-group { font-size: 17px; font-weight: 800; margin: 28px 0 2px; padding-bottom: 6px; border-bottom: 2px solid var(--desk, var(--ink)); color: var(--desk, var(--ink)); }
.reverse[hidden] { display: none; }
.reverse[aria-pressed="true"] { background: var(--ink); color: var(--page); border-color: var(--ink); }
.row { border-bottom: 1px solid var(--rule); }
.row > button {
  width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
  display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 0 14px; padding: 12px 4px 12px 0;
}
.row > button::before { content: ""; grid-row: 1 / span 2; background: var(--desk); border-radius: 2px; }
.row .hl { font-size: 16.5px; font-weight: 500; line-height: 1.3; }
.row.i4 .hl { font-weight: 700; }
.row.i5 .hl { font-weight: 800; font-size: 18px; }
.row .sum { grid-column: 2; font-size: 14px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.row .side { grid-column: 3; grid-row: 1; font-size: 13px; color: var(--ink-3); text-align: right; white-space: nowrap; }
.row .side .place { color: var(--desk); font-weight: 600; display: block; }
.row > button:hover .hl { text-decoration: underline; text-underline-offset: 3px; }
.row.open .sum { display: none; }
.row-body { padding: 4px 0 24px 18px; max-width: calc(var(--measure) + 18px); }
.row-body .lede { font-size: 17px; }
.more { display: block; margin: 24px auto 0; }

/* ---------------- footer ---------------- */
.foot { max-width: 1180px; margin: 0 auto; padding: 32px 16px 48px; font-size: 13px; color: var(--ink-3); border-top: 1px solid var(--rule); }
.foot p { margin: 0; }

/* ---------------- responsive ---------------- */
@media (max-width: 960px) {
  .top-stories { grid-template-columns: minmax(0, 1fr); }
  .seconds { margin-top: 28px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .more-stories ol { columns: 1; }
}
@media (max-width: 640px) {
  /* on phones only the desk switcher stays pinned; the rest of the header scrolls away */
  html { scroll-padding-top: 64px; }
  .top { display: contents; }
  .top-row, .days { padding-left: 16px; padding-right: 16px; }
  .desks { position: sticky; top: 0; z-index: 10; background: var(--page); padding: 0 16px; border-bottom: 1px solid var(--rule); }
  .desks::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 28px; background: linear-gradient(to right, transparent, var(--page)); pointer-events: none; }
  .desk-ink { margin-left: 16px; }
  .jump { display: none; }
  .top-row { padding-top: 10px; }
  .brand { font-size: 19px; }
  .desk-tab { padding: 8px 10px 11px; font-size: 14px; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .lead .lede, .article .lede { font-size: 18px; }
  .article-nav { grid-template-columns: 1fr; }
  .article-nav .next { grid-column: 1; text-align: left; }
  .lede { font-size: 17px; }
  .why p { font-size: 16.5px; }
  .threads { padding: 20px 18px; }
  .row .side { display: none; }
  .row > button { grid-template-columns: 4px minmax(0, 1fr); }
}
