:root {
  color-scheme: light dark;
  /* The palette of Books, the journal and the cards app, unchanged: one
     family of apps on one domain. */
  --bg: #f7f7fa;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #8a8a93;
  --faint: #b6b6c0;
  /* Indigo, spent on what's pressed and what's worth the eye. */
  --accent: #4c3fd6;
  --accent-pressed: #4134b8;
  --on-accent: #ffffff;
  --sold: #b8412f;
  --hairline: rgba(0, 0, 0, 0.1);
  --chip-bg: #ffffff;
  --chip-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  --card-shadow: 0 1px 2px rgba(20, 20, 40, 0.06), 0 10px 30px -18px rgba(20, 20, 40, 0.4);
  --tag-bg: rgba(0, 0, 0, 0.05);
  --photo-bg: #ececf1;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #f2f2f7;
    --muted: #93939c;
    --faint: #55555e;
    --accent: #7c6ffb;
    --accent-pressed: #6b5ef0;
    --on-accent: #ffffff;
    --sold: #ff7c66;
    --hairline: rgba(255, 255, 255, 0.12);
    --chip-bg: #2c2c2e;
    --chip-shadow: none;
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px -18px rgba(0, 0, 0, 0.8);
    --tag-bg: rgba(255, 255, 255, 0.08);
    --photo-bg: #2c2c2e;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* One column, whatever the window: a phone's, in the morning. */
.page {
  max-width: 640px;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top, 0px), 12px) 16px
           max(env(safe-area-inset-bottom, 0px), 24px);
}

.head {
  padding: 18px 4px 14px;
}

.title {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Inbox / Saved / All: Books' segmented control. */
.views {
  display: flex;
  margin: 0 0 10px;
  padding: 3px;
  border: none;
  border-radius: 12px;
  background: var(--tag-bg);
}

.view {
  position: relative;
  flex: 1;
  display: flex;
}

.view input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.view > span {
  flex: 1;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.view input:checked + span {
  background: var(--card);
  box-shadow: var(--chip-shadow);
  color: var(--text);
}

.view input:focus-visible + span {
  outline: 2px solid var(--accent);
}

.view-count {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* The stores, to see one at a time. A row that scrolls sideways rather than
   wraps, so it stays one line however many stores there come to be. */
.stores {
  display: flex;
  gap: 8px;
  margin: 0 -16px 6px;
  padding: 2px 16px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.stores::-webkit-scrollbar {
  display: none;
}

.store {
  flex: none;
  padding: 6px 12px;
  border: none;
  border-radius: 16px;
  background: var(--chip-bg);
  box-shadow: var(--chip-shadow);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
}

.store[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

.store-count {
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

.store:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.status {
  margin: 0;
  padding: 0 4px;
  color: var(--muted);
  font-size: 14px;
}

.status:empty {
  display: none;
}

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

/* An item: its photos, what it is and costs, and what to do about it. The
   whole card is the button for "read". */
.item {
  margin: 12px 0 0;
  overflow: hidden;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: opacity 0.2s ease;
  touch-action: manipulation;
}

.item.is-read {
  opacity: 0.42;
}

/* Swiped sideways, a photo at a time; with more than one, the next one
   shows at the edge, which says there's more. */
.photos {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  background: var(--photo-bg);
}

.photos::-webkit-scrollbar {
  display: none;
}

.photos img {
  flex: 0 0 100%;
  width: 100%;
  /* Wide rather than tall, so a phone's screen holds most of two items. */
  aspect-ratio: 3 / 2;
  object-fit: cover;
  scroll-snap-align: start;
  background: var(--photo-bg);
}

.photos-many img {
  flex-basis: 88%;
  width: 88%;
}

.photos-many img + img {
  margin-left: 2px;
}

.item-body {
  padding: 12px 16px 4px;
}

.item-price {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.was {
  margin-left: 4px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  vertical-align: 3px;
}

.tag-sold {
  background: var(--sold);
  color: #ffffff;
}

.item-title {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

.item-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* Measurements and condition, mostly. A few lines, and the store has the rest. */
.item-desc {
  margin: 8px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-line;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 8px;
}

.act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}

.act svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.act:focus-visible {
  outline: 2px solid var(--accent);
}

.act-read[aria-pressed="true"],
.act-save[aria-pressed="true"] {
  color: var(--accent);
}

.act-save[aria-pressed="true"] svg {
  fill: currentColor;
}

/* A saved item stays bright when it's read: it was kept to be looked at. */
.item.is-read:has(.act-save[aria-pressed="true"]) {
  opacity: 0.75;
}

.act-open {
  margin-left: auto;
  color: var(--accent);
}

.empty {
  padding: 48px 16px 24px;
  color: var(--muted);
  text-align: center;
}

.empty p {
  margin: 4px 0 0;
  font-size: 15px;
}

.empty .empty-head {
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
}

.all-read {
  display: block;
  width: 100%;
  margin: 16px 0 0;
  padding: 13px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.all-read:active {
  background: var(--accent-pressed);
}

.foot {
  padding: 28px 4px 8px;
  text-align: center;
}

.checked {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.checked:empty {
  display: none;
}

.account-line {
  font-size: 13px;
  color: var(--faint);
}

.account-line form {
  display: inline;
}

.text-link {
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
