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

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg:          #0d1117;
    --surface:     #161b22;
    --surface2:    #21262d;
    --border:      #30363d;
    --accent:      #58a6ff;
    --accent2:     #3fb950;
    --danger:      #f85149;
    --warning:     #d29922;
    --text:        #e6edf3;
    --text-muted:  #8b949e;
    --code-bg:     #1c2128;
    --flag-bg:     #1a2a1a;
    --flag-border: #3fb950;
    --flag-text:   #3fb950;
    --radius:      8px;
    --max-width:   860px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ---------- Layout ---------- */
.page-wrapper {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px 60px;
}

/* ---------- Header / Hero ---------- */
.site-header {
    border-bottom: 1px solid var(--border);
    padding: 32px 0 24px;
    margin-bottom: 40px;
}

.site-header .breadcrumb {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8em;
    color: var(--text-muted);
    margin-bottom: 12px;
    letter-spacing: 0.03em;
}

.site-header .breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

.site-header .breadcrumb a:hover {
    text-decoration: underline;
}

.site-header h1 {
    font-size: 2em;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.site-header .subtitle {
    margin-top: 8px;
    font-size: 0.9em;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* ---------- Navigation back ---------- */
.nav-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.875em;
    font-weight: 600;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    transition: background 0.15s, border-color 0.15s;
    margin-bottom: 32px;
    margin-top: 8px;
}

.nav-back:hover {
    background: var(--surface2);
    border-color: var(--accent);
    text-decoration: none;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

h2 {
    font-size: 1.4em;
    margin-top: 2.5em;
    margin-bottom: 0.75em;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
    color: var(--accent);
}

h3 {
    font-size: 1.1em;
    margin-top: 1.8em;
    margin-bottom: 0.5em;
    color: var(--text);
}

p {
    margin-bottom: 1em;
    color: var(--text);
}

ul, ol {
    margin: 0.5em 0 1em 1.5em;
}

li {
    margin-bottom: 4px;
}

strong {
    color: var(--text);
    font-weight: 700;
}

/* ---------- Links ---------- */
a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ---------- Code blocks ---------- */
pre {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.875em;
    background: var(--code-bg);
    color: #c9d1d9;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 16px 20px;
    overflow-x: auto;
    margin-bottom: 1.25em;
    line-height: 1.6;
}

code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875em;
    background: var(--code-bg);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

/* ---------- Flag highlight ---------- */
pre.flag {
    background: var(--flag-bg);
    border-left: 4px solid var(--flag-border);
    color: var(--flag-text);
    font-weight: 700;
    font-size: 1em;
    letter-spacing: 0.03em;
    position: relative;
}

pre.flag::before {
    content: '🚩 FLAG';
    display: block;
    font-size: 0.7em;
    letter-spacing: 0.1em;
    color: var(--flag-border);
    margin-bottom: 8px;
    opacity: 0.8;
}

/* ---------- Images ---------- */
img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 16px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

/* ---------- Callout / info box ---------- */
.callout {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--warning);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 1.25em;
    font-size: 0.9em;
    color: var(--text-muted);
}

.callout strong {
    color: var(--warning);
}

/* ---------- Tags / badges ---------- */
.tag {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72em;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.04em;
    vertical-align: middle;
}

.tag-web    { background: #1c2a3a; color: #58a6ff; border: 1px solid #1e4280; }
.tag-rootme { background: #1a1a2e; color: #a78bfa; border: 1px solid #4c3a7a; }
.tag-easy   { background: #1a2e1a; color: #3fb950; border: 1px solid #2a5a2a; }

/* ---------- Write-up card (index) ---------- */
.writeup-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.writeup-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: border-color 0.15s, background 0.15s;
    text-decoration: none;
    color: var(--text);
}

.writeup-card:hover {
    border-color: var(--accent);
    background: var(--surface2);
    text-decoration: none;
}
/* ---------- Reset & Base ---------- */
.writeup-card .card-title {
    font-weight: 600;
    font-size: 1em;
    color: var(--text);
    margin-bottom: 4px;
}

.writeup-card .card-meta {
    font-size: 0.8em;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.writeup-card .card-arrow {
    color: var(--text-muted);
    font-size: 1.2em;
    flex-shrink: 0;
}

/* ---------- Section category header (index) ---------- */
.category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 32px 0 16px;
    font-size: 0.85em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.category-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ---------- Footer ---------- */
.site-footer {
    margin-top: 60px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.8em;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    body { font-size: 15px; }
    .site-header h1 { font-size: 1.5em; }
    .writeup-card { flex-direction: column; align-items: flex-start; }
}
