/* ============================================================
   Game Shelf — shared styles
   Library shell = warm shelf/ledger palette.
   Individual game pages layer a per-game accent on top via
   the --accent / --accent-soft / --accent-ink custom properties
   set on <body data-game="...">.
   ============================================================ */

@font-face {
  font-family: "Fraunces";
  src: local("Fraunces");
}

:root {
  /* Shelf (library) palette */
  --shelf-bg: #f2ecdd;
  --shelf-panel: #fffdf7;
  --shelf-ink: #2b2620;
  --shelf-ink-soft: #6b6255;
  --shelf-line: #ded4bb;
  --shelf-amber: #b9862f;
  --shelf-amber-ink: #6e4c17;

  /* Default accent (overridden per game page) */
  --accent: #b9862f;
  --accent-soft: #eee2c4;
  --accent-ink: #6e4c17;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --font-display: "Fraunces", Georgia, "Iowan Old Style", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--shelf-bg);
  color: var(--shelf-ink);
  font-family: var(--font-body);
  line-height: 1.45;
}

a { color: inherit; }

img { max-width: 100%; display: block; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 3px solid var(--accent-ink);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Library shell (index.html) ---------- */

.shelf-header {
  padding: 2.6rem 1.25rem 1.4rem;
  max-width: clamp(320px, 90vw, 1000px);
  margin: 0 auto;
}

.shelf-header-row {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.shelf-header-icon {
  width: 175px;
  height: 175px;
  border-radius: 16px;
  flex-shrink: 0;
}

.shelf-eyebrow {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--shelf-amber-ink);
  margin: 0 0 0.15rem;
}

.shelf-title {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 7vw, 3rem);
  font-weight: 600;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

.shelf-sub {
  color: var(--shelf-ink-soft);
  max-width: 46ch;
  margin: 0;
  font-size: 1rem;
}

.shelf-search {
  max-width: clamp(320px, 90vw, 1000px);
  margin: 0 auto;
  padding: 0 1.25rem 1rem;
}

.shelf-search input {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--shelf-line);
  background: var(--shelf-panel);
  font-size: 1rem;
  font-family: var(--font-body);
  color: var(--shelf-ink);
}

.shelf-search input::placeholder { color: #a89d89; }

/* A-Z jump rail: horizontal scroll strip on mobile,
   sticky vertical rail on wide screens */
.az-rail {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(var(--shelf-bg) 70%, transparent);
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 0.6rem 1.25rem 0.8rem;
  scrollbar-width: none;
  max-width: clamp(320px, 90vw, 1000px);
  margin: 0 auto;
}
.az-rail::-webkit-scrollbar { display: none; }

.az-rail a {
  flex: 0 0 auto;
  min-width: 1.7rem;
  text-align: center;
  padding: 0.3rem 0.35rem;
  border-radius: 7px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--shelf-ink-soft);
}

.az-rail a[data-empty="true"] {
  color: #cabf9f;
  pointer-events: none;
}

.az-rail a:not([data-empty="true"]):hover,
.az-rail a:not([data-empty="true"]):focus-visible {
  background: var(--shelf-amber);
  color: #fff;
}

.shelf-list {
  max-width: clamp(320px, 90vw, 1000px);
  margin: 0 auto;
  padding: 0.5rem 1.25rem 4rem;
}

.letter-group { margin-bottom: 1.6rem; }

.letter-heading {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--shelf-amber-ink);
  border-bottom: 1.5px solid var(--shelf-line);
  padding-bottom: 0.25rem;
  margin: 0 0 0.5rem;
  scroll-margin-top: 3.2rem;
}

.game-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.8rem 0.4rem;
  text-decoration: none;
  color: var(--shelf-ink);
  border-bottom: 1px solid #e9e0c9;
}

.game-row:last-child { border-bottom: none; }

.game-swatch {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  color: #fff;
  font-size: 1.05rem;
}

.game-cover {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid var(--shelf-line);
}

.game-row-text { min-width: 0; }

.game-row-name {
  font-weight: 600;
  font-size: 1.02rem;
}

.game-row-meta {
  font-size: 0.85rem;
  color: var(--shelf-ink-soft);
}

.shelf-empty-note {
  color: var(--shelf-ink-soft);
  font-size: 0.9rem;
  padding: 1rem 0.4rem;
  border: 1.5px dashed var(--shelf-line);
  border-radius: var(--radius-md);
  text-align: center;
}

/* ---------- Individual game page ---------- */

.game-page { background: var(--shelf-bg); }

.game-hero {
  background: var(--accent-ink);
  color: #fff;
  padding: 1.4rem 1.25rem 2.2rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  text-decoration: none;
  color: rgba(255,255,255,0.85);
  margin-bottom: 1rem;
}
.back-link:hover { color: #fff; }

.back-link-icon {
  width: 75px;
  height: 75px;
  border-radius: 6px;
  display: block;
}
.back-link:hover .back-link-icon {
  opacity: 0.85;
}

.game-hero-kicker {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
  opacity: 0.85;
  margin: 0 0 0.1rem;
}

.game-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 2.7rem);
  margin: 0 0 0.4rem;
  letter-spacing: -0.01em;
}

.game-hero p {
  margin: 0;
  max-width: none;
  opacity: 0.92;
  font-size: 1rem;
}

/* section pill nav, sticky under top */
.section-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.7rem 1.25rem;
  background: var(--shelf-bg);
  border-bottom: 1px solid var(--shelf-line);
  scrollbar-width: none;
}
.section-nav::-webkit-scrollbar { display: none; }

.section-nav a {
  flex: 0 0 auto;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent-ink);
  border: 1.5px solid var(--accent-soft);
  background: var(--shelf-panel);
}

.section-nav a.is-active,
.section-nav a:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.game-main {
  max-width: clamp(320px, 88vw, 900px);
  margin: 0 auto;
  padding: 1.6rem 1.25rem 4rem;
}

.game-section {
  scroll-margin-top: 4rem;
  margin-bottom: 2.4rem;
}

.game-section h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 0 0 0.9rem;
  color: var(--accent-ink);
}

.panel {
  background: var(--shelf-panel);
  border: 1.5px solid var(--shelf-line);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
}

.panel + .panel { margin-top: 0.9rem; }

.note {
  margin-top: 0.9rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color:red;
  font-size: 0.88rem;
}

/* numbered steps (turn overview really is a sequence) */
.steps { list-style: none; margin: 0; padding: 0; }

.steps > li {
  display: flex;
  gap: 0.85rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #ece4d0;
}
.steps li:last-child { border-bottom: none; }

.step-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.step-body p { margin: 0.15rem 0 0; color: var(--shelf-ink-soft); font-size: 0.92rem; }
.step-body strong { color: var(--shelf-ink); }

.step-body p.note {
  margin-top: 0.9rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: red;
  font-size: 0.88rem;
  font-family: inherit; /* Ensures it pulls font from parent or specify your custom font here */
}

.substeps {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
}
.substeps li {
  border: none;
  padding: 0.35rem 0 0.35rem 0;
  font-size: 0.9rem;
  color: var(--shelf-ink-soft);
}
.substeps li strong { 
  color: var(--shelf-ink); 
  display: block;
}

.steps strong,
.substeps strong,
.step-body strong {
  display: inline !important;
  margin: 0 !important;
  padding: 0 !important;
}

.step-body {
  flex: 1 1 auto;
  min-width: 0;
}

.block-content {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.substeps .substeps {
  padding-left: 1.25rem;
  margin-top: 0.2rem;
}

.callout {
  margin-top: 0.9rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.88rem;
}

.callout strong {
  color: inherit;
}

.step-body p.callout {
  margin-top: 0.9rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.88rem;
  font-family: inherit;
}


.step-body p.callout strong {
  color: inherit;
}



/* stat / points-to-end row */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 0.7rem;
}
.stat-tile {
  background: var(--shelf-bg);
  border-radius: var(--radius-md);
  padding: 0.8rem 0.5rem;
  text-align: center;
  min-width: 0;
}
.stat-tile .n {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent-ink);
  display: block;
}
.stat-tile .label {
  font-size: 0.78rem;
  color: var(--shelf-ink-soft);
  overflow-wrap: break-word;
}

.stat-row-flex {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}


/* glossary card categories */
.glossary-group { margin-bottom: 1.4rem; }
.glossary-group:last-child { margin-bottom: 0; }

.glossary-group h3 {
  font-size: 0.82rem;
  text-transform: none;
  color: var(--shelf-ink-soft);
  margin: 0 0 0.6rem;
  font-weight: 700;
}

.glossary-item {
  display: flex;
  gap: 0.9rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid #ece4d0;
  align-items: flex-start;
}
.glossary-item:last-child { border-bottom: none; }

.glossary-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.glossary-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.glossary-text { min-width: 0; }

.glossary-name {
  font-weight: 700;
  font-size: 0.98rem;
  margin: 0 0 0.15rem;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.glossary-count {
  font-weight: 600;
  font-size: 0.72rem;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
}

.glossary-points {
  font-size: 0.87rem;
  color: var(--shelf-ink);
  margin: 0 0 0.2rem;
}

.glossary-effect {
  font-size: 0.85rem;
  color: var(--shelf-ink-soft);
  margin: 0;
}
.glossary-effect strong { color: var(--shelf-ink); font-weight: 600; }

.glossary-pair {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.glossary-pair .glossary-icon { width: 40px; height: 40px; }

footer.site-footer {
  text-align: center;
  color: var(--shelf-ink-soft);
  font-size: 0.82rem;
  padding: 2rem 1.25rem 3rem;
}

/* Container query setup to make table scale relative to its parent container */
.panel, .game-section {
  container-type: inline-size;
}

/* Generic Reusable Manual Table */
.manual-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  text-align: center;
  margin: 1em 0;
  /* Fluid font size that scales between 0.75rem and 1.1rem depending on container width */
  font-size: clamp(0.75rem, 2.2cqw, 1.1rem);
}

.manual-table th,
.manual-table td {
  border: 0.15em solid var(--table-border-color, #3a2b20);
  padding: 0.4em 0.6em;
  vertical-align: middle;
}

.manual-table th {
  font-weight: bold;
  background-color: var(--table-header-bg, rgba(0, 0, 0, 0.04));
}

/* Left-align row headers (first column) */
.manual-table td:first-child {
  text-align: left;
  font-weight: 500;
}

/* Responsive horizontal scrolling for tight viewports */
@supports not (container-type: inline-size) {
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.sub-bullets {
  list-style-type: disc;
  padding-left: 1.4rem;
  margin: 0.4rem 0;
}
.sub-bullets li {
  border: none;
  padding: 0.35rem 0;
  font-size: 0.9rem;
  color: var(--shelf-ink-soft);
}

.pdf-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 100;
  display: flex;
  flex-direction: column;
}
.pdf-modal[hidden] { display: none; }

.pdf-modal-bar {
  display: flex;
  justify-content: flex-end;
  padding: 0.6rem 0.8rem;
  background: var(--shelf-panel);
}

.pdf-modal-close {
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
}

.pdf-modal iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
}

.game-hero-top {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.back-link { margin-bottom: 0; }

.game-hero-cover {
  width: auto;
  height: 65px;
  border-radius: 8px;
  object-fit: contain;
  border: 1.5px solid rgba(255,255,255,0.35);
}