/* Obal · 3D krabička */
.ob-hero { background: var(--cream); padding: clamp(40px, 6vw, 72px) 0 clamp(28px, 4vw, 40px); border-bottom: 1px solid var(--line); }
.ob-hero h1 { margin-bottom: .3em; }
.ob-hero__tags { display: flex; flex-wrap: wrap; gap: 8px; }

.ob-studio { padding: clamp(32px, 5vw, 64px) 0 clamp(48px, 7vw, 88px); background: radial-gradient(80% 70% at 30% 40%, #FFF3C4 0%, var(--paper) 70%); }
.ob-studio__grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 40px; align-items: start; }
@media (max-width: 960px) { .ob-studio__grid { grid-template-columns: 1fr; } }

/* ---------- Scéna ---------- */
.ob-stage {
  --s: 1;
  --W: 240px; --H: 400px; --D: 120px;
  position: relative; height: calc(580px * var(--s)); min-height: 380px;
  perspective: 1700px; perspective-origin: 50% 38%;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  border-radius: 28px; outline-offset: 6px;
}
.ob-stage.is-dragging { cursor: grabbing; }
@media (max-width: 600px) { .ob-stage { --s: .78; } }
@media (max-width: 370px) { .ob-stage { --s: .7; } }

.ob-anchor { position: absolute; left: 50%; top: 47%; width: 0; height: 0; transform-style: preserve-3d; transform: scale3d(var(--s), var(--s), var(--s)); }
.box3d { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-style: preserve-3d; will-change: transform; }

.ob-shadow {
  position: absolute; left: 50%; top: calc(47% + 200px * var(--s) + 26px * var(--s));
  width: calc(var(--sw, 240px) * var(--s)); height: calc(38px * var(--s));
  transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(90, 60, 0, .38), rgba(90, 60, 0, 0));
  filter: blur(6px); opacity: var(--so, 1); pointer-events: none;
}

.face { position: absolute; left: 0; top: 0; overflow: hidden; color: var(--ink); font-family: var(--f-text); }
.face p { margin: 0; max-width: none; }
.f-front, .f-back { width: var(--W); height: var(--H); margin: calc(var(--H) / -2) 0 0 calc(var(--W) / -2); }
.f-side { width: var(--D); height: var(--H); margin: calc(var(--H) / -2) 0 0 calc(var(--D) / -2); }
.f-bottomface { width: var(--W); height: var(--D); margin: calc(var(--D) / -2) 0 0 calc(var(--W) / -2); }

.f-front { transform: translateZ(calc(var(--D) / 2)); }
.f-back { transform: rotateY(180deg) translateZ(calc(var(--D) / 2)); }
.f-bok1 { transform: rotateY(90deg) translateZ(calc(var(--W) / 2)); }
.f-bok2 { transform: rotateY(-90deg) translateZ(calc(var(--W) / 2)); }
.f-bottomface { transform: rotateX(-90deg) translateZ(calc(var(--H) / 2)); }

/* přední strana */
.f-front { background: var(--sun); display: flex; flex-direction: column; align-items: center; text-align: center; box-shadow: inset -8px 0 14px -10px rgba(0,0,0,.25), inset 0 -10px 16px -14px rgba(0,0,0,.3); }
.f-wave { position: absolute; left: 0; top: 0; width: 100%; height: 150px; }
.f-mark { position: relative; width: 94px; height: 94px; margin-top: 62px; filter: drop-shadow(0 6px 8px rgba(120, 80, 0, .25)); }
.f-stamp { position: absolute; top: 16px; right: 14px; width: 58px; height: 58px; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center; transform: rotate(-12deg); background: transparent; }
.f-stamp::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; border: 1px dashed var(--ink); }
.f-stamp b { font-family: var(--f-head); font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.f-name { position: relative; font-family: var(--f-head); font-weight: 800; font-size: 43px; line-height: 1; letter-spacing: -.03em; margin-top: 8px !important; }
.f-name sup { color: var(--amber); font-size: .6em; vertical-align: .55em; margin-left: 1px; }
.f-slogan { font-weight: 700; font-size: 13px; margin-top: 6px !important; }
.f-ingr { font-size: 10.5px; font-weight: 600; margin: 10px 14px 0 !important; padding: 5px 0; border-top: 1.5px solid rgba(31,26,20,.8); border-bottom: 1.5px solid rgba(31,26,20,.8); line-height: 1.35; }
.f-rel { font-size: 11px; font-weight: 700; margin-top: 8px !important; background: var(--ink); color: var(--cream); padding: 4px 10px; border-radius: 999px; }
.f-bottom { margin-top: auto; margin-bottom: 14px; }
.f-count { font-weight: 800; font-size: 12.5px; }
.f-type { font-style: italic; font-size: 11px; font-weight: 500; margin-top: 2px !important; }

/* zadní strana */
.f-back { background: var(--cream); padding: 13px 13px 10px; font-size: 7.9px; line-height: 1.28; box-shadow: inset 0 0 0 4px var(--sun); }
.f-back p + p, .f-back .b-tab + p { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--sun); }
.b-h { font-family: var(--f-head); font-weight: 800; font-size: 13px; line-height: 1.1; color: var(--amber-text); margin-bottom: 6px !important; padding-bottom: 6px; border-bottom: 2px solid var(--sun); }
.f-back p.b-sub { font-size: 8.5px; color: var(--amber-text); }
.b-tab { width: 100%; border-collapse: collapse; margin-top: 3px; font-size: 7.9px; }
.b-tab td { padding: 1.5px 0; border-bottom: .5px solid var(--line); vertical-align: top; }
.b-tab td:nth-child(2), .b-tab td:nth-child(3) { text-align: right; white-space: nowrap; padding-left: 4px; }

/* boky */
.f-side { background: var(--cream); padding: 14px 9px 10px; font-size: 11px; line-height: 1.28; display: flex; flex-direction: column; gap: 6px; box-shadow: inset 0 0 0 3px var(--sun), inset 10px 0 18px -14px rgba(0,0,0,.25); }
.s-mark { width: 34px; height: 34px; }
.s-h { font-family: var(--f-head); font-weight: 800; font-size: 13px; line-height: 1.12; color: var(--amber-text); padding-bottom: 6px; border-bottom: 2px solid var(--sun); }
.s-free { font-weight: 700; font-size: 11px; background: var(--sun); padding: 5px 6px; border-radius: 6px; }
.s-eco { font-size: 10px; color: var(--ink-soft); }
.s-eco .ico { width: 16px; height: 16px; margin-bottom: 3px; color: var(--ok); }
.s-made { font-family: var(--f-head); font-weight: 800; font-size: 14px; line-height: 1.1; color: var(--amber-text); padding-bottom: 6px; border-bottom: 2px solid var(--sun); }
.s-dd { display: flex; align-items: center; gap: 4px; font-weight: 600; font-size: 12px; text-transform: lowercase; }
.s-dd svg { width: 16px; height: 16px; }
.f-bok2 { font-size: 10.5px; }
.s-ean { margin-top: auto; background: #fff; padding: 3px; border-radius: 3px; }
.s-ean .ean { width: 100%; height: auto; }

/* spodek */
.f-bottomface { background: var(--cream); padding: 9px 12px; font-size: 9.6px; line-height: 1.28; display: flex; flex-direction: column; gap: 4px; box-shadow: inset 0 0 0 3px var(--sun); }
.bt-row { display: flex; flex-direction: column; gap: 0; }
.bt-row p { font-size: 10px; font-family: "Courier New", ui-monospace, monospace; font-weight: 700; }
.bt-check { font-size: 10.5px; background: #fff; padding: 2px 6px; border-radius: 4px; border: 1px dashed var(--amber); }

/* vnitřek a víko */
.ob-inside {
  position: absolute; left: calc(var(--W) / -2); top: calc(var(--D) / -2); width: var(--W); height: var(--D);
  transform: translateY(calc(var(--H) / -2 + 6px)) rotateX(90deg);
  background: radial-gradient(circle at 50% 50%, #F4E7BF, #E2CF98); box-shadow: inset 0 0 18px rgba(90, 60, 0, .45);
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
.pill { display: inline-block; width: 34px; height: 18px; border-radius: 999px; background: linear-gradient(180deg, #FFFDF6 0%, #F6E9C2 100%); box-shadow: inset 0 -3px 0 rgba(196,127,0,.25), 0 3px 4px rgba(90,60,0,.35); position: relative; }
.pill::after { content: ""; position: absolute; left: 50%; top: 3px; bottom: 3px; width: 1.5px; background: rgba(196,127,0,.35); }
.pill--1 { transform: rotate(-18deg); }
.pill--3 { transform: rotate(24deg); }

.lid {
  --lid: 90deg;
  position: absolute; left: calc(var(--W) / -2); top: 0; width: var(--W); height: var(--D);
  transform-origin: 50% 0; transform-style: preserve-3d;
  transform: translateY(calc(var(--H) / -2)) translateZ(calc(var(--D) / -2)) rotateX(var(--lid));
  transition: transform .7s cubic-bezier(.3, 1.3, .5, 1);
}
.lid.is-open { --lid: 200deg; }
.lid__out, .lid__in { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.lid__out { background: var(--sun); display: flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--f-head); font-weight: 800; font-size: 26px; letter-spacing: -.02em; box-shadow: inset 0 -6px 10px -8px rgba(0,0,0,.3); }
.lid__out img { width: 40px; height: 40px; }
.lid__out sup { color: var(--amber); font-size: .6em; }
.lid__in { transform: rotateX(180deg); background: var(--cream); padding: 8px 14px; font-size: 10.2px; line-height: 1.32; display: flex; flex-direction: column; justify-content: center; gap: 4px; text-align: center; box-shadow: inset 0 0 0 3px var(--sun); }
.lid__in p { margin: 0; max-width: none; }
.li-h { font-family: var(--f-head); font-weight: 800; font-size: 12.5px; color: var(--amber-text); }
.li-sign { font-family: var(--f-hand); font-size: 15px; font-weight: 600; }

.ob-hint { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); margin: 0; display: flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--ink-soft); background: rgba(255,255,255,.8); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; transition: opacity .4s; }
.ob-hint .ico { width: 16px; height: 16px; }
.ob-stage.is-touched .ob-hint { opacity: 0; }

/* ovládání */
.ob-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.ob-btn { border: 2px solid var(--ink); background: #fff; border-radius: 999px; padding: 9px 16px; font-weight: 700; font-size: .92rem; transition: background .15s, transform .15s; }
.ob-btn:hover { background: var(--cream); transform: translateY(-1px); }
.ob-btn[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
.ob-btn--lid { background: var(--sun); border-color: var(--sun); }
.ob-btn--lid:hover { background: #FFCB0A; }
.ob-btn--lid[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--cream); }

/* panel */
.ob-panel { position: sticky; top: calc(var(--bar-h) + 20px); }
.ob-panel__title { font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
.ob-text { font-size: .97rem; }
.ob-text h3 { color: var(--amber-text); margin-top: 1em; }
.ob-text h3:first-child { margin-top: 0; }
.ob-front-big { font-family: var(--f-head); font-weight: 800; font-size: 2.2rem; line-height: 1; margin-bottom: .3em; }
.ob-list { list-style: none; padding: 0; margin: 0 0 1em; }
.ob-list li { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.ob-list li span:last-child { white-space: nowrap; font-weight: 600; }
.ob-text.is-swap { animation: obSwap .3s ease; }
@keyframes obSwap { from { opacity: 0; transform: translateY(6px); } }
@media (max-width: 960px) { .ob-panel { position: static; } }

/* modal */
.ob-modal { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 0; border-radius: 22px; padding: 0; background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
.ob-modal::backdrop { background: rgba(31, 26, 20, .6); }
.ob-modal__head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px; background: var(--sun); }
.ob-modal__head h2 { margin: 0; font-size: 1.5rem; }
.ob-modal__close { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255,255,255,.6); display: grid; place-items: center; flex: none; }
.ob-modal__close .ico { width: 22px; height: 22px; }
.ob-modal__body { padding: 24px; font-size: 1.2rem; line-height: 1.6; }
.ob-modal__body .ob-text { font-size: inherit; }

/* galerie: CSS kompozice */
.ob-gallery figure { margin: 0; }
.ob-gallery figcaption { margin-top: 10px; font-size: .9rem; color: var(--ink-soft); }
.ob-ph1 { background: linear-gradient(180deg, #FFF6D6 0%, #F7E7B5 100%); display: grid; place-items: center; }
.ob-ph1__glow { position: absolute; width: 70%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(closest-side, rgba(255,255,255,.9), rgba(255,255,255,0)); top: 10%; }
.ob-ph1__box { transform: translateY(-4%); }
.ob-ph1 .pill { position: absolute; bottom: 22%; }
.ob-ph1__p1 { left: 22%; transform: rotate(-12deg); }
.ob-ph1__p2 { left: 30%; bottom: 18% !important; transform: rotate(20deg); }
.ob-ph1__p3 { right: 24%; transform: rotate(-30deg); }
.ob-ph2 { background: #EDE7DC; }
.ob-ph2__sheet { position: absolute; inset: 0; background: radial-gradient(60% 30% at 30% 30%, rgba(255,255,255,.9), transparent), repeating-linear-gradient(115deg, #F7F4EE 0 26px, #ECE6DB 26px 40px); }
.ob-ph2__book { position: absolute; left: 8%; bottom: 14%; width: 46%; aspect-ratio: 1.5; background: linear-gradient(90deg, #fff 0 49%, #DCD3C2 49% 51%, #fff 51%); border-radius: 4px; transform: rotate(-14deg); box-shadow: 0 10px 18px -8px rgba(0,0,0,.35); }
.ob-ph2__mug { position: absolute; right: 12%; top: 14%; width: 26%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #4A2E1A 0 55%, #F3EFE8 56% 100%); box-shadow: 0 12px 20px -10px rgba(0,0,0,.4); }
.ob-ph2__box { position: absolute; right: 22%; bottom: 18%; transform: rotate(8deg); }
.ob-ph2__light { position: absolute; inset: 0; background: linear-gradient(120deg, rgba(255,236,170,.55), transparent 55%); pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .lid { transition: none; }
}

/* referenční render (obal.html?view=…): jen krabička na krémovém pozadí */
.is-render body > *:not(main), .is-render main > *:not(.ob-studio), .is-render .ob-panel, .is-render .ob-controls, .is-render .ob-hint { display: none !important; }
.is-render .ob-studio { background: var(--cream); padding: 0; }
.is-render .ob-studio__grid { display: block; max-width: none; padding: 0; }
.is-render .ob-stage { height: 100vh; border-radius: 0; }
.is-render .ob-anchor { top: 50%; }
.is-render .ob-shadow { top: calc(50% + 226px); }
/* potisk víka čitelný při pohledu zepředu shora */
.lid__out { flex-direction: row-reverse; }
.lid__out > * { transform: rotate(180deg); }
