/*
 * ACCS Lone Wolf App -- shared theme
 * "Worn adventurer's book" palette: aged paper, ink brown, leather-red accent.
 * Used by both the character-creation shortcode and the book-upload admin page.
 * Enqueued from accs-lonewolf-character-creation.php and accs-lonewolf-book-admin.php.
 */

:root {
  --lw-paper: #e9dfc7;         /* aged paper */
  --lw-paper-dark: #ddd0ac;    /* paper shadow / recessed panels */
  --lw-ink: #2b2117;           /* near-black ink brown, used instead of pure black */
  --lw-ink-soft: #4a3c2c;      /* secondary text */
  --lw-leather: #6b2d2d;       /* worn leather-red accent, used sparingly */
  --lw-leather-dark: #4e1f1f;
  --lw-line: #b9a97e;          /* hairline rule / border on paper */
  --lw-focus: #1a5276;         /* high-contrast focus ring, distinct from paper/leather */
}

.lw-scope {
  background-color: var(--lw-paper);
  background-image:
    repeating-linear-gradient(0deg, rgba(43,33,23,0.02) 0px, rgba(43,33,23,0.02) 1px, transparent 1px, transparent 3px);
  color: var(--lw-ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  line-height: 1.55;
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem;
}

.lw-scope * { box-sizing: border-box; }

/* Skip link: hidden until focused, first tab stop */
.lw-skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--lw-ink);
  color: var(--lw-paper);
  padding: 0.6rem 1rem;
  z-index: 100;
}
.lw-skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.lw-scope h1,
.lw-scope h2,
.lw-scope h3 {
  font-family: "Iowan Old Style", Georgia, serif;
  font-weight: 600;
  color: var(--lw-ink);
  letter-spacing: 0.01em;
}

.lw-scope h1 {
  font-size: 1.7rem;
  border-bottom: 1px solid var(--lw-line);
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
}

.lw-scope h2 { font-size: 1.25rem; margin-top: 2rem; }

.lw-scope fieldset {
  border: 1px solid var(--lw-line);
  background: var(--lw-paper-dark);
  border-radius: 2px;
  padding: 1rem 1.25rem;
  margin: 0 0 1.5rem 0;
}

.lw-scope legend {
  font-weight: 600;
  padding: 0 0.5rem;
  color: var(--lw-ink);
}

.lw-scope label {
  display: block;
  margin: 0.5rem 0 0.25rem 0;
  font-weight: 600;
}

.lw-scope .lw-hint {
  font-size: 0.9rem;
  color: var(--lw-ink-soft);
  margin: 0 0 0.5rem 0;
}

.lw-scope input[type="text"],
.lw-scope input[type="number"],
.lw-scope select,
.lw-scope textarea {
  font: inherit;
  color: var(--lw-ink);
  background: var(--lw-paper);
  border: 1px solid var(--lw-ink-soft);
  border-radius: 2px;
  padding: 0.5rem 0.6rem;
  width: 100%;
  max-width: 20rem;
}

.lw-scope .lw-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(185,169,126,0.4);
}
.lw-scope .lw-checkbox-row:last-child { border-bottom: none; }
.lw-scope .lw-checkbox-row label {
  margin: 0;
  font-weight: 400;
  display: flex;
  flex-direction: column;
}
.lw-scope .lw-checkbox-row input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
}
.lw-scope .lw-discipline-desc {
  font-size: 0.85rem;
  color: var(--lw-ink-soft);
  font-weight: 400;
}

.lw-scope button,
.lw-scope .lw-button {
  font: inherit;
  font-weight: 600;
  background: var(--lw-leather);
  color: var(--lw-paper);
  border: 1px solid var(--lw-leather-dark);
  border-radius: 2px;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
}
.lw-scope button:hover,
.lw-scope .lw-button:hover { background: var(--lw-leather-dark); }
.lw-scope button.lw-secondary {
  background: transparent;
  color: var(--lw-ink);
  border: 1px solid var(--lw-ink-soft);
}
.lw-scope button.lw-secondary:hover { background: rgba(43,33,23,0.06); }

/* Visible focus ring on every interactive element -- required, never remove */
.lw-scope a:focus-visible,
.lw-scope button:focus-visible,
.lw-scope input:focus-visible,
.lw-scope select:focus-visible,
.lw-scope textarea:focus-visible {
  outline: 3px solid var(--lw-focus);
  outline-offset: 2px;
}

.lw-scope .lw-stat-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.lw-scope .lw-stat-row input[type="number"] { max-width: 6rem; }

/* Screen-reader-only text: present in the DOM, announced, never shown visually */
.lw-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.lw-scope [role="status"],
.lw-scope [role="alert"] {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--lw-line);
  border-left: 4px solid var(--lw-leather);
  background: var(--lw-paper-dark);
}
.lw-scope [role="alert"] { border-left-color: var(--lw-leather-dark); }

/* --- Image display toggles (bandwidth / cosmetic controls) --- */
.lw-scope .lw-image-settings {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.lw-scope .lw-cosmetic-img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--lw-line);
  display: block;
  margin: 0.75rem 0;
}
.lw-scope[data-lw-cosmetic-images="off"] .lw-cosmetic-img { display: none; }

.lw-scope .lw-book-img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--lw-line);
  display: block;
  margin: 0.75rem 0;
}
.lw-scope[data-lw-book-images="off"] .lw-book-img { display: none; }
.lw-scope[data-lw-book-images="off"] .lw-book-img-caption::before {
  content: "Illustration hidden (images off): ";
}

@media (max-width: 480px) {
  .lw-scope { padding: 1rem; }
  .lw-scope h1 { font-size: 1.4rem; }
}

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