/* ============================================================
   QuietWire - main.css
   Global styles shared across all pages.
   Includes: CSS variables, reset, typography, nav, footer.
   Page-specific styles belong in their own CSS files.
   ============================================================ */


/* ============================================================
   CSS Custom Properties - Theme System
   ============================================================ */

:root {
    --primary:               #10b981;
    --primary-hover:         #0d9668;
    --primary-dim:           rgba(16, 185, 129, 0.12);
    --primary-border:        rgba(16, 185, 129, 0.2);
    --accent:                #60a5fa;

    --text:                  #e2e8f0;
    --text-secondary:        #94a3b8;
    --text-muted:            #64748b;

    --bg:                    #0a0e17;
    --bg-subtle:             #0d1220;
    --card-bg:               #111827;
    --card-bg-hover:         #141e2e;

    --border:                #1e293b;
    --border-subtle:         #162032;

    --btn-primary-bg:        #10b981;
    --btn-primary-text:      #0a0e17;
    --btn-primary-hover:     #0d9668;
    --btn-secondary-text:    #e2e8f0;
    --btn-secondary-border:  #1e293b;
    --btn-secondary-hover:   #111827;

    --status-done:           #10b981;
    --status-done-bg:        rgba(16, 185, 129, 0.1);
    --status-done-border:    rgba(16, 185, 129, 0.2);
    --status-progress:       #f59e0b;
    --status-progress-bg:    rgba(245, 158, 11, 0.1);
    --status-progress-border:rgba(245, 158, 11, 0.2);
    --status-planned:        #64748b;
    --status-planned-bg:     rgba(100, 116, 139, 0.1);
    --status-planned-border: rgba(100, 116, 139, 0.2);

    --radius-sm:             6px;
    --radius-md:             10px;
    --radius-lg:             14px;

    --shadow-sm:             0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow-md:             0 4px 16px rgba(0, 0, 0, 0.35);
}

[data-theme="light"] {
    --primary:               #059669;
    --primary-hover:         #047857;
    --primary-dim:           rgba(5, 150, 105, 0.1);
    --primary-border:        rgba(5, 150, 105, 0.2);
    --accent:                #3b82f6;

    --text:                  #0f172a;
    --text-secondary:        #475569;
    --text-muted:            #94a3b8;

    --bg:                    #f8fafc;
    --bg-subtle:             #f1f5f9;
    --card-bg:               #ffffff;
    --card-bg-hover:         #f8fafc;

    --border:                #e2e8f0;
    --border-subtle:         #f1f5f9;

    --btn-primary-bg:        #059669;
    --btn-primary-text:      #ffffff;
    --btn-primary-hover:     #047857;
    --btn-secondary-text:    #0f172a;
    --btn-secondary-border:  #e2e8f0;
    --btn-secondary-hover:   #f1f5f9;

    --status-done:           #059669;
    --status-done-bg:        rgba(5, 150, 105, 0.08);
    --status-done-border:    rgba(5, 150, 105, 0.2);
    --status-progress:       #d97706;
    --status-progress-bg:    rgba(217, 119, 6, 0.08);
    --status-progress-border:rgba(217, 119, 6, 0.2);
    --status-planned:        #94a3b8;
    --status-planned-bg:     rgba(148, 163, 184, 0.1);
    --status-planned-border: rgba(148, 163, 184, 0.2);

    --shadow-sm:             0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md:             0 4px 16px rgba(0, 0, 0, 0.1);
}


/* ============================================================
   Binary Background Canvas
   ============================================================ */

#binary-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

#navbar,
.page-content,
#footer {
    position: relative;
    z-index: 1;
}


/* ============================================================
   Reset and Base
   ============================================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
}

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

a {
    color: inherit;
    text-decoration: none;
}

ul {
    list-style: none;
}


/* ============================================================
   Layout Utilities
   ============================================================ */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-narrow {
    max-width: 760px;
}

.text-center {
    text-align: center;
}


/* ============================================================
   Scroll Animation - fade-in-up
   Add class "fade-in-up" to any element to opt in.
   animations.js handles the IntersectionObserver trigger.
   ============================================================ */

.fade-in-up {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.55s ease, transform 0.55s ease;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}


/* ============================================================
   Buttons
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, border-color 0.2s;
    text-decoration: none;
    border: 1px solid transparent;
    white-space: nowrap;
    font-family: inherit;
}

.btn:active {
    transform: translateY(0) !important;
}

.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border-color: var(--btn-primary-bg);
}

.btn-primary:hover {
    background: var(--btn-primary-hover);
    border-color: var(--btn-primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: var(--btn-secondary-text);
    border-color: var(--btn-secondary-border);
}

.btn-secondary:hover {
    background: var(--btn-secondary-hover);
    transform: translateY(-1px);
}

.btn-large {
    font-size: 1rem;
    padding: 0.8rem 2rem;
}


/* ============================================================
   Navigation
   ============================================================ */

#navbar {
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    background: rgba(10, 14, 23, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

[data-theme="light"] .nav-container {
    background: rgba(248, 250, 252, 0.9);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.nav-brand:hover {
    opacity: 0.8;
}

.nav-logo {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    padding: 0 1rem;
}

.nav-links a {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
}

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

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.nav-github-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.nav-github-link:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

.theme-toggle {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: border-color 0.2s;
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: var(--primary);
}

.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: inline; }

[data-theme="light"] .theme-toggle .icon-sun  { display: inline; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }


/* ============================================================
   Footer
   ============================================================ */

.footer-block {
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 2rem 1.5rem;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-logo {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.footer-brand-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

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

.footer-links a {
    font-size: 0.875rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--text);
}

.footer-copy {
    font-size: 0.8rem;
    color: var(--text-muted);
}


/* ============================================================
   Responsive - Global
   ============================================================ */

@media (max-width: 640px) {
    .nav-links {
        display: none;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .nav-brand span {
        display: none;
    }
}
