/* ============================================================
   juraj.zvolensky — terminal-lite stylesheet
   Light by default, dark via [data-theme="dark"] on <html>.
   Shared across index / cv / projects / article.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

/* ---- Theme tokens ---------------------------------------- */
:root {
    --bg:        #f1f0ec;
    --paper:     #fbfaf7;
    --ink:       #1b1d1c;
    --muted:     #66706b;
    --faint:     #8b938e;
    --border:    #d4d2c8;
    --border-strong: #b7b5a8;
    --accent:    #15616d;   /* deep teal — prompts, markers, links */
    --accent-2:  #b4541a;   /* warm amber — secondary accent */
    --link:      #15616d;
    --link-visited: #5a4a86;
    --selection: rgba(21, 97, 109, 0.18);
    --grid:      rgba(0, 0, 0, 0.035);
    --shadow:    3px 3px 0 var(--border-strong);
    --ok:        #3a7d44;
    --wip:       #b07d1a;
    --idle:      #7a7a7a;

    --mono: 'IBM Plex Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
    --sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
    --bg:        #14171a;
    --paper:     #1b1f23;
    --ink:       #e4e6e1;
    --muted:     #9aa39d;
    --faint:     #6f7873;
    --border:    #2f353a;
    --border-strong: #434b50;
    --accent:    #5fb6c4;
    --accent-2:  #e2884c;
    --link:      #6cc0cd;
    --link-visited: #b3a3e0;
    --selection: rgba(95, 182, 196, 0.22);
    --grid:      rgba(255, 255, 255, 0.03);
    --shadow:    3px 3px 0 #000;
    --ok:        #6bbf75;
    --wip:       #d9aa45;
    --idle:      #9a9a9a;
}

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

::selection { background: var(--selection); }

html { scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.7;
    color: var(--ink);
    background-color: var(--bg);
    /* faint engineering-paper grid */
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 24px 24px;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* ---- Layout ---------------------------------------------- */
.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

/* ---- Top bar / nav --------------------------------------- */
.topbar {
    max-width: 820px;
    margin: 0 auto;
    padding: 22px 24px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.brand {
    font-family: var(--mono);
    font-weight: 600;
    font-size: 0.98rem;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: -0.3px;
}

.brand:hover { color: var(--accent); }

.brand .cursor {
    color: var(--accent);
    animation: blink 1.1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.nav {
    font-family: var(--mono);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nav a {
    color: var(--muted);
    text-decoration: none;
    padding: 2px 0;
    border-bottom: 1px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.nav a.current { color: var(--ink); border-bottom-color: var(--accent); }
.nav .sep { color: var(--border-strong); }

#theme-toggle {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--border);
    padding: 3px 9px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.15s ease;
}

#theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.topbar-rule {
    max-width: 820px;
    margin: 0 auto;
    border-top: 1px solid var(--border);
}

/* ---- Page header ----------------------------------------- */
.page-head {
    padding: 48px 0 36px;
}

.page-head h1 {
    font-family: var(--mono);
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    font-weight: 600;
    letter-spacing: -1px;
    line-height: 1.1;
    color: var(--ink);
}

.page-head .role {
    font-family: var(--mono);
    font-size: 1rem;
    color: var(--muted);
    margin-top: 10px;
}

.page-head .tagline {
    font-size: 1rem;
    color: var(--accent);
    margin-top: 18px;
}

.page-head .tagline::before { content: '> '; color: var(--accent-2); }

/* ---- Section header: "## about ────────" ----------------- */
.sh {
    font-family: var(--mono);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 44px 0 20px;
    letter-spacing: 0.2px;
}

.sh::before { content: '##'; color: var(--accent); font-weight: 500; }
.sh::after {
    content: '';
    flex: 1;
    border-top: 1px solid var(--border);
}

/* ---- Boxes (terminal window panels) ---------------------- */
.box {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 2px;
    box-shadow: var(--shadow);
    margin-bottom: 22px;
}

.box__bar {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--faint);
    padding: 7px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(var(--grid), var(--grid));
}

.box__bar::before {
    content: '';
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 13px 0 0 var(--wip), 26px 0 0 var(--ok);
    margin-right: 22px;
}

.box__body { padding: 22px 24px; }
.box__body > :last-child { margin-bottom: 0; }

p { margin-bottom: 16px; color: var(--ink); }
.muted { color: var(--muted); }

a { color: var(--link); }
a:visited { color: var(--link-visited); }

/* ---- Buttons / pill links -------------------------------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

.btn {
    font-family: var(--mono);
    font-size: 0.86rem;
    color: var(--accent);
    text-decoration: none;
    border: 1px solid var(--border-strong);
    background: var(--paper);
    padding: 9px 16px;
    border-radius: 2px;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:visited { color: var(--accent); }

.btn:hover {
    color: var(--paper);
    background: var(--accent);
    border-color: var(--accent);
    transform: translate(-1px, -1px);
    box-shadow: 2px 2px 0 var(--border-strong);
}

.btn::before { content: '$'; color: var(--accent-2); }
.btn:hover::before { color: var(--paper); }

/* ---- Tag / chip ------------------------------------------ */
.tags { display: flex; flex-wrap: wrap; gap: 7px; }

.tag {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--muted);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 2px;
    background: var(--bg);
}
.tag::before { content: '#'; color: var(--accent); }

/* ---- Status badge ---------------------------------------- */
.status {
    font-family: var(--mono);
    font-size: 0.74rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
}
.status::before { content: '●'; }
.status.active::before { color: var(--ok); }
.status.wip::before    { color: var(--wip); }
.status.archived::before { color: var(--idle); }

/* ---- Generic list ---------------------------------------- */
.list { list-style: none; }
.list li {
    position: relative;
    padding-left: 22px;
    margin-bottom: 10px;
    color: var(--ink);
}
.list li::before {
    content: '–';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-family: var(--mono);
}

/* ============================================================
   CV page specifics
   ============================================================ */
.contact {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 18px;
}
.contact a { text-decoration: none; }
.contact a:hover { text-decoration: underline; }

.entry { margin-bottom: 26px; }
.entry:last-child { margin-bottom: 0; }

.entry__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 16px;
}
.entry__title { font-weight: 600; color: var(--ink); }
.entry__org { color: var(--accent); font-family: var(--mono); font-size: 0.9rem; }
.entry__date {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--faint);
    white-space: nowrap;
}
.entry .list { margin-top: 10px; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.grid h4 {
    font-family: var(--mono);
    font-size: 0.9rem;
    color: var(--accent);
    margin-bottom: 8px;
}
.grid h4::before { content: '› '; color: var(--accent-2); }

/* ============================================================
   Projects page specifics
   ============================================================ */
.filter-nav {
    font-family: var(--mono);
    font-size: 0.82rem;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 30px;
}
.filter-btn {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--muted);
    background: var(--paper);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.filter-btn:hover { color: var(--accent); border-color: var(--accent); }
.filter-btn.active {
    color: var(--paper);
    background: var(--accent);
    border-color: var(--accent);
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.card { display: flex; flex-direction: column; }
.card .box__body { display: flex; flex-direction: column; flex: 1; }
.card__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}
.card__title { font-weight: 600; font-size: 1.1rem; color: var(--ink); }
.card__desc { color: var(--muted); flex: 1; margin-bottom: 16px; }
.card__meta { margin-bottom: 14px; }

.articles { display: flex; flex-direction: column; gap: 14px; }
.article-item {
    display: flex;
    gap: 14px;
    align-items: baseline;
    text-decoration: none;
    color: var(--ink);
    padding: 4px 0;
}
.article-item .marker { font-family: var(--mono); color: var(--accent); }
.article-item:hover .article-item__title { color: var(--accent); }
.article-item__title { font-weight: 600; }
.article-item__desc { color: var(--muted); font-size: 0.95rem; }
.article-item__date { font-family: var(--mono); font-size: 0.8rem; color: var(--faint); }

/* ============================================================
   Article page — markdown rendering
   ============================================================ */
.back-link {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--muted);
    text-decoration: none;
    display: inline-block;
    margin: 8px 0 28px;
}
.back-link:hover { color: var(--accent); }
.back-link::before { content: '< '; color: var(--accent-2); }

#article-meta {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--faint);
    border-bottom: 1px solid var(--border);
    padding-bottom: 18px;
    margin-bottom: 30px;
}
#article-meta div { margin-bottom: 4px; }
#article-meta strong { color: var(--muted); font-weight: 500; }

#loading { font-family: var(--mono); color: var(--muted); padding: 40px 0; }
.spinner-dots::after {
    content: '';
    animation: dots 1.2s steps(4, end) infinite;
}
@keyframes dots {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
}

#error {
    display: none;
    font-family: var(--mono);
    border: 1px solid var(--accent-2);
    border-radius: 2px;
    background: var(--paper);
    padding: 24px;
    color: var(--ink);
}
#error h2 { color: var(--accent-2); margin-bottom: 8px; font-size: 1.1rem; }

#article-content { display: none; }

/* markdown body */
#markdown-body { font-size: 1.02rem; }
#markdown-body > :first-child { margin-top: 0; }

#markdown-body h1 {
    font-family: var(--mono);
    font-size: 1.9rem;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 8px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
#markdown-body h2 {
    font-family: var(--mono);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--ink);
    margin: 40px 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
#markdown-body h2::before { content: '##'; color: var(--accent); font-weight: 500; }
#markdown-body h3 {
    font-family: var(--mono);
    font-size: 1.12rem;
    font-weight: 600;
    color: var(--ink);
    margin: 28px 0 12px;
}
#markdown-body h3::before { content: '### '; color: var(--accent); font-weight: 500; }
#markdown-body h4, #markdown-body h5, #markdown-body h6 {
    font-family: var(--mono);
    color: var(--accent);
    margin: 22px 0 10px;
}

#markdown-body p { margin-bottom: 18px; line-height: 1.8; color: var(--ink); }
#markdown-body a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
#markdown-body a:hover { color: var(--accent-2); }

#markdown-body ul, #markdown-body ol { margin: 0 0 18px 1.2em; }
#markdown-body li { margin-bottom: 8px; line-height: 1.7; }
#markdown-body ul li::marker { color: var(--accent); content: '– '; }

#markdown-body code {
    font-family: var(--mono);
    font-size: 0.88em;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--accent-2);
    padding: 1px 5px;
    border-radius: 2px;
}

#markdown-body pre {
    background: var(--paper);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 2px;
    padding: 18px;
    overflow-x: auto;
    margin-bottom: 20px;
}
#markdown-body pre code {
    background: none;
    border: none;
    color: var(--ink);
    padding: 0;
    font-size: 0.86rem;
    line-height: 1.6;
}

#markdown-body blockquote {
    border-left: 3px solid var(--accent-2);
    background: var(--bg);
    padding: 12px 18px;
    margin: 0 0 20px;
    color: var(--muted);
}
#markdown-body blockquote p:last-child { margin-bottom: 0; }

#markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 22px;
    font-size: 0.92rem;
    border: 1px solid var(--border);
}
#markdown-body th {
    font-family: var(--mono);
    background: var(--bg);
    color: var(--accent);
    text-align: left;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-strong);
}
#markdown-body td { padding: 9px 12px; border-top: 1px solid var(--border); color: var(--ink); }
#markdown-body tr:hover td { background: var(--bg); }

#markdown-body img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 2px;
    margin: 8px 0 20px;
}
#markdown-body hr { border: none; border-top: 1px dashed var(--border-strong); margin: 32px 0; }

/* ---- Footer ---------------------------------------------- */
footer {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--faint);
    text-align: center;
    margin-top: 64px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
footer p { color: var(--faint); margin-bottom: 6px; }
footer .sig { color: var(--accent); }

/* ---- Responsive ------------------------------------------ */
@media (max-width: 640px) {
    .topbar { flex-direction: column; align-items: flex-start; gap: 12px; }
    .page-head { padding: 32px 0 24px; }
    .entry__head { flex-direction: column; }
    .cards { grid-template-columns: 1fr; }
    .box__body { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto; }
}
