/* =====================================================================
   Pocket – vzhled v2: tónované plochy podle barvy aplikace, teplé neutrály,
   sklo na lištách a plovoucích prvcích, jednotná typografie, pohyb.
   Načítá se po app.css a přepisuje jeho základní tokeny.
   ===================================================================== */

/* ---------- Tokeny ---------- */
:root {
  --r-xs: 8px; --r-sm: 12px; --r-md: 16px; --r-lg: 24px; --r-xl: 28px;
  --topbar-h: calc(60px + env(safe-area-inset-top));
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.45, .55, 1);
  /* typografie */
  --fs-display: 38px; --fs-headline: 30px; --fs-title: 20px; --fs-title-s: 17px;
  --fs-body: 15px; --fs-label: 13px; --fs-small: 12px;
}
:root:not([data-theme="dark"]) {
  --bg: color-mix(in srgb, var(--primary) 5%, #F6F3EF);
  --surface: color-mix(in srgb, var(--primary) 2.5%, #FFFCF9);
  --surface-hi: color-mix(in srgb, var(--primary) 1.5%, #FFFFFF);
  --bg-2: color-mix(in srgb, var(--primary) 8%, #F0ECE7);
  --bg-3: color-mix(in srgb, var(--primary) 13%, #E8E2DC);
  --line: color-mix(in srgb, var(--primary) 9%, #E6E0D9);
  --line-2: color-mix(in srgb, var(--primary) 14%, #CEC7BF);
  --text: color-mix(in srgb, var(--primary) 8%, #1C1A18);
  --text-2: color-mix(in srgb, var(--primary) 10%, #45413D);
  --text-3: color-mix(in srgb, var(--primary) 10%, #625D58);
  --text-4: color-mix(in srgb, var(--primary) 10%, #8A847E);
  --glass: color-mix(in srgb, var(--surface-hi) 68%, transparent);
  --glass-strong: color-mix(in srgb, var(--surface-hi) 82%, transparent);
  --glass-line: rgba(255, 255, 255, .7);
  --card-shadow: 0 1px 2px color-mix(in srgb, var(--primary) 7%, rgba(40, 30, 20, .06)), 0 10px 28px -16px color-mix(in srgb, var(--primary) 30%, rgba(40, 30, 20, .25));
  --shadow: 0 18px 50px -12px color-mix(in srgb, var(--primary) 28%, rgba(30, 25, 20, .3)), 0 2px 6px rgba(30, 25, 20, .08);
  --card-line: color-mix(in srgb, var(--primary) 6%, rgba(120, 100, 80, .1));
  --amb-1: color-mix(in srgb, var(--primary) 16%, transparent);
  --amb-2: rgba(217, 101, 112, .10);
  --amb-3: rgba(155, 114, 203, .10);
}
:root[data-theme="dark"] {
  --bg: color-mix(in srgb, var(--primary) 4%, #121110);
  --surface: color-mix(in srgb, var(--primary) 6%, #1B1A18);
  --surface-hi: color-mix(in srgb, var(--primary) 8%, #222120);
  --bg-2: color-mix(in srgb, var(--primary) 9%, #252321);
  --bg-3: color-mix(in srgb, var(--primary) 13%, #2F2C29);
  --line: color-mix(in srgb, var(--primary) 9%, #2D2A27);
  --line-2: color-mix(in srgb, var(--primary) 13%, #47433E);
  --text: #EDE8E2; --text-2: #CFC9C2; --text-3: #A9A39C; --text-4: #857F78;
  --glass: color-mix(in srgb, var(--surface-hi) 62%, transparent);
  --glass-strong: color-mix(in srgb, var(--surface-hi) 80%, transparent);
  --glass-line: rgba(255, 255, 255, .07);
  --card-shadow: 0 10px 30px -18px rgba(0, 0, 0, .7);
  --shadow: 0 20px 50px -10px rgba(0, 0, 0, .65), 0 2px 6px rgba(0, 0, 0, .35);
  --card-line: rgba(255, 255, 255, .045);
  --amb-1: color-mix(in srgb, var(--primary) 11%, transparent);
  --amb-2: rgba(217, 101, 112, .07);
  --amb-3: rgba(155, 114, 203, .08);
}
.tc { --tc-soft: color-mix(in srgb, var(--tc) 14%, var(--surface)); --tc-soft-2: color-mix(in srgb, var(--tc) 7%, var(--surface)); }
[data-theme="dark"] .tc { --tc-soft: color-mix(in srgb, var(--tc) 20%, var(--surface)); --tc-soft-2: color-mix(in srgb, var(--tc) 9%, var(--surface)); }

/* ---------- Pozadí s barevnou atmosférou ---------- */
body { background: var(--bg); font-size: var(--fs-body); letter-spacing: 0; font-feature-settings: "ss01", "cv11"; }
body::before {
  content: ""; position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 35% at 15% 10%, var(--amb-1), transparent 70%),
    radial-gradient(35% 30% at 90% 25%, var(--amb-2), transparent 70%),
    radial-gradient(45% 35% at 50% 95%, var(--amb-3), transparent 70%);
  animation: amb-drift 28s ease-in-out infinite alternate;
}
@keyframes amb-drift { to { transform: translate3d(3%, 4%, 0) rotate(4deg) scale(1.05); } }
#app { position: relative; isolation: isolate; }
#app, #main, #view, #sidebar, #topbar, .cbar { background: transparent; }

/* ---------- Horní lišta: sklo nad obsahem ---------- */
#main { position: relative; }
#topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 40;
  height: var(--topbar-h); min-height: 0; padding-top: env(safe-area-inset-top); padding-bottom: 0;
  transition: background .25s, box-shadow .25s, backdrop-filter .25s;
}
#topbar.scrolled {
  background: var(--glass); backdrop-filter: blur(22px) saturate(1.6); -webkit-backdrop-filter: blur(22px) saturate(1.6);
  box-shadow: 0 1px 0 var(--card-line), 0 8px 24px -18px rgba(0, 0, 0, .35);
}
#topbar .crumbs { font-size: 15px; font-weight: 500; color: var(--text-3); }
#topbar .crumbs b { font-weight: 600; color: var(--text); }
#view { padding-top: var(--topbar-h); }
.cbar { top: 0; }

/* ---------- Postranní panel ---------- */
#sidebar { border-right: 0; }
@media (min-width: 861px) {
  #sidebar { background: color-mix(in srgb, var(--surface) 45%, transparent); box-shadow: inset -1px 0 0 var(--card-line); }
}

/* ---------- Typografie ---------- */
h1.title, input.title, textarea.title { font-size: var(--fs-headline); font-weight: 600; letter-spacing: -.025em; line-height: 1.15; }
h2.h2, .modal header h2 { font-size: 22px; font-weight: 600; letter-spacing: -.015em; }
.greet { font-size: var(--fs-display); font-weight: 600; letter-spacing: -.03em; background-size: 200% 100%; animation: grad-shift 9s ease-in-out infinite alternate; }
@keyframes grad-shift { to { background-position: 100% 0; } }
.hcard-t, .rch-t b { font-weight: 600; letter-spacing: -.01em; }
.hcard-t { font-size: var(--fs-title-s); }
.rch-t b { font-size: var(--fs-title); }
.section-h, .group-h, .nav-h { font-size: var(--fs-label); font-weight: 600; letter-spacing: .01em; }
.hstat .n, .rtile .v { font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.hstat .n { font-size: 28px; font-weight: 600; }
.hstat .l, .rtile .k { font-size: var(--fs-label); font-weight: 500; }
.muted, .hsub { color: var(--text-3); }
.steps li { font-size: 16px; line-height: 1.6; }
.steps .sq { font-weight: 600; }

/* ---------- Plochy a karty: odstíny místo bílé ---------- */
.card, .hcard, .ocard, .day, .tablewrap, .items, .olist, .month, .prop, .empty, .rcard, .cfilters {
  background: var(--surface); border: 1px solid var(--card-line); box-shadow: var(--card-shadow);
}
.card, .hcard, .ocard, .empty, .month { border-radius: var(--r-xl); }
.rcard { border-radius: var(--r-xl); }
.items, .olist, .prop, .cfilters, .day { border-radius: var(--r-lg); }
/* karty na domovské stránce: jemný barevný nádech podle sekce */
.hcard.tc { background: linear-gradient(180deg, var(--tc-soft-2) 0%, var(--surface) 140px); }
.hcard header .tbadge { box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--tc) 55%, transparent); }
/* dlaždice statistik: přechod ve dvou odstínech + dekorativní kruh */
.hstat { position: relative; overflow: hidden; border: 1px solid color-mix(in srgb, var(--tc) 14%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--tc) 22%, var(--surface)) 0%, color-mix(in srgb, var(--tc) 9%, var(--surface)) 100%); }
[data-theme="dark"] .hstat { background: linear-gradient(135deg, color-mix(in srgb, var(--tc) 30%, var(--surface)) 0%, color-mix(in srgb, var(--tc) 10%, var(--surface)) 100%); }
.hstat::after { content: ""; position: absolute; right: -28px; bottom: -36px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--tc) 28%, transparent), transparent 70%); pointer-events: none; }
.hstat .tbadge { background: var(--tc); color: var(--surface); box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--tc) 70%, transparent); }
[data-theme="dark"] .hstat .tbadge { color: #1B1A18; }
.hstat:hover { background: linear-gradient(135deg, color-mix(in srgb, var(--tc) 28%, var(--surface)), color-mix(in srgb, var(--tc) 12%, var(--surface))); }
/* dlaždice v receptu */
.rtile { background: linear-gradient(135deg, color-mix(in srgb, var(--tc) 20%, var(--surface)), color-mix(in srgb, var(--tc) 8%, var(--surface))); border: 1px solid color-mix(in srgb, var(--tc) 12%, transparent); border-radius: 20px; }
[data-theme="dark"] .rtile { background: linear-gradient(135deg, color-mix(in srgb, var(--tc) 28%, var(--surface)), color-mix(in srgb, var(--tc) 10%, var(--surface))); }
/* vstupy a pilulky */
.input, .select, .textarea { border-radius: var(--r-md); background: var(--surface-hi); border-color: var(--line); }
.quickadd, .csearch, .searchbtn { background: var(--bg-2); }
.csearch { background: var(--glass-strong); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); border: 1px solid var(--card-line); box-shadow: var(--card-shadow); }
.cadd { border-radius: var(--r-md); background: var(--primary-c); box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--primary) 60%, transparent); }
.chip { border-radius: var(--r-sm); }
.tag { border-radius: 999px; background: var(--bg-2); }
.vchip { border-radius: var(--r-sm); }
.srcchip { background: var(--bg-2); }
.rtabs { border-bottom-color: var(--line); }
.rtabs button.on { border-bottom-width: 3px; }
.btn.tonal { background: var(--primary-c); }
.ings li, .item, .olist a, .hlist li, .hnotes a { border-bottom-color: color-mix(in srgb, var(--line) 75%, transparent); }

/* ---------- Sklo: plovoucí prvky ---------- */
.menu, .suggest, .timer, #toast {
  background: var(--glass-strong); backdrop-filter: blur(24px) saturate(1.7); -webkit-backdrop-filter: blur(24px) saturate(1.7);
  border: 1px solid var(--glass-line); box-shadow: var(--shadow); color: var(--text);
}
[data-theme="dark"] .menu { background: var(--glass-strong); }
.menu { border-radius: 20px; padding: 6px; transform-origin: top left; animation: pop-in .2s var(--spring); }
.menu button { border-radius: 12px; }
.modal { background: var(--glass-strong); backdrop-filter: blur(30px) saturate(1.6); -webkit-backdrop-filter: blur(30px) saturate(1.6); border: 1px solid var(--glass-line); box-shadow: var(--shadow); border-radius: var(--r-xl); animation: modal-in .28s var(--ease); }
.overlay { background: color-mix(in srgb, #0B0A09 30%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade-in .2s ease-out; }
#toast { border-radius: var(--r-md); font-weight: 500; width: max-content; }
.timer { border-radius: 20px; }
#app.drawer #scrim { background: color-mix(in srgb, #0B0A09 30%, transparent); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
@media (max-width: 860px) {
  #sidebar { background: var(--glass-strong); backdrop-filter: blur(30px) saturate(1.6); -webkit-backdrop-filter: blur(30px) saturate(1.6); border-right: 1px solid var(--glass-line); transition: transform .32s var(--ease); }
  #tabbar { background: var(--glass) !important; border-color: var(--glass-line) !important; }
  :root { --fs-display: 32px; --fs-headline: 28px; }
}

/* ---------- Fotka receptu: paralaxa (JS nastavuje --py a --fade) ---------- */
.ohead .backdrop { top: calc(-32px - var(--topbar-h)); transform: translate3d(0, var(--py, 0px), 0) scale(var(--ps, 1)); opacity: calc(.6 * var(--fade, 1)); will-change: transform, opacity; }
[data-theme="dark"] .ohead .backdrop { opacity: calc(.5 * var(--fade, 1)); }
.ohead.has-img textarea.title { text-shadow: 0 1px 18px var(--bg), 0 0 2px var(--bg); }
@media (max-width: 860px) { .ohead .backdrop { top: calc(-20px - var(--topbar-h)); } }

/* ---------- Pohyb ---------- */
@keyframes rise { from { opacity: 0; transform: translate3d(0, 14px, 0); } }
@keyframes pop-in { from { opacity: 0; transform: scale(.92); } }
@keyframes modal-in { from { opacity: 0; transform: translate3d(0, 18px, 0) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }
/* příchod na stránku: obsah najíždí postupně (jen při změně stránky, ne při překreslení) */
#view.entering .page > * { animation: rise .45s var(--ease) backwards; }
#view.entering .page > :nth-child(2) { animation-delay: .04s; }
#view.entering .page > :nth-child(3) { animation-delay: .08s; }
#view.entering .page > :nth-child(4) { animation-delay: .12s; }
#view.entering .page > :nth-child(n+5) { animation-delay: .16s; }
#view.entering :is(.cards, .hstats, .hgrid) > * { animation: rise .5s var(--ease) backwards; }
#view.entering :is(.cards, .hstats, .hgrid) > :nth-child(2) { animation-delay: .05s; }
#view.entering :is(.cards, .hstats, .hgrid) > :nth-child(3) { animation-delay: .1s; }
#view.entering :is(.cards, .hstats, .hgrid) > :nth-child(4) { animation-delay: .15s; }
#view.entering :is(.cards, .hstats, .hgrid) > :nth-child(5) { animation-delay: .2s; }
#view.entering :is(.cards, .hstats, .hgrid) > :nth-child(6) { animation-delay: .25s; }
#view.entering :is(.cards, .hstats, .hgrid) > :nth-child(n+7) { animation-delay: .3s; }
/* pružná odezva na dotyk */
:is(.ocard, .rcardx, .hstat, .btn, .chip, .vchip, .iconbtn, .cadd, .hday, .hrecipe, .navlink, .backlinks a, .accents button) { transition: transform .22s var(--spring), background-color .2s, box-shadow .2s; }
:is(.ocard, .rcardx, .hstat, .hrecipe):active { transform: scale(.97); }
:is(.btn, .chip, .vchip, .iconbtn, .cadd, .hday, .navlink, .backlinks a, .accents button):active { transform: scale(.94); }
.rcardx:hover { transform: translateY(-3px); }
.rcardx .bg { transition: transform .6s var(--ease); }
/* spodní lišta: indikátor naskočí, ikona poskočí */
@media (max-width: 860px) {
  #tabbar.moved a.on .ind { animation: ind-pop .38s var(--spring); }
  #tabbar.moved a.on .ind .ic { animation: ic-hop .45s var(--spring); }
  #tabbar .fab { transition: transform .25s var(--spring), box-shadow .25s; }
  #tabbar .fab:active { transform: scale(.9) rotate(90deg); }
  #tabbar a:active .ind { transform: scale(.9); }
  #tabbar a .ind { transition: transform .2s var(--spring), background .25s; }
}
@keyframes ind-pop { from { transform: scaleX(.4); opacity: .2; } }
@keyframes ic-hop { 40% { transform: translateY(-3px); } }
/* záložky receptu: podtržení klouže */
.rtabs button { transition: color .2s, border-color .25s; }
/* hvězdičky */
.stars .star { transition: transform .2s var(--spring), color .15s; }
.stars .star:active { transform: scale(1.3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .ohead .backdrop { transform: none; }
}

/* ---------- Zámek do stran: stránka se posouvá jen svisle ---------- */
html, body { overflow: hidden; overscroll-behavior: none; }
#view { overflow-x: hidden; overscroll-behavior-x: none; }
@supports (overflow: clip) { #view { overflow-x: clip; } .page { overflow-x: clip; } }

/* ---------- Spodní lišta v detailu receptu ---------- */
@media (max-width: 860px) {
  #tabbar > button.tc { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 60px; border: 0; background: none; padding: 0; color: var(--text-3); font-size: 11px; font-weight: 500; }
  #tabbar > button.tc .ind { width: 52px; height: 30px; border-radius: 15px; display: grid; place-items: center; transition: transform .2s var(--spring), background .25s, color .2s; }
  #tabbar > button.tc .lb { line-height: 1; }
  #tabbar > button.tc.on { color: var(--tc-text); font-weight: 700; }
  #tabbar > button.tc.on .ind { background: color-mix(in srgb, var(--tc) 22%, transparent); color: var(--tc-text); animation: ind-pop .38s var(--spring); }
  #tabbar > button.tc:active .ind { transform: scale(.9); }
  #tabbar[data-ctx="recipe"] .fab { background: linear-gradient(135deg, #FCAD70 0%, #E8710A 55%, #D96570 100%); box-shadow: 0 6px 16px rgba(232, 113, 10, .45); }
  #tabbar .fab:disabled { opacity: .45; box-shadow: none; }
  #tabbar[data-ctx="recipe"] .fab:active { transform: scale(.9); }
  #tabbar .fab.bump { animation: fab-bump .5s var(--spring); }
  .rtabs { scroll-margin-top: calc(var(--topbar-h) + 8px); }
}
@keyframes fab-bump { 30% { transform: scale(.85); } 60% { transform: scale(1.12) rotate(-8deg); } }

/* ---------- Nákupní seznam: kompaktní ---------- */
.page.is-list { gap: 10px; }
.lhead { gap: 6px; }
.lhead-row { display: flex; align-items: center; gap: 2px; }
.lhead-row textarea.title { flex: 1; min-width: 0; font-size: 24px; line-height: 1.2; }
.lhead-row .iconbtn { width: 38px; height: 38px; }
.lbody { display: flex; flex-direction: column; gap: 8px; }
.ltools { display: flex; align-items: center; gap: 6px; position: sticky; top: 0; z-index: 5; padding: 2px 0 4px; }
.ltools .quickadd { flex: 1; min-height: 44px; border-radius: 22px; padding-left: 14px; gap: 8px; background: var(--glass-strong); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); border: 1px solid var(--card-line); }
.ltools .quickadd input { font-size: 16px; padding: 8px 0; }
.ltools .lmore { width: 44px; height: 44px; flex: none; background: var(--bg-2); }
.is-list .progress { gap: 8px; font-size: 12px; color: var(--text-3); padding: 0 4px; }
.is-list .progress .bar { height: 4px; }
.is-list .group-h { margin: 8px 0 4px 6px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--tc-text); }
.is-list .items { padding: 0 6px; border-radius: 18px; }
.is-list .item { min-height: 44px; gap: 8px; padding: 2px 0; }
.is-list .item .cb.round { width: 30px; height: 30px; margin: 5px 4px 5px 2px; border-width: 2px; }
.is-list .item .cb.round::after { width: 11px; height: 6px; }
.is-list .item .main { flex-direction: row; align-items: baseline; gap: 8px; }
.is-list .item .n { font-size: 15px; line-height: 1.3; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-list .item .from { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; gap: 3px; font-size: 11px; opacity: .85; white-space: nowrap; overflow: hidden; }
.is-list .item .from .ic { flex: none; }
.is-list .item .q { font-size: 13px; padding: 4px; white-space: nowrap; }
.is-list .item .del { width: 30px; height: 30px; opacity: .35; }
.is-list .empty { padding: 16px; font-size: 14px; }
.is-list .item .from .ft { overflow: hidden; text-overflow: ellipsis; }
