/* ============================================================
   shayvana — base stylesheet · card system
   Loaded by all redesigned pages via the head.html partial.
   Homepage-specific CSS lives in index.html's <style> block.
   ============================================================ */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font-family: "Archivo", system-ui, sans-serif;
  font-weight: 300;
  font-size: 1.0625rem;
  line-height: 1.65;
}

/* Paper grain overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: .4;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/></filter><rect width='160' height='160' filter='url(%23n)' opacity='.22'/></svg>");
}

a { color: inherit; }
::selection { background: var(--red); color: var(--sheet); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--sheet);
  padding: .7rem 1.1rem;
  z-index: 100;
}
.skip:focus { left: 0; }

/* --- Sheet (max-width container) --- */
.sheet {
  max-width: 70rem;
  margin: 0 auto;
  background: var(--sheet);
  border-left: 1px solid var(--faint);
  border-right: 1px solid var(--faint);
  min-height: 100vh;
}

.pad {
  padding-left: var(--pad);
  padding-right: var(--pad);
}

/* --- Shared subpage header (non-sticky) --- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 0;
  border-bottom: 1px solid var(--faint);
}

.mark {
  font-family: "Bodoni Moda", serif;
  font-size: 1.2rem;
  letter-spacing: .1em;
  text-decoration: none;
  color: var(--body);
}

nav {
  display: flex;
  gap: clamp(.75rem, 2vw, 1.4rem);
  font-size: .9rem;
  color: var(--soft);
}

nav a {
  text-decoration: none;
  padding: .35rem 0;
  border-bottom: 1px solid transparent;
}

nav a:hover,
nav a.active,
nav a[aria-current="page"] {
  color: var(--body);
  border-bottom-color: var(--red);
}

/* --- Card frame --- */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--ink);
  padding: .5rem;
}

.card::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(184, 28, 39, .32);
  pointer-events: none;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .2rem .25rem .4rem;
}

.cname {
  font-family: "Bodoni Moda", serif;
  font-size: 1.2rem;
  line-height: 1.12;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pips {
  display: flex;
  gap: 4px;
  flex: none;
  align-items: center;
}

.pip {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: transparent;
  flex-shrink: 0;
  display: inline-block;
}

.pip.ink { background: var(--ink); }
.pip.red  { background: var(--red); border-color: var(--red); }

.art {
  border: 1px solid var(--ink);
  background: #fff;
  overflow: hidden;
  position: relative;
  line-height: 0;
}

.art svg { width: 100%; height: 100%; display: block; }

.typeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .4rem .25rem;
  font-size: .8rem;
  letter-spacing: .04em;
  color: var(--body);
  border-bottom: 1px solid var(--faint);
}

.rarity {
  color: var(--red);
  font-size: .75rem;
  letter-spacing: .1em;
}

.rules {
  padding: .6rem .25rem .25rem;
  font-size: .875rem;
  line-height: 1.55;
}

.rules p { margin: 0 0 .5rem; }
.rules p:last-child { margin-bottom: 0; }

.flavor {
  margin-top: .6rem;
  padding-top: .55rem;
  border-top: 1px solid var(--faint);
  font-family: "Bodoni Moda", serif;
  font-style: italic;
  font-size: .9rem;
  color: var(--body);
}

.credit {
  display: flex;
  justify-content: space-between;
  gap: .6rem;
  padding: .5rem .25rem .05rem;
  font-size: .72rem;
  color: var(--soft);
}

a.card {
  display: block;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}

a.card:hover,
a.card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 5px 7px 0 rgba(0, 0, 0, .12);
  outline: none;
}

.flag {
  position: absolute;
  top: -.7rem;
  right: .9rem;
  z-index: 2;
  background: var(--red);
  color: #fff;
  font-size: .7rem;
  letter-spacing: .12em;
  padding: .15rem .55rem;
}

/* --- Sections --- */
section {
  border-top: 1px solid var(--faint);
  padding-top: var(--rhythm);
  padding-bottom: var(--rhythm);
  scroll-margin-top: 4.5rem;
}

.head-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.6rem;
  flex-wrap: wrap;
}

h2 {
  margin: 0;
  font-family: "Bodoni Moda", serif;
  font-weight: 400;
  font-size: clamp(1.6rem, 3.4vw, 2.25rem);
  letter-spacing: -.01em;
  line-height: 1;
}

.h-note {
  font-size: .9rem;
  color: var(--soft);
  max-width: 44ch;
}

.more {
  margin-left: auto;
  font-size: .9rem;
  text-decoration: none;
  border-bottom: 1px solid var(--faint);
  padding-bottom: 2px;
  color: var(--body);
  white-space: nowrap;
}

.more:hover { border-bottom-color: var(--red); }

/* --- Card grids --- */
.spread {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}

.spread .cname { font-size: 1.05rem; }
.spread .art   { aspect-ratio: 5 / 3.4; }

.grid5 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}

.mini .cname { font-size: 1rem; }
.mini .art   { aspect-ratio: 5 / 1.2; }
.mini .typeline { border-bottom: 0; }

/* --- Work ruled list --- */
.ruled {
  background-image:
    repeating-linear-gradient(to right, rgba(184, 28, 39, .13) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(to bottom, rgba(184, 28, 39, .13) 0 1px, transparent 1px 34px);
  background-position: center top;
  border-top: 1px solid rgba(184, 28, 39, .32);
  border-bottom: 1px solid rgba(184, 28, 39, .32);
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .25rem 1rem;
  padding: .95rem 1rem;
  text-decoration: none;
  background: var(--sheet);
  border-bottom: 1px solid rgba(184, 28, 39, .16);
  min-height: 3rem;
  color: var(--body);
  transition: background-color .15s ease, padding-left .15s ease;
}

.row:last-child { border-bottom: 0; }
.row:hover, .row:focus-visible { background: #fff; padding-left: 1.5rem; outline: none; }
.row .pips { gap: 3px; }

.t {
  font-family: "Bodoni Moda", serif;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.25;
}

.meta { font-size: .8rem; color: var(--soft); white-space: nowrap; }

/* --- Two-column layout --- */
.two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 21rem);
  gap: var(--gap);
  align-items: start;
}

/* --- Creed --- */
.creed {
  margin: 0;
  padding: 0;
  counter-reset: c;
  list-style: none;
  max-width: 52ch;
}

.creed li {
  counter-increment: c;
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: .6rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--faint);
  font-size: 1.0625rem;
}

.creed li:first-child { border-top: 1px solid var(--faint); }

.creed li::before {
  content: counter(c);
  font-family: "Bodoni Moda", serif;
  color: var(--red);
  font-size: .95rem;
}

/* --- Status/stats board --- */
.board .card + .card { margin-top: 1rem; }

.lines {
  margin: 0;
  padding: .6rem .25rem .15rem;
  list-style: none;
  font-size: .9rem;
}

.lines li {
  display: flex;
  justify-content: space-between;
  gap: .9rem;
  padding: .45rem 0;
  border-bottom: 1px dotted var(--faint);
  color: var(--soft);
}

.lines li:last-child { border-bottom: 0; }

.lines b {
  font-weight: 400;
  color: var(--body);
  text-align: right;
}

.lines a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.lines a:hover { border-bottom-color: var(--red); }

/* --- Elsewhere --- */
.elsewhere { display: flex; flex-wrap: wrap; }

.elsewhere a {
  font-size: .9rem;
  text-decoration: none;
  padding: .55rem 1rem;
  border: 1px solid var(--faint);
  margin: 0 -1px -1px 0;
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  color: var(--body);
}

.elsewhere a:hover { border-color: var(--red); color: var(--red); position: relative; z-index: 1; }

/* --- Ghost link --- */
.ghost {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-size: .95rem;
  text-decoration: none;
  border-bottom: 1px solid var(--faint);
  color: var(--body);
}

.ghost:hover { border-bottom-color: var(--red); }

/* --- Footer --- */
footer {
  border-top: 1px solid var(--faint);
  padding-top: 2rem;
  padding-bottom: 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.stamp { width: 4rem; height: 4rem; flex: none; }

.colophon {
  font-size: .8rem;
  color: var(--soft);
  line-height: 1.6;
  max-width: 34ch;
  margin: 0;
}

/* --- Prose (things/work single pages) --- */
.prose { font-size: 1rem; line-height: 1.75; color: var(--body); }
.prose p { margin: 0 0 1rem; }
.prose h2 {
  font-family: "Bodoni Moda", serif;
  font-weight: 400;
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  margin: 2rem 0 .75rem;
  line-height: 1.15;
}
.prose h3 { font-family: "Bodoni Moda", serif; font-weight: 400; font-size: 1.05rem; margin: 1.5rem 0 .5rem; }
.prose a { border-bottom: 1px solid var(--faint); text-decoration: none; transition: border-color .15s; }
.prose a:hover { border-bottom-color: var(--red); }
.prose img { max-width: 100%; height: auto; display: block; margin: 1.5rem 0; border: 1px solid var(--faint); }
.prose ul, .prose ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.prose li { margin-bottom: .35rem; }
.prose strong { font-weight: 500; }

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* --- Responsive --- */
@media (max-width: 60rem) {
  .spread, .grid5 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 48rem) {
  .spread, .grid5, .two { grid-template-columns: 1fr; }
  nav { display: none; }
  .row { grid-template-columns: auto 1fr; }
  .row .meta { grid-column: 2; white-space: normal; }
}
