/* Poebroker — v3 Dusk palette (colors only, structure unchanged) */
:root {
  /* Surfaces — lifted dusk: warm taupe */
  --pb-base: #4a443c;
  --pb-surface: #574f46;
  --pb-raised: #635a4f;
  --pb-row-alt: #524b42;

  /* Text — warm bone, higher contrast on lifted bg */
  --pb-text: #f4ecd9;
  --pb-muted: #a59781;
  --pb-dim: #7a6e5f;

  /* Accents — tuned for lifted bg */
  --pb-bronze: #b88955;
  --pb-brass: #d4a85c;
  --pb-crimson: #c25647;
  --pb-ember: #e07644;

  /* Borders */
  --pb-border: #9c7530;
  --pb-border-soft: rgba(212, 168, 92, 0.4);

  /* Item rarity (calibrated for lifted dusk) */
  --pb-r-normal: #d4c8af;
  --pb-r-magic: #92b0e0;
  --pb-r-rare: #ecd57a;
  --pb-r-unique: #d68a52;
  --pb-r-gem: #7ccdb6;
  --pb-r-currency: #d4a85c;

  /* Shadows */
  --pb-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.2);
  --pb-inner-glow: inset 0 1px 0 rgba(244, 236, 217, 0.06);
}

/* Root font-size drives all rem-based Tailwind text-* utilities.
   Bumping this scales every text-* class proportionally without
   changing layout, padding, or fixed-pixel sizes. */
html { font-size: 20px; }

/* Body baseline */
body.pb-body {
  background: var(--pb-base);
  color: var(--pb-text);
  font-family: 'Lora', 'Crimson Pro', serif;
}

@media (max-width: 639px) {
  /* Tap-target minimum: WCAG 2.5.5 / Apple HIG recommend ≥44×44px hit
     area for any interactive element. Apply to nav and button-like
     elements so phones can hit them reliably. */
  .pb-nav-link,
  .pb-side-link,
  .pb-btn,
  .pb-btn-primary,
  .pb-btn-secondary,
  .pb-btn-ghost,
  .pb-row-add,
  .pb-row-remove,
  .pb-star {
    min-height: 44px;
  }
  .pb-row-remove {
    min-width: 44px;
  }
  .pb-nav-link {
    display: inline-flex;
    align-items: center;
    padding-top: 4px;
    padding-bottom: 8px;
  }
  /* Star toggle (favourite) — small glyph but high-frequency tap;
     enlarge hit area without changing the visible icon size. */
  .pb-star {
    min-width: 44px;
    padding: 10px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  /* Lang toggle anchors live inside an .pb-smallcaps strip in the nav.
     Default padding is 4px 10px → ~24x16. Bump to 44px hit area. */
  nav a.pb-smallcaps {
    padding: 12px 12px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
  }
  /* Brand link in the nav — img + text combo currently 28px tall.
     Give the whole anchor a 44px hit area. */
  nav a:has(img) {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  /* Action buttons rendered as <button class="pb-smallcaps"> — e.g.
     EXPAND, UNTRACK, "Use output as name". These are first-class tap
     targets and should be ≥44 high. */
  button.pb-smallcaps {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  /* Page-level back-links ("← Hold", "← Watchlist") and similar
     standalone navigation anchors are templated with an inline
     display: inline-block. Bump them to 44px on mobile. */
  a.pb-smallcaps[style*="inline-block"] {
    min-height: 44px;
    display: inline-flex !important;
    align-items: center;
  }
}

/* Parchment noise — faint procedural texture */
.pb-noise {
  position: relative;
}
.pb-noise::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image:
    radial-gradient(rgba(212, 166, 87, 0.4) 1px, transparent 1px),
    radial-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 1px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1px 2px;
  mix-blend-mode: overlay;
}

/* Brass corner ornaments — geometric, hairline only */
.pb-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
}
.pb-corner-tl { top: 4px; left: 4px; border-top: 1px solid var(--pb-border); border-left: 1px solid var(--pb-border); }
.pb-corner-tr { top: 4px; right: 4px; border-top: 1px solid var(--pb-border); border-right: 1px solid var(--pb-border); }
.pb-corner-bl { bottom: 4px; left: 4px; border-bottom: 1px solid var(--pb-border); border-left: 1px solid var(--pb-border); }
.pb-corner-br { bottom: 4px; right: 4px; border-bottom: 1px solid var(--pb-border); border-right: 1px solid var(--pb-border); }

/* Heavy ornament variant — adds inner tick */
.pb-corner-heavy::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--pb-brass);
}
.pb-corner-heavy.pb-corner-tl::after { top: 4px; left: 4px; }
.pb-corner-heavy.pb-corner-tr::after { top: 4px; right: 4px; }
.pb-corner-heavy.pb-corner-bl::after { bottom: 4px; left: 4px; }
.pb-corner-heavy.pb-corner-br::after { bottom: 4px; right: 4px; }

/* Common surfaces */
.pb-panel {
  background: var(--pb-raised);
  border: 1px solid var(--pb-border);
  box-shadow: var(--pb-inner-glow), var(--pb-shadow);
  position: relative;
}

.pb-panel-flat {
  background: var(--pb-surface);
  border: 1px solid var(--pb-border-soft);
  position: relative;
}

/* Buttons */
.pb-btn {
  font-family: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-variant: small-caps;
  padding: 12px 24px;
  border: 1px solid var(--pb-border);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-weight: 600;
  display: inline-block;
  text-decoration: none;
  text-align: center;
}
.pb-btn-primary {
  background: var(--pb-crimson);
  color: var(--pb-text);
}
.pb-btn-primary:hover {
  background: var(--pb-ember);
  border-color: var(--pb-brass);
}
.pb-btn-secondary {
  background: transparent;
  color: var(--pb-text);
}
.pb-btn-secondary:hover {
  border-color: var(--pb-brass);
  color: var(--pb-brass);
}
.pb-btn-ghost {
  background: transparent;
  color: var(--pb-text);
  border: none;
  padding: 12px 0;
}
.pb-btn-ghost:hover {
  color: var(--pb-brass);
  text-decoration: underline;
  text-decoration-color: var(--pb-brass);
  text-underline-offset: 4px;
}

/* Mobile flex-centering for .pb-btn variants. Placed after the
   unconditional .pb-btn { display: inline-block; } rule above so
   source-order wins on small viewports. Without this the
   min-height: 44px tap-target stretches the box and the extra space
   collects at the bottom of the label instead of being split. */
@media (max-width: 639px) {
  .pb-btn,
  .pb-btn-primary,
  .pb-btn-secondary,
  .pb-btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Form fields */
.pb-input {
  width: 100%;
  background: var(--pb-base);
  border: 1px solid var(--pb-border-soft);
  color: var(--pb-text);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.pb-input:focus {
  border-color: var(--pb-brass);
  box-shadow: 0 0 0 1px rgba(212, 166, 87, 0.2);
}
.pb-input::placeholder {
  color: var(--pb-dim);
}

.pb-label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--pb-muted);
  margin-bottom: 6px;
}

/* Tags / badges — sharp corners */
.pb-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid currentColor;
}

.pb-tag-normal { color: var(--pb-r-normal); }
.pb-tag-magic { color: var(--pb-r-magic); }
.pb-tag-rare { color: var(--pb-r-rare); }
.pb-tag-unique { color: var(--pb-r-unique); }
.pb-tag-gem { color: var(--pb-r-gem); }
.pb-tag-currency { color: var(--pb-r-currency); }

/* Item-name text colors */
.pb-r-normal { color: var(--pb-r-normal); }
.pb-r-magic { color: var(--pb-r-magic); }
.pb-r-rare { color: var(--pb-r-rare); }
.pb-r-unique { color: var(--pb-r-unique); }
.pb-r-gem { color: var(--pb-r-gem); }
.pb-r-currency { color: var(--pb-r-currency); }

/* Divider */
.pb-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--pb-border-soft), transparent);
}
.pb-divider-solid {
  height: 1px;
  background: var(--pb-border-soft);
}

/* Brand sigil — coin-as-logo. Brass disc with twelve hairline rim notches,
   crowned PB monogram etched into the face, soft top-left sheen, and a
   chipped notch upper-right (the "small change") tying to the weathered
   theme. Rendered as inline SVG via the Sigil templ component so the
   gradients pick up the live --pb-brass / --pb-bronze theme variables. */
.pb-sigil {
  width: 28px;
  height: 28px;
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}
.pb-sigil-svg { display: block; width: 100%; height: 100%; }

/* Scrollbar (subtle) */
.pb-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.pb-scroll::-webkit-scrollbar-track { background: var(--pb-surface); }
.pb-scroll::-webkit-scrollbar-thumb { background: var(--pb-bronze); }

/* Type pairing helpers */
.pb-display-cinzel { font-family: 'Cinzel', 'Marcellus', serif; font-weight: 600; letter-spacing: 0.08em; }
.pb-body-lora { font-family: 'Lora', 'Crimson Pro', serif; }
.pb-mono-jb { font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace; }

.pb-display-marcellus { font-family: 'Marcellus', 'Cinzel', serif; font-weight: 400; letter-spacing: 0.06em; }
.pb-body-crimson { font-family: 'Crimson Pro', 'Lora', serif; }
.pb-mono-plex { font-family: 'IBM Plex Mono', 'JetBrains Mono', monospace; }

/* Small-caps utility */
.pb-smallcaps {
  font-variant: small-caps;
  letter-spacing: 0.12em;
}

/* Utility */
.pb-h1 { font-size: 3.75rem; line-height: 1.05; font-weight: 600; margin: 0; }
.pb-h2 { font-size: 1.875rem; line-height: 1.15; font-weight: 600; margin: 0; }
.pb-h3 { font-size: 1.125rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; margin: 0; }

/* Nav link hover */
.pb-nav-link {
  font-size: 0.75rem;
  color: var(--pb-muted);
  text-decoration: none;
  letter-spacing: 0.2em;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.pb-nav-link:hover {
  color: var(--pb-text);
  border-bottom-color: var(--pb-crimson);
}
.pb-nav-link.is-active {
  color: var(--pb-text);
  border-bottom-color: var(--pb-crimson);
}
/* Buttons rendered as nav links inherit the surrounding font + line-height
   so their baseline matches sibling <a>/<span> entries. Side/top borders
   are zeroed (UA button outset border), but the 2px transparent
   border-bottom from .pb-nav-link is preserved so the button's box
   height matches the anchors and the flex row centers them at the
   same baseline. */
button.pb-nav-link {
  background: transparent;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  padding-top: 0;
  padding-right: 0;
  padding-left: 0;
  font-family: inherit;
  line-height: inherit;
  cursor: pointer;
}

/* Sidebar link */
.pb-side-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  text-decoration: none;
  font-size: 0.875rem;
  color: var(--pb-muted);
  border-left: 2px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.pb-side-link:hover { color: var(--pb-text); background: rgba(122, 31, 31, 0.04); }
.pb-side-link.is-active {
  color: var(--pb-text);
  border-left-color: var(--pb-crimson);
  background: rgba(122, 31, 31, 0.08);
}

/* Table row hover */
.pb-table tbody tr { transition: background 0.12s; }
.pb-table tbody tr:hover { background: rgba(212, 166, 87, 0.04) !important; }

/* Searchable combobox (recipe form item picker) */
.pb-combo {
  position: relative;
  flex: 1;
}
.pb-combo-list {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 30;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--pb-base);
  border: 1px solid var(--pb-border);
  box-shadow: var(--pb-shadow);
  max-height: 280px;
  overflow-y: auto;
  font-size: 0.875rem;
}
.pb-combo-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--pb-border-soft);
  color: var(--pb-text);
}
.pb-combo-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.pb-combo-desc {
  font-size: 0.75rem;
  color: var(--pb-muted);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.pb-combo-item:last-child { border-bottom: none; }
.pb-combo-item:hover,
.pb-combo-item.is-active {
  background: rgba(122, 31, 31, 0.18);
  color: var(--pb-brass);
}
.pb-combo-name {
  font-size: 0.875rem;
}
.pb-combo-group {
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--pb-muted);
  flex-shrink: 0;
}
.pb-combo-empty {
  padding: 10px 12px;
  color: var(--pb-dim);
  font-style: italic;
  font-size: 0.75rem;
}

/* Ingredient row layout */
.pb-ing-rows { display: flex; flex-direction: column; gap: 8px; }
.pb-ing-row {
  display: grid;
  grid-template-columns: 1fr 110px 32px;
  gap: 10px;
  align-items: start;
}
.pb-row-remove {
  background: transparent;
  border: 1px solid var(--pb-border-soft);
  color: var(--pb-bronze);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  height: 38px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.pb-row-remove:hover {
  border-color: var(--pb-crimson);
  color: var(--pb-ember);
  background: rgba(122, 31, 31, 0.08);
}
.pb-row-add {
  background: transparent;
  border: 1px dashed var(--pb-border-soft);
  color: var(--pb-muted);
  cursor: pointer;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-variant: small-caps;
  margin-top: 8px;
  transition: border-color 0.15s, color 0.15s;
}
.pb-row-add:hover {
  border-color: var(--pb-brass);
  color: var(--pb-brass);
}

/* Alert banners */
.pb-alert-error {
  background: rgba(122, 31, 31, 0.18);
  border: 1px solid var(--pb-crimson);
  color: var(--pb-text);
  padding: 10px 14px;
  font-size: 0.875rem;
}
.pb-alert-success {
  background: rgba(27, 162, 155, 0.12);
  border: 1px solid var(--pb-r-gem);
  color: var(--pb-text);
  padding: 10px 14px;
  font-size: 0.875rem;
}
