/* ============================================
   Catharsis Market Wiki -- Design System
   ============================================ */

/* --- CSS Variables --- */
:root {
    --bg-base: #0a0a0a;
    --bg-surface: #1a1a1a;
    --bg-card: #1c1c1c;
    --bg-input: #2a2a2a;
    --bg-hover: #333333;

    --text-primary: #e5e5e5;
    --text-secondary: #a3a3a3;
    --text-tertiary: #737373;
    --text-inverse: #0a0a0a;
    --text-white: #ffffff;

    --accent: #4ade80;
    --accent-hover: #22c55e;
    --accent-yellow: #facc15;

    --cat-red: #f87171;
    --cat-cyan: #22d3ee;
    --cat-green: #4ade80;
    --cat-yellow: #facc15;
    --cat-purple: #c084fc;
    --cat-blue: #60a5fa;
    --cat-pink: #f472b6;
    --cat-gray: #a8a8a8;

    --border-subtle: #2a2a2a;
    --border-input: #3a3a3a;
    --border-panel: #333333;

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-pill: 9999px;

    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', 'Liberation Mono', monospace;

    --text-xs: 11px;
    --text-sm: 13px;
    --text-base: 14px;
    --text-md: 16px;
    --text-lg: 20px;
    --text-xl: 24px;
    --text-2xl: 28px;
    --text-3xl: 36px;

    --container-width: 1200px;
}

/* --- Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    list-style: none;
}

/* --- Header --- */
.header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-white);
    font-size: var(--text-md);
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -0.3px;
}

.logo:hover {
    color: var(--text-white);
}

.logo img {
    width: 28px;
    height: 28px;
    filter: invert(1);
}

/* --- Navigation --- */
.nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav a {
    color: var(--text-secondary);
    font-size: var(--text-base);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    text-decoration: none;
}

.nav a:hover {
    color: var(--text-primary);
    background-color: var(--bg-input);
}

.nav a.active {
    color: var(--accent);
    background-color: rgba(74, 222, 128, 0.08);
}

/* --- Hamburger --- */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 90;
}

.nav-overlay.active {
    display: block;
}

/* --- Onion Bar --- */
.onion-bar {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    padding: 10px 24px;
}

.onion-bar-inner {
    max-width: var(--container-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.onion-bar-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}

.onion-bar-url {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-primary);
    background-color: var(--bg-input);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    word-break: break-all;
    user-select: all;
    flex: 1;
    min-width: 0;
}

.onion-bar-copy {
    font-family: var(--font-primary);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-inverse);
    background-color: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.onion-bar-copy:hover {
    background-color: var(--accent-hover);
}

.onion-bar-copy.copied {
    background-color: var(--cat-cyan);
    font-size: 0;
}

.onion-bar-copy.copied::after {
    content: 'Copied!';
    font-size: var(--text-sm);
}

/* --- Page Preview Image --- */
.page-preview {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 24px 24px 0;
}

.page-preview picture {
    display: block;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.page-preview img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 340px;
    object-fit: cover;
    object-position: top center;
}

/* --- Container --- */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 32px 24px;
}

/* --- Breadcrumbs --- */
.breadcrumbs {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--accent);
}

/* --- Container content (non-article pages like mirrors, market) --- */
.container p {
    line-height: 1.8;
    margin-bottom: 16px;
}

.container ul {
    margin-bottom: 20px;
}

.container ul li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    line-height: 1.7;
    color: var(--text-primary);
}

.container ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
}

.container ol {
    counter-reset: item;
    margin-bottom: 20px;
}

.container ol li {
    counter-increment: item;
    position: relative;
    padding-left: 32px;
    margin-bottom: 10px;
    line-height: 1.7;
    color: var(--text-primary);
}

.container ol li::before {
    content: counter(item);
    position: absolute;
    left: 0;
    top: 2px;
    width: 22px;
    height: 22px;
    background: var(--accent);
    color: var(--text-inverse);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-white);
    line-height: 1.25;
    letter-spacing: -0.3px;
}

h1 { font-size: var(--text-3xl); font-weight: 700; margin-bottom: 16px; }
h2 { font-size: var(--text-2xl); font-weight: 700; margin-bottom: 16px; }
h3 { font-size: var(--text-xl); font-weight: 600; margin-bottom: 12px; margin-top: 32px; }
h4 { font-size: var(--text-lg); font-weight: 600; margin-bottom: 10px; margin-top: 24px; }

/* --- Article Content --- */
.article-content {
    max-width: 800px;
}

.article-content > h2:first-child {
    font-size: var(--text-3xl);
    margin-bottom: 20px;
}

.article-content > h2:first-child + p {
    font-size: var(--text-md);
    color: var(--text-secondary);
    line-height: 1.7;
    border-left: 3px solid var(--accent);
    padding-left: 20px;
    margin-bottom: 32px;
}

.article-content p {
    color: var(--text-primary);
    line-height: 1.8;
    margin-bottom: 16px;
    font-size: var(--text-base);
}

.article-content h3 {
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
}

.article-content ul,
.article-content ol {
    margin-bottom: 20px;
    padding-left: 0;
}

.article-content ul li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    line-height: 1.7;
    color: var(--text-primary);
}

.article-content ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
}

.article-content ol {
    counter-reset: item;
}

.article-content ol li {
    counter-increment: item;
    position: relative;
    padding-left: 32px;
    margin-bottom: 10px;
    line-height: 1.7;
    color: var(--text-primary);
}

.article-content ol li::before {
    content: counter(item);
    position: absolute;
    left: 0;
    top: 2px;
    width: 22px;
    height: 22px;
    background: var(--accent);
    color: var(--text-inverse);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-content strong {
    color: var(--text-white);
    font-weight: 600;
}

.article-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article-content a:hover {
    color: var(--accent-hover);
}

/* --- Code Blocks --- */
.article-content code {
    font-family: var(--font-mono);
    font-size: 13px;
    background-color: var(--bg-input);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--accent);
}

.article-content pre {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin: 20px 0;
    overflow-x: auto;
    line-height: 1.6;
}

.article-content pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
    font-size: 13px;
}

/* --- Related Articles --- */
.related-articles {
    margin-top: 48px;
    padding: 28px;
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.04) 0%, rgba(74, 222, 128, 0.01) 100%);
    border: 1px solid rgba(74, 222, 128, 0.12);
    border-radius: var(--radius-lg);
}

.related-articles h3 {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    color: var(--accent);
    font-size: var(--text-lg);
    margin-bottom: 16px;
}

.related-articles ul li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 10px;
}

.related-articles ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 0;
    height: 0;
    border-left: 6px solid var(--accent);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    background: none;
    border-radius: 0;
}

.related-articles ul li a {
    text-decoration: none;
    font-weight: 500;
}

/* --- Cards --- */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: border-color 0.2s;
}

.card:hover {
    border-color: var(--border-panel);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* --- Article Cards (listing page) --- */
.article-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, transform 0.2s;
}

.article-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.article-card-tag {
    display: inline-block;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    background-color: rgba(74, 222, 128, 0.08);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    margin-bottom: 12px;
    width: fit-content;
}

.article-card-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: 8px;
    line-height: 1.35;
}

.article-card-title a {
    color: inherit;
    text-decoration: none;
}

.article-card-title a:hover {
    color: var(--accent);
}

.article-listing h4 {
    margin-top: 0;
    margin-bottom: 8px;
}
.article-listing h4 + p {
    margin-top: 0;
    margin-bottom: 4px;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}
.article-listing h4 + p + p {
    margin-top: 0;
    margin-bottom: 0;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.6;
}
.article-listing h4 ~ h4 {
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
}

.article-card-desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.6;
    flex: 1;
    margin-bottom: 16px;
}

.article-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

.article-card-date {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.article-card-link {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

.article-card-link:hover {
    color: var(--accent-hover);
}

/* --- Resource Cards (external links) --- */
.resource-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, transform 0.2s;
    text-decoration: none;
    color: inherit;
}

.resource-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    color: inherit;
}

.resource-card-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: 8px;
    line-height: 1.35;
}

.resource-card:hover .resource-card-title {
    color: var(--accent);
}

.resource-card-desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.6;
    flex: 1;
    margin-bottom: 12px;
}

.resource-card-domain {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
}

/* --- Magazine header --- */
.magazine-header {
    margin-bottom: 40px;
}

.magazine-header h2 {
    font-size: var(--text-3xl);
    margin-bottom: 8px;
}

/* --- Section blocks --- */
.section-block {
    margin-bottom: 48px;
}

.section-block h3 {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 8px;
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}

.section-block > p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-bottom: 20px;
}

.section-block h2 {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 24px;
}

/* --- Info block --- */
.info-block {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
}

.info-block h3 {
    margin-top: 24px;
}

.info-block h3:first-child {
    margin-top: 0;
}

/* --- Mirror links block --- */
.mirror-links-block {
    background-color: var(--bg-surface);
    border: 1px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin: 24px 0;
    min-height: 60px;
}

.mirror-links-block h3 {
    margin-top: 0;
    color: var(--accent);
    font-size: var(--text-lg);
    margin-bottom: 12px;
}

.mirror-links-block p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.6;
    margin-bottom: 16px;
}

.mirror-links-block ul li {
    margin-bottom: 12px;
    font-size: var(--text-base);
    color: var(--text-primary);
}

.mirror-links-block ul li code {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    background-color: var(--bg-input);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    color: var(--accent);
    word-break: break-all;
    border: 1px solid var(--border-subtle);
}

.mirror-link-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.mirror-link-label {
    font-weight: 600;
    color: var(--text-white);
    white-space: nowrap;
    font-size: var(--text-base);
}

.mirror-link-url {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    background-color: var(--bg-input);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: var(--accent);
    word-break: break-all;
    border: 1px solid var(--border-subtle);
    flex: 1;
    min-width: 0;
    user-select: all;
}

/* --- Video embed --- */
.video-embed {
    position: relative;
    width: 100%;
    max-width: 720px;
    margin: 24px 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.video-embed iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border: none;
    display: block;
}

/* --- Tags --- */
.tag {
    display: inline-block;
    font-size: var(--text-xs);
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background-color: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.tag--green { background-color: rgba(74, 222, 128, 0.1); color: var(--cat-green); border-color: rgba(74, 222, 128, 0.2); }
.tag--red { background-color: rgba(248, 113, 113, 0.1); color: var(--cat-red); border-color: rgba(248, 113, 113, 0.2); }
.tag--cyan { background-color: rgba(34, 211, 238, 0.1); color: var(--cat-cyan); border-color: rgba(34, 211, 238, 0.2); }
.tag--purple { background-color: rgba(192, 132, 252, 0.1); color: var(--cat-purple); border-color: rgba(192, 132, 252, 0.2); }
.tag--blue { background-color: rgba(96, 165, 250, 0.1); color: var(--cat-blue); border-color: rgba(96, 165, 250, 0.2); }
.tag--yellow { background-color: rgba(250, 204, 21, 0.1); color: var(--cat-yellow); border-color: rgba(250, 204, 21, 0.2); }
.tag--pink { background-color: rgba(244, 114, 182, 0.1); color: var(--cat-pink); border-color: rgba(244, 114, 182, 0.2); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: 600;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--accent);
    color: var(--text-inverse);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    color: var(--text-inverse);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-input);
}

.btn-secondary:hover {
    background-color: var(--bg-input);
    border-color: var(--border-panel);
}

/* --- Feature Grid (homepage) --- */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 32px 0;
}

.feature-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: border-color 0.2s;
}

.feature-card:hover {
    border-color: var(--accent);
}

.feature-card h4 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: var(--text-md);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.6;
}

/* --- Category cards (colored) --- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 24px 0;
}

.category-card {
    border-radius: var(--radius-lg);
    padding: 20px;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
}

.category-card:hover {
    transform: translateY(-2px);
}

.category-card h4 {
    color: var(--text-inverse);
    margin: 0;
    font-size: var(--text-md);
    font-weight: 700;
}

.category-card p {
    color: rgba(0, 0, 0, 0.6);
    font-size: var(--text-sm);
    margin: 4px 0 0;
}

.category-card--red { background-color: var(--cat-red); }
.category-card--cyan { background-color: var(--cat-cyan); }
.category-card--green { background-color: var(--cat-green); }
.category-card--yellow { background-color: var(--cat-yellow); }
.category-card--purple { background-color: var(--cat-purple); }
.category-card--blue { background-color: var(--cat-blue); }
.category-card--pink { background-color: var(--cat-pink); }
.category-card--gray { background-color: var(--cat-gray); }

/* --- Page title --- */
.page-title {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: var(--text-md);
    color: var(--text-secondary);
    max-width: 640px;
    line-height: 1.6;
    margin-bottom: 32px;
}

/* --- Footer --- */
.footer {
    margin-top: auto;
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    padding: 48px 24px 24px;
}

.footer-inner {
    max-width: var(--container-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
}

.footer-col h4 {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-white);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    margin-top: 0;
}

.footer-col ul li {
    margin-bottom: 8px;
}

.footer-col ul li a {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-col ul li a:hover {
    color: var(--accent);
}

.footer-bottom {
    max-width: var(--container-width);
    margin: 32px auto 0;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

/* --- Gallery --- */
.gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 24px 0 32px;
}

.gallery-item {
    display: block;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    transition: border-color 0.2s, transform 0.2s;
    background-color: var(--bg-card);
}

.gallery-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    aspect-ratio: 4/3;
}

.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.92);
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.lightbox.active {
    display: flex;
}
.lightbox img {
    max-width: 92vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    cursor: default;
}
.lightbox-close {
    position: absolute;
    top: 16px;
    right: 24px;
    background: none;
    border: none;
    color: var(--text-white);
    font-size: 36px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.lightbox-close:hover {
    opacity: 1;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .card-grid,
    .feature-grid,
    .gallery {
        grid-template-columns: repeat(2, 1fr);
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-inner {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: var(--bg-surface);
        flex-direction: column;
        padding: 24px;
        gap: 4px;
        z-index: 95;
        overflow-y: auto;
    }

    .nav.active {
        display: flex;
    }

    .nav a {
        font-size: var(--text-md);
        padding: 14px 16px;
        border-radius: var(--radius-md);
        width: 100%;
    }

    .nav a:hover,
    .nav a.active {
        background-color: var(--bg-input);
    }

    .onion-bar {
        padding: 10px 16px;
    }

    .onion-bar-inner {
        gap: 8px;
    }

    .onion-bar-url {
        font-size: 11px;
        padding: 4px 8px;
    }

    .page-preview {
        padding: 16px 16px 0;
    }

    .page-preview img {
        max-height: 200px;
    }

    .container {
        padding: 24px 16px;
    }

    .card-grid,
    .feature-grid,
    .category-grid,
    .gallery {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    h1, .page-title { font-size: var(--text-xl); }
    h2, .article-content > h2:first-child { font-size: var(--text-xl); }
    h3 { font-size: var(--text-lg); }

    .magazine-header h2 {
        font-size: var(--text-xl);
    }

    .page-subtitle {
        font-size: var(--text-sm);
        margin-bottom: 24px;
    }

    .article-content pre {
        padding: 14px;
        font-size: 12px;
    }

    .info-block {
        padding: 20px;
    }

    .video-embed {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .header-inner {
        padding: 0 16px;
    }

    .logo {
        font-size: var(--text-base);
    }

    .logo img {
        width: 24px;
        height: 24px;
    }

    .onion-bar {
        padding: 8px 12px;
    }

    .onion-bar-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .onion-bar-label {
        font-size: var(--text-xs);
    }

    .onion-bar-url {
        font-size: 10px;
        padding: 6px 8px;
    }

    .onion-bar-copy {
        align-self: flex-start;
        padding: 6px 20px;
    }

    .article-card,
    .resource-card {
        padding: 16px;
    }

    .mirror-links-block {
        padding: 16px;
    }

    .breadcrumbs {
        font-size: var(--text-xs);
    }

    .related-articles {
        padding: 20px;
    }

    .magazine-header {
        margin-bottom: 24px;
    }
}
