/*
 * PT Štítky – spoločný dizajn (landing page, aplikácia, návod, firmvér, OAuth stránky).
 * Tokeny na :root, tmavý režim cez tie isté premenné. Písmo je systémové – nič sa nesťahuje.
 */

:root {
  /* farby */
  --bg: #f7f6f3;
  --bg-elev: #efede8;
  --surface: #ffffff;
  --surface-2: #f3f1ed;
  --text: #1b1d21;
  --muted: #5c6168;
  --border: #e4e1da;
  --border-strong: #cfcac0;
  --accent: #b8501a;
  --accent-hover: #9e4313;
  --accent-text: #ffffff;
  --accent-soft: #fbeadf;
  --accent-ink: #8a3a10;
  --ok: #15803d;
  --ok-soft: #e3f4e8;
  --warn: #a15c07;
  --warn-soft: #fdf1dc;
  --error: #b42318;
  --error-soft: #fde8e6;
  --info-soft: #eaeef5;
  --tape: #fffdf6;
  --tape-edge: #e8e0c8;
  --ink: #111111;
  --focus: #2563eb;
  --overlay: rgb(20 18 15 / .45);

  /* typografia */
  --font: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: system-ui, -apple-system, "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --fs-xs: .8rem;
  --fs-sm: .9rem;
  --fs-md: 1rem;
  --fs-lg: 1.15rem;
  --fs-xl: 1.4rem;
  --fs-2xl: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem);
  --fs-hero: clamp(2rem, 1.3rem + 3.2vw, 3.4rem);
  --lh: 1.5;

  /* rozostupy */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 72px;

  /* polomery a tiene */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-pill: 999px;
  --sh-1: 0 1px 2px rgb(28 25 20 / .06), 0 1px 1px rgb(28 25 20 / .04);
  --sh-2: 0 4px 14px rgb(28 25 20 / .08), 0 1px 3px rgb(28 25 20 / .06);
  --sh-3: 0 18px 50px rgb(28 25 20 / .16), 0 4px 12px rgb(28 25 20 / .08);

  --control-h: 44px;
  --content: 1120px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121416;
    --bg-elev: #17191c;
    --surface: #1b1e22;
    --surface-2: #23272c;
    --text: #ecebe7;
    --muted: #a3a8ae;
    --border: #2e3338;
    --border-strong: #41474e;
    --accent: #f08a4b;
    --accent-hover: #f6a370;
    --accent-text: #1a120c;
    --accent-soft: #3a2518;
    --accent-ink: #f6b48b;
    --ok: #4ade80;
    --ok-soft: #173123;
    --warn: #fbbf24;
    --warn-soft: #3a2c10;
    --error: #ff8a80;
    --error-soft: #3d1c1a;
    --info-soft: #1f2631;
    --tape: #f4f1e6;
    --tape-edge: #6f6a5a;
    --focus: #7aa7ff;
    --overlay: rgb(0 0 0 / .6);
    --sh-1: 0 1px 2px rgb(0 0 0 / .4);
    --sh-2: 0 6px 18px rgb(0 0 0 / .35);
    --sh-3: 0 24px 60px rgb(0 0 0 / .55);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121416;
  --bg-elev: #17191c;
  --surface: #1b1e22;
  --surface-2: #23272c;
  --text: #ecebe7;
  --muted: #a3a8ae;
  --border: #2e3338;
  --border-strong: #41474e;
  --accent: #f08a4b;
  --accent-hover: #f6a370;
  --accent-text: #1a120c;
  --accent-soft: #3a2518;
  --accent-ink: #f6b48b;
  --ok: #4ade80;
  --ok-soft: #173123;
  --warn: #fbbf24;
  --warn-soft: #3a2c10;
  --error: #ff8a80;
  --error-soft: #3d1c1a;
  --info-soft: #1f2631;
  --tape: #f4f1e6;
  --tape-edge: #6f6a5a;
  --focus: #7aa7ff;
  --overlay: rgb(0 0 0 / .6);
  --sh-1: 0 1px 2px rgb(0 0 0 / .4);
  --sh-2: 0 6px 18px rgb(0 0 0 / .35);
  --sh-3: 0 24px 60px rgb(0 0 0 / .55);
  color-scheme: dark;
}

/* ---------- základ ---------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-md)/var(--lh) var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: var(--fs-2xl); font-weight: 750; }
h2 { font-size: var(--fs-lg); font-weight: 700; }
h3 { font-size: var(--fs-md); font-weight: 650; }
p { margin: 0; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

code, kbd {
  font-family: var(--font-mono);
  font-size: .9em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 5px;
  overflow-wrap: anywhere;
}

img, svg, canvas { max-width: 100%; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.skip-link {
  position: absolute; left: var(--s-3); top: -60px; z-index: 100;
  background: var(--surface); color: var(--text); padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm); box-shadow: var(--sh-2);
}
.skip-link:focus { top: var(--s-3); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.muted { color: var(--muted); font-size: var(--fs-sm); }
.stack { display: flex; flex-direction: column; gap: var(--s-3); }
.row { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }

/* ---------- značka ---------- */

.brand { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; color: var(--text); text-decoration: none; font-weight: 750; font-size: 1.1rem; letter-spacing: -.01em; }
.brand:hover { color: var(--text); }
.brand-mark { width: 32px; height: 32px; flex: none; border-radius: 9px; box-shadow: var(--sh-1); }

/* ---------- tlačidlá ---------- */

button, .btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1.2;
  min-height: var(--control-h);
  padding: 0 var(--s-4);
  border-radius: var(--r);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
button:hover, .btn:hover { background: var(--surface-2); color: var(--text); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: default; transform: none; }

button.primary, .btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--sh-1);
}
button.primary:hover, .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }

button.ghost, .btn.ghost { background: transparent; border-color: transparent; }
button.ghost:hover, .btn.ghost:hover { background: var(--surface-2); }

button.danger, .btn.danger { color: var(--error); }
button.danger:hover { background: var(--error-soft); border-color: var(--error); }

button.small, .btn.small { min-height: 36px; padding: 0 var(--s-3); border-radius: 10px; }
.btn.large, button.large { min-height: 52px; padding: 0 var(--s-5); font-size: var(--fs-md); border-radius: 14px; }

button.link, .btn.link {
  border: 0; background: none; box-shadow: none; padding: 0 var(--s-1);
  color: var(--accent); text-decoration: underline; text-underline-offset: 2px; font-weight: 600;
}
button.link:hover { color: var(--accent-hover); background: none; }

/* ---------- formuláre ---------- */

input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], input[type="url"], select, textarea {
  font: inherit;
  font-size: var(--fs-md);
  min-height: var(--control-h);
  padding: 0 var(--s-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  max-width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
textarea { padding: var(--s-2) var(--s-3); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
input:disabled, select:disabled { opacity: .6; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 20px; height: 20px; margin: 0; flex: none; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.field > input, .field > select { width: 100%; font-weight: 400; }
.field .hint { font-weight: 400; color: var(--muted); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--fs-sm); }

/* ---------- karty a povrchy ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-4);
  box-shadow: var(--sh-1);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
@media (min-width: 600px) { .card { padding: var(--s-5); } }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); font-weight: 650; letter-spacing: .01em;
  padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

/* stavová bodka (tlačiareň, PT Link) */
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--border-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-strong) 30%, transparent); }
.dot[data-on="1"] { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }

/* hlásenia */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: var(--s-3) var(--s-4); border-radius: var(--r);
  background: var(--info-soft); color: var(--text); border: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.notice[data-kind="ok"] { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.notice[data-kind="error"] { background: var(--error-soft); border-color: color-mix(in srgb, var(--error) 35%, transparent); }
.notice[data-kind="ok"]::before, .notice[data-kind="error"]::before, .notice[data-kind="info"]::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; margin-top: .5em; flex: none; background: var(--muted);
}
.notice[data-kind="ok"]::before { background: var(--ok); }
.notice[data-kind="error"]::before { background: var(--error); }
.form-error { color: var(--error); font-weight: 600; font-size: var(--fs-sm); }

/* čipy (pásky, zarovnanie) */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { min-height: 36px; padding: 0 var(--s-3); border-radius: var(--r-pill); font-weight: 600; }
.chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* ---------- dialóg ---------- */

dialog {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  width: min(440px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: var(--s-5);
  box-shadow: var(--sh-3);
}
dialog::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
dialog[open] { animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- prihlásenie / registrácia (landing modal, aplikácia, OAuth) ---------- */

.auth { display: flex; flex-direction: column; gap: var(--s-4); }
.auth-head { display: flex; flex-direction: column; gap: 6px; }
.auth-head h2 { font-size: var(--fs-xl); }
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  background: var(--surface-2); border-radius: var(--r); border: 1px solid var(--border);
}
.auth-tabs button { min-height: 38px; border: 0; background: transparent; border-radius: 9px; color: var(--muted); }
.auth-tabs button:hover { background: transparent; color: var(--text); }
.auth-tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }
.auth form { display: flex; flex-direction: column; gap: var(--s-3); }
.auth form.auth-tabs { display: grid; gap: 4px; } /* OAuth stránka: záložky sú formulár */
.auth form .primary { width: 100%; margin-top: var(--s-1); }
.auth .fine { font-size: var(--fs-xs); color: var(--muted); text-align: center; }

/* ---------- jednoduchá stránka (OAuth, návod, firmvér) ---------- */

.page-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.page-header-inner {
  max-width: var(--content); margin: 0 auto;
  display: flex; align-items: center; gap: var(--s-3);
  padding: calc(10px + env(safe-area-inset-top)) var(--s-4) 10px;
  min-height: 60px;
}
.page-header nav { margin-left: auto; display: flex; gap: var(--s-1); align-items: center; }

.narrow { max-width: 760px; margin: 0 auto; padding: var(--s-5) var(--s-4) calc(var(--s-7) + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: var(--s-4); }

.center-shell { min-height: 100dvh; display: grid; place-items: center; padding: var(--s-4); }
.center-shell > main { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: var(--s-4); }

.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.steps li::marker { color: var(--accent); font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
