/* Základní proměnné a reset */
:root {
  --bg: #fafbfc;
  --bg-elevated: #ffffff;
  --fg: #0f172a;
  --fg-muted: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #dbeafe;
  --accent-ink: #ffffff;
  --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --gradient-subtle: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  --callout-tip: #ecfdf5;
  --callout-tip-border: #10b981;
  --callout-warn: #fff7ed;
  --callout-warn-border: #f59e0b;
  --code-bg: #0f172a;
  --code-fg: #e2e8f0;
  --container: 72rem;
  --measure: 68ch;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -2px rgba(15, 23, 42, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.12), 0 10px 10px -5px rgba(15, 23, 42, 0.04);
  --space: clamp(1rem, 2vw, 1.5rem);
  --space-lg: clamp(1.5rem, 3vw, 2.5rem);
  --space-xl: clamp(2rem, 4vw, 4rem);
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f1e;
    --bg-elevated: #0f172a;
    --fg: #f1f5f9;
    --fg-muted: #cbd5e1;
    --muted: #94a3b8;
    --muted-light: #64748b;
    --border: #1e293b;
    --border-subtle: #172033;
    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --accent-light: #1e3a8a;
    --accent-ink: #0f172a;
    --gradient-primary: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    --gradient-subtle: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --callout-tip: #022c22;
    --callout-tip-border: #10b981;
    --callout-warn: #2b1e0f;
    --callout-warn-border: #f59e0b;
    --code-bg: #020617;
    --code-fg: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.5);
  }
}

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

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.7 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Obecná typografie */
img, svg, video {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: none;
}

p {
  margin: 0 0 1.25em;
  line-height: 1.75;
}

.lead {
  font-size: clamp(1.125rem, 2.5vw, 1.375rem);
  color: var(--fg-muted);
  line-height: 1.6;
  font-weight: 400;
}

h1, h2, h3, h4 {
  margin: 2em 0 0.75em;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
}

h1:first-child,
h2:first-child,
h3:first-child,
h4:first-child {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
}

h3 {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
}

h4 {
  font-size: clamp(1.125rem, 2vw, 1.25rem);
  color: var(--fg-muted);
  font-weight: 600;
}

code, kbd, samp {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", "Source Code Pro", Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}

:not(pre) > code {
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.15em 0.4em;
  border-radius: 0.25rem;
  font-weight: 500;
  font-size: 0.875em;
}

pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  overflow: auto;
  line-height: 1.6;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-weight: normal;
}

/* Layout */
.container {
  max-width: var(--container);
  padding-inline: var(--space);
  margin-inline: auto;
}
.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}
@media (min-width: 1024px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) min( min(36ch, 30%), 320px );
    align-items: start;
  }
  .post { order: 1; }
  .toc { order: 2; }
}

/* Hlavička / patička webu */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: saturate(180%) blur(20px);
  background: rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

@media (prefers-color-scheme: dark) {
  .site-header {
    background: rgba(10, 15, 30, 0.8);
  }
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  font-weight: 800;
  font-size: 1.125rem;
  color: var(--fg);
  letter-spacing: -0.02em;
  transition: color var(--transition);
}

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

.site-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.site-nav a {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9375rem;
  transition: color var(--transition);
  position: relative;
}

.site-nav a:hover {
  color: var(--fg);
}

.site-nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width var(--transition);
}

.site-nav a:hover::after {
  width: 100%;
}

.site-footer {
  margin-top: var(--space-xl);
  border-top: 1px solid var(--border);
  padding: var(--space-lg) 0;
  color: var(--muted);
  text-align: center;
}

.site-footer a {
  color: var(--muted);
  font-weight: 500;
}

.site-footer a:hover {
  color: var(--accent);
}

/* Progress bar nahoře */
.reading-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 110;
  background: linear-gradient(90deg, var(--accent) var(--progress, 0%), transparent 0);
  transition: opacity var(--transition);
}

.reading-progress::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: var(--gradient-primary);
  width: var(--progress, 0%);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* Článek */
.post__header {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space);
  border-bottom: 1px solid var(--border-subtle);
}

.post__kicker {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: inline-block;
}

.post__title {
  margin-top: 0.5em;
  margin-bottom: 0.75rem;
}

.post__meta {
  color: var(--muted);
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.9375rem;
  margin-top: 1rem;
}

.post__content {
  max-width: var(--measure);
  font-size: 1.0625rem;
  line-height: 1.8;
}

.post__content > * + * {
  margin-top: 1.5em;
}

.post__content figure {
  margin: 2em 0;
}

.post__content figcaption {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 0.75rem;
  text-align: center;
  font-style: italic;
}

.post__footer {
  margin-top: var(--space-xl);
  padding-top: var(--space);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* TOC */
.toc {
  position: sticky; top: 80px;
  max-height: calc(100dvh - 100px);
  overflow: auto;
  padding: var(--space);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: color-mix(in oklab, var(--bg), transparent 6%);
}
.toc__title { font-weight: 700; margin-bottom: .5rem; }
.toc ol { list-style: none; padding-left: .5rem; margin: 0; }
.toc li { margin: .25rem 0; }
.toc a { color: var(--muted); }
.toc a:hover { color: var(--fg); text-decoration: none; }

/* Tabulky, seznamy, citace */
table {
  width: 100%; border-collapse: collapse; margin: 1rem 0;
  font-size: .95rem; overflow: hidden; border-radius: 12px;
  border: 1px solid var(--border);
}
thead { background: color-mix(in oklab, var(--bg), var(--fg) 4%); }
th, td { padding: .6rem .8rem; border-bottom: 1px solid var(--border); text-align: left; }
tbody tr:last-child td { border-bottom: none; }

blockquote {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--accent);
  background: var(--bg-elevated);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-style: italic;
  color: var(--fg-muted);
  position: relative;
}

blockquote::before {
  content: '"';
  position: absolute;
  top: -0.25rem;
  left: 0.75rem;
  font-size: 4rem;
  color: var(--accent);
  opacity: 0.15;
  font-family: Georgia, serif;
  line-height: 1;
  pointer-events: none;
}

blockquote p {
  margin: 0;
}

/* Callouty (info/tip/warn) */
.callout {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  background: var(--bg-elevated);
  position: relative;
  overflow: hidden;
}

.callout::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  pointer-events: none;
}

.callout strong {
  display: inline-block;
  margin-right: 0.5rem;
  font-weight: 700;
}

.callout--tip {
  background: var(--callout-tip);
  border-color: var(--callout-tip-border);
}

.callout--tip::before {
  background: var(--callout-tip-border);
}

.callout--warn {
  background: var(--callout-warn);
  border-color: var(--callout-warn-border);
}

.callout--warn::before {
  background: var(--callout-warn-border);
}

/* Tagy */
.tag-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg-elevated);
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.tag:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  text-decoration: none;
}

/* Tlačítka */
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  background: var(--gradient-primary);
  color: var(--accent-ink);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9375rem;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 100%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.btn:hover::before {
  opacity: 1;
}

.btn:active {
  transform: translateY(0);
}

/* Obrázky */
.post__content img {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transition: all var(--transition);
  width: 100%;
  height: auto;
}

.post__content img:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

/* Kakeibo tabulky */
.kakeibo-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
}

.kakeibo-table th,
.kakeibo-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.kakeibo-table th {
  background: color-mix(in oklab, var(--bg), var(--muted) 5%);
  font-weight: 600;
  color: var(--fg);
  font-size: 0.9rem;
}

.kakeibo-table tbody tr:nth-child(odd) {
  background: color-mix(in oklab, var(--bg), var(--muted) 2%);
}

.kakeibo-table tbody tr:hover {
  background: color-mix(in oklab, var(--bg), var(--accent) 5%);
}

.kakeibo-table tbody tr:last-child td {
  border-bottom: none;
}

.kakeibo-table td {
  color: var(--text);
}

.kakeibo-table td small {
  color: var(--muted);
  font-size: 0.8rem;
}

/* Thinking hats tables */
.thinking-hats-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
}

.thinking-hats-table th,
.thinking-hats-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.thinking-hats-table th {
  background: color-mix(in oklab, var(--bg), var(--muted) 5%);
  font-weight: 600;
  color: var(--fg);
  font-size: 0.9rem;
}

.thinking-hats-table tbody tr:hover {
  background: color-mix(in oklab, var(--bg), var(--accent) 5%);
}

.example-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.example-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.example-table .hat-icon {
  width: 2.5rem;
  text-align: center;
  font-size: 1.2rem;
  padding-right: 0.5rem;
}

.example-table tr:last-child td {
  border-bottom: none;
}

.example-table tr:hover {
  background: color-mix(in oklab, var(--bg), var(--accent) 3%);
}

/* Jar savings tables */
.jar-savings-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.jar-savings-table td {
  padding: 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.jar-savings-table .jar-icon {
  width: 2.5rem;
  text-align: center;
  font-size: 1.3rem;
  padding-right: 1rem;
}

.jar-savings-table .jar-category {
  min-width: 8rem;
  padding-right: 1rem;
}

.jar-savings-table .jar-description {
  color: var(--muted);
  font-style: italic;
}

.jar-savings-table tr:last-child td {
  border-bottom: none;
}

.jar-savings-table tr:hover {
  background: color-mix(in oklab, var(--bg), var(--accent) 3%);
}

.options-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.9rem;
}

.options-table th,
.options-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.options-table th {
  background: color-mix(in oklab, var(--bg), var(--muted) 5%);
  font-weight: 600;
  color: var(--fg);
  font-size: 0.85rem;
}

.options-table tbody tr:nth-child(odd) {
  background: color-mix(in oklab, var(--bg), var(--muted) 2%);
}

.options-table tbody tr:hover {
  background: color-mix(in oklab, var(--bg), var(--accent) 5%);
}

.options-table tbody tr:last-child td {
  border-bottom: none;
}

/* Utility */
.dot::before { content: "•"; margin: 0 .5rem; color: var(--muted); }
