/* Gavin's Tavern V2 — warm tavern theme (static background, parchment UI) */
:root {
  --ink: #2a1c12;
  --ink-soft: #4a3426;
  --parchment: #c9b08a;
  --parchment-deep: #b09068;
  --wood: #1a130f;
  --wood-mid: #2c2118;
  --ember: #b65a2a;
  --ember-hot: #c9783a;
  --gold: #c9a45c;
  --fog: rgba(26, 19, 15, 0.55);
  /* Darker cream fill at ~50% alpha — tavern BG must read through clearly. */
  --panel: rgba(188, 158, 110, 0.5);
  --panel-max: 44rem;
  --side: rgba(22, 16, 12, 0.82);
  --font-display: "Cinzel", "Palatino Linotype", Palatino, serif;
  --font-body: "Source Serif 4", "Palatino Linotype", Palatino, serif;
  --radius: 10px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --rule: rgba(90, 64, 48, 0.2);
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.55;
  /* Transparent so .bg-plane shows through (do not paint opaque wood here). */
  background: transparent;
}

body.page-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  isolation: isolate;
}

.bg-plane {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background-color: #1a130f;
}
/* picture must also fill — otherwise an unstyled host CSS leaves the img in document flow (scrolls). */
.bg-plane picture,
.bg-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.bg-photo {
  object-fit: cover;
  object-position: center center;
}
.bg-plane::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(12, 8, 5, 0.12), rgba(12, 8, 5, 0.28));
}

.top-bar,
.flash-stack,
.main-stage,
.site-footer {
  position: relative;
  z-index: 1;
}

.top-bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.75rem 1.5rem;
  background: rgba(14, 10, 7, 0.92);
  border-bottom: 1px solid rgba(201, 164, 92, 0.25);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--parchment);
}

.brand-sign { width: 36px; height: 36px; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 1rem;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.1rem;
  flex: 1;
}
.top-nav a {
  color: #d9c7a8;
  text-decoration: none;
  font-size: 0.95rem;
}
.top-nav a[aria-current="page"],
.top-nav a:hover { color: var(--gold); }

.top-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.header-greeting {
  margin: 0 0.15rem 0 0;
  color: #d9c7a8;
  font-size: 0.92rem;
  line-height: 1.2;
  white-space: nowrap;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inline-form { display: inline; margin: 0; }
.cart-link { position: relative; }
.cart-count {
  display: inline-block;
  min-width: 1.15rem;
  margin-left: 0.2rem;
  padding: 0 0.28rem;
  border-radius: 4px;
  background: var(--ember);
  color: #fff8ef;
  font-size: 0.75rem;
  line-height: 1.25rem;
  text-align: center;
  vertical-align: middle;
}

.main-stage {
  flex: 1;
  width: min(1100px, calc(100% - 2rem));
  margin: 1.5rem auto 2.5rem;
}

/* Parchment pages (incl. home hero panel): drop ~60–80px farther from the top bar. */
.main-stage:has(.parchment-panel) {
  margin-top: 5.5rem;
}

.main-stage--nook { width: min(1200px, calc(100% - 2rem)); }

.parchment-panel {
  /* Shared size + centered on every Tavern page */
  position: relative;
  overflow: hidden;
  width: min(var(--panel-max), 100%);
  max-width: var(--panel-max);
  margin-inline: auto;
  box-sizing: border-box;
  /* Translucent parchment BACKGROUND only — never opacity/mix-blend the panel itself. */
  background-color: var(--panel);
  background-image: none;
  opacity: 1;
  mix-blend-mode: normal;
  isolation: auto;
  border: 1px solid rgba(72, 48, 28, 0.38);
  border-radius: var(--radius);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
  padding: 1.75rem 1.9rem;
  animation: rise-in 0.55s ease both;
}

/*
 * Texture veil: background-only layer.
 * Own isolated stacking context so multiply/opacity cannot flatten into text/portrait.
 */
.parchment-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  isolation: isolate;
  background-image: url("../images/parchment-texture.webp");
  background-size: 360px auto;
  background-repeat: repeat;
  opacity: 0.38;
  mix-blend-mode: multiply;
}

/*
 * Content = solid layers above the veil.
 * isolation + explicit normal blend keeps ink/buttons/portrait out of parchment multiply.
 */
.parchment-panel > * {
  position: relative;
  z-index: 1;
  isolation: isolate;
  opacity: 1;
  mix-blend-mode: normal;
}

.parchment-panel :where(
  h1, h2, h3, h4, p, a, li, span, strong, em, label,
  input, textarea, select, button, .btn, img, picture, svg, code
) {
  opacity: 1;
  mix-blend-mode: normal;
}

.static-page .prose p { margin: 0 0 1rem; }
.static-page .prose p:last-child { margin-bottom: 0; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  margin: 0 0 0.75rem;
  color: var(--ink);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin: 0 0 0.5rem;
}
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { color: var(--ember); }

.lede { color: var(--ink-soft); margin-top: 0; }
.empty-state {
  font-style: italic;
  color: var(--ink-soft);
  padding: 1rem 0 0.35rem;
}
.empty-actions { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.price { font-weight: 600; color: var(--ember); }
.meta-line {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin: 0.25rem 0 0.75rem;
}
.meta-line a { color: var(--ember); text-decoration: none; }
.meta-line a:hover { text-decoration: underline; }

.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 0.55rem 1rem;
  font: inherit;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  color: inherit;
}
/* Warm oak plank buttons — visible wood grain + light contrast veil for text. */
.btn-primary,
.btn-ink {
  color: #fff8ef;
  text-shadow: 0 1px 2px rgba(20, 10, 4, 0.75);
  border-color: #5a3a22;
  background-color: #8a5a32;
  background-image:
    linear-gradient(180deg, rgba(255, 236, 200, 0.28), rgba(40, 22, 10, 0.28)),
    url("../images/wood-btn-tile.webp");
  background-size: auto, 140px 140px;
  background-position: center, center;
  background-blend-mode: normal, normal;
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 200, 0.35),
    inset 0 -2px 0 rgba(40, 22, 10, 0.35),
    0 2px 0 #3a2212,
    0 6px 14px rgba(0, 0, 0, 0.28);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover,
.btn-ink:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}
.btn-primary:active,
.btn-ink:active {
  transform: translateY(1px);
  filter: brightness(0.97);
}
.btn-lg { padding: 0.85rem 1.45rem; font-size: 1.05rem; }
.btn-ghost {
  border-color: rgba(201, 164, 92, 0.55);
  color: #f7ecd4;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  background-color: #6b4528;
  background-image:
    linear-gradient(180deg, rgba(255, 236, 200, 0.18), rgba(20, 12, 8, 0.35)),
    url("../images/wood-btn-tile.webp");
  background-size: auto, 140px 140px;
  box-shadow: inset 0 1px 0 rgba(255, 220, 170, 0.18), 0 1px 0 #2a180e;
}
.btn-ghost:hover { filter: brightness(1.08); }
.btn-danger {
  color: #fff4ee;
  text-shadow: 0 1px 2px rgba(40, 8, 4, 0.7);
  border-color: #6b2a1e;
  background-color: #8a3f2a;
  background-image:
    linear-gradient(180deg, rgba(255, 200, 170, 0.22), rgba(40, 10, 6, 0.35)),
    url("../images/wood-btn-tile.webp");
  background-size: auto, 140px 140px;
  box-shadow: inset 0 1px 0 rgba(255, 200, 170, 0.2), 0 2px 0 #3a120c;
}
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 1.1rem; }

.hero {
  min-height: calc(100vh - 14rem);
  display: grid;
  place-items: center;
  padding: 0;
  width: 100%;
}
/* Home: raise first panel (~half prior top blank) and even the gap between panels. */
.is-home .main-stage:has(.parchment-panel) {
  margin-top: 2.75rem;
}
.is-home .hero {
  min-height: 0;
  place-items: start center;
  padding: 0;
}
.is-home .keeper-message {
  margin: 2.75rem 0 2.5rem;
}
.hero-panel {
  animation: fade-up 0.8s ease both;
}
.keeper-message {
  width: 100%;
  margin: 1.35rem 0 2.5rem;
  animation: rise-in 0.55s ease 0.12s both;
}
.keeper-letter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.15rem 1.35rem;
  align-items: start;
}
.keeper-portrait-wrap {
  flex-shrink: 0;
  isolation: isolate;
  opacity: 1;
  mix-blend-mode: normal;
}
.keeper-portrait-wrap picture {
  display: block;
  isolation: isolate;
  opacity: 1;
  mix-blend-mode: normal;
}
.keeper-portrait {
  width: 7rem;
  height: 7rem;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(90, 64, 48, 0.35);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
  display: block;
  background: var(--parchment-deep);
  isolation: isolate;
  opacity: 1;
  mix-blend-mode: normal;
}
.keeper-letter-copy h2 {
  margin-bottom: 0.55rem;
}
.keeper-message-panel .lede,
.keeper-message-body {
  margin-bottom: 0;
}
.keeper-message-body p {
  margin: 0 0 0.85rem;
  color: var(--ink-soft);
}
.keeper-message-body p:last-child {
  margin-bottom: 0;
}
.keeper-signoff {
  margin-top: 1.35rem; /* blank line before sign-off */
  color: var(--ink);
  font-style: italic;
}
.hero-inner { max-width: none; }
.hero-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.hero-sign {
  width: 72px;
  height: 72px;
  filter: drop-shadow(0 0 10px rgba(201, 164, 92, 0.28));
  animation: sign-glow 3.5s ease-in-out infinite;
}
.hero-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  color: var(--ink);
}
.hero-headline {
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  color: var(--ink);
}
.hero-support {
  color: var(--ink-soft);
  max-width: 38rem;
  margin: 0;
}
.hero-cta { margin-top: 1.4rem; margin-bottom: 0; }
.hero-cta .btn-primary { animation: cta-breathe 2.8s ease-in-out infinite; }

/* Home: same centered stage width as other Tavern parchment pages. */
.is-home .main-stage { width: min(1100px, calc(100% - 2rem)); }

.nook-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}
.side-nav {
  background: var(--side);
  color: #e8d7b8;
  border-radius: var(--radius);
  padding: 1rem 0.85rem;
  border: 1px solid rgba(201, 164, 92, 0.18);
  animation: slide-in 0.45s ease both;
}
.side-nav-title {
  font-family: var(--font-display);
  margin: 0 0 0.75rem;
  padding: 0 0.55rem;
  font-size: 0.95rem;
  color: var(--gold);
}
.side-nav ul { list-style: none; margin: 0; padding: 0; }
.side-nav a {
  display: block;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  color: #e6d4b4;
  text-decoration: none;
}
.side-nav a:hover,
.side-nav a[aria-current="page"] {
  background: rgba(201, 164, 92, 0.16);
  color: #fff1d2;
}

.stand-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1rem 0 0.25rem;
}
.stand-tabs a {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(90, 64, 48, 0.28);
  border-radius: 6px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.92rem;
  background: rgba(255, 255, 255, 0.28);
}
.stand-tabs a:hover,
.stand-tabs a[aria-current="page"] {
  color: var(--ink);
  border-color: var(--ember);
  background: rgba(255, 248, 232, 0.65);
}

.listing { list-style: none; padding: 0; margin: 1rem 0 0; }
.listing > li {
  padding: 0.95rem 0;
  border-top: 1px solid var(--rule);
  animation: rise-in 0.45s ease both;
}
.listing > li:nth-child(2) { animation-delay: 0.04s; }
.listing > li:nth-child(3) { animation-delay: 0.08s; }
.listing > li:nth-child(4) { animation-delay: 0.12s; }
.listing-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
}
.listing-row:hover .listing-title { color: var(--ember); }
.listing-cover {
  width: 72px;
  height: 96px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid rgba(90, 64, 48, 0.25);
  background: var(--parchment-deep);
  flex-shrink: 0;
}
.listing-cover--empty {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  text-transform: uppercase;
}
.listing-body { flex: 1; min-width: 0; }
.listing-title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 0.2rem;
  transition: color 0.15s ease;
}
.listing-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.listing-summary {
  margin: 0.45rem 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.stand-grid {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  display: grid;
  gap: 1.15rem;
}
.stand-grid > li {
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.stand-grid h2 { font-size: 1.3rem; margin-bottom: 0.35rem; }
.stand-grid h2 a { color: inherit; text-decoration: none; }
.stand-grid h2 a:hover { color: var(--ember); }
.stand-grid p { margin: 0; color: var(--ink-soft); }
.stand-open { margin-top: 0.65rem; }

.product-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
}
.product-layout.has-cover {
  grid-template-columns: minmax(140px, 200px) minmax(0, 1fr);
  align-items: start;
}
.product-cover {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(90, 64, 48, 0.3);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}
.product-desc {
  margin-top: 1rem;
  white-space: pre-wrap;
}
.owned-banner {
  margin: 1rem 0 0;
  padding: 0.65rem 0.85rem;
  border-left: 3px solid #3d6b3a;
  background: rgba(61, 107, 58, 0.1);
  color: var(--ink-soft);
}
.artifact-note {
  margin: 0.85rem 0 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.related-list { list-style: none; padding: 0; margin: 0.75rem 0 0; }
.related-list li { padding: 0.4rem 0; border-top: 1px solid var(--rule); }
.related-list a { color: var(--ember); text-decoration: none; }
.related-list a:hover { text-decoration: underline; }

.vault-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
.vault-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.vault-waiting {
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-style: italic;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--rule);
}
.checkout-note {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.stack-form { display: grid; gap: 0.85rem; max-width: 28rem; margin-top: 1rem; }
.stack-form label { display: grid; gap: 0.3rem; font-size: 0.95rem; }
.stack-form input,
.stack-form textarea,
.stack-form select {
  font: inherit;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(90, 64, 48, 0.35);
  border-radius: 6px;
  background: #f4ebda;
  color: var(--ink);
}
.account-nooks { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.account-nooks li { padding: 0.35rem 0; }
/* Account text links match body ink (no browser blue/purple visited). Scoped to Account page. */
.account-page .account-nooks a,
.account-page .account-nooks a:link,
.account-page .account-nooks a:visited,
.account-page .account-keeper-tools a,
.account-page .account-keeper-tools a:link,
.account-page .account-keeper-tools a:visited {
  color: var(--ink);
  text-decoration: none;
}
.account-page .account-nooks a:hover,
.account-page .account-keeper-tools a:hover {
  text-decoration: underline;
}
.account-section { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); }

.flash-stack { width: min(1100px, calc(100% - 2rem)); margin: 0.75rem auto 0; }
.flash {
  margin: 0.35rem 0;
  padding: 0.65rem 0.9rem;
  border-radius: 6px;
  background: rgba(232, 215, 184, 0.92);
}
.flash-ok { border-left: 4px solid #3d6b3a; }
.flash-err { border-left: 4px solid #8a2f22; }

.site-footer {
  margin-top: auto;
  padding: 1.75rem 1rem 2rem;
  text-align: center;
  background: rgba(14, 10, 7, 0.94);
  color: #cbb892;
  border-top: 1px solid rgba(201, 164, 92, 0.2);
}
.footer-brand {
  font-family: var(--font-display);
  color: var(--parchment);
  margin: 0;
}
.footer-tag { margin: 0.25rem 0 0.75rem; font-size: 0.95rem; }
.footer-nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.85rem; }
.footer-nav a { color: #b9a48a; text-decoration: none; font-size: 0.9rem; }
.footer-nav a:hover { color: var(--gold); }
.footer-copy { margin: 0.9rem 0 0; font-size: 0.8rem; color: #8f7d66; }

.local-hint { font-size: 0.85rem; word-break: break-all; }
code { font-size: 0.9em; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes slide-in {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: none; }
}
@keyframes sign-glow {
  0%, 100% { filter: drop-shadow(0 0 12px rgba(201, 164, 92, 0.25)); }
  50% { filter: drop-shadow(0 0 22px rgba(201, 164, 92, 0.5)); }
}
@keyframes cta-breathe {
  0%, 100% {
    box-shadow:
      inset 0 1px 0 rgba(255, 236, 200, 0.35),
      inset 0 -2px 0 rgba(40, 22, 10, 0.35),
      0 2px 0 #3a2212,
      0 6px 14px rgba(0, 0, 0, 0.28);
  }
  50% {
    box-shadow:
      inset 0 1px 0 rgba(255, 236, 200, 0.45),
      inset 0 -2px 0 rgba(40, 22, 10, 0.35),
      0 2px 0 #3a2212,
      0 8px 18px rgba(120, 70, 30, 0.4);
  }
}

/* Codex Nook workflow */
.codex-workspace {
  margin: 0 0 1.1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--rule);
  animation: fade-up 0.5s ease both;
}
.codex-world-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: end;
}
.codex-label {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.25rem;
}
.codex-world-switch select {
  font: inherit;
  min-width: 12rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(90, 64, 48, 0.35);
  border-radius: 6px;
  background: #f4ebda;
  color: var(--ink);
}
.codex-world-meta {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.codex-stat-row {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  padding: 0;
  margin: 1rem 0;
}
.codex-stat-row li {
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.codex-stat-row strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  margin-right: 0.25rem;
}
.codex-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1.1rem 0 0;
}
.codex-quick a {
  color: var(--ember);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.codex-quick a:hover { border-bottom-color: var(--ember); }
.codex-section {
  margin-top: 1.75rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
  animation: rise-in 0.45s ease both;
}
.codex-section h2 { margin-top: 0; }
.codex-hint {
  margin: 0.35rem 0 0.85rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.codex-hint-warn { color: #7a3a28; }
.codex-form-wide { max-width: 40rem; }
.codex-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.codex-atom-list { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.codex-atom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.55rem 1rem;
  align-items: center;
  padding: 0.7rem 0;
  border-top: 1px solid var(--rule);
}
.codex-atom-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.55rem;
  align-items: center;
  min-width: 0;
}
.codex-atom-head a {
  color: inherit;
  text-decoration: none;
}
.codex-atom-head a:hover { color: var(--ember); }
.codex-band-label {
  list-style: none;
  margin: 1rem 0 0.25rem;
  font-family: var(--font-display);
  color: var(--ink-soft);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}
.codex-pill {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.12rem 0.45rem;
  border: 1px solid rgba(90, 64, 48, 0.28);
  border-radius: 4px;
  color: var(--ink-soft);
  background: rgba(255, 248, 232, 0.45);
}
.codex-pill-ok {
  border-color: rgba(61, 107, 58, 0.45);
  color: #2f5a2c;
}
.codex-pill-warn {
  border-color: rgba(138, 47, 34, 0.4);
  color: #7a3a28;
}
.codex-pill-lb {
  border-color: rgba(160, 100, 40, 0.45);
  color: #6b4520;
}
.codex-card {
  margin: 1rem 0 1.5rem;
  padding: 0.85rem 0 0;
  border-top: 1px solid var(--rule);
}
.codex-card h3 { margin: 0 0 0.75rem; }
.codex-ledger { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.codex-ledger li {
  padding: 0.65rem 0;
  border-top: 1px solid var(--rule);
}
.codex-ledger p { margin: 0.35rem 0 0; color: var(--ink-soft); }
.codex-muted { color: var(--ink-soft); font-size: 0.9rem; }
.codex-meta { color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 0.4rem; }
.codex-manuscript-preview {
  white-space: pre-wrap;
  font-family: var(--font-body, "Source Serif 4", Georgia, serif);
  font-size: 0.95rem;
  line-height: 1.55;
  background: rgba(255, 248, 232, 0.55);
  border: 1px solid rgba(90, 64, 48, 0.18);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  max-height: 18rem;
  overflow: auto;
  color: var(--ink);
}
.codex-manuscript-full { max-height: none; }
.codex-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1rem 0;
}
.codex-handle-list { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.codex-handle-list li {
  padding: 0.65rem 0;
  border-top: 1px solid var(--rule);
}
.codex-handle-list p { margin: 0.3rem 0 0; }
.codex-gate { margin: 0.75rem 0; }
.codex-paths { font-size: 0.85rem; color: var(--ink-soft); word-break: break-all; }
.inline-form { display: inline; }

@media (max-width: 800px) {
  .top-bar { flex-wrap: wrap; }
  .nook-layout { grid-template-columns: 1fr; }
  .hero { min-height: calc(100vh - 14rem); place-items: center; }
  .is-home .hero { min-height: 0; place-items: start center; }
  .keeper-message { width: 100%; }
  .header-greeting { max-width: 100%; white-space: normal; }
  .keeper-letter {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: left;
  }
  .keeper-portrait-wrap { order: -1; }
  .keeper-portrait { width: 6.25rem; height: 6.25rem; }
  .keeper-letter-copy { width: 100%; }
  .vault-item { flex-direction: column; align-items: flex-start; }
  .product-layout.has-cover { grid-template-columns: 1fr; }
  .product-cover { max-width: 160px; }
  .codex-form-row { grid-template-columns: 1fr; }
}
