/* Help button, help dialog and the introductory tour (static/help.js). */

/* ---- "?" button: fixed bottom-right (top-right holds the case-study "Hide" link
   and the map's place search) ---- */
.th-help-btn {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1100;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #334155;
    font: 600 0.95rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
    opacity: 0.85;
    transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.th-help-btn:hover { opacity: 1; color: #2563eb; border-color: #bfdbfe; }
.th-help-btn:focus-visible { opacity: 1; outline: 2px solid #2563eb; outline-offset: 2px; }

/* ---- Help dialog ---- */
.th-help-dialog {
    width: min(560px, calc(100vw - 32px));
    max-height: min(80vh, 720px);
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    color: #334155;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.th-help-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.th-help-inner {
    display: flex;
    flex-direction: column;
    max-height: inherit;
}
.th-help-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}
.th-help-head h2 { margin: 0; font-size: 1.05rem; color: #0f172a; flex: 1 1 auto; }
.th-help-close {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    font-size: 1rem;
    cursor: pointer;
}
.th-help-close:hover { background: #f1f5f9; color: #0f172a; }
.th-help-close:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }
.th-help-body {
    overflow-y: auto;
    padding: 0.75rem 1.25rem 0.5rem;
    font-size: 0.88rem;
    line-height: 1.5;
}
.th-help-body h3 {
    margin: 0.9rem 0 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #334155;
}
.th-help-body h3:first-of-type { margin-top: 0.4rem; }
.th-help-body p { margin: 0.25rem 0; }
.th-help-body ul { margin: 0.2rem 0; padding-left: 1.1rem; }
.th-help-body li { margin: 0.15rem 0; }
.th-help-body strong { color: #0f172a; font-weight: 600; }
.th-help-body .th-x,
.th-tour-card .th-x { color: #dc2626; font-weight: 700; }
.th-help-foot {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem 1rem;
    border-top: 1px solid #e2e8f0;
}

/* ---- Shared buttons ---- */
.th-btn {
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
}
.th-btn:hover { background: #f8fafc; color: #0f172a; }
.th-btn:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.th-btn-primary { background: #2563eb; border-color: #2563eb; color: #ffffff; }
.th-btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; color: #ffffff; }
.th-btn-link {
    border-color: transparent;
    background: transparent;
    color: #64748b;
    font-weight: 500;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
}
.th-btn-link:hover { background: transparent; color: #0f172a; text-decoration: underline; }
.th-btn[hidden] { display: none; }

/* ---- Tour ---- */
.th-tour-blocker {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: transparent;
}
.th-tour-blocker.th-dim { background: rgba(15, 23, 42, 0.55); }
.th-tour-spot {
    position: fixed;
    z-index: 10001;
    border-radius: 12px;
    box-shadow: 0 0 0 2px #2563eb, 0 0 0 9999px rgba(15, 23, 42, 0.55);
    pointer-events: none;
    transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
}
.th-tour-spot[hidden] { display: none; }
.th-tour-card {
    position: fixed;
    z-index: 10002;
    width: min(340px, calc(100vw - 24px));
    box-sizing: border-box;
    padding: 1rem 1.1rem 0.85rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
    color: #334155;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.88rem;
    line-height: 1.5;
    transition: top 0.25s ease, left 0.25s ease, opacity 0.2s ease;
}
.th-tour-card.th-centered { width: min(420px, calc(100vw - 24px)); }
.th-tour-card.th-docked {
    left: 12px !important;
    right: 12px;
    top: auto !important;
    bottom: 12px;
    width: auto;
}
.th-tour-card:focus { outline: none; }
.th-tour-card h2 { margin: 0 0 0.35rem; font-size: 1rem; color: #0f172a; }
.th-tour-card p { margin: 0; }
.th-tour-foot {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.85rem;
}
.th-tour-count { font-size: 0.75rem; color: #64748b; margin-right: auto; }

@media (prefers-reduced-motion: reduce) {
    .th-help-btn,
    .th-tour-spot,
    .th-tour-card { transition: none; }
}

@media print {
    .th-help-btn { display: none; }
}
