/* ============================================================
   Páťák na Gympl – CSS
   Monochrome, calm, compact. Inspired by umimematiku.cz.
   Mobile-first. No scroll above the fold on task pages.
   ============================================================ */

:root {
    /* Grayscale-first palette */
    --c-bg: #f4f4f2;
    --c-surface: #ffffff;
    --c-surface-soft: #fafaf8;
    --c-text: #1a1a1a;
    --c-text-soft: #555555;
    --c-text-mute: #888888;
    --c-border: #d9d9d4;
    --c-border-soft: #ececea;
    --c-rule: #b8b8b3;
    /* Single subtle accent for links + focus only */
    --c-accent: #1a3a8f;
    --c-accent-soft: #eef1f8;
    /* Math/code background */
    --c-code-bg: #f1f1ee;
    /* Fonts */
    --font-body: 'Nunito', system-ui, -apple-system, sans-serif;
    --font-heading: 'Nunito', system-ui, -apple-system, sans-serif;
    --font-math: 'Cambria Math', 'STIX Two Math', 'Latin Modern Math', Georgia, serif;
    --radius: 6px;
    --radius-lg: 10px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --max-w: 820px;
    --gap: 1rem;
}

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

html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-body);
    color: var(--c-text);
    background: var(--c-bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- HEADER --- */
.site-header {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    padding: 0.6rem var(--gap);
    position: sticky;
    top: 0;
    z-index: 100;
}
.site-header__inner {
    max-width: var(--max-w);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.site-logo {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--c-text);
    text-decoration: none;
    letter-spacing: -0.01em;
}
.site-logo span { color: var(--c-text-mute); font-weight: 600; }
.site-nav { display: flex; gap: 1rem; }
.site-nav a {
    color: var(--c-text-soft);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
}
.site-nav a:hover { color: var(--c-text); border-bottom-color: var(--c-text); }

/* --- MAIN --- */
main {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 1.25rem var(--gap) 2rem;
    width: 100%;
    flex: 1;
}

/* --- BREADCRUMBS --- */
.breadcrumbs {
    font-size: 0.85rem;
    color: var(--c-text-mute);
    margin-bottom: 0.6rem;
}
.breadcrumbs a { color: var(--c-text-soft); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .sep { margin: 0 0.35rem; color: var(--c-rule); }

/* --- HEADINGS --- */
h1 {
    font-family: var(--font-heading);
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.25;
    color: var(--c-text);
    margin-bottom: 0.4rem;
    letter-spacing: -0.015em;
}
h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 1.4rem 0 0.6rem;
    color: var(--c-text);
}
h3 {
    font-size: 1.02rem;
    font-weight: 700;
    margin: 1rem 0 0.4rem;
    color: var(--c-text);
}
p { margin-bottom: 0.7rem; color: var(--c-text); }
strong { color: var(--c-text); font-weight: 700; }
a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- TASK META ROW --- */
.task-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--c-text-soft);
}
.task-diff {
    display: inline-block;
    padding: 0.1rem 0.55rem;
    border: 1px solid var(--c-border);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--c-surface);
}
.task-diff--easy { color: #2a6f3a; border-color: #b9d6c1; }
.task-diff--medium { color: #6b5410; border-color: #d6c98a; }
.task-diff--hard { color: #7a2424; border-color: #d6b1b1; }
.task-badge-free {
    display: inline-block;
    padding: 0.1rem 0.55rem;
    border: 1px solid var(--c-border);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--c-text-soft);
    background: var(--c-surface);
}
.task-sep { color: var(--c-rule); }

/* --- TASK SECTIONS --- */
.task-section {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    margin-bottom: 0.7rem;
}
.task-section__label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--c-text-mute);
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--c-border-soft);
    padding-bottom: 0.35rem;
}
.task-section p:last-child { margin-bottom: 0; }
.task-section--zadani {
    background: var(--c-surface);
    border-left: 3px solid var(--c-text);
}
.task-section--reseni { background: var(--c-surface-soft); }
.task-section--vysledek {
    border-left: 3px solid #2a6f3a;
}
.task-section--tip {
    border-left: 3px solid #a04848;
    background: var(--c-surface-soft);
}

/* --- MATH BLOCK --- */
.math {
    font-family: var(--font-math);
    background: var(--c-code-bg);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    text-align: center;
    font-size: 1.15rem;
    margin: 0.5rem 0;
    color: var(--c-text);
}

/* --- STEP LIST --- */
.step-list {
    list-style: none;
    counter-reset: step;
    padding: 0;
    margin: 0;
}
.step-list > li {
    counter-increment: step;
    position: relative;
    padding: 0.4rem 0 0.4rem 2.1rem;
    margin-bottom: 0.3rem;
}
.step-list > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0.45rem;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--c-text);
    color: var(--c-surface);
    border-radius: 50%;
    text-align: center;
    line-height: 1.5rem;
    font-size: 0.8rem;
    font-weight: 800;
}
.step-list > li + li { border-top: 1px solid var(--c-border-soft); }

/* --- DETAILS / SOLUTION TOGGLE --- */
details.solution-toggle {
    margin: 0.5rem 0 0.7rem;
}
details.solution-toggle > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.1rem;
    background: var(--c-text);
    color: var(--c-surface);
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.95rem;
    transition: background .15s;
    user-select: none;
}
details.solution-toggle > summary::-webkit-details-marker { display: none; }
details.solution-toggle > summary:hover { background: #000; }
details.solution-toggle[open] > summary {
    background: var(--c-surface);
    color: var(--c-text);
    border: 1px solid var(--c-border);
    padding: 0.55rem 1rem;
}
details.solution-toggle > summary::before {
    content: '▶';
    font-size: 0.7rem;
    display: inline-block;
    transition: transform .15s;
}
details.solution-toggle[open] > summary::before { transform: rotate(90deg); }

/* --- BACK BOX --- */
.back-box {
    margin-top: 1.2rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--c-border);
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    font-size: 0.9rem;
}
.back-box a {
    color: var(--c-text-soft);
    text-decoration: none;
}
.back-box a:hover { color: var(--c-text); text-decoration: underline; }

/* --- CATEGORY INDEX --- */
.cat-intro { color: var(--c-text-soft); margin-bottom: 1rem; }
.task-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin: 1rem 0;
}
.task-card {
    display: block;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    text-decoration: none;
    color: var(--c-text);
    transition: border-color .15s, transform .1s;
}
.task-card:hover { border-color: var(--c-text); text-decoration: none; }
.task-card:active { transform: translateY(1px); }
.task-card__title { font-weight: 700; font-size: 1rem; margin-bottom: 0.15rem; }
.task-card__meta { font-size: 0.82rem; color: var(--c-text-mute); display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.task-card--locked { opacity: 0.55; cursor: not-allowed; }
.task-card--locked:hover { border-color: var(--c-border); }
.lock-icon::before { content: '🔒'; margin-right: 0.3rem; font-size: 0.85rem; }

/* --- LONG-FORM CATEGORY CONTENT (SEO) --- */
.cat-longform { margin-top: 1.5rem; color: var(--c-text-soft); }
.cat-longform h2 { color: var(--c-text); }

/* --- FOOTER --- */
.site-footer {
    text-align: center;
    padding: 1rem var(--gap);
    border-top: 1px solid var(--c-border);
    background: var(--c-surface);
    color: var(--c-text-mute);
    font-size: 0.8rem;
}

/* --- RESPONSIVE --- */
@media (min-width: 640px) {
    h1 { font-size: 1.85rem; }
    main { padding: 1.5rem var(--gap) 2.5rem; }
    .task-grid { grid-template-columns: 1fr 1fr; }
}

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