:root{
    --bg:#f6f7fb;
    --card:#ffffff;
    --muted:#6b7280;
    --accent:#0b5fff;
    --text:#0f172a;
    --code-bg: rgba(15,23,42,0.04);
    --bg-image: linear-gradient(45deg, #f5f5dc 0%, #ede8d0 25%, #f5f5dc 50%, #ede8d0 75%, #f5f5dc 100%);

    --max-width:1100px;
    --radius:10px;

    --border:#eef2f7;
    --shadow-sm:0 4px 12px rgba(12,14,23,0.04);
    --shadow-md:0 6px 18px rgba(12,14,23,0.06);
}

html.dark {
    --bg:#121212;
    --card:#1e1e1e;
    --muted:#cccccc;
    --accent:#4a9eff;
    --text:#f0f0f0;
    --code-bg: rgba(255,255,255,0.1);
    --bg-image: linear-gradient(135deg, #2c1810 0%, #1a0f0a 25%, #2c1810 50%, #1a0f0a 75%, #2c1810 100%);

    --border:#333333;
    --shadow-sm:0 4px 12px rgba(0,0,0,0.3);
    --shadow-md:0 6px 18px rgba(0,0,0,0.5);
}

html{
    overflow-y:scroll;
    scrollbar-gutter:stable;
}

*{
    box-sizing:border-box;
}

body{
    margin:0;
    font-family:'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    background: var(--bg) var(--bg-image);
    color:var(--text);
    -webkit-font-smoothing:antialiased;
    transition: background 0.3s ease, color 0.3s ease;
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}

.wrap{
    max-width:var(--max-width);
    margin:0 auto;
    padding:0 20px;
}

/* ================= Header ================= */

.site-header{
    background:var(--card);
    border-bottom:1px solid var(--border);
    transition: background 0.3s ease, border-color 0.3s ease;
}

/* Fixed header */
.site-header{position:fixed !important;top:0 !important;left:0;right:0;z-index:2147483646 !important;background:var(--card);box-shadow:var(--shadow-md);opacity:1 !important;visibility:visible !important;transition:none !important}
.site-header *{transition:none !important}

/* Debug overlay removed. */

/* Reserve space for fixed header so content doesn't slip under it. */
body{padding-top:92px}

.site-header .wrap{
    display:grid;
    grid-template-columns:260px 1fr;
    align-items:center;
    padding:14px 20px;
    min-height:64px;
}

.brand{
    grid-column:1;
}

.brand .logo{
    font-weight:700;
    color:var(--accent);
    font-size:1.15rem;
    text-decoration:none;
}

.brand .tagline{
    margin:4px 0 0;
    color:var(--muted);
    font-size:0.95rem;
    max-width:220px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.main-nav{
    display:flex;
    gap:18px;
    align-items:center;
    justify-self:end;
}

/* Dropdown for Tutorials */
.nav-dropdown{position:relative}
.drop-toggle{background:none;border:none;padding:0;color:inherit;font:inherit;cursor:pointer;font-weight:600}
.dropdown-menu{position:absolute;top:calc(100% + 8px);left:0;background:var(--card);border:1px solid var(--border);box-shadow:var(--shadow-md);border-radius:8px;min-width:160px;display:none;flex-direction:column;overflow:hidden}
.dropdown-menu a{display:block;padding:10px 14px;color:var(--accent);text-decoration:none;font-weight:500}
.dropdown-menu a:hover{background:var(--bg);color:var(--accent)}
.nav-dropdown:hover .dropdown-menu,.nav-dropdown.open .dropdown-menu{display:flex}

.main-nav a{
    color:var(--text);
    text-decoration:none;
    font-weight:600;
    transition: color 0.3s ease;
}

.main-nav a:hover{
    color:var(--accent);
}

.main-nav button {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    margin-left: 8px;
}

/* ================= Hero ================= */

.hero{
    padding:48px 0;
    background: var(--card);
}

.hero h1{
    margin:0 0 12px;
    font-size:2.1rem;
    color:var(--text);
}

.hero .lead{
    color:var(--muted);
    max-width:70ch;
}

/* ================= Buttons ================= */

.cta{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    margin-top:12px;
    padding:10px 16px;
    background:var(--accent);
    color:#fff;
    border-radius:8px;
    border:none;
    font-weight:600;
    cursor:pointer;
    text-decoration:none;
}

.cta:hover{
    background:#084bd8;
}

.cta:active{
    transform:translateY(1px);
}

/* ================= Layout ================= */

.content{
    display:grid;
    grid-template-columns:1fr 320px;
    gap:32px;
    padding:40px 0;
}

.content.single{
    grid-template-columns:1fr;
}

.posts,
.sidebar{
    min-width:0;
}

/* ================= Card System ================= */

.card,
.post,
.project-card,
.contact-card{
    background:var(--card);
    border:1px solid var(--border);
    border-radius:var(--radius);
}

.post,
.project-card,
.contact-card{
    box-shadow:var(--shadow-md);
}

/* ================= Posts ================= */

.post{
    padding:20px;
    margin-bottom:18px;
}

.post h2{
    margin:0 0 8px;
    font-size:1.25rem;
}

.meta{
    color:var(--muted);
    font-size:0.9rem;
    margin-bottom:12px;
}

.read-more{
    color:var(--accent);
    font-weight:600;
    text-decoration:none;
}

/* ================= Pagination ================= */

.pagination {
    text-align: center;
    margin: 20px 0;
}

.pagination a,
.pagination span {
    margin: 0 5px;
    padding: 8px 12px;
    text-decoration: none;
    color: var(--accent);
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--card);
}

.pagination span.current {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.pagination a:hover {
    background: var(--bg);
}

/* ================= Sidebar ================= */

.card{
    padding:16px;
    margin-bottom:16px;
}

.card h3{
    margin:0 0 8px;
}

.card ul{
    padding-left:18px;
    margin:0;
}

.card a{
    color:var(--accent);
    text-decoration:none;
}

/* ================= Contact Page ================= */

.contact-page{
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:70vh;
    padding:40px 0;
}

.contact-card{
    max-width:680px;
    width:100%;
    padding:28px;
}

.contact-card .muted{
    color:var(--muted);
    font-size:0.95rem;
    margin-top:14px;
}

/* ================= Forms ================= */

.contact-form{
    display:flex;
    flex-direction:column;
    gap:10px;
    margin-top:12px;
}

.contact-form label{
    font-size:0.9rem;
    color:var(--muted);
}

.contact-form input,
.contact-form textarea{
    background:var(--card);
    padding:10px;
    border:1px solid var(--border);
    border-radius:8px;
    font-family:inherit;
}

.contact-form input:focus,
.contact-form textarea:focus{
    outline:2px solid rgba(11,95,255,0.12);
    border-color:var(--accent);
}

/* ================= Portfolio ================= */

.projects-grid{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:18px;
    margin-top:16px;
}

.project{
    margin-bottom:18px;
}

.project h2{
    margin:0 0 6px;
}

.project-card{
    padding:16px;
}

.proj-title{
    margin:0 0 6px;
    font-size:1.05rem;
}

.proj-sub{
    margin:0 0 10px;
    color:var(--muted);
    font-size:0.95rem;
}

.proj-desc{
    margin:0 0 10px;
}

.proj-meta{
    margin-bottom:8px;
}

.tag{
    display:inline-block;
    background:#eef6ff;
    color:var(--accent);
    padding:4px 8px;
    border-radius:999px;
    font-size:0.8rem;
    margin-right:6px;
}

.proj-links a{
    margin-right:10px;
    color:var(--accent);
    text-decoration:none;
    font-weight:600;
}

/* ================= Code ================= */

pre{
    padding:14px;
    border-radius:8px;
    overflow:auto;
    font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, 'Roboto Mono', 'Courier New', monospace;
    font-size:0.92rem;
    margin:1rem 0;
    border:1px solid var(--border);
    background: var(--card);
}

code{
    background:var(--code-bg);
    padding:2px 6px;
    border-radius:6px;
    font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, 'Roboto Mono', 'Courier New', monospace;
}

pre code{
    background:transparent;
    padding:0;
    color:inherit;
}

/* ================= Diagrams ================= */

.diagram {
    margin: 2rem 0;
    text-align: center;
    background: var(--card);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.diagram svg {
    max-width: 100%;
    height: auto;
}

/* ================= Article Styling ================= */

.content.single article {
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.content.single h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.content.single h2 {
    color: var(--accent);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.content.single p {
    line-height: 1.6;
    margin-bottom: 1rem;
}

.content.single ul, .content.single ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.content.single li {
    margin-bottom: 0.5rem;
}

/* ================= Footer ================= */

.site-footer{
    border-top:1px solid #e6e9ef;
    background:transparent;
    padding:20px 0;
    color:var(--muted);
}

/* ================= Responsive ================= */

@media (max-width:1000px){
    .projects-grid{
        grid-template-columns:repeat(2,1fr);
    }
}

@media (max-width:900px){
    .content{
        grid-template-columns:1fr;
    }
    .main-nav{
        gap:12px;
    }
    .hero h1{
        font-size:1.6rem;
    }
}

@media (max-width:640px){
    .projects-grid{
        grid-template-columns:1fr;
    }
}

@media (max-width:480px){
    .brand .tagline{
        display:none;
    }
    .wrap{
        padding:0 14px;
    }
}

/* ================= Music Player ================= */

.music-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 1.2rem;
    transition: all 0.2s;
}

.music-toggle:hover {
    background: var(--bg);
    color: var(--accent);
}

.music-player {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    height: 200px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    display: none;
    z-index: 1000;
    overflow: hidden;
}

.music-player iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.music-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.music-retry {
    position: absolute;
    top: 10px;
    right: 50px;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .music-player {
        width: 250px;
        height: 150px;
        bottom: 10px;
        right: 10px;
    }
}

/* Volume slider */
#volumeSlider {
    width: 60px;
    height: 4px;
    border-radius: 2px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

#volumeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

#volumeSlider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}
