/* 
   MacTechBuds Design System
   Theme: Deep Mint & Obsidian (Dark) / Clean Emerald (Light)
   Status: Stable & Compact
*/

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* DARK MODE (Default) */
    --primary-accent: #00ffa3;
    /* Neon Mint */
    --primary-accent-rgb: 0, 255, 163;

    --bg-main: #02040a;
    /* Obsidian */
    --bg-gradient: radial-gradient(circle at 60% 0%, #1e293b 0%, #02040a 70%);

    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --header-bg: rgba(2, 4, 10, 0.9);
    --bg-card: rgba(15, 23, 42, 0.85);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Typography */
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;

    /* Layout */
    --radius-lg: 12px;
    /* Reduced radius for compact feel */
    --header-height: 60px;
    /* More compact header */
    --glass-blur: 16px;
    --glass-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    /* LIGHT MODE (High Contrast) */
    --primary-accent: #008a5e;
    /* Deep Emerald (Darker for readability) */
    --primary-accent-rgb: 0, 138, 94;

    --bg-main: #f5f5f7;
    /* Soft Off-White/Grey */
    --bg-gradient: linear-gradient(180deg, #eef2f6 0%, #f5f5f7 100%);

    --glass-bg: #ffffff;
    /* Solid/High opacity for clean look */
    --glass-border: #d1d5db;
    /* Slate 300 - Slightly darker border for contrast */
    --header-bg: rgba(245, 245, 247, 0.95);
    --bg-card: #ffffff;

    --text-primary: #0f172a;
    /* Slate 900 - Very Dark */
    --text-secondary: #334155;
    /* Slate 700 */
    --text-muted: #64748b;

    --glass-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.06), 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

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

body {
    background-color: var(--bg-main);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Header --- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: var(--header-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--glass-border);
    z-index: 1000;
}

.header-content {
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: 32px;
    width: auto;
    display: block;
}

.nav-menu {
    display: flex;
    gap: 24px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
    /* Dark in light mode */
}

/* Header Buttons */
.header-actions {
    display: flex;
    gap: 8px;
}

/* Dedicated Icon Button */
.btn-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(125, 125, 125, 0.1);
    border-color: var(--primary-accent);
    color: var(--primary-accent);
}

/* --- Mobile Nav Fix --- */
@media (max-width: 900px) {
    .nav-menu {
        display: none;
    }
}

/* --- Hero --- */
.hero {
    padding-top: calc(var(--header-height) + 40px);
    padding-bottom: 40px;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    /* Smaller, cleaner */
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

[data-theme="dark"] .hero h1 {
    background: linear-gradient(135deg, #fff 30%, var(--primary-accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    font-size: 1.1rem;
}

/* --- Compact Cards / Tiles --- */
.glass-panel,
.download-item,
.glass-element {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    /* Reduced padding for 'small tile' feel */
    margin-bottom: 16px;
    box-shadow: var(--glass-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    will-change: transform;
}

.glass-panel:hover,
.download-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -5px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-accent);
}

.card-title,
.download-title {
    font-size: 1.1rem;
    /* Smaller headers */
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.card-desc,
.download-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.card-tag {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(var(--primary-accent-rgb), 0.1);
    color: var(--primary-accent);
    display: inline-block;
    margin-bottom: 10px;
}

/* --- Grids (Compact) --- */
.grid-2,
.grid-cols-2 {
    display: grid;
    /* Allow smaller columns -> more tiles per row */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.grid-3,
.grid-cols-3,
.downloads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    /* Very compact */
    gap: 16px;
}

@media (max-width: 600px) {

    .grid-2,
    .grid-cols-2,
    .grid-3,
    .downloads-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Buttons --- */
.btn,
.download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.btn-primary {
    background: rgba(0, 255, 163, 0.15);
    /* Tinted glass */
    color: var(--primary-accent);
    border: 1px solid rgba(0, 255, 163, 0.3);
}

.btn-primary:hover {
    background: rgba(0, 255, 163, 0.25);
    box-shadow: 0 0 20px rgba(0, 255, 163, 0.2);
    transform: translateY(-2px);
}

.btn-glass,
.download-button {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-glass:hover,
.download-button:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--text-primary);
    transform: translateY(-2px);
}

/* Light Mode Overrides */
[data-theme="light"] .btn-glass,
[data-theme="light"] .download-button {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .btn-glass:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: var(--text-primary);
}

/* --- Hyperlinks --- */
a {
    color: inherit;
    text-decoration: none;
}

p a,
.article-content a {
    color: var(--primary-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

p a:hover {
    color: var(--text-primary);
}


/* macOS Version List Styles */
.download-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.download-version {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    padding: 2px 6px;
    background: rgba(125, 125, 125, 0.1);
    border-radius: 4px;
    color: var(--text-secondary);
}

.download-version.latest {
    background: rgba(var(--primary-accent-rgb), 0.15);
    color: var(--primary-accent);
    font-weight: 700;
    border: 1px solid rgba(var(--primary-accent-rgb), 0.3);
}

.download-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: auto;
}

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

/* Sections */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 30px 0 16px;
    padding: 0 4px;
}

.section-header span {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.section-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-toggle:hover {
    background: rgba(var(--primary-accent-rgb), 0.1);
    color: var(--primary-accent);
}

.section-content {
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

.section-content.collapsed {
    display: none;
}

/* Small Box Grid for Downloads */
.small-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.small-tile {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    /* Slightly rounder for icon-box feel */
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text-primary);
    aspect-ratio: 1 / 1;
    /* Make them square-ish */
    justify-content: center;
}

.small-tile:hover {
    transform: translateY(-4px);
    border-color: var(--primary-accent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    background: var(--bg-card);
}

.small-tile i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    color: var(--primary-accent);
}

.small-tile .tile-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
}

.small-tile .tile-tag {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 99px;
    background: rgba(125, 125, 125, 0.1);
    color: var(--text-secondary);
}

/* --- Content Block (section wrapper in macOSversion page) --- */
.content-block {
    margin-bottom: 24px;
}

/* --- Disabled download buttons (IPSW N/A) --- */
.download-button.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.4);
}

.download-button.disabled:hover {
    transform: none;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

/* --- Background Glow Orbs --- */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.3;
}

.glow-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(var(--primary-accent-rgb), 0.25) 0%, transparent 70%);
    top: -150px;
    right: -100px;
}

.glow-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0, 120, 255, 0.15) 0%, transparent 70%);
    bottom: -100px;
    left: -80px;
}

[data-theme="light"] .bg-glow {
    opacity: 0.15;
}

/* Footer */
.site-footer {
    margin-top: 60px;
    padding: 40px 0;
    border-top: 1px solid var(--glass-border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.footer-links a {
    margin: 0 10px;
    color: var(--text-secondary);
    transition: color 0.2s;
}

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

/* --- Terminal Loader Overlay --- */
#terminal-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #02040a;
    z-index: 9999;
    padding: 40px;
    font-family: 'JetBrains Mono', monospace;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    color: #f8fafc;
    overflow: hidden;
    transition: opacity 0.5s ease-out, visibility 0.5s;
}

#terminal-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.terminal-line {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 4px;
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.terminal-line.visible {
    opacity: 1;
    transform: translateY(0);
}

.terminal-accent {
    color: var(--primary-accent);
}

.term-cyan {
    color: #00d4ff;
}

.term-green {
    color: #4af626;
}

.cursor {
    display: inline-block;
    width: 8px;
    height: 1.2rem;
    background: var(--primary-accent);
    margin-left: 4px;
    animation: blink 0.8s infinite;
    vertical-align: middle;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

@media (max-width: 600px) {
    #terminal-loader {
        padding: 20px;
    }

    .terminal-line {
        font-size: 0.85rem;
    }
}

/* Revert complete: layout logic restored */
/* Revert complete: layout logic restored */

/* ---------------------------------------------------- */
/*  Terminal Code Block Styles                          */
/* ---------------------------------------------------- */
.code-block-container {
    background: #1e1e1e;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    margin: 20px 0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    max-width: 100%;
}

.code-header {
    background: #2d2d2d;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.window-controls {
    display: flex;
    gap: 8px;
}

.control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.control.red {
    background: #ff5f56;
}

.control.yellow {
    background: #ffbd2e;
}

.control.green {
    background: #27c93f;
}

.language-label {
    color: #888;
    font-size: 0.8rem;
    font-weight: 500;
}

.copy-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 10px;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.copy-btn i {
    font-size: 0.8rem;
}

pre {
    margin: 0;
    padding: 15px;
    overflow-x: auto;
    color: #d4d4d4;
    font-size: 0.9rem;
    line-height: 1.5;
    background: transparent;
    /* Remove default background if any */
    white-space: pre-wrap;
    /* CSS3 */
    white-space: -moz-pre-wrap;
    /* Mozilla, since 1999 */
    white-space: -pre-wrap;
    /* Opera 4-6 */
    white-space: -o-pre-wrap;
    /* Opera 7 */
    word-wrap: break-word;
    /* Internet Explorer 5.5+ */
    max-width: 100%;
}

code {
    font-family: inherit;
    background: transparent;
    /* Ensure code doesn't have its own background */
}

/* Syntax Highlighting Colors (Simple) */
.token-comment {
    color: #6a9955;
}

.token-string {
    color: #ce9178;
}

.token-keyword {
    color: #569cd6;
}

.token-function {
    color: #dcdcaa;
}
/* ─── Article Content Typography ─────────────────────────────── */
.article-content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.article-content > *:first-child { margin-top: 0; }

.article-content h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 48px 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(var(--primary-accent-rgb), 0.2);
    position: relative;
}

.article-content h2::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 44px;
    height: 2px;
    background: var(--primary-accent);
    border-radius: 2px;
}

.article-content h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 32px 0 10px;
}

.article-content h4 {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-accent);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    margin: 32px 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.article-content h4::before {
    content: '//';
    opacity: 0.45;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
}

.article-content p {
    margin: 0 0 18px;
}

.article-content ul,
.article-content ol {
    margin: 4px 0 22px;
    padding-left: 1.5em;
}

.article-content li {
    margin-bottom: 10px;
    line-height: 1.75;
}

.article-content ul li::marker {
    color: var(--primary-accent);
}

.article-content ol li::marker {
    color: var(--primary-accent);
    font-weight: 700;
}

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

.article-content em {
    color: var(--text-muted);
    font-style: italic;
}

.article-content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82em;
    background: rgba(var(--primary-accent-rgb), 0.08);
    color: var(--primary-accent);
    padding: 2px 7px;
    border-radius: 5px;
    border: 1px solid rgba(var(--primary-accent-rgb), 0.18);
    white-space: nowrap;
}

/* Callout / note block */
.article-note {
    background: rgba(var(--primary-accent-rgb), 0.06);
    border-left: 3px solid var(--primary-accent);
    border-radius: 0 8px 8px 0;
    padding: 14px 18px;
    margin: 24px 0;
    color: var(--text-secondary);
    font-size: 0.93rem;
    line-height: 1.7;
}

/* Article header block */
.article-header {
    margin-bottom: 36px;
}

.article-title {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-primary);
    margin: 16px 0 12px;
}

.article-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-meta i {
    color: var(--primary-accent);
    font-size: 0.8rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 20px;
    transition: color 0.2s;
}

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

/* ─── Page Watermark (all pages) ─────────────────────────────── */
/* URL is relative to style.css (site root), so works at all depths */
.page-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 440px;
    height: 440px;
    background-image: url('dark_logo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.042;
    pointer-events: none;
    z-index: 0;
    filter: blur(0.6px);
}

[data-theme="light"] .page-watermark {
    background-image: url('dark_logo.png');
    opacity: 0.07;
    filter: blur(0.4px);
}
