* {
  box-sizing: border-box;
}

html {
  font-size: 18px;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", Times, serif;
  background: #fff;
  color: #111;
  line-height: 1.45;
}

a {
  color: #000;
  text-decoration: underline;
}

a:hover, a:focus {
  background: #000;
  color: #fff;
}

.wrap {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

header.app {
  margin-bottom: 1rem;
}

/* Reading pages keep their toolbar small: every pixel it takes is a pixel the
   page of text does not get. */
header.app.compact {
  margin-bottom: 0.6rem;
}

header.app.compact nav.top a,
header.app.compact nav.top button {
  min-height: 2.4rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.95rem;
}

header.app .brand {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  margin-bottom: 0.5rem;
}

/* Controls are spaced with margins rather than flex `gap`, which the Kindle
   browser ignores: two 2px borders that meet read as one line of double
   thickness. Rows that wrap pull the spacing back off their own edges. */
nav.top {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  margin: 0 -0.5rem -0.5rem 0;
}

/* Forms holding a single button reset their margin further down, so every row
   below names them rather than leaning on a `> *` that they would outrank. */
nav.top > a,
nav.top > button,
nav.top > form.inline {
  margin: 0 0.5rem 0.5rem 0;
}

/* The navigation fills the width, so every button is a wide target. Growing by
   content keeps the longer labels from being squeezed onto two lines. */
nav.top > a,
nav.top > button,
nav.top > form.inline {
  flex: 1 1 auto;
}

nav.top > form.inline > button {
  width: 100%;
}

nav.top a, button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.65rem 0.9rem;
  border: 2px solid #000;
  background: #fff;
  color: #000;
  font: inherit;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

nav.top a:hover, button:hover, .btn:hover,
nav.top a:focus, button:focus, .btn:focus {
  background: #000;
  color: #fff;
}

button[disabled], button[disabled]:hover, button[disabled]:focus {
  background: #fff;
  color: #999;
  border-color: #999;
  cursor: default;
}

/* Inline forms hold a single button; they must not add a line box of their own,
   otherwise the button sits lower than the links beside it. */
form.inline {
  display: inline-flex;
  margin: 0;
  padding: 0;
}

.flash {
  border: 2px solid #000;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.flash.error {
  background: #f5f5f5;
}

h1, h2 {
  font-weight: 700;
  line-height: 1.2;
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.2rem;
  margin: 1.5rem 0 0.75rem;
}

label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

input[type="url"], input[type="password"], input[type="text"] {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 0.75rem;
  border: 2px solid #000;
  font: inherit;
  background: #fff;
  color: #000;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  margin: 0 -0.75rem 0.25rem 0;
}

.row > * {
  margin: 0 0.75rem 0.75rem 0;
}

.row > input {
  flex: 1 1 14rem;
}

.row > button, .row > .btn {
  flex: 0 0 auto;
}

.feed-list, .item-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feed-list > li, .item-list > li {
  border-top: 1px solid #000;
  padding: 0.9rem 0;
}

.feed-list > li:last-child, .item-list > li:last-child {
  border-bottom: 1px solid #000;
}

/* Article entries stay short so a screen holds as many as possible: the title on
   one line, then the source and the buttons sharing the next. */
.item-list > li {
  padding: 0.45rem 0;
}

.item-title {
  display: block;
  line-height: 1.25;
}

.item-row {
  display: flex;
  align-items: center;
  margin-top: 0.3rem;
}

.item-row > * + *,
.item-row > form.inline {
  margin-left: 0.5rem;
}

.item-row .meta {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-row .btn,
.item-row button {
  flex: 0 0 auto;
  min-height: 2.25rem;
  min-width: 0;
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
}

.meta {
  font-size: 0.95rem;
  color: #333;
  margin: 0.25rem 0 0.5rem;
}

.badge {
  display: inline-block;
  border: 2px solid #000;
  padding: 0.15rem 0.45rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  margin: 0.5rem -0.5rem -0.5rem 0;
}

.actions > a,
.actions > button,
.actions > form.inline {
  margin: 0 0.5rem 0.5rem 0;
}

/* Inside the reader the content is laid out in columns exactly one frame wide,
   so these rows keep their spacing within their own width. */
.filters {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.filters > * {
  margin: 0 0.5rem 0.5rem 0;
}

.filters a.active {
  background: #000;
  color: #fff;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 1.25rem;
}

.pagination > a,
.pagination > button,
.pagination > form.inline {
  margin: 0 0.5rem 0.5rem 0;
}

/* Paged reading. Without the reader script the content simply flows and scrolls.
   reader.js adds .paged and then sets the height of .reader-frame, plus the column
   width and horizontal offset of .reader-content, in pixels — a Kindle's browser
   is more dependable with pixels than with viewport units. The columns overflow
   .reader-content on purpose and are clipped by .reader-frame. */
.reader-frame {
  position: relative;
}

.reader.paged .reader-frame {
  overflow: hidden;
}

.reader.paged .reader-content > h1 {
  margin-top: 0;
}

.reader.paged .item-list > li,
.reader.paged .article-body img,
.reader.paged .article-body figure,
.reader.paged .article-body blockquote {
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  break-inside: avoid;
}

.reader-end {
  height: 1px;
}

.pager {
  display: none;
}

.reader.paged .pager {
  display: flex;
  align-items: stretch;
  border-top: 2px solid #000;
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

.reader.paged .pager > * + * {
  margin-left: 0.5rem;
}

.pager .btn {
  flex: 1 1 0;
}

.pager-label {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0 0.5rem;
  font-size: 0.95rem;
  white-space: nowrap;
}

body.reading .wrap {
  padding-bottom: 0.75rem;
}

.article-body {
  margin-top: 1rem;
  border-top: 2px solid #000;
  padding-top: 1rem;
}

.article-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem 0;
  border: 1px solid #000;
}

.article-body pre, .article-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.error-box {
  border: 2px solid #000;
  padding: 1rem;
}

.muted {
  color: #444;
}

.build-info {
  border-top: 1px solid #000;
  margin-top: 2rem;
  padding-top: 0.5rem;
  font-size: 0.85rem;
  color: #444;
}

.check {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
}

.check > * + * {
  margin-left: 0.5rem;
}

.check input {
  width: 1.25rem;
  height: 1.25rem;
}

@media (max-width: 520px) {
  html { font-size: 17px; }
  .wrap { padding: 0.75rem 0.75rem 2.5rem; }
}
