/* ============================================================================
   PULT — base.css
   Reset, typografie, fokus, přístupnost, utility.
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: calc(100% * var(--font-scale, 1));
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
  overscroll-behavior: none;
}

body {
  margin: 0;
  height: 100%;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-md);
  letter-spacing: var(--tracking-snug);
  font-weight: var(--fw-regular);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Zámek posunu, když je otevřená plovoucí vrstva. */
body[data-scroll-lock="on"] { overflow: hidden; }

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

h1, h2, h3, h4 {
  font-weight: var(--fw-semi);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-lg);
  text-wrap: balance;
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

img, svg, video, canvas { display: block; max-width: 100%; }

button, input, select, textarea {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
}
button { background: none; border: 0; padding: 0; cursor: pointer; }

/* ── Fokus ──────────────────────────────────────────────────────────────
   Viditelný vždy, když jde o klávesnici. U myši/doteku neruší. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
.u-focus-inset:focus-visible { outline-offset: -3px; }

::selection { background: var(--accent-soft-2); color: var(--text); }

/* ── Čísla ──────────────────────────────────────────────────────────────
   Všechny částky jsou tabulková a vpravo zarovnaná. Číslo na účtence
   musí držet sloupec. */
.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums slashed-zero;
  font-feature-settings: "tnum" 1, "zero" 1, "cv01" 1;
  letter-spacing: var(--tracking-snug);
}
.num-lg { font-size: var(--fs-xl); font-weight: var(--fw-semi); letter-spacing: var(--tracking-tight); }
.num-xl { font-size: var(--fs-2xl); font-weight: var(--fw-semi); letter-spacing: -0.025em; }
.num-display {
  font-size: var(--fs-display);
  font-weight: var(--fw-semi);
  letter-spacing: -0.03em;
  line-height: var(--lh-display);
}
.num-hero {
  font-size: clamp(2.75rem, 7vw, 4.25rem);
  font-weight: var(--fw-semi);
  letter-spacing: -0.035em;
  line-height: 1;
}
/* slashed-zero: přeškrtnutá nula se ve vytištěné účtence neplete s osmičkou. */

/* ── Textové utility ─────────────────────────────────────────────────── */
.t-xs  { font-size: var(--fs-xs); line-height: var(--lh-xs); }
.t-sm  { font-size: var(--fs-sm); line-height: var(--lh-sm); }
.t-md  { font-size: var(--fs-md); }
.t-lg  { font-size: var(--fs-lg); line-height: var(--lh-lg); }
.t-xl  { font-size: var(--fs-xl); line-height: var(--lh-xl); }
.t-2xl { font-size: var(--fs-2xl); line-height: var(--lh-2xl); }

.t-med  { font-weight: var(--fw-medium); }
.t-semi { font-weight: var(--fw-semi); }
.t-2    { color: var(--text-2); }
.t-3    { color: var(--text-3); }
.t-accent { color: var(--accent-text); }
.t-success { color: var(--s-success); }
.t-warning { color: var(--s-warning); }
.t-danger  { color: var(--s-danger); }

.t-right { text-align: right; }
.t-center { text-align: center; }
.t-nowrap { white-space: nowrap; }
.t-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-balance { text-wrap: balance; }
.t-pretty { text-wrap: pretty; }

/* Popisek nad hodnotou — malý, ale ne verzálkový. Verzálky s rozestupem
   jsou univerzální výplň; tady nese informaci velikost a barva. */
.label {
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  color: var(--text-2);
  font-weight: var(--fw-medium);
}
.label-xs {
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--text-3);
  font-weight: var(--fw-medium);
}

/* ── Rozvržení ───────────────────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: var(--s-3); }
.row-tight { display: flex; align-items: center; gap: var(--s-2); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.col { display: flex; flex-direction: column; }
.col-tight { display: flex; flex-direction: column; gap: var(--s-1); }
.grow { flex: 1 1 auto; min-width: 0; }
.shrink-0 { flex: 0 0 auto; }
.stack-2 { display: flex; flex-direction: column; gap: var(--s-2); }
.stack-3 { display: flex; flex-direction: column; gap: var(--s-3); }
.stack-4 { display: flex; flex-direction: column; gap: var(--s-4); }
.stack-5 { display: flex; flex-direction: column; gap: var(--s-5); }
.stack-6 { display: flex; flex-direction: column; gap: var(--s-6); }
.wrap { flex-wrap: wrap; }

.divider { height: 1px; background: var(--border-soft); border: 0; margin: 0; flex: 0 0 auto; }
.divider-v { width: 1px; align-self: stretch; background: var(--border-soft); flex: 0 0 auto; }

.scroll-y { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.scroll-x { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }

/* ── Skrývání ────────────────────────────────────────────────────────── */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
[hidden] { display: none !important; }

/* ── Skeleton ────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: skeleton-wave 1.4s ease infinite;
  border-radius: var(--r-sm);
}
@keyframes skeleton-wave {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ── Klávesové zkratky ───────────────────────────────────────────────── */
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--r-xs);
}

/* ── Pohyb: respekt k systémovému nastavení ──────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* Přepnutí motivu: barvy se mají změnit okamžitě, ne se přelévat. */
:root.is-switching-theme *,
:root.is-switching-theme *::before,
:root.is-switching-theme *::after {
  transition: none !important;
}

/* Třída pro ruční vypnutí pohybu v nastavení (přepíše i delší animace). */
:root[data-motion="reduced"] * {
  animation-duration: 1ms !important;
  transition-duration: 1ms !important;
}

/* ── Tisk (účtenka) ──────────────────────────────────────────────────── */
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
}
