/* Site-wide design system derived from duel/duel.css.
   Tokens are set in :root (Gunfighter parchment) and overridden per CONTEXT
   by an inline <style id="site-theme-vars"> emitted from context.php.
   Live duel screens (.duel-page) keep their own scoped rules. */

:root {
  --site-ink: #2a1a0a;
  --site-muted: #4a3218;
  --site-panel: rgba(221, 207, 188, 0.88);
  --site-panel-solid: #e8dcc8;
  --site-border: #6b3e1f;
  --site-gold: #8b5a2b;
  --site-rust: #7a3b2e;
  --site-shadow: 0 4px 18px rgba(60, 30, 10, 0.35);
  --site-inset: inset 0 0 0 1px rgba(120, 70, 30, 0.35);
  --site-btn-top: #f0e0c0;
  --site-btn-bot: #d4b88a;
  --site-btn-hover-top: #ffe8b8;
  --site-btn-hover-bot: #e0c090;
  --site-th: rgba(90, 55, 25, 0.12);
  --site-row: rgba(255, 250, 235, 0.4);
  --site-input-bg: rgba(255, 250, 235, 0.65);
  --site-highlight: rgba(255, 248, 230, 0.55);
  --site-radius: 6px;
}

/* ---------- Page chrome ---------- */

body.site-page {
  box-sizing: border-box;
  color: var(--site-ink);
}

body.site-page *,
body.site-page *::before,
body.site-page *::after {
  box-sizing: border-box;
}

body:not(.duel-page) a {
  color: var(--site-gold);
}

body:not(.duel-page) a:hover {
  color: var(--site-rust);
}

/* ---------- Panels / tables ---------- */

body:not(.duel-page) table {
  border-collapse: separate;
  border-spacing: 0;
  border: 2px solid var(--site-border);
  border-radius: var(--site-radius);
  background-color: var(--site-panel);
  box-shadow: var(--site-shadow), var(--site-inset);
}

body:not(.duel-page) table table {
  box-shadow: none;
  background-color: transparent;
  border-radius: 4px;
}

body:not(.duel-page) th,
body:not(.duel-page) td {
  border-color: var(--site-border);
  color: inherit;
}

body:not(.duel-page) th {
  background: var(--site-th);
  font-weight: bold;
  text-shadow: 0 1px 0 rgba(255, 245, 220, 0.45);
}

body:not(.duel-page) tr.spacerRow td,
body:not(.duel-page) .spacerRow td {
  background: transparent;
  border-left: none;
  border-right: none;
  box-shadow: none;
}

body:not(.duel-page) .table-responsive {
  max-width: 100%;
  overflow-x: auto;
}

/* Explicit card hook for pages that want a named panel */
.site-panel {
  margin: 12px auto;
  padding: 10px 12px 14px;
  border: 2px solid var(--site-border);
  border-radius: var(--site-radius);
  background-color: var(--site-panel);
  box-shadow: var(--site-shadow), var(--site-inset);
  overflow: hidden;
}

.site-header {
  padding: 6px 8px;
  background: var(--site-th);
  border-bottom: 1px solid rgba(107, 62, 31, 0.3);
}

.site-callout {
  padding: 6px 10px;
  background: var(--site-highlight);
  border: 1px solid rgba(107, 62, 31, 0.25);
  border-radius: 3px;
}

/* ---------- Buttons ---------- */

body:not(.duel-page) button,
body:not(.duel-page) input[type="submit"],
body:not(.duel-page) input[type="button"],
.site-btn,
.gf-home .gf-home-button,
.gf-tutorial .gf-tutorial-button {
  display: inline-block;
  padding: 6px 14px;
  border: 2px solid var(--site-border);
  border-radius: 4px;
  background: linear-gradient(var(--site-btn-top), var(--site-btn-bot));
  color: var(--site-ink);
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.25;
}

body:not(.duel-page) button:hover,
body:not(.duel-page) input[type="submit"]:hover,
body:not(.duel-page) input[type="button"]:hover,
.site-btn:hover,
.gf-home .gf-home-button:hover,
.gf-tutorial .gf-tutorial-button:hover {
  background: linear-gradient(var(--site-btn-hover-top), var(--site-btn-hover-bot));
  text-decoration: none;
  color: var(--site-ink);
}

body:not(.duel-page) button:disabled,
body:not(.duel-page) button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

body:not(.duel-page) button:focus,
body:not(.duel-page) input[type="submit"]:focus,
body:not(.duel-page) .site-btn:focus,
.gf-home .gf-home-button:focus,
.gf-tutorial .gf-tutorial-button:focus {
  outline: 2px solid var(--site-gold);
  outline-offset: 2px;
}

/* Compact parchment +/- controls (equip / quantity). Replaces plus.png / minus.png. */
.site-qty-btn,
a.site-qty-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.35em;
  border: 2px solid var(--site-border);
  border-radius: 4px;
  background: linear-gradient(var(--site-btn-top), var(--site-btn-bot));
  color: var(--site-ink);
  font-weight: bold;
  font-size: 1.35em;
  line-height: 1;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(60, 30, 10, 0.22), inset 0 1px 0 rgba(255, 245, 220, 0.45);
}

.site-qty-btn:hover,
a.site-qty-btn:hover {
  background: linear-gradient(var(--site-btn-hover-top), var(--site-btn-hover-bot));
  color: var(--site-ink);
  text-decoration: none;
}

.site-qty-btn:focus,
a.site-qty-btn:focus {
  outline: 2px solid var(--site-gold);
  outline-offset: 2px;
  color: var(--site-ink);
}

/* ---------- Forms ---------- */

body:not(.duel-page) input[type="text"],
body:not(.duel-page) input[type="password"],
body:not(.duel-page) input[type="email"],
body:not(.duel-page) input[type="number"],
body:not(.duel-page) input[type="search"],
body:not(.duel-page) select,
body:not(.duel-page) textarea {
  padding: 5px 8px;
  border: 1px solid var(--site-border);
  border-radius: 4px;
  background: var(--site-input-bg);
  color: var(--site-ink);
  max-width: 100%;
}

body:not(.duel-page) input:focus,
body:not(.duel-page) select:focus,
body:not(.duel-page) textarea:focus {
  outline: 2px solid var(--site-gold);
  outline-offset: 1px;
}

/* ---------- Portraits / framed images ---------- */

.site-portrait,
body:not(.duel-page) img.site-portrait,
.gf-home .gf-home-portrait {
  border: 3px solid var(--site-border);
  border-radius: 4px;
  box-shadow: 0 3px 10px rgba(40, 20, 5, 0.45);
  background: rgba(255, 250, 235, 0.35);
  object-fit: contain;
}

/* ---------- Footer ---------- */

body:not(.duel-page) table.footer,
body:not(.duel-page) table.site-footer {
  width: min(1165px, 96%);
  margin: 16px auto 20px;
  border: 2px solid var(--site-border);
  border-radius: var(--site-radius);
  background-color: var(--site-panel);
  box-shadow: var(--site-shadow), var(--site-inset);
}

body:not(.duel-page) table.footer td,
body:not(.duel-page) table.site-footer td {
  padding: 8px 12px;
  text-align: center;
}

/* ---------- Page titles / nav ---------- */

.site-title {
  font-size: 1.35em;
  font-weight: bold;
  text-shadow: 0 1px 0 rgba(255, 245, 220, 0.6);
  color: var(--site-ink);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
}

.site-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* Gold-vs-rust hierarchy cues (player / opponent, primary / danger) */
.site-accent-gold {
  border-left: 3px solid var(--site-gold);
  background: linear-gradient(90deg, rgba(180, 140, 80, 0.28), transparent);
  padding-left: 8px;
}

.site-accent-rust {
  border-right: 3px solid var(--site-rust);
  background: linear-gradient(270deg, rgba(140, 70, 50, 0.28), transparent);
  padding-right: 8px;
}

/* ---------- Home + tutorial: align local shells with the system ---------- */

.gf-home .gf-home-panel,
.gf-tutorial .gf-tutorial-panel,
.gf-home .gf-home-footer-table {
  border: 2px solid var(--site-border);
  border-radius: var(--site-radius);
  background-color: var(--site-panel);
  box-shadow: var(--site-shadow), var(--site-inset);
  overflow: hidden;
}

.gf-home .gf-home-section h2,
.gf-tutorial .gf-tutorial-main h2 {
  text-shadow: 0 1px 0 rgba(255, 245, 220, 0.55);
}

.gf-home .gf-home-nav-links a,
.gf-tutorial .gf-tutorial-nav a {
  font-weight: bold;
}

/* ---------- Dashboard / inventory portraits ---------- */

img.site-portrait-sm {
  width: 80px;
  height: 80px;
  max-width: 100%;
  object-fit: contain;
  border: 3px solid var(--site-border);
  border-radius: 4px;
  box-shadow: 0 3px 10px rgba(40, 20, 5, 0.45);
  background: rgba(255, 250, 235, 0.35);
}

/* ---------- Mobile ---------- */

@media (max-width: 45rem) {
  body:not(.duel-page) table {
    width: 100%;
    max-width: 100%;
  }

  body.site-page {
    margin: 0.5rem;
    width: auto;
    min-width: 0;
  }

  body:not(.duel-page) button,
  body:not(.duel-page) input[type="submit"],
  .site-btn,
  .site-qty-btn {
    min-height: 40px;
  }

  body:not(.duel-page) [style*="white-space: nowrap"],
  body:not(.duel-page) span[style*="nowrap"] {
    white-space: normal !important;
  }
}

@media (max-width: 30rem) {
  .gf-home .gf-home-actions .gf-home-button,
  .gf-tutorial .gf-tutorial-actions .gf-tutorial-button {
    flex: 1 1 100%;
    text-align: center;
  }
}
