/* FAQ page — clean white, monochrome, Typhur-inspired */

* {
    box-sizing: border-box;
}

:root {
    --faq-bg: #ffffff;
    --faq-bg-subtle: #f9fafb;
    --faq-text: #111827;
    --faq-text-muted: #6b7280;
    --faq-text-faint: #9ca3af;
    --faq-border: #e5e7eb;
    --faq-border-strong: #d1d5db;
    --faq-accent: #111827;
    --faq-radius: 12px;
    --faq-shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04);
    --faq-shadow-md: 0 4px 16px rgba(17, 24, 39, 0.06);
    --faq-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--faq-bg);
    color: var(--faq-text);
    font-family: var(--faq-font);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--faq-text);
    text-decoration: underline;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--faq-accent);
}

/* Page container — single column, centered */
.faq-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 56px 24px 80px;
}

/* Hero */
.faq-hero {
    text-align: center;
    margin-bottom: 36px;
}

.faq-hero-title {
    margin: 0 0 8px;
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--faq-text);
}

.faq-hero-subtitle {
    margin: 0;
    font-size: 21px;
    color: var(--faq-text-muted);
}

/* Toolbar (search + chips) */
.faq-toolbar {
    margin-bottom: 28px;
}

/* Search — centered, constrained width */
.faq-search {
    position: relative;
    max-width: 600px;
    margin: 0 auto 18px;
}

.faq-search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--faq-text-faint);
    pointer-events: none;
}

.faq-search-clear {
    position: absolute;
    right: 44px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--faq-text-muted);
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.faq-search-clear:hover {
    color: var(--faq-text);
    background: var(--faq-bg-subtle);
}

.faq-search-clear.visible {
    display: inline-flex;
}

.faq-search-input {
    width: 100%;
    height: 52px;
    padding: 0 48px 0 18px;
    border: 1px solid var(--faq-border);
    border-bottom-color: transparent;
    border-radius: 10px;
    background: var(--faq-bg);
    font-family: inherit;
    font-size: 15px;
    color: var(--faq-text);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, padding 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.faq-search-input.has-value {
    padding-right: 78px;
}

.faq-search-input::placeholder {
    color: var(--faq-text-faint);
}

.faq-search-input:focus {
    border-color: var(--faq-accent);
    border-bottom-color: transparent;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.06);
}

/* Category chips — wrap to multiple rows on desktop */
.faq-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    row-gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 16px;
    border: 1px solid var(--faq-border);
    border-radius: 999px;
    background: var(--faq-bg);
    color: var(--faq-text);
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    user-select: none;
}

.chip:hover {
    border-color: var(--faq-border-strong);
    background: var(--faq-bg-subtle);
}

.chip.active {
    background: var(--faq-accent);
    border-color: var(--faq-accent);
    color: #ffffff;
}

.chip.active:hover {
    background: var(--faq-accent);
}

/* FAQ list — flat rows separated by thin dividers */
.faq-list {
    display: flex;
    flex-direction: column;
}

/* FAQ item — no card, just a row */
.faq-item {
    border-top: 1px solid var(--faq-border);
}

.faq-item:last-child {
    border-bottom: 1px solid var(--faq-border);
}

.faq-question {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px 4px;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.15s ease;
}

.faq-question:hover {
    opacity: 0.7;
}

.faq-question .question-text {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--faq-text);
    word-break: break-word;
}

/* Search highlight — matched characters render in red */
.highlight {
    color: #dc2626;
    font-weight: inherit;
}

.faq-question .toggle-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: block;
    color: var(--faq-text-muted);
    transition: transform 0.25s ease, color 0.2s ease;
    user-select: none;
}

.faq-item.open .faq-question .toggle-icon {
    transform: rotate(180deg);
    color: var(--faq-text);
}

/* Answer — collapsible */
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.open .faq-answer {
    max-height: 4000px; /* large enough for long answers */
}

.faq-answer-inner {
    padding: 0 4px 24px;
    font-size: 18px !important;
    line-height: 1.7;
    color: var(--faq-text);
}

.faq-answer-inner img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 12px 0;
}

.faq-answer-inner p {
    margin: 10px 0;
    font-size: inherit !important;
}

.faq-answer-inner p:first-child {
    margin-top: 0;
}

.faq-answer-inner p:last-child {
    margin-bottom: 0;
}

.faq-answer-inner ul,
.faq-answer-inner ol {
    padding-left: 24px;
    margin: 10px 0;
    font-size: inherit !important;
}

.faq-answer-inner li {
    font-size: inherit !important;
}

.faq-answer-inner a {
    color: var(--faq-text);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-size: inherit !important;
}

/* YouTube thumb card */
.yt-thumb {
    position: relative;
    cursor: pointer;
    display: block;
    max-width: 480px;
    margin: 12px 0;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    border: 1px solid var(--faq-border);
}

.yt-thumb img {
    display: block;
    width: 100%;
    height: auto;
}

.yt-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border-radius: 50%;
    font-size: 22px;
    line-height: 56px;
    text-align: center;
    pointer-events: none;
}

.yt-play::before {
    content: "\25B6";
    margin-left: 3px;
}

/* Mobile — smaller video preview */
@media (max-width: 768px) {
    .yt-thumb {
        max-width: 280px;
    }

    .yt-play {
        width: 44px;
        height: 44px;
        font-size: 16px;
        line-height: 44px;
    }
}

/* Internal FAQ links */
.faq-internal-link {
    color: var(--faq-text);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
}

/* Attachments */
.faq-attachments {
    margin: 14px 0;
    padding: 12px 14px;
    background: var(--faq-bg);
    border: 1px dashed var(--faq-border);
    border-radius: 8px;
}

.attachment-link {
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    margin-right: 0;
    margin-bottom: 10px;
    color: var(--faq-text);
    text-decoration: none;
    font-size: 14px;
    padding: 8px 12px;
    border: 1px solid var(--faq-border);
    border-radius: 8px;
    background: var(--faq-bg-subtle);
    position: relative;
}

.attachment-link::after {
    content: "";
    flex-shrink: 0;
    margin-left: auto;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/><polyline points='7 10 12 15 17 10'/><line x1='12' y1='15' x2='12' y2='3'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.attachment-link:last-child {
    margin-bottom: 0;
}

.attachment-link:hover {
    background: var(--faq-bg);
    border-color: var(--faq-border-strong);
}

.attachment-link:hover::after {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/><polyline points='7 10 12 15 17 10'/><line x1='12' y1='15' x2='12' y2='3'/></svg>");
}

/* Helpful section */
.faq-helpful {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--faq-border);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 14px;
    color: var(--faq-text-muted);
}

.helpful-label {
    margin-right: 4px;
}

.helpful-btns {
    display: inline-flex;
    gap: 8px;
}

.helpful-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    height: 34px;
    border: 1px solid var(--faq-border);
    border-radius: 999px;
    background: var(--faq-bg);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    color: var(--faq-text);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.helpful-btn:hover:not(:disabled) {
    border-color: var(--faq-border-strong);
    background: var(--faq-bg-subtle);
}

.helpful-btn.voted {
    cursor: not-allowed;
    opacity: 1;
    color: #ffffff;
}

.helpful-btn:disabled:not(.voted) {
    cursor: not-allowed;
    opacity: 0.45;
}

.helpful-btn.yes.voted {
    background: #16a34a;
    border-color: #16a34a;
}

.helpful-btn.no.voted {
    background: #dc2626;
    border-color: #dc2626;
}

/* Empty state */
.faq-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--faq-text-faint);
    font-size: 15px;
    background: var(--faq-bg-subtle);
    border: 1px dashed var(--faq-border);
    border-radius: var(--faq-radius);
}

/* Responsive */
@media (max-width: 768px) {
    .faq-page {
        padding: 32px 16px 64px;
    }

    .faq-hero {
        margin-bottom: 28px;
    }

    .faq-hero-title {
        font-size: 28px;
    }

    .faq-hero-subtitle {
        font-size: 15px;
    }

    .faq-search-input {
        height: 48px;
        font-size: 14px;
    }

    .chip {
        flex-shrink: 0;
    }

    .faq-question {
        padding: 18px 0;
        gap: 12px;
    }

    .faq-question .question-text {
        font-size: 18px;
    }

    .faq-answer-inner {
        padding: 0 0 20px;
        font-size: 14px;
    }
}

@media (max-width: 420px) {
    .faq-hero-title {
        font-size: 24px;
    }
}