/* =====================================================================
 * MySubs — Design tokens & global styles
 * Aesthetic: editorial × modern brutalism, dark obsidian + electric lime + warm clay accents
 * Typography: "Fraunces" (display) + "Geist" / "Geist Mono" (UI/code) + "Instrument Serif"
 * ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,300;9..144,400;9..144,600;9..144,800;9..144,900&family=Instrument+Serif:ital@0;1&family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap');

:root {
    /* — Core palette — */
    --ink: #0b0b0a;
    --ink-2: #141413;
    --ink-3: #1d1d1b;
    --paper: #f4f1ea;
    --paper-2: #ebe6dc;
    --paper-3: #d6d0c2;
    --bone: #fffef9;

    /* — Accents — */
    --lime: #d8ff3e;
    --lime-soft: #e9ff7a;
    --clay: #c4654a;
    --clay-soft: #e08a6f;
    --moss: #4a5d3a;
    --plum: #4a2545;
    --gold: #d4a948;

    /* — Semantic — */
    --bg: var(--paper);
    --bg-alt: var(--paper-2);
    --bg-card: var(--bone);
    --fg: var(--ink);
    --fg-soft: #4a4a48;
    --fg-mute: #6f6f6c;
    --line: #1a1a18;
    --line-soft: #c8c2b3;

    --accent: var(--lime);
    --accent-fg: var(--ink);
    --warning: var(--clay);
    --success: #2f7a3a;
    --danger:  #b13838;
    --info:    #2c5f8d;

    /* — Type — */
    --font-display: 'Fraunces', Georgia, serif;
    --font-serif:   'Instrument Serif', Georgia, serif;
    --font-sans:    'Geist', -apple-system, system-ui, sans-serif;
    --font-mono:    'Geist Mono', ui-monospace, monospace;

    /* — Radii (brutalist: minimal rounding) — */
    --r-sm: 4px;
    --r-md: 8px;
    --r-lg: 14px;
    --r-xl: 22px;

    /* — Shadows — */
    --shadow-hard:  4px 4px 0 var(--ink);
    --shadow-hard-lg: 8px 8px 0 var(--ink);
    --shadow-soft: 0 6px 24px -8px rgba(11,11,10,0.18);
    --shadow-pop:  0 18px 48px -12px rgba(11,11,10,0.25);

    /* — Layout — */
    --container: 1240px;
    --gutter: 28px;
    --header-h: 76px;
}

[data-theme="dark"] {
    --bg: var(--ink);
    --bg-alt: var(--ink-2);
    --bg-card: var(--ink-3);
    --fg: var(--paper);
    --fg-soft: #c8c4b8;
    --fg-mute: #92908a;
    --line: var(--paper);
    --line-soft: #2c2c2a;
    --accent-fg: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Selection */
::selection { background: var(--lime); color: var(--ink); }

/* Subtle paper grain on light bg */
body::before {
    content: '';
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: .35;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
[data-theme="dark"] body::before { mix-blend-mode: screen; opacity: .12; }

/* Scrollbar */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink); border: 3px solid var(--bg); border-radius: 999px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--paper); }

/* ==================== TYPOGRAPHY ==================== */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.02;
    margin: 0;
    color: var(--fg);
}
h1 { font-size: clamp(3rem, 9vw, 7.5rem); font-weight: 900; letter-spacing: -0.04em; }
h2 { font-size: clamp(2.2rem, 5vw, 4rem); font-weight: 800; letter-spacing: -0.03em; }
h3 { font-size: clamp(1.5rem, 2.5vw, 2.1rem); font-weight: 700; }
h4 { font-size: 1.2rem; font-weight: 600; }
p  { margin: 0; }

.lead {
    font-family: var(--font-serif);
    font-size: clamp(1.2rem, 1.8vw, 1.6rem);
    line-height: 1.45;
    font-style: italic;
    color: var(--fg-soft);
    max-width: 56ch;
}
.eyebrow {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fg-mute);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.eyebrow::before {
    content: ''; width: 32px; height: 1px;
    background: currentColor;
}
.italic-script {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
}

/* Buttons */
.btn {
    --b-bg: var(--ink);
    --b-fg: var(--paper);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 26px;
    background: var(--b-bg);
    color: var(--b-fg);
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.96rem;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, background .2s ease;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-hard); }
.btn:active { transform: translate(0, 0); box-shadow: none; }
.btn--accent { --b-bg: var(--lime); --b-fg: var(--ink); }
.btn--ghost  { --b-bg: transparent; --b-fg: var(--ink); }
[data-theme="dark"] .btn--ghost { --b-fg: var(--paper); border-color: var(--paper); }
.btn--clay   { --b-bg: var(--clay); --b-fg: var(--bone); border-color: var(--clay); }
.btn--sm { padding: 9px 16px; font-size: 0.85rem; }
.btn--lg { padding: 18px 32px; font-size: 1rem; }
.btn--block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* Card */
.card {
    background: var(--bg-card);
    color: var(--fg);
    border: 1.5px solid var(--line);
    border-radius: var(--r-lg);
    padding: 24px;
    transition: transform .25s ease, box-shadow .25s ease;
}
.card strong { color: var(--fg); }
.card--hard { box-shadow: var(--shadow-hard); }
.card--hard:hover { transform: translate(-3px, -3px); box-shadow: var(--shadow-hard-lg); }
.card--soft { border: 1px solid var(--line-soft); border-radius: var(--r-lg); box-shadow: var(--shadow-soft); }

/* Layout */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding-inline: var(--gutter);
    position: relative;
    z-index: 1;
}
.flex { display: flex; }
.grid { display: grid; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.gap-4 { gap: 36px; }

/* Pill */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--bg-alt);
    border: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.pill--accent { background: var(--lime); border-color: var(--ink); color: var(--ink); }
.pill--success { background: #d8ebd5; color: #224e26; border-color: #224e26; }
.pill--danger  { background: #f3d5d2; color: #6e1f1f; border-color: #6e1f1f; }
.pill--warn    { background: #f6e1c9; color: #6b3e0a; border-color: #6b3e0a; }
.pill--mute    { background: var(--bg-alt); color: var(--fg-mute); border-color: var(--line-soft); }

/* Inputs */
.field {
    display: flex; flex-direction: column; gap: 6px;
}
.label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--fg-mute);
}
.input, .select, .textarea {
    width: 100%;
    background: var(--bg-card);
    border: 1.5px solid var(--line);
    border-radius: var(--r-md);
    padding: 12px 14px;
    font-family: var(--font-sans);
    font-size: 0.96rem;
    color: var(--fg);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
}
[data-theme="dark"] .input:focus, [data-theme="dark"] .select:focus, [data-theme="dark"] .textarea:focus {
    box-shadow: 3px 3px 0 var(--paper);
}
.textarea { min-height: 100px; resize: vertical; }
.help { font-size: 0.82rem; color: var(--fg-mute); }
.error { font-size: 0.82rem; color: var(--danger); font-family: var(--font-mono); }

/* Header / nav */
.app-header {
    position: sticky; top: 0; z-index: 50;
    height: var(--header-h);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(14px);
    border-bottom: 1.5px solid var(--line);
}
.app-header__inner {
    height: 100%;
    display: flex; align-items: center; justify-content: space-between;
    gap: 20px;
}
.brand {
    display: inline-flex; align-items: center; gap: 12px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.55rem;
    letter-spacing: -0.03em;
    color: var(--fg);
    text-decoration: none;
}
.brand__mark {
    width: 38px; height: 38px;
    background: var(--ink);
    color: var(--lime);
    display: grid; place-items: center;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-weight: 700;
    transform: rotate(-4deg);
    transition: transform .3s;
}
.brand:hover .brand__mark { transform: rotate(4deg); }
[data-theme="dark"] .brand__mark { background: var(--lime); color: var(--ink); }

.nav-links {
    display: flex; align-items: center; gap: 32px;
}
.nav-links a {
    color: var(--fg);
    text-decoration: none;
    font-size: 0.95rem;
    position: relative;
}
.nav-links a::after {
    content: ''; position: absolute; left: 0; right: 100%; bottom: -4px;
    height: 2px; background: var(--ink);
    transition: right .25s;
}
.nav-links a:hover::after { right: 0; }
[data-theme="dark"] .nav-links a::after { background: var(--paper); }

/* Toast */
.toast-host {
    position: fixed; right: 24px; bottom: 24px; z-index: 100;
    display: flex; flex-direction: column; gap: 10px;
}
.toast {
    background: var(--ink); color: var(--paper);
    padding: 14px 18px;
    border-radius: var(--r-md);
    box-shadow: var(--shadow-hard);
    font-size: 0.9rem;
    border: 1.5px solid var(--ink);
    animation: toast-in .3s cubic-bezier(.2,.9,.3,1.2);
    max-width: 360px;
}
.toast--ok    { background: #2f7a3a; border-color: #1f5024; }
.toast--err   { background: #b13838; border-color: #7a1e1e; }
.toast--warn  { background: var(--clay); border-color: #6b2f1c; }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Modal */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(11,11,10,0.55);
    backdrop-filter: blur(4px);
    display: grid; place-items: center;
    z-index: 90;
    padding: 20px;
    animation: fade .2s;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: var(--bg-card);
    border: 1.5px solid var(--ink);
    border-radius: var(--r-lg);
    padding: 32px;
    box-shadow: var(--shadow-hard-lg);
    max-width: 560px;
    width: 100%;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    animation: modal-in .25s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes modal-in { from { transform: translateY(20px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal__title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.modal__close {
    background: transparent; border: 1.5px solid var(--line); width: 32px; height: 32px;
    border-radius: 999px; cursor: pointer; display: grid; place-items: center;
    color: var(--fg);
}
.modal__close:hover { background: var(--ink); color: var(--paper); }

/* Loading spinner */
.spinner {
    width: 18px; height: 18px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 999px;
    display: inline-block;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
    background: linear-gradient(90deg, var(--bg-alt) 0%, var(--line-soft) 50%, var(--bg-alt) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: var(--r-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Utility */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.flex-1 { flex: 1; }
.divider { height: 1px; background: var(--line-soft); margin: 24px 0; }
.divider--strong { height: 1.5px; background: var(--line); }

/* Responsive */
@media (max-width: 768px) {
    :root { --gutter: 18px; --header-h: 64px; }
    .nav-links { display: none; }
    h1 { font-size: clamp(2.4rem, 11vw, 4rem); }

    /* Header buttons — make compact on mobile so they don't overflow */
    .app-header__inner > div { gap: 6px !important; }
    .app-header__inner .btn--sm {
        padding: 8px 12px;
        font-size: 0.82rem;
    }
    .app-header__inner .theme-toggle {
        width: 36px;
        height: 36px;
    }
    .brand { font-size: 1.25rem; }
    .brand__mark { width: 32px; height: 32px; font-size: 0.95rem; }
}

/* Very small phones — hide login button, keep only "Začít zdarma" + theme toggle */
@media (max-width: 420px) {
    .app-header__inner .btn--ghost { display: none; }
    .app-header__inner .btn--sm { padding: 8px 14px; }
    .brand { font-size: 1.15rem; gap: 8px; }
}
