/**
 * torGate - Main Stylesheet
 * Privacy-First Educational Portal
 * Mobile-First Responsive Design
 */

/* ==========================================================================
   CSS RESET & BASE STYLES
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    overflow-x: hidden;
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: #1a1a1a;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1.25rem;
    border-bottom: 3px solid #7c3aed;
    padding-bottom: 0.5rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1rem;
}

a {
    color: #7c3aed;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #5b21b6;
    text-decoration: underline;
}

a:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
}

strong,
b {
    font-weight: 700;
}

em,
i {
    font-style: italic;
}

code {
    font-family: "Courier New", Courier, monospace;
    background-color: #e5e7eb;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
}

pre {
    background-color: #1f2937;
    color: #f3f4f6;
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

pre code {
    background-color: transparent;
    padding: 0;
    color: #f3f4f6;
}

/* ==========================================================================
   LAYOUT & CONTAINERS
   ========================================================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #7c3aed;
    color: white;
    padding: 0.5rem 1rem;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* ==========================================================================
   HEADER
   ========================================================================== */

.site-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 2rem;
}

.site-branding {
    margin-bottom: 0;
}

.site-branding a {
    color: white;
    text-decoration: none;
}

.site-name {
    font-size: 1.5rem;
    font-weight: 900;
    margin: 0 0 0.15rem 0;
    color: white;
    line-height: 1;
}

.site-tagline {
    font-size: 0.75rem;
    opacity: 0.85;
    margin: 0;
    font-weight: 300;
    line-height: 1;
    white-space: nowrap;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: 2px solid white;
    color: white;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 5px;
}

.hamburger-icon {
    display: block;
    width: 25px;
    height: 2px;
    background: white;
    position: relative;
}

.hamburger-icon::before,
.hamburger-icon::after {
    content: "";
    position: absolute;
    width: 25px;
    height: 2px;
    background: white;
    left: 0;
}

.hamburger-icon::before {
    top: -8px;
}

.hamburger-icon::after {
    bottom: -8px;
}

/* Main Navigation */
.main-navigation {
    flex: 1;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.nav-menu li {
    position: relative;
}

.nav-menu a {
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.4rem 0.6rem;
    display: block;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.nav-menu a:hover,
.nav-menu li.active a {
    background-color: rgba(255, 255, 255, 0.2);
    text-decoration: none;
}

/* Onion Notice */
.onion-notice {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.15);
    padding: 0.75rem;
    border-radius: 5px;
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
}

.onion-icon {
    margin-right: 0.5rem;
}

.onion-link {
    color: white;
    text-decoration: underline;
    font-family: monospace;
    font-weight: bold;
}

/* ==========================================================================
   MAIN CONTENT
   ========================================================================== */

.main-content {
    min-height: calc(100vh - 400px);
    padding: 2rem 0;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
    margin-bottom: 2rem;
}

.hero h1 {
    color: white;
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.25rem;
    max-width: 800px;
    margin: 0 auto 2rem;
    opacity: 0.95;
}

.hero .cta-button {
    display: inline-block;
    background-color: white;
    color: #7c3aed;
    padding: 1rem 2rem;
    border-radius: 5px;
    font-weight: 700;
    font-size: 1.1rem;
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.hero .cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

/* Section Styles */
section {
    margin-bottom: 3rem;
}

.section-header {
    text-align: center;
    margin-bottom: 2rem;
}

.section-intro {
    max-width: 800px;
    margin: 0 auto 2rem;
    text-align: center;
    font-size: 1.1rem;
    color: #555;
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.card h3 {
    color: #7c3aed;
    margin-bottom: 0.75rem;
}

.card .card-meta {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.75rem;
}

.card .read-more {
    display: inline-block;
    margin-top: 1rem;
    color: #7c3aed;
    font-weight: 600;
}

/* ==========================================================================
   ARTICLE & NEWS PAGES
   ========================================================================== */

.article-header {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.article-title {
    color: #1a1a1a;
    margin-bottom: 1rem;
}

.article-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: #666;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.article-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.article-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    line-height: 1.8;
}

.article-content h2 {
    margin-top: 2rem;
}

.article-content h3 {
    margin-top: 1.5rem;
}

.article-content ul,
.article-content ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content blockquote {
    border-left: 4px solid #7c3aed;
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #555;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    margin: 1.5rem 0;
}

/* Table of Contents */
.toc {
    background: #f3f4f6;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.toc h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    border: none;
}

.toc ul {
    list-style: none;
    margin-left: 0;
}

.toc li {
    margin-bottom: 0.5rem;
}

.toc a {
    color: #7c3aed;
}

/* Related Articles */
.related-articles {
    background: #f3f4f6;
    padding: 2rem;
    border-radius: 8px;
    margin-top: 3rem;
}

/* ==========================================================================
   DIRECTORY & LISTINGS
   ========================================================================== */

.directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.directory-item {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #7c3aed;
}

.directory-item h3 {
    color: #7c3aed;
    margin-bottom: 0.5rem;
}

.directory-category {
    display: inline-block;
    background: #e5e7eb;
    color: #555;
    padding: 0.25rem 0.75rem;
    border-radius: 3px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.directory-url {
    background: #f3f4f6;
    padding: 0.75rem;
    border-radius: 5px;
    font-family: monospace;
    font-size: 0.9rem;
    word-break: break-all;
    margin-top: 1rem;
}

.directory-verified {
    color: #059669;
    font-weight: 600;
    margin-top: 0.5rem;
}

/* ==========================================================================
   TOOLS
   ========================================================================== */

.tool-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.tool-input-group {
    margin-bottom: 1.5rem;
}

.tool-input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.tool-input-group input,
.tool-input-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.tool-input-group input:focus,
.tool-input-group textarea:focus {
    outline: none;
    border-color: #7c3aed;
}

.tool-button {
    background: #7c3aed;
    color: white;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.tool-button:hover {
    background: #5b21b6;
}

.tool-result {
    background: #f3f4f6;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1.5rem;
    border-left: 4px solid #7c3aed;
}

.tool-result.success {
    border-left-color: #059669;
    background: #d1fae5;
}

.tool-result.error {
    border-left-color: #dc2626;
    background: #fee2e2;
}

/* ==========================================================================
   BUTTONS & FORMS
   ========================================================================== */

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: #7c3aed;
    color: white;
}

.btn-primary:hover {
    background: #5b21b6;
    text-decoration: none;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
    text-decoration: none;
}

/* ==========================================================================
   BADGES & LABELS
   ========================================================================== */

.badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.badge-primary {
    background: #ddd6fe;
    color: #5b21b6;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* ==========================================================================
   ALERTS & NOTICES
   ========================================================================== */

.alert {
    padding: 1rem 1.5rem;
    border-radius: 5px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-info {
    background: #dbeafe;
    border-left-color: #3b82f6;
    color: #1e40af;
}

.alert-success {
    background: #d1fae5;
    border-left-color: #10b981;
    color: #065f46;
}

.alert-warning {
    background: #fef3c7;
    border-left-color: #f59e0b;
    color: #92400e;
}

.alert-danger {
    background: #fee2e2;
    border-left-color: #ef4444;
    color: #991b1b;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.site-footer {
    background: #1f2937;
    color: #d1d5db;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-top {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #374151;
}

.footer-column h3 {
    color: white;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #d1d5db;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: white;
}

.footer-onion-mirror {
    background: #374151;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.onion-box {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.onion-box .onion-icon {
    font-size: 2rem;
}

.onion-info h4 {
    color: white;
    margin-bottom: 0.5rem;
}

.onion-verify {
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.footer-disclaimer {
    background: #111827;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    font-size: 0.85rem;
    line-height: 1.6;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding: 2rem 0 1rem;
    gap: 1rem;
}

.footer-copyright p {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.footer-badges {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.footer-badges .badge {
    background: #374151;
    color: white;
}

.footer-tech {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid #374151;
}

.tech-note {
    font-size: 0.8rem;
    color: #9ca3af;
}

/* ==========================================================================
   PGP PAGE
   ========================================================================== */

.pgp-key-container {
    background: #1f2937;
    color: #d1d5db;
    padding: 1.5rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    margin-bottom: 2rem;
}

.pgp-fingerprint {
    background: #f3f4f6;
    padding: 1rem;
    border-radius: 5px;
    font-family: monospace;
    font-size: 1.1rem;
    text-align: center;
    margin: 1rem 0;
    letter-spacing: 2px;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    /* Typography */
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    /* Header */
    .site-header {
        padding: 0.75rem 0;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .site-name {
        font-size: 1.5rem;
    }

    .site-tagline {
        font-size: 0.75rem;
    }

    .mobile-menu-toggle {
        display: block;
        position: absolute;
        top: 0.75rem;
        right: 1rem;
    }

    .main-navigation {
        width: 100%;
        display: none;
    }

    .main-navigation.active {
        display: block;
    }

    .nav-menu {
        flex-direction: column;
        gap: 0;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-menu a {
        display: block;
        padding: 0.75rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Grids */
    .card-grid,
    .directory-grid {
        grid-template-columns: 1fr;
    }

    /* Footer */
    .footer-top {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    .onion-box {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }

    .article-content,
    .tool-container {
        padding: 1.25rem;
    }

    .hero {
        padding: 2rem 0;
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .site-header,
    .site-footer,
    .mobile-menu-toggle,
    .related-articles,
    .tool-button {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    a {
        color: black;
        text-decoration: underline;
    }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

*:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    body {
        background: white;
    }

    .card,
    .article-content,
    .tool-container {
        border: 2px solid black;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
