:root {
  color-scheme: light dark;
}

body {
  font-family: system-ui, sans-serif;
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
}

nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  border-bottom: 1px solid #8888;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

nav a {
  text-decoration: none;
  font-weight: 600;
}

form.inline {
  display: inline-block;
  margin: 0;
}

.actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.flashes {
  list-style: none;
  padding: 0;
}

.flashes li {
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.flash-success {
  background: #1a7f371a;
  border: 1px solid #1a7f37;
}

.flash-error {
  background: #cf222e1a;
  border: 1px solid #cf222e;
}

table.settings td {
  padding: 0.4rem 0.6rem;
  vertical-align: top;
}

table.settings .label {
  font-weight: 600;
  white-space: nowrap;
}

table.settings .help {
  font-weight: 400;
  font-size: 0.8rem;
  opacity: 0.7;
  white-space: normal;
  max-width: 22rem;
}

table.settings input {
  width: 22rem;
  max-width: 100%;
}

table.news {
  width: 100%;
  border-collapse: collapse;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
}

table.news th,
table.news td {
  text-align: left;
  padding: 0.3rem 0.6rem;
  border-bottom: 1px solid #8884;
  white-space: nowrap;
}

table.news td:last-child {
  white-space: normal;
}

.pager {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 20rem;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* --- front page (newspaper) --- */

.masthead {
  text-align: center;
  border-bottom: 4px double #8888;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
}

.masthead h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 3rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 0.25rem 0 0;
}

.masthead .tagline {
  margin: 0;
  font-style: italic;
  opacity: 0.75;
}

.masthead .dateline {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
}

.edition-note {
  text-transform: none;
  letter-spacing: normal;
  font-style: italic;
}

.last-updated {
  margin-top: 0.15rem;
  font-size: 0.75rem;
  opacity: 0.55;
}

.day-picker {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.day-pill {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid #8888;
  font-size: 0.8rem;
  text-transform: none;
  letter-spacing: normal;
  text-decoration: none;
  color: inherit;
}

.day-pill:hover {
  border-color: currentColor;
}

.day-pill-active {
  background: #8888;
  font-weight: 700;
}

.empty {
  text-align: center;
  opacity: 0.7;
  padding: 2rem 0;
}

.badges {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid #8888;
  opacity: 0.85;
}

.badge-hot {
  background: #cf222e1a;
  border-color: #cf222e;
  color: #cf222e;
}

.badge-category {
  background: #8888;
}

.badge-importance {
  background: transparent;
}

.badge-unlabeled {
  background: transparent;
  opacity: 0.6;
  font-style: italic;
}

.topic-form {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.topic-form input[type="text"] {
  flex: 1 1 16rem;
  padding: 0.4rem 0.6rem;
}

.topic-form label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.headline {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.15;
  margin: 0 0 0.35rem;
}

.headline a {
  color: inherit;
  text-decoration: none;
}

.headline a:hover {
  text-decoration: underline;
}

.lead-story .headline {
  font-size: 2.1rem;
}

.lead-story {
  border-bottom: 1px solid #8888;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
}

.dek {
  font-style: italic;
  opacity: 0.85;
  margin: 0 0 0.35rem;
}

.byline {
  font-size: 0.8rem;
  opacity: 0.65;
  margin: 0;
}

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

.story-item {
  border-bottom: 1px solid #8884;
  padding: 1rem 0;
}

.story-item:last-child {
  border-bottom: none;
}

.story-item .headline {
  font-size: 1.15rem;
}

/* --- responsive --- */

nav {
  flex-wrap: wrap;
}

.headline {
  overflow-wrap: break-word;
}

@media (max-width: 640px) {
  body {
    padding: 0.75rem 1rem 2rem;
  }

  nav {
    gap: 0.75rem;
  }

  .masthead h1 {
    font-size: 2rem;
  }

  .lead-story .headline {
    font-size: 1.5rem;
  }

  .story-item .headline {
    font-size: 1.05rem;
  }

  .topic-form input[type="text"] {
    flex-basis: 100%;
  }

  /* news table becomes stacked cards */
  table.news thead {
    display: none;
  }

  table.news tr {
    display: block;
    padding: 0.6rem 0;
    border-bottom: 1px solid #8884;
  }

  table.news td {
    display: block;
    border-bottom: none;
    padding: 0.15rem 0;
    white-space: normal;
  }

  table.news td[data-label]::before {
    content: attr(data-label) ": ";
    font-weight: 700;
    opacity: 0.7;
  }

  /* settings table stacks label above input */
  table.settings,
  table.settings tbody,
  table.settings tr,
  table.settings td {
    display: block;
    width: 100%;
  }

  table.settings tr {
    padding: 0.75rem 0;
    border-bottom: 1px solid #8884;
  }

  table.settings td.label {
    white-space: normal;
    padding: 0 0 0.35rem;
  }

  table.settings td .help {
    max-width: none;
  }

  table.settings input,
  table.settings select {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .masthead h1 {
    font-size: 1.7rem;
  }

  .lead-story .headline {
    font-size: 1.35rem;
  }
}
