/* Viewer chrome — deliberately quiet so the themes are the only thing with a
   voice. Neutral institutional surface: warm paper, ink text, hairline rules,
   a system sans for the UI. No brand colour competes with a theme's own. */

:root {
  --paper: #f6f4ef;
  --card: #ffffff;
  --ink: #1c1b19;
  --muted: #6b675f;
  --rule: #ddd8cf;
  --rule-strong: #c9c3b7;
  --accent: #1c1b19;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  font-family: var(--ui);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--ink);
  text-decoration: none;
}

/* ---------- top bar ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0.9rem 1.6rem;
  background: rgba(246, 244, 239, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--rule);
}

.bar .brand {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.bar .brand small {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.bar nav {
  margin-left: auto;
  display: flex;
  gap: 1.2rem;
  font-size: 0.86rem;
}

.bar nav a {
  color: var(--muted);
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}

.bar nav a:hover,
.bar nav a[aria-current="page"] {
  color: var(--ink);
  border-color: var(--ink);
}

/* ---------- page intro ---------- */
.intro {
  padding: 2.4rem 1.6rem 0.6rem;
  max-width: 1320px;
  margin: 0 auto;
}

.intro h1 {
  margin: 0 0 0.4rem;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}

.intro p {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
}

/* ---------- gallery grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.6rem;
  padding: 1.6rem;
  max-width: 1320px;
  margin: 0 auto;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, box-shadow 0.16s ease,
    border-color 0.16s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--rule-strong);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 16px 40px rgba(0, 0, 0, 0.1);
}

.card .preview {
  position: relative;
  display: flex;
  justify-content: center;
  background: #e9e6df;
  padding: 18px 18px 0;
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
  /* reserve a cover's height (264/794 * 1123 + top pad) before lazy mount */
  min-height: 391px;
}

.card .meta {
  padding: 1rem 1.1rem 1.15rem;
}

.card .meta .family {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.card .meta h2 {
  margin: 0.15rem 0 0.35rem;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.card .meta .tagline {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- rendered specimen frame ---------- */
.stage {
  position: relative;
  overflow: hidden;
}

.specimen-frame {
  border: 0;
  display: block;
  transform-origin: top left;
  background: #fff;
}

/* drop a paper-edge shadow under document renders */
.framed .stage {
  box-shadow: var(--shadow);
  background: #fff;
}

/* ---------- theme detail ---------- */
.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 2rem;
  align-items: start;
  padding: 1.8rem;
  max-width: 1320px;
  margin: 0 auto;
}

.detail .doc {
  display: flex;
  justify-content: center;
}

.detail aside {
  position: sticky;
  top: 72px;
}

.detail aside .family {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail aside h1 {
  margin: 0.2rem 0 0.3rem;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.theory {
  font-size: 0.92rem;
}

.theory h1 {
  display: none; /* the theme name is already the panel heading */
}

.theory blockquote {
  margin: 0.4rem 0 1.1rem;
  padding-left: 0.9rem;
  border-left: 3px solid var(--rule-strong);
  color: var(--ink);
  font-style: italic;
}

.theory h2 {
  font-size: 0.78rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.4rem 0 0.4rem;
}

.theory p {
  margin: 0 0 0.8rem;
  color: #34322d;
}

.theory ul {
  margin: 0 0 0.8rem;
  padding-left: 1.1rem;
}

.theory li {
  margin: 0.2rem 0;
  color: #34322d;
}

.theory code {
  background: #efece5;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0 0.3em;
  font-size: 0.88em;
}

.switcher {
  margin-top: 1.6rem;
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.switcher .label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.switcher a {
  font-size: 0.9rem;
  color: var(--muted);
  padding: 0.15rem 0;
}

.switcher a:hover {
  color: var(--ink);
}

.switcher a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- compare ---------- */
.compare-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.7rem 1.6rem;
  background: var(--card);
  border-bottom: 1px solid var(--rule);
}

.compare-controls .label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 0.4rem;
}

.chip {
  font: inherit;
  font-size: 0.82rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 0.18rem 0.7rem;
  cursor: pointer;
  transition: all 0.12s ease;
}

.chip:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.chip[aria-pressed="true"] {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}

.compare {
  display: flex;
  gap: 1px;
  background: var(--rule);
  height: calc(100vh - 108px);
}

.compare .empty {
  margin: auto;
  color: var(--muted);
  font-size: 0.9rem;
}

.compare .col {
  flex: 1 1 0;
  min-width: 0;
  background: #e9e6df;
  display: flex;
  flex-direction: column;
}

.compare .col-head {
  padding: 0.6rem 0.9rem;
  background: var(--card);
  border-bottom: 1px solid var(--rule);
}

.compare .col-head .family {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.compare .col-head .name {
  font-weight: 600;
  font-size: 0.98rem;
}

.compare .col-head .name a {
  color: var(--ink);
}

.compare .col-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  padding: 16px 0;
}

.hint {
  padding: 0.5rem 1.6rem;
  font-size: 0.82rem;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  background: var(--card);
}

/* ---------- footer ---------- */
.foot {
  padding: 2rem 1.6rem 3rem;
  max-width: 1320px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--rule);
}

.foot code {
  background: #efece5;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0 0.3em;
}

@media (max-width: 880px) {
  .detail {
    grid-template-columns: 1fr;
  }
  .detail aside {
    position: static;
  }
}
