/* Colophon theme — base layer. Gitea loads this as theme "colophon". */
:root {
  --paper: #FAF6EF;
  --ink: #1A1A18;
  --oxblood: #7C2D2D;
  --oxblood-dark: #5e2121;
  --sage: #5C6B54;
  --surface: #EFE7D8;
  --gold: #B08D4F;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-ui: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --border-rule: 1px solid rgba(26, 26, 24, 0.18);
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  background-image: url("/assets/img/grain.png");
  background-size: 180px 180px;
  background-blend-mode: multiply;
}

h1, h2, h3, h4, h5, h6, .ui.header {
  font-family: var(--font-display);
  color: var(--ink);
  letter-spacing: 0.01em;
}

a { color: var(--oxblood); }
a:hover { color: var(--oxblood-dark); }

.primary.button, .ui.primary.button, .ui.primary.labels .label {
  background: var(--oxblood);
  color: var(--paper);
  border-radius: 2px;
}
.primary.button:hover { background: var(--oxblood-dark); }

.ui.top.menu, #topbarmenu {
  background: var(--surface);
  border-bottom: var(--border-rule);
}
.ui.menu .item { font-family: var(--font-ui); }

.ui.segment, .ui.card, .ui.form .field input,
.ui.input > input, textarea {
  background: var(--paper);
  border-radius: 2px;
  border: var(--border-rule);
  box-shadow: none;
}

footer#footer {
  border-top: var(--border-rule);
  background: var(--surface);
  font-family: var(--font-ui);
  color: var(--ink);
}

.logo img, .logo svg { max-height: 28px; }

/* code stays mono, tinted surface */
code, pre, .ui.code {
  font-family: var(--font-mono);
  background: var(--surface);
}

/* ---- Bookshelf ---- */
.shelf-row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
  padding: 1.5rem 1rem 0;
  border-bottom: 6px solid #8a6a43;
  box-shadow: 0 8px 0 -4px rgba(26,26,24,.15);
  margin-bottom: 2.5rem;
}
.spine {
  --spine-h: 14rem;
  width: 3.25rem;
  height: var(--spine-h);
  border-radius: 2px 4px 0 0;
  background: var(--surface);
  border: var(--border-rule);
  border-left: 4px solid var(--spine-color, var(--sage));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: .5rem 0;
  text-decoration: none;
  color: var(--ink);
  transition: transform .18s ease, box-shadow .18s ease;
  position: relative;
}
.spine:nth-child(3n) { --spine-color: var(--oxblood); }
.spine:nth-child(3n+1) { --spine-color: var(--gold); }
.spine:nth-child(3n+2) { --spine-color: var(--sage); }
.spine:hover {
  transform: translateY(-10px) rotate(-1.5deg);
  box-shadow: 4px 10px 14px rgba(26,26,24,.18);
  z-index: 2;
}
.spine-title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-display);
  font-size: .85rem;
  max-height: calc(var(--spine-h) - 3rem);
  overflow: hidden;
  text-overflow: ellipsis;
}
.spine-owner {
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sage);
  margin-top: .4rem;
}
.spine.is-hidden { display: none; }
.shelf-filters { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0; }
.shelf-chip {
  font-family: var(--font-ui);
  font-size: .8rem;
  padding: .35rem .8rem;
  border: var(--border-rule);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.shelf-chip.is-active { background: var(--oxblood); color: var(--paper); border-color: var(--oxblood); }

/* ---- Landing hero ---- */
.colophon-hero {
  position: relative; text-align: center; padding: 4.5rem 1rem 3rem;
  overflow: hidden; border-bottom: var(--border-rule);
  background: linear-gradient(180deg, var(--surface), var(--paper));
}
.colophon-hero h1 { font-size: 3.4rem; margin: 0 0 .4rem; }
.colophon-hero .tagline { font-family: var(--font-display); font-style: italic; color: var(--sage); font-size: 1.15rem; margin-bottom: 1.4rem; }
#ink-hero { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* ---- Binding picker (publishing wizard) ---- */
.binding-picker { border: var(--border-rule); border-radius: 4px; padding: 1rem; margin-bottom: 1.5rem; }
.binding-picker legend { font-family: var(--font-display); font-weight: 600; padding: 0 .4rem; }
.binding-card {
  display: inline-flex; flex-direction: column; align-items: center; gap: .25rem;
  width: 9.5rem; padding: .9rem .5rem; margin: .3rem; cursor: pointer; text-align: center;
  border: var(--border-rule); border-radius: 3px; background: var(--paper);
  position: relative;
}
.binding-card:has(input:checked) { border-color: var(--oxblood); background: var(--surface); box-shadow: inset 0 0 0 1px var(--oxblood); }
.binding-card input { position: absolute; opacity: 0; }
.binding-glyph { font-size: 1.6rem; color: var(--oxblood); }
.binding-name { font-family: var(--font-display); font-weight: 600; }
.binding-desc { font-size: .7rem; color: var(--sage); }

/* ---- Type stamps (Task 7) ---- */
.colophon-book .overflow-menu-items a.item::after {
  content: "";
  display: inline-block;
  width: 0.45rem; height: 0.45rem; margin-left: .45rem;
  border-radius: 50%;
  background: var(--gold);
}

/* ---- Reading mode (Task 8) ---- */
#colophon-reading {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--paper); background-image: url("/assets/img/grain.png");
  display: flex; flex-direction: column;
}
#colophon-reading header, #colophon-reading footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: .8rem 1.4rem; background: var(--surface); border-bottom: var(--border-rule);
  font-family: var(--font-ui);
}
#colophon-reading footer { border-bottom: 0; border-top: var(--border-rule); }
.reading-title { font-family: var(--font-display); }
.reading-page {
  flex: 1; overflow-y: auto; padding: 3rem 1.5rem;
  max-width: 38rem; margin: 0 auto; width: 100%;
  font-family: var(--font-display); font-size: 1.15rem; line-height: 1.75;
}
.reading-chapter h1:first-of-type::first-letter,
.reading-chapter h2:first-of-type + p::first-letter {
  font-size: 3.2rem; float: left; line-height: 1; padding-right: .4rem; color: var(--oxblood);
}
.reading-close, .reading-prev, .reading-next {
  background: none; border: var(--border-rule); border-radius: 2px;
  padding: .3rem .8rem; cursor: pointer; font-family: var(--font-ui);
}
.reading-launch { margin-bottom: 1rem; }

/* ---- Parchment toasts + spinner (Task 9) ---- */
.parchment-toast, .ui.message {
  background: var(--surface) !important;
  border: var(--border-rule);
  border-left: 4px solid var(--gold);
  border-radius: 2px;
  color: var(--ink);
  font-family: var(--font-ui);
  box-shadow: 2px 3px 0 rgba(26,26,24,.08);
}
.ui.message.error { border-left-color: var(--oxblood); }
.ui.message.success { border-left-color: var(--sage); }
.colophon-spinner {
  display: inline-block; width: 1rem; height: 1rem; border-radius: 50%;
  border: 2px solid var(--surface); border-top-color: var(--oxblood);
  animation: quill-spin .7s linear infinite;
}
@keyframes quill-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .colophon-spinner { animation: none; }
}
.marginalia-note {
  position: relative;
}
.marginalia-note::after {
  content: "✎";
  color: var(--gold);
  font-size: .8em;
  margin-left: .3rem;
}

/* ---- Reader card + seals (Task 10) ---- */
.reader-card {
  background: var(--surface); border: 2px solid var(--ink); border-radius: 4px;
  padding: 1.5rem 1.75rem; position: relative; margin: 1rem 0 2rem;
  box-shadow: 4px 4px 0 rgba(26,26,24,.12);
}
.reader-card::before {
  content: "MEMBER"; position: absolute; top: .8rem; right: 1rem;
  font-family: var(--font-ui); font-size: .65rem; letter-spacing: .25em;
  color: var(--oxblood); border: 1.5px solid var(--oxblood); border-radius: 3px;
  padding: .15rem .5rem; transform: rotate(6deg); opacity: .85;
}
.reader-card h2 { font-family: var(--font-display); }
.seal { width: 2.2rem; height: 2.2rem; vertical-align: middle; margin-left: .4rem; }

/* ---- Card catalog (Task 10) ---- */
.card-catalog {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(26,26,24,.35);
  display: flex; justify-content: center; align-items: flex-start; padding-top: 14vh;
}
.catalog-card {
  position: relative; width: min(30rem, 92vw); padding: 1.6rem 1.4rem 1.1rem;
  background:
    repeating-linear-gradient(180deg, transparent 0 1.7rem, rgba(92,107,84,.35) 1.7rem 1.72rem),
    var(--surface);
  border: var(--border-rule); border-radius: 3px;
  box-shadow: 0 10px 28px rgba(26,26,24,.35);
}
.catalog-card input {
  width: 100%; border: none; background: transparent; outline: none;
  font-family: var(--font-display); font-size: 1.35rem; color: var(--ink);
  line-height: 1.7rem; border-bottom: var(--border-rule); padding-bottom: .2rem;
}
.catalog-stamp {
  position: absolute; top: -.9rem; right: .8rem; transform: rotate(8deg);
  font-family: var(--font-ui); font-size: .6rem; letter-spacing: .28em;
  color: var(--oxblood); border: 1.5px solid var(--oxblood); border-radius: 2px;
  padding: .15rem .45rem; background: var(--paper); opacity: .9;
}
.catalog-hint { display: block; margin-top: .6rem; font-size: .68rem; color: var(--sage); }

/* ---- Eggs (Task 10) ---- */
@keyframes gold-leaf {
  0%, 100% { filter: none; }
  40% { filter: brightness(1.12) saturate(1.25) hue-rotate(-8deg); }
}
.gold-leaf-shimmer { animation: gold-leaf 1.2s ease; }
.egg-toast { border-left-color: var(--gold) !important; }
@media (prefers-reduced-motion: reduce) {
  .gold-leaf-shimmer { animation: none; }
}
