@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;1,8..60,400&display=swap');

/* ── Reader design system tokens (light mode defaults) ── */
:root {
  --surface-primary:   #ffffff;
  --surface-secondary: #f1f3f4;
  --text-primary:      #29313a;
  --text-secondary:    #606c79;
  --text-tertiary:     #909aa6;
  --interactive:       #2675de;
  --border-subtle:     #e0e3e6;
  --border-default:    #c1c7cf;
  --success:           #22a06b;
  --success-bg:        rgba(34, 160, 107, 0.1);
  --error:             #ef4444;
  --mark-bg:           #FBEEB8;
}

[data-theme="dark"] {
  --surface-primary:   #161c22;
  --surface-secondary: #1e252d;
  --text-primary:      #e0e3e6;
  --text-secondary:    #939fad;
  --text-tertiary:     #606c79;
  --interactive:       #7caeec;
  --border-subtle:     #29313a;
  --border-default:    #8592a0;
  --success:           #2ea876;
  --success-bg:        rgba(46, 168, 118, 0.12);
  --error:             #f87171;
  --mark-bg:           rgba(251, 218, 131, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--surface-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Shell nav ── */
.shell-nav {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-primary);
  position: sticky;
  top: 0;
  z-index: 10;
}

.shell-brand {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  text-decoration: none;
  margin-right: 28px;
  flex-shrink: 0;
}
.shell-brand:hover { color: var(--interactive); }

.shell-nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.shell-nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 5px;
}
.shell-nav-link:hover { color: var(--text-primary); background: var(--surface-secondary); }
.shell-nav-link.active { color: var(--text-primary); background: var(--surface-secondary); }

.shell-nav-right {
  display: flex;
  align-items: center;
}

.theme-toggle {
  display: flex;
  align-items: center;
  background: var(--surface-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 3px;
  gap: 2px;
}

.theme-toggle-btn {
  width: 28px;
  height: 22px;
  border-radius: 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.theme-toggle-btn.active {
  background: var(--surface-primary);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* ── Page layout ── */
.page-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 36px 24px 48px;
}

.page-heading {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 30px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 4px;
}

.page-sub {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 36px;
}

/* ── Volume list ── */
.volumes-list { margin-top: 0; }

.volume { border-top: 1px solid var(--border-subtle); }
.volume:last-child { border-bottom: 1px solid var(--border-subtle); }

.volume-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  width: 100%;
  padding: 15px 0;
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  color: var(--text-primary);
  font-family: inherit;
}
.volume-header:hover .vol-num { color: var(--interactive); }

.vol-num {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
  width: 68px;
  letter-spacing: -0.01em;
  transition: color 0.12s;
}

.vol-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 14px;
  font-weight: 400;
  font-style: italic;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}

.vol-meta {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.vol-chevron {
  color: var(--text-tertiary);
  font-size: 13px;
  flex-shrink: 0;
  display: inline-block;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.volume-header[aria-expanded="true"] .vol-chevron { transform: rotate(90deg); }

/* ── Collapsible body ── */
.volume-body-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}
.volume-body-wrapper.open { grid-template-rows: 1fr; }
.volume-body-inner { overflow: hidden; }

/* ── Items ── */
.item {
  padding: 13px 0 13px 68px;
  border-top: 1px solid var(--border-subtle);
}
.item:last-of-type { padding-bottom: 20px; }

.item-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.type-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.type-article { background: rgba(38, 117, 222, 0.12); color: #2675de; }
.type-tweet   { background: rgba(102, 153, 204, 0.12); color: #6699cc; }
.type-video   { background: rgba(180, 122, 32, 0.12);  color: #b07a20; }
.type-pdf     { background: rgba(181, 64, 48, 0.12);   color: #b54030; }
.type-rss     { background: rgba(34, 160, 107, 0.12);  color: #22a06b; }
.type-book    { background: rgba(180, 110, 30, 0.12);  color: #b46e1e; }

[data-theme="dark"] .type-article { background: rgba(124, 174, 236, 0.14); color: #7caeec; }
[data-theme="dark"] .type-tweet   { background: rgba(102, 153, 204, 0.14); color: #7aa0cc; }
[data-theme="dark"] .type-video   { background: rgba(210, 170, 80, 0.14);  color: #c99a30; }
[data-theme="dark"] .type-pdf     { background: rgba(220, 100, 80, 0.14);  color: #e06050; }
[data-theme="dark"] .type-rss     { background: rgba(46, 168, 118, 0.14);  color: #2ea876; }
[data-theme="dark"] .type-book    { background: rgba(200, 140, 60, 0.14);  color: #c88c3c; }

.item-title-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1.35;
}
.item-title-link:hover { color: var(--interactive); text-decoration: underline; }

.item-byline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 7px;
  min-height: 4px;
}

.item-stats { font-variant-numeric: tabular-nums; }

.blurb-final {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--success);
  background: var(--success-bg);
  padding: 1px 5px;
  border-radius: 3px;
}

.item-blurb {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 60ch;
}
.item-blurb p { margin: 0 0 0.55em; }
.item-blurb p:last-child { margin-bottom: 0; }
.item-blurb strong { color: var(--text-primary); font-weight: 600; }
.item-blurb em { font-style: italic; }
.item-blurb mark {
  background: var(--mark-bg);
  color: var(--text-primary);
  padding: 0 2px;
  border-radius: 2px;
  font-style: italic;
}

.no-items {
  font-size: 13px;
  color: var(--text-tertiary);
  font-style: italic;
  padding: 14px 0 20px 68px;
}

/* ── States ── */
.state-loading,
.state-empty,
.state-error {
  font-size: 14px;
  color: var(--text-tertiary);
  padding: 56px 0;
  text-align: center;
}
.state-error { color: var(--error); }

/* ── Links ── */
a { color: var(--interactive); }

.volume-editor {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ── Mobile ── */
@media (max-width: 580px) {
  .shell-nav { padding: 0 16px; }
  .page-inner { padding: 24px 16px 40px; }
  .page-heading { font-size: 24px; }
  .vol-meta { display: none; }
  .vol-num { font-size: 15px; width: 56px; }
  .vol-title { font-size: 13px; }
  .item { padding-left: 0; }
  .no-items { padding-left: 0; }
}
