/* Reveal Community page — visual language shared with the Reveal landing page */

/* Dark Theme (Default) — tokens mirrored from reveal_site/css/styles.css */
:root,
[data-theme="dark"] {
    --primary-color: #0066cc;
    --primary-dark: #004499;
    --secondary-color: #6c757d;
    --accent-color: #00d4aa;
    --success-color: #28a745;
    --background-color: #0a0a0a;
    --surface-color: #1a1a1a;
    --card-background: rgba(26, 26, 26, 0.8);
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #808080;
    --border-color: rgba(255, 255, 255, 0.1);
    --input-background: #111111;
    --gradient-primary: linear-gradient(135deg, #0066cc, #00d4aa);
    --gradient-background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    --box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --box-shadow-hover: 0 12px 48px rgba(0, 0, 0, 0.4);
    --navbar-bg: rgba(10, 10, 10, 0.95);
}

/* Light Theme */
[data-theme="light"] {
    --primary-color: #0066cc;
    --primary-dark: #004499;
    --secondary-color: #6c757d;
    --accent-color: #00b894;
    --success-color: #28a745;
    --background-color: #ffffff;
    --surface-color: #f8f9fa;
    --card-background: rgba(255, 255, 255, 0.8);
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --border-color: rgba(0, 0, 0, 0.1);
    --input-background: #ffffff;
    --gradient-primary: linear-gradient(135deg, #0066cc, #00b894);
    --gradient-background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    --box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --box-shadow-hover: 0 12px 48px rgba(0, 0, 0, 0.15);
    --navbar-bg: rgba(255, 255, 255, 0.95);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--gradient-background);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
}

.container {
    width: min(1100px, calc(100% - 2rem));
    margin-inline: auto;
}

/* Navigation */
.navbar {
    background: var(--navbar-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.navbar-logo {
    height: 3rem;
    width: auto;
    margin-right: 0.5rem;
    transition: all 0.3s ease;
}

.navbar-badge {
    color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 16%, transparent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1;
    margin-left: 0.6rem;
    padding: 0.35rem 0.6rem;
    border: 1.5px solid color-mix(in srgb, var(--accent-color) 70%, transparent);
    border-radius: 6px;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .navbar-badge {
        display: none;
    }
}

.page-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem;
    margin: 0 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.theme-toggle:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1) rotate(15deg);
}

.theme-toggle:focus-visible {
    box-shadow: 0 0 0 2px var(--primary-color);
    outline: none;
}

.theme-icon {
    font-size: 1.2rem;
}

/* Language Selector */
.nav-language-selector {
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 3px;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    user-select: none;
}

.lang-option:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: translateY(-1px);
}

.lang-option.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 6px rgba(0, 102, 204, 0.3);
}

.flag {
    font-size: 1rem;
}

[data-theme="light"] .nav-language-selector {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .lang-option {
    color: rgba(0, 0, 0, 0.7);
}

[data-theme="light"] .lang-option:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

[data-theme="light"] .lang-option.active {
    background: var(--primary-color);
    color: white;
}

/* Hero */
main {
    flex: 1;
}

.hero {
    padding: clamp(1.25rem, 3vw, 2rem) 0 1.5rem;
    max-width: 780px;
}

.section-title {
    font-size: clamp(2rem, 5vw, 2.5rem);
    font-weight: 700;
    margin: 0 0 1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0 0 1rem;
}

/* Cards */
.card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--box-shadow);
    padding: clamp(1rem, 4vw, 2rem);
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1.3rem;
    margin-top: 0;
}

.privacy-notice {
    padding: 0.85rem clamp(1rem, 4vw, 2rem);
}

.privacy-notice details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    cursor: pointer;
    list-style: none;
}

.privacy-notice details summary::-webkit-details-marker {
    display: none;
}

.privacy-notice details summary h2 {
    margin: 0;
}

.privacy-notice details summary::after {
    content: "▾";
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

.privacy-notice details[open] summary::after {
    transform: rotate(180deg);
}

.privacy-notice details summary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-color);
    border-radius: 8px;
}

.privacy-notice-body {
    padding-top: 0.75rem;
}

.privacy-notice p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.privacy-notice a,
.discussion-card a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

.privacy-notice a:hover,
.discussion-card a:hover {
    color: var(--accent-color);
}

.discussion-help {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Footer */
.footer {
    background: var(--surface-color);
    padding: 2.5rem 0 1.5rem;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 0.25rem 0;
}

.footer-link:hover {
    color: var(--primary-color);
}

.footer-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0 1rem;
}

.footer-copyright {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.9rem;
}

.footer-copyright a {
    color: var(--primary-color);
    text-decoration: none;
}

/* Isso thread — restyle the embedded widget with the site tokens.
 * Isso 0.14 exposes --isso-* custom properties; mapping them to the site
 * tokens keeps the widget correct in both themes (notably the preview box,
 * which otherwise stays white-on-white in dark mode). */
#isso-thread {
    color: var(--text-primary);
    --isso-primary-text-color: var(--text-primary);
    --isso-secondary-text-color: var(--text-secondary);
    --isso-input-background-color: var(--input-background);
    --isso-input-outline-color: var(--primary-color);
    --isso-border: 1px solid var(--border-color);
    --isso-comment-divider-color: var(--border-color);
    --isso-preview-background: repeating-linear-gradient(
        -45deg,
        var(--surface-color),
        var(--surface-color) 10px,
        var(--background-color) 10px,
        var(--background-color) 20px
    );
    --isso-preview-border-color: var(--border-color);
    --isso-preview-box-shadow-color: transparent;
    --isso-pre-background-color: var(--surface-color);
    --isso-pre-border-color: var(--border-color);
    --isso-pre-color: var(--text-primary);
    --isso-button-background-color: var(--surface-color);
    --isso-button-hover-background-color: var(--input-background);
    --isso-button-active-background-color: var(--input-background);
    --isso-button-border: 1px solid var(--border-color);
    --isso-hover-color: var(--primary-color);
    --isso-link-hover-color: var(--accent-color);
    --isso-link-text-shadow-color: transparent;
    --isso-target-fade-background-color: var(--surface-color);
}

#isso-thread .isso-preview,
#isso-thread .isso-preview .isso-text,
#isso-thread .isso-preview .isso-comment {
    color: var(--text-primary);
}

#isso-thread .isso-feedlink,
#isso-thread a {
    color: var(--primary-color);
}

#isso-thread h4 {
    color: var(--text-primary);
}

#isso-thread input:not([type="checkbox"]):not([type="radio"]),
#isso-thread textarea,
#isso-thread .isso-textarea {
    background: var(--input-background);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    padding: 0.6rem 0.8rem;
    width: 100%;
}

#isso-thread input:focus,
#isso-thread textarea:focus,
#isso-thread .isso-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.25);
}

#isso-thread .isso-textarea {
    min-height: 12rem;
    resize: vertical;
    overflow: auto;
}

#isso-thread input[type="submit"],
#isso-thread .isso-post-action input[type="submit"] {
    background: var(--primary-color);
    color: white;
    border: 0;
    border-radius: 10px;
    padding: 0.7rem 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: auto;
}

#isso-thread input[type="submit"]:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

#isso-thread .isso-comment {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 1rem;
}

#isso-thread .isso-comment .isso-text {
    color: var(--text-primary);
}

#isso-thread .isso-comment .isso-author,
#isso-thread .isso-comment .isso-spacer,
#isso-thread .isso-comment .isso-permalink,
#isso-thread .isso-comment time,
#isso-thread .isso-comment-footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

#isso-thread .isso-comment-footer a:hover {
    color: var(--primary-color);
}

#isso-thread .isso-note,
#isso-thread .isso-comment.isso-no-votes .isso-votes {
    color: var(--text-muted);
}

#isso-thread .isso-avatar svg,
#isso-thread .isso-avatar img {
    border-radius: 50%;
    border: 1px solid var(--border-color);
}

#isso-thread .isso-thread-heading {
    color: var(--text-primary);
}

/* Markdown formatting toolbar injected by community.js above each comment box */
.md-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.4rem;
}

.md-toolbar button {
    background: var(--surface-color);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-width: 2.2rem;
    height: 2.2rem;
    padding: 0 0.5rem;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.md-toolbar button:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.md-toolbar button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.md-toolbar .md-bold { font-weight: 700; }
.md-toolbar .md-italic { font-style: italic; }
.md-toolbar .md-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.md-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: auto;
}

/* Floating scroll-to-top / scroll-to-bottom buttons */
.scroll-nav {
    position: fixed;
    right: 1rem;
    bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 50;
}

.scroll-nav button {
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--box-shadow);
    transition: all 0.2s ease;
}

.scroll-nav button:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: scale(1.08);
}

.scroll-nav button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-color);
}

/* Toast shown when a comment submission is rejected by the server */
.comment-error-toast {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%);
    z-index: 100;
    max-width: min(560px, calc(100% - 2rem));
    background: var(--surface-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-left: 4px solid #dc3545;
    border-radius: 10px;
    box-shadow: var(--box-shadow-hover);
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
}

.comment-error-toast small {
    display: block;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Error fallback message injected by community.js */
#isso-thread .isso-load-error {
    color: var(--text-secondary);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
}

/* Small screens */
@media (max-width: 575px) {
    .navbar-inner {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 0.25rem;
    }
}
