/* =========================================================================
   Corporeal Vanguard — shared styles
   Used by index.html, map.html, and future POS / Forge / etc.
   ========================================================================= */

:root {
  --bg-deep:    #050507;
  --bg-base:    #0a0c10;
  --bg-card:    #11141a;
  --bg-card-hi: #161a22;
  --bg-input:   #0d1015;
  --line:       rgba(255,255,255,.08);
  --line-hi:    rgba(255,255,255,.14);
  --text:       #e8e2d0;
  --text-dim:   #b3a98e;
  --text-mute:  #7a7261;
  --cyan:       #06b6d4;
  --cyan-hi:    #22d3ee;
  --cyan-lo:    #083344;
  --cyan-wash:  rgba(6,182,212,.08);
  --cyan-glow:  rgba(6,182,212,.35);
  --gold:       #d4af37;
  --gold-hi:    #f0c850;
  --gold-deep:  #8b6914;
  --gold-glow:  rgba(212,175,55,.3);
  --banner:     #5a1f1f;
  --danger:     #ef4444;
  --ok:         #34d399;
  --r:    5px;
  --r-sm: 3px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg-base);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
button { font: inherit; color: inherit; cursor: pointer; }

.font-cinzel { font-family: "Cinzel", "Times New Roman", serif; letter-spacing: .04em; }
.font-skyrim { font-family: "MedievalSharp", serif; letter-spacing: .04em; }

.coin { color: var(--gold); opacity: .9; font-size: .82em; margin-left: 2px; }

/* ============= BUTTONS ============= */
.btn {
  font-family: "Cinzel", serif;
  font-weight: 600;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--line-hi);
  color: var(--text);
  border-radius: var(--r);
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: rgba(255,255,255,.32); background: rgba(255,255,255,.03); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(to bottom, rgba(6,182,212,.18), rgba(6,182,212,.08));
  border-color: rgba(6,182,212,.55);
  color: var(--cyan-hi);
}
.btn-primary:hover {
  background: linear-gradient(to bottom, rgba(6,182,212,.28), rgba(6,182,212,.14));
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(6,182,212,.3);
  color: #fff;
}
.btn-gold {
  background: linear-gradient(to bottom, rgba(212,175,55,.16), rgba(212,175,55,.06));
  border-color: rgba(212,175,55,.5);
  color: var(--gold-hi);
}
.btn-gold:hover {
  background: linear-gradient(to bottom, rgba(212,175,55,.26), rgba(212,175,55,.12));
  border-color: var(--gold);
  box-shadow: 0 0 18px rgba(212,175,55,.25);
  color: #fff;
}
.btn-danger { color: #fca5a5; border-color: rgba(185,28,28,.45); }
.btn-danger:hover { background: rgba(185,28,28,.12); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: .65rem; }

/* ============= INPUTS ============= */
.input, .select, textarea.input {
  background: var(--bg-input);
  border: 1px solid var(--line-hi);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--r);
  font-family: inherit;
  font-size: 14px;
  outline: 0; width: 100%;
  transition: border .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(6,182,212,.15);
}

/* ============= ORNAMENTS ============= */
.orn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  color: rgba(212,175,55,.55);
}
.orn .star { color: var(--gold); filter: drop-shadow(0 0 6px var(--gold-glow)); }
.orn svg { display: block; }

/* Inline divider: <hr class="orn-rule"> or <div class="orn-rule"></div>.
   Renders as a tapered gold line with a centered diamond glyph. */
.orn-rule {
  border: 0;
  height: 14px;
  margin: 14px auto;
  width: 100%;
  max-width: 360px;
  position: relative;
  background:
    linear-gradient(to right,
      transparent 0%, rgba(212,175,55,.45) 22%,
      rgba(212,175,55,.65) 50%, rgba(212,175,55,.45) 78%, transparent 100%);
  -webkit-mask: linear-gradient(to bottom, transparent 40%, #000 49%, #000 51%, transparent 60%);
          mask: linear-gradient(to bottom, transparent 40%, #000 49%, #000 51%, transparent 60%);
}
.orn-rule::before, .orn-rule::after {
  content: ""; position: absolute; top: 50%;
  width: 6px; height: 6px;
  background: var(--gold);
  transform: translateY(-50%) rotate(45deg);
  box-shadow: 0 0 4px var(--gold-glow);
}
.orn-rule::before { left: calc(50% - 32px); }
.orn-rule::after  { left: calc(50% + 26px); }
.orn-rule .center {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  color: var(--gold-hi); font-size: .85rem;
  background: var(--bg-base);
  padding: 0 8px;
  filter: drop-shadow(0 0 6px var(--gold-glow));
}

/* ============= HERALDIC CARD ============= */
/* A more decorative panel: subtle inner-top gold highlight (mimics polished
   metal catching candlelight), gentle gradient inside, and optional corner
   brackets when you add the `.with-corners` modifier. */
.heraldic {
  position: relative;
  background:
    linear-gradient(165deg, rgba(255,255,255,.025), transparent 35%, rgba(0,0,0,.18)),
    var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: inset 0 1px 0 rgba(212,175,55,.12), 0 6px 24px rgba(0,0,0,.35);
}
.heraldic.with-corners { padding-top: 18px; }
.heraldic.with-corners::before,
.heraldic.with-corners::after,
.heraldic.with-corners > .br-bl,
.heraldic.with-corners > .br-br {
  content: ""; position: absolute;
  width: 12px; height: 12px;
  border: 1px solid rgba(212,175,55,.55);
  opacity: .9;
  pointer-events: none;
}
.heraldic.with-corners::before { top: -1px; left: -1px;  border-right: 0; border-bottom: 0; }
.heraldic.with-corners::after  { top: -1px; right: -1px; border-left: 0;  border-bottom: 0; }
.heraldic.with-corners > .br-bl { bottom: -1px; left: -1px;  border-right: 0; border-top: 0; }
.heraldic.with-corners > .br-br { bottom: -1px; right: -1px; border-left: 0;  border-top: 0; }

/* ============= EMPTY STATE ============= */
.empty-state {
  position: relative;
  padding: 38px 24px 32px;
  background: rgba(10,12,16,.55);
  border: 1px solid rgba(212,175,55,.18);
  border-radius: var(--r);
  text-align: center;
  color: var(--text-mute);
  font-family: "MedievalSharp", serif;
  font-style: italic;
  font-size: .95rem;
  line-height: 1.55;
  overflow: hidden;
}
.empty-state::before, .empty-state::after {
  content: ""; position: absolute;
  width: 14px; height: 14px;
  border: 1px solid rgba(212,175,55,.55);
}
.empty-state::before { top: 6px; left: 6px;  border-right: 0; border-bottom: 0; }
.empty-state::after  { bottom: 6px; right: 6px; border-left: 0;  border-top: 0; }
.empty-state .mark {
  display: block; margin: 0 auto 10px;
  color: rgba(212,175,55,.55);
  font-size: 1.8rem;
  text-shadow: 0 0 12px var(--gold-glow);
}
.empty-state .lead {
  font-family: "Cinzel", serif;
  font-style: normal;
  font-size: .82rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold-hi);
  display: block;
  margin-bottom: 6px;
}

/* ============= BUTTON HOVER POLISH ============= */
/* Subtle gold-edge shimmer on .btn hover — applies under existing button
   color variants. */
.btn { position: relative; overflow: hidden; }
.btn::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.08) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform .55s ease;
  pointer-events: none;
}
.btn:hover::after { transform: translateX(120%); }

/* ============= INPUT FOCUS — gold variant for forms in heraldic context */
.input-gold:focus, .input.input-gold:focus, .select.input-gold:focus,
textarea.input.input-gold:focus {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 2px rgba(212,175,55,.18) !important;
}

/* ============= PAGE FADE-IN ============= */
@media (prefers-reduced-motion: no-preference) {
  body { animation: page-in .35s ease both; }
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* =========================================================================
   RP / TAVERN PROPS — parchment, wax seals, wooden backboards.
   Used by the Dossiers bounty board, modal notes, map detail panel, etc.
   ========================================================================= */

/* Parchment paper — aged cream gradient with subtle grain. Drop dark ink
   text on top of this. Tweak --tilt on each instance for hand-pinned feel. */
.parchment {
  position: relative;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,245,210,.6), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(110,80,40,.18), transparent 55%),
    linear-gradient(160deg, #e6d3a3 0%, #d2bb83 55%, #b89968 100%);
  color: #2c1f10;
  border-radius: 2px;
  box-shadow:
    0 6px 14px rgba(0,0,0,.55),
    0 2px 0 rgba(0,0,0,.15) inset;
  isolation: isolate;
}
/* Aged grain via SVG noise — multiplies into the warm base color. */
.parchment::before {
  content: ""; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.4' seed='5' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.18  0 0 0 0 0.13  0 0 0 0 0.07  0 0 0 .35 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
  opacity: .55;
  pointer-events: none;
  border-radius: inherit;
}
/* Aged edges + faint center vignette */
.parchment::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(40,20,5,.28) 100%),
    linear-gradient(180deg, rgba(60,30,5,.12), transparent 30%, transparent 70%, rgba(60,30,5,.14));
  pointer-events: none;
  border-radius: inherit;
}
.parchment > * { position: relative; z-index: 1; }

/* Curled corner — small dog-ear that reads as paper, not a CSS box. */
.parchment.curled::before {
  /* Reuse ::before for the curl effect by adding a second background layer */
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.4' seed='5' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.18  0 0 0 0 0.13  0 0 0 0 0.07  0 0 0 .35 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    radial-gradient(circle at bottom right, rgba(0,0,0,.4) 18px, transparent 19px);
  background-blend-mode: multiply, normal;
}

/* Ink text — for content sitting on parchment. */
.ink {
  font-family: "Crimson Text", "Times New Roman", serif;
  color: #2c1f10;
  text-shadow: 0 1px 0 rgba(255,245,210,.4);
}
.ink-script {
  font-family: "MedievalSharp", "Crimson Text", serif;
  color: #2c1f10;
  letter-spacing: .01em;
}
.ink-header {
  font-family: "Cinzel", "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #1a1208;
  text-shadow: 0 1px 0 rgba(255,245,210,.5);
}

/* Wax seal — small circular emblem, typically in a corner of a parchment.
   Drop a glyph or initial in the center via .wax-seal > * { color: #f0d9a0; }. */
.wax-seal {
  position: absolute;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 35% 30%, rgba(255,180,180,.45), transparent 38%),
    radial-gradient(circle at 70% 75%, rgba(0,0,0,.5), transparent 55%),
    radial-gradient(circle at center, #8b1d1d 0%, #5a1414 60%, #3a0c0c 100%);
  border-radius: 50%;
  color: #f0d9a0;
  font-family: "Cinzel", serif; font-weight: 700; font-size: .8rem; letter-spacing: .04em;
  box-shadow:
    0 3px 6px rgba(0,0,0,.55),
    0 0 0 1px rgba(0,0,0,.4),
    inset 0 -2px 4px rgba(0,0,0,.4),
    inset 0 2px 3px rgba(255,200,200,.25);
  transform: rotate(-6deg);
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.3));
}
.wax-seal::before {
  content: ""; position: absolute; inset: 4px;
  border: 1px solid rgba(255,200,200,.22);
  border-radius: 50%;
}

/* Pin — small brass tack at the top of a pinned paper. */
.pin {
  position: absolute;
  width: 14px; height: 14px; border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #f5d97a, #b8881e 60%, #6b4d10 100%);
  box-shadow: 0 2px 3px rgba(0,0,0,.55), inset 0 -1px 2px rgba(0,0,0,.3), inset 0 1px 1px rgba(255,230,160,.4);
}

/* Wooden backboard — for grids of pinned papers (bounty board, notice
   board). Deep coffee browns with vertical grain stripes. */
.wood-board {
  position: relative;
  background:
    radial-gradient(ellipse at top, rgba(80,55,30,.45), transparent 70%),
    radial-gradient(ellipse at bottom, rgba(20,10,5,.65), transparent 70%),
    linear-gradient(180deg, #251a0e 0%, #14100a 100%);
  overflow: hidden;
}
.wood-board::before {
  content: ""; position: absolute; inset: 0;
  background:
    repeating-linear-gradient(91deg,
      transparent 0 60px,
      rgba(255,200,140,.025) 61px, transparent 62px,
      transparent 80px,
      rgba(0,0,0,.18) 81px, transparent 82px,
      transparent 130px,
      rgba(255,200,140,.015) 131px, transparent 132px),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='340' height='340'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.65' seed='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.16  0 0 0 0 0.10  0 0 0 0 0.05  0 0 0 .45 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
  opacity: .8;
  pointer-events: none;
}
.wood-board > * { position: relative; z-index: 1; }

/* ============= TOPBAR — shared polish ============= */
/* Tapered gold gradient sitting just below every page's topbar border.
   Subtle — just enough that the edge feels intentional, not stamped. */
.topbar { position: relative; }
.topbar::after {
  content: "";
  position: absolute;
  left: 8%; right: 8%;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(to right, transparent 0%, rgba(212,175,55,.45) 50%, transparent 100%);
  pointer-events: none;
}
.topbar a, .topbar button { position: relative; }

/* Each PHP page defines its own .topbar block inline; these media rules
   make the now-long admin link list wrap and shrink cleanly on phones. */
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 8px 10px !important; padding: 8px 12px !important; }
  .topbar .crumb { display: none; }
  .topbar .spacer { display: none; }
  .topbar a, .topbar button {
    font-size: .58rem !important;
    letter-spacing: .1em !important;
    padding: 5px 8px !important;
  }
}
@media (max-width: 420px) {
  .topbar .brand { font-size: .66rem !important; letter-spacing: .14em !important; }
}

/* ============= TOAST ============= */
.toast {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(10,12,16,.95);
  border: 1px solid rgba(6,182,212,.5);
  color: var(--cyan-hi);
  padding: 8px 18px;
  border-radius: var(--r);
  font-family: "Cinzel", serif;
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: 0;
  transition: all .25s;
  pointer-events: none;
  box-shadow: 0 8px 30px rgba(0,0,0,.6), 0 0 20px rgba(6,182,212,.2);
  z-index: 2000;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: rgba(239,68,68,.6); color: #fca5a5; box-shadow: 0 8px 30px rgba(0,0,0,.6), 0 0 20px rgba(239,68,68,.2); }
.toast.gold  { border-color: rgba(212,175,55,.6); color: var(--gold-hi); box-shadow: 0 8px 30px rgba(0,0,0,.6), 0 0 20px rgba(212,175,55,.2); }

/* ============= SCROLLBARS ============= */
*::-webkit-scrollbar { width: 7px; height: 7px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,.06); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(6,182,212,.4); }
