/* wtpage.css — Individual writeup page styles */

:root {
    --blue: #6ea8fe;
    --blue-dim: #4d8fec;
    --blue-muted: rgba(110, 168, 254, 0.08);
    --blue-glow: 0 0 20px rgba(110, 168, 254, 0.15);
    --green: #22c55e;

    --bg-0: #050507;
    --bg-1: #0c0c0f;
    --bg-2: #131316;
    --bg-3: #1a1a1f;

    --text-0: #f0f0f2;
    --text-1: #b0b0b8;
    --text-2: #6e6e7a;

    --border: rgba(255, 255, 255, 0.06);
    --border-active: rgba(110, 168, 254, 0.25);

    --sans: 'Inter', system-ui, sans-serif;
    --mono: 'Fira Code', 'Cascadia Code', monospace;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);

    --nav-h: 56px;
    --max-w: 1060px;
}

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

html {
    font-size: 62.5%;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--blue) var(--bg-1);
}

body {
    font-family: var(--sans);
    font-size: 1.6rem;
    line-height: 1.7;
    color: var(--text-0);
    background: var(--bg-0);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--blue);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover { color: var(--blue-dim); }

/* ===================== NAVBAR ===================== */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    z-index: 900;
    display: flex;
    align-items: center;
    background: rgba(5, 5, 7, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 2rem;
}

.topbar-logo {
    font-family: var(--mono);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-0);
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.topbar-logo img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.topbar-logo span {
    color: var(--text-2);
    font-weight: 400;
}

.topbar-nav {
    display: flex;
    gap: 2rem;
}

.topbar-nav a {
    color: var(--text-2);
    font-size: 1.25rem;
    font-weight: 500;
    transition: color 0.2s;
}

.topbar-nav a:hover,
.topbar-nav a.active { color: var(--text-0); }

.burger {
    display: none;
    width: 22px;
    height: 16px;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
}

.burger span {
    display: block;
    height: 2px;
    background: var(--text-1);
    border-radius: 1px;
    transition: all 0.3s var(--ease);
}

.burger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.mobile-menu {
    position: fixed;
    inset: var(--nav-h) 0 0 0;
    background: var(--bg-0);
    display: flex;
    flex-direction: column;
    padding: 3rem 2rem;
    transform: translateX(-100%);
    transition: transform 0.35s var(--ease);
    z-index: 800;
    border-top: 1px solid var(--border);
}

.mobile-menu.open { transform: translateX(0); }

.mobile-menu a {
    display: block;
    padding: 1.4rem 0;
    color: var(--text-1);
    font-size: 1.6rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

.mobile-menu a:last-child { border-bottom: none; }

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

/* ===================== HERO ===================== */
.writeup-hero {
    padding-top: var(--nav-h);
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.writeup-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 70% 50%, rgba(110, 168, 254, 0.04) 0%, transparent 60%);
}

.hero-inner {
    position: relative;
    z-index: 2;
    padding: 3.6rem 2rem 3rem;
    max-width: var(--max-w);
    margin: 0 auto;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 1.2rem;
    color: var(--text-2);
    margin-bottom: 2rem;
}

.breadcrumb a { color: var(--blue); }
.breadcrumb i { font-size: 1.2rem; }

.writeup-banner {
    display: flex;
    align-items: center;
    gap: 3rem;
}

.box-avatar {
    width: 88px;
    height: 88px;
    border-radius: 14px;
    border: 1px solid var(--border-active);
    object-fit: cover;
    box-shadow: var(--blue-glow);
    flex-shrink: 0;
}

.writeup-meta h1 {
    font-size: 3.2rem;
    font-weight: 700;
    color: var(--text-0);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.writeup-meta h1 span { color: var(--blue); }

.meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
}

.meta-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
}

.meta-badge.difficulty-easy   { background: rgba(34, 197, 94, 0.08);  border-color: rgba(34, 197, 94, 0.2);  color: #34d399; }
.meta-badge.difficulty-medium { background: rgba(250, 204, 21, 0.08); border-color: rgba(250, 204, 21, 0.2); color: #fbbf24; }
.meta-badge.difficulty-hard   { background: rgba(239, 68, 68, 0.08);  border-color: rgba(239, 68, 68, 0.2);  color: #f87171; }
.meta-badge.difficulty-insane { background: rgba(168, 85, 247, 0.08); border-color: rgba(168, 85, 247, 0.2); color: #a855f7; }

.meta-badge.os-linux   { background: rgba(110, 168, 254, 0.08); border-color: rgba(110, 168, 254, 0.2); color: var(--blue); }
.meta-badge.os-windows { background: rgba(0, 120, 212, 0.08);   border-color: rgba(0, 120, 212, 0.2);   color: #60a5fa; }

.meta-badge.type-web      { background: rgba(139, 92, 246, 0.08); border-color: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.meta-badge.type-active-directory { background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.2); color: #f87171; }
.meta-badge.type-pwn      { background: rgba(110, 168, 254, 0.08); border-color: rgba(110, 168, 254, 0.2); color: var(--blue); }
.meta-badge.platform      { background: rgba(110, 168, 254, 0.06); border-color: rgba(110, 168, 254, 0.15); color: var(--blue-dim); }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
    font-family: var(--mono);
    font-size: 1.05rem;
    color: var(--text-2);
    padding: 3px 10px;
    background: var(--bg-2);
    border-radius: 4px;
    border: 1px solid var(--border);
}

.tag::before {
    content: '#';
    color: var(--blue);
    margin-right: 2px;
}

/* ===================== LAYOUT ===================== */
.writeup-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 3rem;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 3rem 2rem;
    align-items: start;
}

/* ===================== TOC SIDEBAR ===================== */
.toc-sidebar {
    position: sticky;
    top: calc(var(--nav-h) + 2rem);
}

.toc-box {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.8rem;
    font-family: var(--mono);
}

.toc-title {
    font-size: 1.1rem;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toc-title i { color: var(--blue); }

.toc-list { list-style: none; }
.toc-list li { margin-bottom: 2px; }

.toc-list a {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-1);
    font-size: 1.15rem;
    padding: 5px 8px;
    border-radius: 5px;
    transition: color 0.2s, background 0.2s;
}

.toc-list a:hover,
.toc-list a.active {
    color: var(--blue);
    background: var(--blue-muted);
}

.toc-list a i {
    font-size: 1.3rem;
    color: var(--blue);
    opacity: 0.7;
}

/* ===================== CONTENT ===================== */
.writeup-content { min-width: 0; }

.wt-section {
    margin-bottom: 5rem;
    animation: fadeInUp 0.5s var(--ease) both;
}

.wt-section:nth-child(1) { animation-delay: 0.05s; }
.wt-section:nth-child(2) { animation-delay: 0.1s; }
.wt-section:nth-child(3) { animation-delay: 0.15s; }
.wt-section:nth-child(4) { animation-delay: 0.2s; }
.wt-section:nth-child(5) { animation-delay: 0.25s; }
.wt-section:nth-child(6) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Section heading */
.section-heading {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.section-heading .heading-icon {
    width: 38px;
    height: 38px;
    background: var(--blue-muted);
    border: 1px solid var(--border-active);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.section-heading .heading-icon i {
    color: var(--blue);
    font-size: 1.8rem;
}

.section-heading h2 {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--text-0);
}

.section-heading .section-num {
    font-family: var(--mono);
    font-size: 1.1rem;
    color: var(--blue);
    opacity: 0.7;
}

/* Text */
.wt-section p {
    color: var(--text-1);
    font-size: 1.55rem;
    line-height: 1.8;
    margin-bottom: 1.2rem;
}

.wt-section ul,
.wt-section ol {
    margin: 1rem 0 1.6rem 2rem;
    color: var(--text-1);
}

.wt-section ul li,
.wt-section ol li {
    font-size: 1.55rem;
    line-height: 1.8;
    margin-bottom: 0.5rem;
}

/* Box info grid */
.box-info-card {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.box-info-item {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.4rem;
    text-align: center;
    transition: border-color 0.2s;
}

.box-info-item:hover { border-color: var(--border-active); }

.box-info-item i {
    color: var(--blue);
    font-size: 2rem;
    margin-bottom: 4px;
    display: block;
}

.box-info-item .bi-label {
    color: var(--text-2);
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 2px;
}

.box-info-item .bi-value {
    color: var(--text-0);
    font-weight: 600;
    font-size: 1.4rem;
}

/* ===================== TERMINAL BLOCKS ===================== */
.terminal-block {
    background: var(--bg-1);
    border-radius: 10px;
    border: 1px solid var(--border);
    overflow: hidden;
    margin: 2rem 0;
    font-family: var(--mono);
}

.terminal-block .tb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
}

.tb-dots { display: flex; gap: 6px; }

.tb-dots span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--bg-3);
}

.tb-label {
    font-size: 1.1rem;
    color: var(--text-2);
}

.tb-copy {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 1.05rem;
    padding: 2px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    font-family: var(--mono);
}

.tb-copy:hover  { color: var(--blue); border-color: var(--border-active); }
.tb-copy.copied { color: var(--green); border-color: rgba(34, 197, 94, 0.3); }

.terminal-block pre {
    padding: 1.6rem;
    margin: 0;
    overflow-x: auto;
    font-size: 1.3rem;
    line-height: 1.8;
    color: var(--text-1);
    white-space: pre;
}

.terminal-block pre .prompt    { color: var(--blue); font-weight: 600; }
.terminal-block pre .cmd       { color: var(--text-0); }
.terminal-block pre .output    { color: var(--text-1); }
.terminal-block pre .success   { color: var(--green); }
.terminal-block pre .highlight { color: #60a5fa; }
.terminal-block pre .warning   { color: #fbbf24; }
.terminal-block pre .error     { color: #f87171; }
.terminal-block pre .comment   { color: var(--text-2); font-style: italic; }

/* ===================== INLINE CODE ===================== */
code.inline {
    font-family: var(--mono);
    background: var(--bg-2);
    color: var(--blue);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 1.3rem;
    border: 1px solid var(--border);
}

/* ===================== IMAGES ===================== */
.writeup-img-wrap {
    margin: 2rem 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: zoom-in;
    transition: border-color 0.2s;
    position: relative;
}

.writeup-img-wrap:hover {
    border-color: var(--border-active);
}

.writeup-img-wrap img {
    width: 100%;
    height: auto;
    display: block;
}

.writeup-img-wrap .img-overlay {
    position: absolute;
    inset: 0;
    background: rgba(110, 168, 254, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.writeup-img-wrap:hover .img-overlay { opacity: 1; }

.writeup-img-wrap .img-overlay i {
    font-size: 2.6rem;
    color: white;
    background: rgba(110, 168, 254, 0.6);
    padding: 8px;
    border-radius: 50%;
}

.img-caption {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-2);
    font-family: var(--mono);
    padding: 6px;
    background: var(--bg-1);
    border-top: 1px solid var(--border);
}

/* ===================== CALLOUTS ===================== */
.callout {
    display: flex;
    gap: 1rem;
    padding: 1.2rem 1.6rem;
    border-radius: 8px;
    margin: 2rem 0;
    font-size: 1.45rem;
    border: 1px solid transparent;
}

.callout.info    { background: rgba(110, 168, 254, 0.06); border-color: rgba(110, 168, 254, 0.15); }
.callout.success { background: rgba(34, 197, 94, 0.06);   border-color: rgba(34, 197, 94, 0.15); }
.callout.warning { background: rgba(250, 204, 21, 0.06);  border-color: rgba(250, 204, 21, 0.15); }
.callout.danger  { background: rgba(239, 68, 68, 0.06);   border-color: rgba(239, 68, 68, 0.15); }

.callout i { font-size: 1.8rem; flex-shrink: 0; margin-top: 1px; }
.callout.info i    { color: var(--blue); }
.callout.success i { color: var(--green); }
.callout.warning i { color: #fbbf24; }
.callout.danger i  { color: #f87171; }
.callout p { margin: 0; color: var(--text-1); }

/* ===================== CVE BADGE ===================== */
.cve-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 1.2rem;
    font-weight: 600;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    margin: 0.4rem 0;
}

.cve-badge i { font-size: 1.5rem; }

/* ===================== LIGHTBOX ===================== */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(4px);
}

.lightbox-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    border: 1px solid var(--border);
    transform: scale(0.92);
    transition: transform 0.3s var(--ease);
}

.lightbox-overlay.active .lightbox-img { transform: scale(1); }

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    background: none;
    border: none;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    line-height: 1;
}

.lightbox-close:hover { opacity: 1; color: var(--blue); }

/* ===================== FOOTER ===================== */
.site-footer {
    padding: 3.5rem 2rem;
    text-align: center;
    border-top: 1px solid var(--border);
    margin-top: 4rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.4rem;
}

.footer-links a {
    color: var(--text-2);
    font-size: 1.8rem;
    transition: color 0.2s, transform 0.2s;
    display: inline-block;
}

.footer-links a:hover {
    color: var(--blue);
    transform: translateY(-2px);
}

.footer-copy {
    font-size: 1.15rem;
    color: var(--text-2);
    font-family: var(--mono);
}

.footer-copy a { color: var(--blue); }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
    .writeup-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .toc-sidebar {
        position: static;
        order: -1;
    }

    .toc-box {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 1.6rem;
        align-items: start;
    }

    .toc-list {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    .toc-list li { margin: 0; }

    .toc-list a {
        font-size: 1.1rem;
        padding: 4px 10px;
        background: var(--bg-2);
        border: 1px solid var(--border);
        border-radius: 16px;
    }
}

@media (max-width: 640px) {
    .hero-inner { padding: 2.4rem 1.6rem 2rem; }

    .writeup-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.6rem;
    }

    .box-avatar { width: 64px; height: 64px; }
    .writeup-meta h1 { font-size: 2.4rem; }
    .box-info-card { grid-template-columns: repeat(2, 1fr); }
    .toc-box { grid-template-columns: 1fr; }

    .writeup-layout { padding: 2rem 1.6rem; }

    .terminal-block pre {
        font-size: 1.1rem;
        padding: 1.2rem;
    }

    .section-heading h2 { font-size: 2rem; }
}

@media (max-width: 480px) {
    .writeup-meta h1 { font-size: 2rem; }
    .meta-row { gap: 0.5rem; }
    .meta-badge { font-size: 1rem; padding: 3px 8px; }
}

@media (min-width: 1921px) {
    html { font-size: 66%; }
    :root { --max-w: 1120px; }
}

@media (min-width: 2560px) {
    html { font-size: 70%; }
    :root { --max-w: 1240px; }
}
