/* --- TUTORIAL SYSTEM STYLES --- */
/* Interactive tutorial system for Race to the Role.
 *
 * Originally authored for another project, so the colour names below are aliased
 * onto this project's design tokens. If you edit the values here, check styles.css
 * first: --accent, --ink, --ink-soft, --surface, --surface-raised, --border and
 * --bg are the real tokens and are themed for light and dark mode.
 */

:root {
  --bg-dark: var(--surface-raised);
  --bg-medium: var(--surface-raised);
  --bg-light: var(--surface);
  --border-color: var(--border);
  --text-primary: var(--ink);
  --text-secondary: var(--ink-soft);
  --accent-primary: var(--accent);
  --accent-tertiary: var(--gold);
}


/* ============================================= */
/* 1. TUTORIAL OVERLAY - Full screen overlay */
/* ============================================= */
#tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10000;
    display: none;
    pointer-events: none;
}

/* ============================================= */
/* 2. TUTORIAL CONTAINER - Main tutorial panel */
/* ============================================= */
#tutorial-container {
    position: fixed;
    z-index: 10001;
    max-width: 300px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    font-size: 13px;
    display: none;
    pointer-events: auto;
}

/* ============================================= */
/* 3. TUTORIAL HEADER - Title and close button area */
/* ============================================= */
#tutorial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

#tutorial-heading {
    font-size: 14px;
    color: var(--accent-primary);
    margin: 0;
    font-weight: bold;
}

#tutorial-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    margin: 0;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

#tutorial-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* ============================================= */
/* 4. TUTORIAL CONTENT - Main content area */
/* ============================================= */
#tutorial-content {
    margin-bottom: 16px;
    line-height: 1.4;
    color: var(--text-secondary);
}

/* ============================================= */
/* 5. TUTORIAL CONTROLS - Button and navigation area */
/* ============================================= */
#tutorial-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* ============================================= */
/* 6. TUTORIAL BUTTONS - Action buttons */
/* ============================================= */
.tutorial-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-medium);
    color: var(--text-primary);
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
}

.tutorial-btn:hover {
    background: var(--bg-light);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.tutorial-btn.secondary {
    border-style: dashed;
    opacity: 0.8;
}

.tutorial-btn.secondary:hover {
    opacity: 1;
    border-color: var(--accent-tertiary);
    color: var(--accent-tertiary);
}

/* ============================================= */
/* 7. TUTORIAL BUTTONS CONTAINER */
/* ============================================= */
#tutorial-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
}

/* ============================================= */
/* 8. TUTORIAL PROGRESS DOTS - Step indicators */
/* ============================================= */
#tutorial-progress-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
}

.tutorial-progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
    transition: all 0.3s;
}

.tutorial-progress-dot.active {
    background: var(--accent-primary);
    transform: scale(1.2);
}

/* ============================================= */
/* 9. TUTORIAL DIRECTIONAL ARROWS - Visual indicators */
/* ============================================= */
.tutorial-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    z-index: 10002;
}

/* ============================================= */
/* 10. ARROW POSITIONS - Directional arrow styles */
/* ============================================= */

/* If tutorial is BELOW target (position: 'bottom'), arrow should be on TOP, pointing UP. */
.tutorial-arrow.bottom {
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0px 8px;
    border-color: var(--accent-primary) transparent transparent transparent;
}

/* If tutorial is ABOVE target (position: 'top'), arrow should be on BOTTOM, pointing DOWN. */
.tutorial-arrow.top {
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0px 8px 8px 8px;
    border-color: transparent transparent var(--accent-primary) transparent;
}

/* For a tutorial placed to the LEFT of the target (position: 'left'), the arrow should be on the LEFT side of the panel, pointing LEFT. */
.tutorial-arrow.left {
    top: 50%;
    left: -8px;
    transform: translateY(-50%);
    border-width: 8px 8px 8px 0px;
    border-color: transparent var(--accent-primary) transparent transparent;
}

/* For a tutorial placed to the RIGHT of the target (position: 'right'), the arrow should be on the RIGHT side of the panel, pointing RIGHT. */
.tutorial-arrow.right {
    top: 50%;
    right: -8px;
    transform: translateY(-50%);
    border-width: 8px 0px 8px 8px;
    border-color: transparent transparent transparent var(--accent-primary);
}

/* ============================================= */
/* 11. ARROW POSITION OVERRIDES - Precise placement along sides */
/* ============================================= */
.tutorial-arrow.top-third {
    top: 33.33% !important;
}

.tutorial-arrow.middle-third {
    top: 50% !important;
}

.tutorial-arrow.bottom-third {
    top: 66.66% !important;
}

.tutorial-arrow.left-third {
    left: 33.33% !important;
}

.tutorial-arrow.center-third {
    left: 50% !important;
}

.tutorial-arrow.right-third {
    left: 66.66% !important;
}


/* ============================================= */
/* 12. OPEN STATE - driven by the engine, not the hidden attribute
 * ============================================= */
/* The rules above default to display:none, so the engine adds .is-open to the
 * overlay and the container when a step is showing. */
#tutorial-overlay.is-open { display: block; }
#tutorial-container.is-open { display: block; }

/* The dim is a separate child so the spotlight can sit above it. */
/* No full-screen scrim. A scrim covers the highlighted element too, so the very
 * thing being pointed at ended up behind two dark layers and was hard to read.
 * The spotlight's oversized box-shadow darkens everything OUTSIDE the target
 * instead, which leaves the target itself completely untouched. */
#tutorial-dim { display: none; }

/* The spotlight is a ring around the target. The oversized box-shadow is what
 * darkens everything outside it, which avoids needing a clip-path. */
#tutorial-spotlight {
    position: absolute;
    border: 2px solid var(--accent-primary);
    border-radius: var(--radius, 10px);
    box-shadow: 0 0 0 9999px rgba(6, 7, 14, 0.55), 0 0 0 3px color-mix(in srgb, var(--accent-primary), transparent 55%), 0 0 22px color-mix(in srgb, var(--accent-primary), transparent 40%);
    pointer-events: none;
    transition: top 0.2s ease, left 0.2s ease, width 0.2s ease, height 0.2s ease;
}
#tutorial-spotlight[hidden] { display: none; }

/* Step counter sits in the header, the dots do the progress work. */
#tutorial-step-count {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-mono, monospace);
}

#tutorial-buttons .tutorial-btn { padding: 8px 14px; font-size: 12px; }
#tutorial-buttons .tutorial-btn:disabled { opacity: 0.4; cursor: not-allowed; }
#tutorial-buttons .tutorial-btn.primary {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--bg, #fff);
}
#tutorial-buttons .tutorial-btn.primary:hover {
    background: var(--accent-primary);
    color: var(--bg, #fff);
    opacity: 0.9;
}
#tutorial-content p { margin: 0 0 8px; }
#tutorial-content p:last-child { margin-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
    #tutorial-spotlight,
    .tutorial-progress-dot,
    .tutorial-btn,
    #tutorial-close { transition: none; }
}

/* A step that advances when its target is clicked says so, so the player knows the
   click is the answer and not just an incidental interaction. */
#tutorial-container[data-advance-on-click="true"] .tutorial-btn.primary {
  background: color-mix(in srgb, var(--accent-primary), transparent 82%);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}
#tutorial-container[data-advance-on-click="true"]::after {
  content: "or click the highlighted item";
  display: block;
  margin-top: 8px;
  font-size: 10px;
  color: var(--text-secondary);
  text-align: center;
}
