/* Tokens. Light is the base; dark is its own palette. "System" follows the OS through the media query,
   a pinned choice sets html[data-theme]. One accent: workshop orange. */
:root {
    --bg: #F7F6F4;
    --surface: #FFFFFF;
    --hairline: rgba(0, 0, 0, .10);
    --hover: rgba(0, 0, 0, .045);
    --text: #1B1C20;
    --text-2: #5A5D68;
    --text-3: #868995;
    --accent: #C2410C;
    --accent-ink: #FFFFFF;
    --accent-soft: rgba(194, 65, 12, .10);
    --ok: #059669;
    --warn: #B45309;
    --error: #DC2626;
    --code-bg: rgba(0, 0, 0, .05);
    --img-bg: #ECEAE6;
    --shadow: 0 10px 30px rgba(0, 0, 0, .10);
    --radius: 10px;
    --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    --mono: "Cascadia Mono", ui-monospace, Consolas, monospace;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0F1013;
    --surface: #17181D;
    --hairline: rgba(255, 255, 255, .09);
    --hover: rgba(255, 255, 255, .05);
    --text: #E8E9ED;
    --text-2: #A0A3AE;
    --text-3: #70737F;
    --accent: #FB923C;
    --accent-ink: #1A0E05;
    --accent-soft: rgba(251, 146, 60, .14);
    --ok: #34D399;
    --warn: #FBBF24;
    --error: #F87171;
    --code-bg: rgba(255, 255, 255, .06);
    --img-bg: #1F2026;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0F1013;
        --surface: #17181D;
        --hairline: rgba(255, 255, 255, .09);
        --hover: rgba(255, 255, 255, .05);
        --text: #E8E9ED;
        --text-2: #A0A3AE;
        --text-3: #70737F;
        --accent: #FB923C;
        --accent-ink: #1A0E05;
        --accent-soft: rgba(251, 146, 60, .14);
        --ok: #34D399;
        --warn: #FBBF24;
        --error: #F87171;
        --code-bg: rgba(255, 255, 255, .06);
        --img-bg: #1F2026;
        --shadow: 0 10px 30px rgba(0, 0, 0, .5);
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 15px/1.55 var(--font); min-height: 100vh;
    display: flex; flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
code { font-family: var(--mono); font-size: .9em; background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.9rem; font-weight: 650; letter-spacing: -.01em; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.spacer { flex: 1; }

/* Header */
.topbar {
    position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px;
    padding: 10px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px); border-bottom: 1px solid var(--hairline);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 17px; text-decoration: none !important; }
.brand b { color: var(--accent); font-weight: 700; }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--text-2); padding: 8px 12px; border-radius: 8px; }
.nav a:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.nav a.active { color: var(--text); font-weight: 600; }
.theme-btn {
    display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; cursor: pointer;
    background: transparent; color: var(--text-2); border: 1px solid var(--hairline); border-radius: 8px; font: inherit; font-size: 13px;
}
.theme-btn:hover { background: var(--hover); color: var(--text); }
.theme-btn:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-btn svg { display: none; flex-shrink: 0; }
.theme-btn .ico-system { display: block; }
:root[data-theme="light"] .theme-btn .ico-system, :root[data-theme="dark"] .theme-btn .ico-system { display: none; }
:root[data-theme="light"] .theme-btn .ico-light { display: block; }
:root[data-theme="dark"] .theme-btn .ico-dark { display: block; }

/* Layout */
.page { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 24px 56px; flex: 1; }
.footer {
    border-top: 1px solid var(--hairline); padding: 18px 24px; color: var(--text-2); font-size: 13px;
    display: flex; flex-direction: column; gap: 6px; max-width: 1180px; width: 100%; margin: 0 auto;
}
.legal { margin: 6px 0 0; }
.footer-row { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; cursor: pointer;
    background: var(--surface); color: var(--text); border: 1px solid var(--hairline); border-radius: 8px;
    font: inherit; font-size: 14px; white-space: nowrap; text-decoration: none !important;
}
.btn:hover { background: var(--hover); }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn.accent:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.big { height: 46px; padding: 0 26px; font-size: 16px; }
.btn.small { height: 26px; padding: 0 9px; font-size: 12px; }

/* Home */
.hero { padding: 8px 0 22px; max-width: 760px; }
.lead { color: var(--text-2); font-size: 1.1rem; margin: 10px 0 0; }
.notice {
    background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    border-radius: 8px; padding: 10px 14px; margin: 0 0 18px; font-size: 14px;
}
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.filters input[type="search"] { flex: 1 1 240px; }
input[type="search"], select, input[type="text"] {
    height: 38px; padding: 0 12px; background: var(--surface); color: var(--text);
    border: 1px solid var(--hairline); border-radius: 8px; font: inherit; font-size: 14px; min-width: 0;
}
.count { margin: 0 0 14px; font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }

.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; }
.product { display: flex; flex-direction: column; transition: transform .15s ease-out, box-shadow .15s ease-out; animation: fade-up .25s ease-out both; }
.product:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.product:nth-child(2) { animation-delay: 40ms; } .product:nth-child(3) { animation-delay: 80ms; }
.product:nth-child(4) { animation-delay: 120ms; } .product:nth-child(n+5) { animation-delay: 160ms; }
.thumb { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--img-bg); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.sold-out .thumb img { opacity: .55; }
.badge {
    position: absolute; top: 10px; left: 10px; background: var(--text); color: var(--bg);
    font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 5px;
}
.noimg { display: grid; place-items: center; width: 100%; height: 100%; color: var(--text-3); font-size: 13px; }
.body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.kicker { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.title { font-size: 1rem; font-weight: 600; }
.title a { color: var(--text); }
.buy-row { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.price { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.price.big { font-size: 1.6rem; margin: 6px 0 14px; }
.empty { text-align: center; padding: 48px 12px; display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* Detail */
.crumbs { font-size: 13px; color: var(--text-3); margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.detail { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 36px; align-items: start; }
.main-img { background: var(--img-bg); border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; aspect-ratio: 1 / 1; }
.main-img img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.thumbs a { flex: none; width: 68px; height: 68px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; background: var(--img-bg); }
.thumbs a.on { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.info { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.info h1 { margin-top: 4px; }
.section-label { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin: 24px 0 8px; }
.description { white-space: pre-line; overflow-wrap: anywhere; color: var(--text); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.tag { font-size: 12px; padding: 4px 10px; border: 1px solid var(--hairline); border-radius: 999px; color: var(--text-2); }
.tag:hover { background: var(--hover); text-decoration: none; }

/* Prose */
.prose { max-width: 720px; }
.prose h2 { margin: 26px 0 8px; font-size: 1.15rem; }
.prose p, .prose li { color: var(--text-2); }

/* Logs */
.title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px; border-bottom: 1px solid var(--hairline); align-items: end; }
.toolbar label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }
.toolbar label.grow { flex: 1 1 200px; }
.toolbar label.check { flex-direction: row; align-items: center; gap: 6px; height: 38px; }
.log-table-wrap { max-height: 520px; overflow: auto; }
.log-table, .files { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.log-table th, .files th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); padding: 8px 12px; position: sticky; top: 0; background: var(--surface); }
.log-table td, .files td { padding: 6px 12px; border-top: 1px solid var(--hairline); vertical-align: top; }
.mono { font-family: var(--mono); white-space: nowrap; }
.msg { overflow-wrap: anywhere; }
.chip { display: inline-block; font-size: 10.5px; font-family: var(--mono); padding: 1px 6px; border-radius: 4px; border: 1px solid var(--hairline); color: var(--text-2); }
.lvl-warning .chip { color: var(--warn); border-color: var(--warn); }
.lvl-error .chip, .lvl-fatal .chip { color: var(--error); border-color: var(--error); }
.exc, .tail { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--code-bg); padding: 8px; border-radius: 6px; margin: 6px 0 0; }
.tail { max-height: 360px; overflow: auto; margin: 12px; }
.card > .muted { padding: 12px; margin: 0; }
.actions { display: flex; gap: 6px; }

/* Motion */
.fade-in { animation: fade-up .25s ease-out both; }
.fade-in.d1 { animation-delay: 40ms; } .fade-in.d2 { animation-delay: 80ms; }
@keyframes fade-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Phone: no horizontal scroll, drawer-free nav, 40px touch targets, stacked filters */
@media (max-width: 760px) {
    .topbar { padding: 8px 16px; gap: 8px; }
    .page { padding: 20px 16px 40px; }
    .footer { padding: 16px; }
    h1 { font-size: 1.5rem; }
    .nav a { padding: 10px 8px; min-height: 40px; display: inline-flex; align-items: center; }
    .nav-etsy { display: none !important; }
    .theme-btn { height: 40px; min-width: 40px; padding: 0 12px; }
    .filters { flex-direction: column; }
    .filters > * { width: 100%; height: 42px; flex: none !important; }
    .btn { height: 42px; }
    .btn.small { height: 40px; }
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .body { padding: 10px 12px 12px; }
    .buy-row .btn { width: 100%; }
    .detail { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .info .btn.big { width: 100%; }
    .thumbs a { width: 60px; height: 60px; }
    .log-table-wrap { max-height: 420px; }
}
@media (max-width: 340px) {
    .grid { grid-template-columns: minmax(0, 1fr); }
}

/* Language switch EN | CS | DE */
.lang { display: inline-flex; border: 1px solid var(--hairline); border-radius: 8px; overflow: hidden; }
.lang a { padding: 0 10px; height: 34px; display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--text-2); }
.lang a:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.lang a.on { background: var(--accent-soft); color: var(--accent); }
@media (max-width: 760px) {
    .lang a { height: 40px; min-width: 40px; justify-content: center; padding: 0 8px; }
    .brand span { display: none; }
}
