/*
 * base.css — layout and components shared by both looks.
 * Colors, fonts and mood come from the theme files (theme-pulp.css / theme-clean.css),
 * which define the CSS variables used below.
 */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--page-bg, var(--bg));
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
a { color: var(--link, var(--accent)); }

.skip { position: absolute; left: -999px; top: 0; z-index: 100; padding: .5rem 1rem; background: var(--accent); color: var(--on-accent); }
.skip:focus { left: 0; }

/* ----- header ----- */
.site-header { padding: 2.25rem 0 1.25rem; border-bottom: 1px solid var(--border); }
.site-title { margin: 0; font-family: var(--font-display); font-size: clamp(1.9rem, 4.5vw, 3rem); line-height: 1.08; letter-spacing: var(--title-tracking, 0); }
.tagline { margin: .45rem 0 0; color: var(--muted); }

/* ----- toolbar ----- */
.toolbar { background: var(--bg-bar); border-bottom: 1px solid var(--border); padding: .55rem 0 .65rem; z-index: 20; }
@media (min-width: 900px) { .toolbar { position: sticky; top: 0; backdrop-filter: blur(8px); } }
.bar-top { display: flex; flex-wrap: wrap; gap: .5rem 1rem; justify-content: space-between; align-items: center; }
.bar-right { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin: .35rem 0; }
.bar-top .row { margin: 0; }

.btn, select, input[type="search"] {
  font: inherit; font-size: .92rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .42rem .75rem; min-height: 2.25rem;
}
.btn { cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.ghost { background: transparent; }
input[type="search"] { flex: 1 1 14rem; min-width: 10rem; }
select { max-width: 100%; }
.check { display: inline-flex; align-items: center; gap: .4rem; font-size: .92rem; color: var(--muted); cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.legend { margin-bottom: 0; }
.chip-btn {
  display: inline-flex; align-items: center; gap: .45rem; cursor: pointer;
  font: inherit; font-size: .85rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: .25rem .7rem;
}
.chip-btn[aria-pressed="false"] { opacity: .45; text-decoration: line-through; }
.count { margin-left: auto; color: var(--muted); font-size: .88rem; }

/* category colors: each theme defines --c-reh ... --c-misc */
.cat-reh    { --cat: var(--c-reh); }
.cat-hpl    { --cat: var(--c-hpl); }
.cat-cas    { --cat: var(--c-cas); }
.cat-heroic { --cat: var(--c-heroic); }
.cat-titan  { --cat: var(--c-titan); }
.cat-misc   { --cat: var(--c-misc); }
.swatch { flex: none; display: inline-block; width: .85rem; height: .85rem; border-radius: 50%; background: var(--cat); box-shadow: 0 0 0 1px rgba(0,0,0,.25); }

/* ----- about blocks ----- */
#meta { margin-top: 1rem; }
.about { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin: .5rem 0; }
.about summary { cursor: pointer; padding: .6rem .9rem; font-weight: 600; }
.about .prose { padding: 0 .9rem .9rem; color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }
.demo-note { margin: 0 0 .5rem; padding: .6rem .9rem; border: 1px dashed var(--accent); border-radius: var(--radius); color: var(--muted); }

.status, .error { padding: 2.5rem 0; text-align: center; color: var(--muted); }
.error { color: var(--text); }

/* ----- eras ----- */
#view { padding-bottom: 3rem; }
.era { margin-top: 2.5rem; }
.era-head h2 { margin: 0 0 .4rem; font-family: var(--font-display); font-size: clamp(1.3rem, 3vw, 1.8rem); line-height: 1.2; }
.era-text { margin: 0 0 1.25rem; max-width: 70ch; color: var(--muted); }

/* ----- timeline view ----- */
.entry { display: grid; grid-template-columns: 9rem 1.6rem minmax(0, 1fr); column-gap: .9rem; }
.entry-year { text-align: right; padding-top: 1rem; font-variant-numeric: tabular-nums; color: var(--muted); font-size: .92rem; }
.entry-rail { position: relative; }
.entry-rail::before { content: ""; position: absolute; top: 0; bottom: 0; left: calc(50% - 1px); width: 2px; background: var(--rail); }
.entry-rail::after  { content: ""; position: absolute; top: 1.15rem; left: 50%; width: .85rem; height: .85rem; transform: translateX(-50%); border-radius: 50%; background: var(--cat); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--rail); }
.entry-card {
  margin: 0 0 .9rem; padding: .8rem 1rem .85rem;
  background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--cat);
  border-radius: var(--radius); box-shadow: var(--shadow, none);
}
.entry-top { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.series::before { content: ""; display: inline-block; width: .6rem; height: .6rem; margin-right: .4rem; border-radius: 50%; background: var(--cat); }
.year-inline { display: none; text-transform: none; letter-spacing: 0; }
.title { margin: .2rem 0 0; font-family: var(--font-display); font-size: 1.15rem; line-height: 1.3; font-weight: 500; }
.entry-card.is-bold .title, .rl-title.is-bold, .c-title .is-bold { font-weight: 700; }
.subtitle { color: var(--muted); font-size: .95rem; }
.byline { color: var(--muted); font-size: .92rem; }
.issues { margin: .35rem 0 0; padding-left: 1.2rem; color: var(--muted); font-size: .9rem; }
.notes { margin: .55rem 0 0; color: var(--text); opacity: .92; font-size: .95rem; overflow-wrap: anywhere; }
.notes.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.linklike { background: none; border: 0; padding: .15rem 0; color: var(--accent); cursor: pointer; font: inherit; font-size: .88rem; }
.meta-line { display: flex; flex-wrap: wrap; gap: .4rem .75rem; align-items: center; margin-top: .6rem; font-size: .85rem; color: var(--muted); }
.tag { padding: .05rem .55rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.badge { padding: .02rem .5rem; border-radius: 999px; border: 1px dashed var(--muted); text-transform: none; letter-spacing: 0; font-size: .75rem; }
.noncanon .title, .noncanon .rl-title { font-style: italic; }
.noncanon .entry-card { opacity: .85; }

@media (max-width: 700px) {
  .entry { grid-template-columns: 1.4rem minmax(0, 1fr); column-gap: .6rem; }
  .entry-year { display: none; }
  .entry-rail { grid-column: 1; grid-row: 1; }
  .entry-card { grid-column: 2; grid-row: 1; }
  .year-inline { display: inline; }
}

/* ----- table view ----- */
.table-wrap { margin-top: 1rem; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.grid { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--surface); }
.grid th, .grid td { padding: .5rem .7rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.grid thead th { position: sticky; top: 0; background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.grid tr.era-row th { background: var(--surface-2); font-family: var(--font-display); font-size: 1.02rem; padding-top: .9rem; color: var(--accent); }
.grid tr.row-entry { cursor: pointer; }
.grid tr.row-entry:hover { background: var(--surface-2); }
.grid .c-year { white-space: nowrap; font-variant-numeric: tabular-nums; }
.grid td:nth-child(5) { white-space: nowrap; }
.grid .badge { margin-left: .5rem; white-space: nowrap; }
.grid .c-year .swatch { margin-right: .5rem; vertical-align: -.05rem; }
.grid tr.detail td { color: var(--muted); background: var(--surface-2); white-space: pre-line; }
.grid tr.noncanon .c-title span:first-child { font-style: italic; }

/* ----- reading list ----- */
.progress { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: 1.25rem 0 0; }
.progress-text { font-weight: 600; }
.progress .bar { flex: 1 1 12rem; height: .55rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.progress .bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s; }
ul.reading { list-style: none; margin: 0; padding: 0; }
ul.reading li { border-bottom: 1px solid var(--border); }
.read-row { display: grid; grid-template-columns: auto auto 8rem minmax(0, 1fr) auto; gap: .6rem; align-items: baseline; padding: .55rem .25rem; cursor: pointer; }
.read-row input { transform: translateY(.15rem); }
.read-row .swatch { align-self: center; }
.rl-year { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.rl-sub, .rl-by { color: var(--muted); }
.rl-type { color: var(--muted); font-size: .82rem; }
.read-row:has(input:checked) .rl-main { opacity: .55; text-decoration: line-through; }
@media (max-width: 700px) {
  .read-row { grid-template-columns: auto auto minmax(0, 1fr); }
  .rl-year, .rl-type { display: none; }
}

/* ----- footer ----- */
.site-footer { border-top: 1px solid var(--border); padding: 1.5rem 0 2.5rem; color: var(--muted); font-size: .9rem; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .progress .bar span { transition: none; } }
