/* ===== Shared Tutorials Styling — matches the main index.html design system ===== */

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

:root {
    --bg: #fafafa;
    --surface: #ffffff;
    --surface-2: #f4f4f5;
    --surface-3: #e9e9ed;
    --border: #e0e0e6;
    --border-hover: #c8c8d4;
    --text: #1a1a2e;
    --text-muted: #64647a;
    --accent: #2563eb;
    --accent-light: #3b82f6;
    --accent-dim: rgba(37,99,235,0.08);
    --accent-glow: rgba(37,99,235,0.15);
    --cyan: #0891b2;
    --cyan-dim: rgba(8,145,178,0.08);
    --green: #059669;
    --green-dim: rgba(5,150,105,0.08);
    --purple: #7c3aed;
    --purple-dim: rgba(124,58,237,0.08);
    --orange: #d97706;
    --orange-dim: rgba(217,119,6,0.08);
    --rose: #e11d48;
    --rose-dim: rgba(225,29,72,0.08);
    --code-bg: #0f172a;
    --code-text: #e2e8f0;
    --code-muted: #94a3b8;
    --code-keyword: #93c5fd;
    --code-string: #a5f3fc;
    --code-comment: #64748b;
    --inline-code-bg: #f1f5f9;
    --inline-code-text: #be185d;
    --nav-bg: rgba(255,255,255,0.6);
    --orb-1: #93c5fd;
    --orb-2: #a5f3fc;
    --orb-3: #c4b5fd;
    --orb-opacity: 0.12;
    --orb-opacity-3: 0.08;
    --shadow-card: 0 8px 32px rgba(0,0,0,0.06);
    --shadow-card-hover: 0 16px 36px rgba(0,0,0,0.07);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, Consolas, monospace;
    --max-w: 1100px;
    --reading-w: 760px;
    --radius: 16px;
}

:root[data-theme="dark"] {
    --bg: #0b0d14;
    --surface: #151822;
    --surface-2: #1e2230;
    --surface-3: #262b3b;
    --border: #2a2f3f;
    --border-hover: #3d4357;
    --text: #e6e8ef;
    --text-muted: #9ba0b0;
    --accent: #60a5fa;
    --accent-light: #93c5fd;
    --accent-dim: rgba(96,165,250,0.14);
    --accent-glow: rgba(96,165,250,0.24);
    --cyan: #22d3ee;
    --cyan-dim: rgba(34,211,238,0.14);
    --green: #34d399;
    --green-dim: rgba(52,211,153,0.14);
    --purple: #a78bfa;
    --purple-dim: rgba(167,139,250,0.14);
    --orange: #fbbf24;
    --orange-dim: rgba(251,191,36,0.14);
    --rose: #fb7185;
    --rose-dim: rgba(251,113,133,0.14);
    --code-bg: #060810;
    --code-text: #e2e8f0;
    --code-muted: #94a3b8;
    --code-keyword: #93c5fd;
    --code-string: #a5f3fc;
    --code-comment: #64748b;
    --inline-code-bg: rgba(244,114,182,0.12);
    --inline-code-text: #f9a8d4;
    --nav-bg: rgba(15,17,23,0.72);
    --orb-1: #1e40af;
    --orb-2: #0e7490;
    --orb-3: #6d28d9;
    --orb-opacity: 0.22;
    --orb-opacity-3: 0.18;
    --shadow-card: 0 8px 32px rgba(0,0,0,0.4);
    --shadow-card-hover: 0 16px 36px rgba(0,0,0,0.5);
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Smooth theme-switch transitions on surfaces that actually change colour */
.subnav, .floating-nav, .tut-card, .tut-chip, .tut-search input,
.stat, .skill-group, .skill-bar-item, .project-card, .edu-card, .timeline-item,
.callout, pre, code,
.btn-primary, .btn-outline, .theme-toggle, .tut-tag, .tut-badge, .hero-avatar {
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

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

/* ===== Animated background mesh — same as homepage ===== */
.bg-mesh {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.bg-mesh .orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: var(--orb-opacity);
    animation: orbFloat 20s ease-in-out infinite alternate;
    transition: background-color 0.3s ease, opacity 0.3s ease;
}
.bg-mesh .orb-1 { width: 600px; height: 600px; background: var(--orb-1); top: -15%; left: -10%; animation-duration: 25s; }
.bg-mesh .orb-2 { width: 500px; height: 500px; background: var(--orb-2); bottom: -20%; right: -10%; animation-duration: 30s; animation-delay: -5s; }
.bg-mesh .orb-3 { width: 400px; height: 400px; background: var(--orb-3); top: 40%; left: 50%; animation-duration: 22s; animation-delay: -10s; opacity: var(--orb-opacity-3); }
@keyframes orbFloat {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -40px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
    100% { transform: translate(10px, -10px) scale(1.02); }
}
.bg-mesh::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.015'/%3E%3C/svg%3E");
    background-size: 256px;
}

.page { position: relative; z-index: 1; }
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 28px; }
.container-narrow { max-width: var(--reading-w); margin: 0 auto; padding: 0 28px; }

/* ===== Sub-page header (replaces the homepage hero) ===== */
.subnav {
    padding: 28px 0 24px;
    border-bottom: 1px solid var(--border);
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.subnav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}
.subnav-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}
.subnav-brand:hover { color: var(--accent); }
.subnav-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}
.subnav-links { display: flex; gap: 6px; flex-wrap: wrap; }
.subnav-links a {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 100px;
    transition: all 0.2s;
}
.subnav-links a:hover { color: var(--text); background: var(--surface-2); }
.subnav-links a.active { color: var(--accent); background: var(--accent-dim); }

/* ===== Theme toggle ===== */
.theme-toggle {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 100px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}
.theme-toggle:hover {
    color: var(--text);
    background: var(--surface-2);
    border-color: var(--border);
}
.theme-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.theme-icon-sun, .theme-icon-moon {
    transition: opacity 0.2s ease, transform 0.3s ease;
}
.theme-icon-sun { display: none; }
.theme-icon-moon { display: inline-block; }
[data-theme="dark"] .theme-icon-sun { display: inline-block; }
[data-theme="dark"] .theme-icon-moon { display: none; }

/* ===== Section helpers shared with homepage ===== */
section { padding: 56px 0; }
.section-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent-light);
    margin-bottom: 10px;
}
.section-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
}
.section-intro {
    color: var(--text-muted);
    font-size: 1.02rem;
    max-width: 720px;
    margin-bottom: 36px;
    line-height: 1.7;
}
.divider { border: none; height: 1px; background: var(--border); margin: 0; }

/* ===== Reveal animation (same as homepage) ===== */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s cubic-bezier(0.16,1,0.3,1), transform 0.7s cubic-bezier(0.16,1,0.3,1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 0.06s; }
.reveal-delay-2 { transition-delay: 0.12s; }
.reveal-delay-3 { transition-delay: 0.18s; }

/* ===== Tutorials index — category filter chips ===== */
.tut-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}
.tut-chip {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 7px 16px;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}
.tut-chip:hover { border-color: var(--border-hover); color: var(--text); }
.tut-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}
.tut-chip .count {
    margin-left: 6px;
    font-variant-numeric: tabular-nums;
    opacity: 0.6;
    font-weight: 500;
    font-size: 0.78rem;
}
.tut-chip.active .count { opacity: 0.85; }

/* ===== Tutorials index — search box ===== */
.tut-search {
    position: relative;
    margin-bottom: 22px;
}
.tut-search input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 13px 18px 13px 44px;
    font-size: 0.92rem;
    font-family: var(--font);
    color: var(--text);
    transition: all 0.2s;
}
.tut-search input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 4px var(--accent-dim);
}
.tut-search input::placeholder { color: var(--text-muted); }
.tut-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* ===== Tutorial cards ===== */
.tut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 16px;
}

.tut-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: all 0.3s cubic-bezier(0.16,1,0.3,1);
    color: inherit;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    min-height: 200px;
}
.tut-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--purple));
    opacity: 0;
    transition: opacity 0.3s ease;
}
.tut-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
    color: inherit;
}
.tut-card:hover::before { opacity: 1; }
.tut-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}
.tut-card-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.tut-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 10px;
    letter-spacing: -0.01em;
    color: var(--text);
}
.tut-card-excerpt {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.6;
    margin-bottom: 16px;
    flex-grow: 1;
}
.tut-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: auto;
}
.tut-tag {
    font-size: 0.7rem;
    padding: 3px 9px;
    border-radius: 6px;
    background: var(--surface-3);
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.tut-badge {
    font-size: 0.66rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}
.badge-servers { background: var(--green-dim); color: var(--green); }
.badge-networking { background: var(--purple-dim); color: var(--purple); }
.badge-linux { background: var(--cyan-dim); color: var(--cyan); }
.badge-hardware { background: var(--orange-dim); color: var(--orange); }
.badge-dev { background: var(--accent-dim); color: var(--accent-light); }

.tut-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ===== Article (single tutorial) ===== */
.article-header {
    padding: 56px 0 36px;
}
.article-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 24px;
    transition: color 0.2s;
}
.article-back:hover { color: var(--accent); }
.article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 18px;
    font-weight: 500;
    letter-spacing: 0.02em;
}
.article-meta-dot {
    width: 3px; height: 3px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.5;
}
.article-meta time { font-variant-numeric: tabular-nums; }
.article-header h1 {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.035em;
    margin-bottom: 18px;
    color: var(--text);
}
.article-lead {
    font-size: 1.12rem;
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 640px;
}

.article-body {
    padding: 0 0 56px;
    font-size: 1.02rem;
    line-height: 1.78;
    color: var(--text);
}
.article-body p { margin-bottom: 1.15em; color: var(--text); }
.article-body p strong { color: var(--text); font-weight: 600; }
.article-body h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 2.2em 0 0.7em;
    letter-spacing: -0.025em;
    line-height: 1.25;
    color: var(--text);
    scroll-margin-top: 100px;
}
.article-body h2:first-child { margin-top: 0; }
.article-body h3 {
    font-size: 1.18rem;
    font-weight: 700;
    margin: 1.8em 0 0.6em;
    letter-spacing: -0.015em;
    line-height: 1.3;
    color: var(--text);
    scroll-margin-top: 100px;
}
.article-body h2 .step-num,
.article-body h3 .step-num {
    display: inline-block;
    color: var(--accent-light);
    margin-right: 12px;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    opacity: 0.8;
}
.article-body ul, .article-body ol {
    margin: 0 0 1.2em 1.4em;
    padding: 0;
}
.article-body ul li, .article-body ol li {
    margin-bottom: 0.5em;
    color: var(--text);
}
.article-body ul li::marker { color: var(--accent-light); }
.article-body ol li::marker { color: var(--accent-light); font-weight: 700; }
.article-body a { color: var(--accent); font-weight: 500; border-bottom: 1px solid transparent; transition: border-color 0.2s; }
.article-body a:hover { color: var(--cyan); border-bottom-color: currentColor; }
.article-body hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 2.4em 0;
}

/* Code blocks */
.article-body pre {
    background: var(--code-bg);
    border-radius: 12px;
    padding: 18px 22px;
    margin: 1.2em 0;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.86rem;
    line-height: 1.6;
    color: var(--code-text);
    border: 1px solid rgba(255,255,255,0.06);
    position: relative;
}
.article-body pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: inherit;
    border: none;
}
.article-body pre .token-comment { color: var(--code-comment); font-style: italic; }
.article-body pre .token-keyword { color: var(--code-keyword); }
.article-body pre .token-string { color: var(--code-string); }
.article-body pre .token-prompt { color: #fbbf24; user-select: none; }
.article-body pre .token-flag { color: #fcd34d; }

.article-body code {
    background: var(--inline-code-bg);
    color: var(--inline-code-text);
    border-radius: 5px;
    padding: 2px 6px;
    font-family: var(--font-mono);
    font-size: 0.86em;
    font-weight: 500;
    border: 1px solid var(--border);
}

/* Callout boxes */
.callout {
    border-radius: 12px;
    padding: 18px 22px;
    margin: 1.5em 0;
    border-left: 3px solid var(--accent);
    background: var(--accent-dim);
    font-size: 0.95rem;
    line-height: 1.65;
}
.callout strong:first-child { display: block; margin-bottom: 4px; color: var(--accent); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; }
.callout-warn { border-left-color: var(--orange); background: var(--orange-dim); }
.callout-warn strong:first-child { color: var(--orange); }
.callout-danger { border-left-color: var(--rose); background: var(--rose-dim); }
.callout-danger strong:first-child { color: var(--rose); }
.callout-tip { border-left-color: var(--green); background: var(--green-dim); }
.callout-tip strong:first-child { color: var(--green); }
.callout-info { border-left-color: var(--cyan); background: var(--cyan-dim); }
.callout-info strong:first-child { color: var(--cyan); }
.callout p { margin-bottom: 0.6em; }
.callout p:last-child { margin-bottom: 0; }

/* Article foot navigation */
.article-foot {
    border-top: 1px solid var(--border);
    padding: 36px 0 64px;
    margin-top: 24px;
}
.article-foot-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}
.article-cta {
    color: var(--text-muted);
    font-size: 0.9rem;
}
.article-cta a { color: var(--accent); font-weight: 600; }
.article-foot-tags { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Footer (matches homepage) ===== */
.site-footer { padding: 48px 0; text-align: center; border-top: 1px solid var(--border); margin-top: 24px; }
.footer-links {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.footer-links a { color: var(--text-muted); font-size: 0.88rem; font-weight: 500; }
.footer-links a:hover { color: var(--accent-light); }
.footer-copy { color: var(--text-muted); font-size: 0.8rem; opacity: 0.6; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .subnav { padding: 18px 0 16px; }
    .subnav-links { width: 100%; justify-content: flex-start; overflow-x: auto; }
    section { padding: 36px 0; }
    .article-header { padding: 28px 0 20px; }
    .article-header h1 { font-size: 1.85rem; }
    .article-body { font-size: 0.98rem; line-height: 1.75; }
    .article-body h2 { font-size: 1.3rem; }
    .article-body h3 { font-size: 1.08rem; }
    .article-body pre { font-size: 0.78rem; padding: 14px 16px; border-radius: 10px; }
    .tut-grid { grid-template-columns: 1fr; }
    .article-foot-row { flex-direction: column; align-items: stretch; }
}
