/**
 * TICKET-306: Instructions Page Premium Retrofit
 *
 * Loaded on the Instructions page template only.
 * Replaces the inline <style> block that was removed from instructions.php.
 * Uses design tokens — no hardcoded hex values.
 *
 * Rules:
 *  - Readability and hierarchy first
 *  - Light-mode "printed manual" treatment must not reduce contrast
 *  - Trust/support clarity is never overridden by atmosphere
 *  - No !important except where directly replacing former inline-style !important
 */

/* ─── Page wrapper ───────────────────────────────────────────────────────────── */

.instructions-page {
  padding: 2rem 0;
  min-height: 100vh;
  color: var(--text-primary);
  font-family: var(--font-logic);
  line-height: 1.6;
  background-color: var(--bg-page);
}

html.light-mode .instructions-page {
  background-color: var(--vellum-base);
  color: var(--ink-blueprint);
}

.instructions-page .container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
  background: transparent;
  box-shadow: none;
  border: none;
}

/* ─── Headings ───────────────────────────────────────────────────────────────── */

.instructions-page h1 {
  font-family: var(--font-gnosis);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  color: var(--text-primary);
  margin-bottom: 2rem;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.15;
  text-shadow: 0 0 30px rgba(212, 175, 55, 0.1);
}

html.light-mode .instructions-page h1 {
  color: var(--ink-blueprint);
  text-shadow: none;
}

.instructions-page h2 {
  font-family: var(--font-gnosis);
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  line-height: 1.2;
}

html.light-mode .instructions-page h2 {
  color: var(--amber-logic);
  border-bottom-color: var(--line-soft);
}

.instructions-page h3 {
  font-family: var(--font-logic);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
}

html.light-mode .instructions-page h3 {
  color: var(--ink-blueprint);
}

/* ─── Body text ──────────────────────────────────────────────────────────────── */

.instructions-page p,
.instructions-page li {
  font-family: var(--font-logic);
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
  line-height: 1.7;
}

html.light-mode .instructions-page p,
html.light-mode .instructions-page li {
  color: var(--ink-slate);
}

.instructions-page section {
  margin-bottom: 2.5rem;
}

/* ─── Code spans ─────────────────────────────────────────────────────────────── */

.instructions-page code {
  font-family: var(--font-logic);
  font-size: 0.875em;
  background-color: var(--bg-panel);
  color: var(--accent);
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
}

html.light-mode .instructions-page code {
  background-color: var(--amber-soft);
  color: var(--amber-logic);
}

/* ─── Instruction steps ──────────────────────────────────────────────────────── */

.instructions-page .instruction-steps {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.instructions-page .step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.instructions-page .step-number {
  background-color: var(--accent);
  color: var(--ink-nocturnal);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-gnosis);
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

html.light-mode .instructions-page .step-number {
  background-color: var(--amber-logic);
  color: #fff;
}

.instructions-page .step-content {
  flex: 1;
}

/* ─── Tips ───────────────────────────────────────────────────────────────────── */

.instructions-page .tips-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.instructions-page .tip {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.instructions-page .tip-number {
  background-color: var(--bg-panel);
  color: var(--accent);
  border: 1px solid rgba(212, 175, 55, 0.25);
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-logic);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

html.light-mode .instructions-page .tip-number {
  background-color: var(--amber-soft);
  color: var(--amber-logic);
  border-color: rgba(180, 83, 9, 0.2);
}

/* ─── Feature / example boxes ────────────────────────────────────────────────── */

.instructions-page .examples,
.instructions-page .feature-box,
.instructions-page .example-box {
  background-color: var(--bg-panel);
  border-left: 3px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  border-radius: 0 4px 4px 0;
}

html.light-mode .instructions-page .examples,
html.light-mode .instructions-page .feature-box,
html.light-mode .instructions-page .example-box {
  background-color: var(--vellum-base);
  border-left-color: var(--amber-logic);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--amber-logic);
}

.instructions-page .feature-box h3 {
  color: var(--accent);
  margin-top: 0;
}

html.light-mode .instructions-page .feature-box h3 {
  color: var(--amber-logic);
}

/* ─── Symbol list ────────────────────────────────────────────────────────────── */

.instructions-page .symbol-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.instructions-page .symbol-item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.instructions-page .symbol-icon {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  padding: 0.5rem 0.875rem;
  border-radius: 3px;
  font-family: var(--font-logic);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  min-width: 3rem;
  text-align: center;
  flex-shrink: 0;
}

html.light-mode .instructions-page .symbol-icon {
  background-color: var(--vellum-base);
  border-color: var(--line-soft);
  color: var(--amber-logic);
}

/* ─── Conclusion block ───────────────────────────────────────────────────────── */

.instructions-page .conclusion {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  padding: 1.5rem;
  border-radius: 4px;
  text-align: center;
  margin-top: 2.5rem;
}

html.light-mode .instructions-page .conclusion {
  background-color: var(--vellum-base);
  border-color: var(--line-soft);
  box-shadow: var(--surface-stack-shadow);
}

.instructions-page .final-line {
  font-family: var(--font-gnosis);
  letter-spacing: 0.1em;
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

html.light-mode .instructions-page .final-line {
  color: var(--amber-logic);
}

.instructions-page .conclusion__actions {
  display: flex;
  gap: 0.875rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ─── Back-to-solver CTAs ────────────────────────────────────────────────────── */

.instructions-page .back-to-solver {
  display: inline-block;
  background-color: var(--accent);
  color: var(--ink-nocturnal);
  padding: 0.625rem 1.25rem;
  text-decoration: none;
  border-radius: 3px;
  font-family: var(--font-logic);
  font-size: 0.875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background-color var(--dur-fast);
}

.instructions-page .back-to-solver:hover {
  background-color: var(--primary-dark);
  text-decoration: none;
  opacity: 1;
  color: var(--ink-nocturnal);
}

.instructions-page .back-to-solver--secondary {
  background-color: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.instructions-page .back-to-solver--secondary:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background-color: transparent;
}

html.light-mode .instructions-page .back-to-solver {
  background-color: var(--amber-logic);
  color: #fff;
}

html.light-mode .instructions-page .back-to-solver:hover {
  background-color: var(--primary-dark);
  color: #fff;
}

html.light-mode .instructions-page .back-to-solver--secondary {
  color: var(--ink-slate);
  border-color: var(--line-soft);
}

html.light-mode .instructions-page .back-to-solver--secondary:hover {
  color: var(--ink-blueprint);
  border-color: var(--amber-logic);
}

/* ─── Mobile ─────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .instructions-page .container {
    padding: 0 1rem;
  }

  .instructions-page .conclusion__actions {
    flex-direction: column;
    align-items: center;
  }

  .instructions-page .back-to-solver {
    width: 100%;
    text-align: center;
  }
}

/* ─── TICKET-323: Guide metadata ─────────────────────────────────────────────── */

.guide-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 2.5rem;
  padding: 0.75rem 1rem;
  background-color: var(--bg-panel);
  border-radius: 3px;
  border: 1px solid var(--border-subtle);
}

html.light-mode .guide-meta {
  background-color: var(--vellum-base);
  border-color: var(--line-soft);
}

.guide-meta__updated,
.guide-meta__author,
.guide-meta__reviewer {
  font-family: var(--font-logic);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

html.light-mode .guide-meta__updated,
html.light-mode .guide-meta__author,
html.light-mode .guide-meta__reviewer {
  color: var(--ink-slate);
}

.guide-meta__updated {
  font-weight: 600;
  color: var(--accent);
}

html.light-mode .guide-meta__updated {
  color: var(--amber-logic);
}

.guide-meta__sep {
  color: var(--border-subtle);
  font-size: 0.75rem;
}

/* ─── TICKET-323: Screenshot placeholder blocks ───────────────────────────────── */

.guide-screenshot {
  margin: 1.5rem 0;
  border-radius: 4px;
  overflow: hidden;
}

.guide-screenshot--pending {
  border: 2px dashed var(--border-subtle);
  background-color: var(--bg-panel);
  padding: 2rem 1.5rem;
  text-align: center;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

html.light-mode .guide-screenshot--pending {
  border-color: var(--line-soft);
  background-color: var(--vellum-base);
}

.guide-screenshot--pending figcaption {
  font-family: var(--font-logic);
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
}

html.light-mode .guide-screenshot--pending figcaption {
  color: var(--ink-slate);
}

/* ─── TICKET-344: Real screenshot images ─────────────────────────────────────── */

.guide-screenshot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

html.light-mode .guide-screenshot img {
  border-color: var(--line-soft);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.guide-screenshot figcaption {
  font-family: var(--font-logic);
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 0.5rem 0.25rem 0;
  text-align: center;
}

html.light-mode .guide-screenshot figcaption {
  color: var(--ink-slate);
}

/* ─── TICKET-323: section-specific reuses ────────────────────────────────────── */

/* single-vs-multiple and dictionary-choice reuse .feature-box and
   .instruction-steps styles already declared above — no extra rules needed.
   The inline style overrides on E/H step-numbers in the HTML are intentional
   and kept in the template since they are one-off per-item overrides. */

@media (max-width: 768px) {
  .guide-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .guide-meta__sep {
    display: none;
  }
}
