/* Shared product dialog (products page + KOGI on home) */

/* ---------- Product dialog ---------- */
/* Global reset sets margin:0, which kills <dialog>'s default centring; restore it. */
.pdialog {
  margin: auto; inset: 0; border: 0; padding: 0; overflow: hidden;
  width: min(940px, calc(100vw - 2rem)); max-height: min(620px, calc(100dvh - 2rem));
  border-radius: 28px; background: var(--white); color: var(--ink);
  box-shadow: 0 40px 90px -20px rgba(0, 0, 0, .55);
}
.pdialog::backdrop { background: rgba(22, 20, 18, .55); backdrop-filter: blur(6px); }
.pdialog[open] { animation: dlg-in .35s cubic-bezier(.2, .9, .3, 1.1); }
.pdialog[open]::backdrop { animation: fade .3s ease; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(24px) scale(.97); } }
@keyframes fade { from { opacity: 0; } }

.pdialog__inner { display: grid; grid-template-columns: 1.1fr 1fr; height: min(620px, calc(100dvh - 2rem)); }
.pdialog__media { background: #fff; display: grid; place-items: center; overflow: hidden; }
.pdialog__media img { width: 100%; height: 100%; object-fit: cover; }

.pdialog__body {
  display: flex; flex-direction: column; justify-content: center;
  padding: 3rem clamp(1.8rem, 3.5vw, 3rem); overflow-y: auto;
  background: var(--cream); border-left: 1px solid var(--sand);
}
.pdialog__cat { font-size: .75rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: .6rem; }
.pdialog__body h2 { font-size: clamp(2rem, 3.4vw, 2.8rem); line-height: 1.05; margin: 0 0 .9rem; }
.pdialog__pill { align-self: flex-start; background: var(--red); color: var(--white); font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: .35rem .8rem; border-radius: 999px; margin-bottom: 1.2rem; }
.pdialog__blurb { color: var(--ink-soft); font-size: 1rem; line-height: 1.65; margin-bottom: 1.8rem; max-width: 34ch; }
.pdialog__wa { width: 100%; padding-block: 1rem; }
.pdialog__wa::before { content: ""; width: 18px; height: 18px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 3a13 13 0 0 0-11.2 19.6L3 29l6.6-1.7A13 13 0 1 0 16 3z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 3a13 13 0 0 0-11.2 19.6L3 29l6.6-1.7A13 13 0 1 0 16 3z'/%3E%3C/svg%3E") center / contain no-repeat; }
.pdialog__mail { text-align: center; font-size: .9rem; color: var(--ink-soft); margin-top: .9rem; }
.pdialog__mail a { color: var(--ink); font-weight: 600; text-underline-offset: 3px; }
.pdialog__mail a:hover { color: var(--red); }

.pdialog__more { margin-top: 2rem; padding-top: 1.4rem; border-top: 1px solid var(--sand); }
.pdialog__more > p { font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: .7rem; }
.pdialog__thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.pdialog__thumb { aspect-ratio: 1; border: 2px solid transparent; border-radius: 12px; overflow: hidden; padding: 0; cursor: pointer; background: #fff; transition: border-color .2s, transform .2s; }
.pdialog__thumb:hover, .pdialog__thumb:focus-visible { border-color: var(--red); transform: translateY(-2px); outline: none; }
.pdialog__thumb img { width: 100%; height: 100%; object-fit: cover; }

.pdialog__close {
  position: absolute; top: 1rem; right: 1rem; z-index: 2;
  width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--white); color: var(--ink); font-size: 1.5rem; line-height: 1;
  display: grid; place-items: center; box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .35);
  transition: transform .2s, background .2s, color .2s;
}
.pdialog__close:hover { background: var(--ink); color: var(--white); transform: rotate(90deg); }

@media (max-width: 820px) {
  /* Dialog becomes a bottom sheet */
  .pdialog { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 26px 26px 0 0; }
  .pdialog[open] { animation: sheet-in .35s cubic-bezier(.2, .9, .3, 1); }
  @keyframes sheet-in { from { transform: translateY(100%); } }
  .pdialog__inner { grid-template-columns: 1fr; height: auto; max-height: 92dvh; overflow-y: auto; }
  .pdialog__media { aspect-ratio: 4 / 3; }
  .pdialog__body { border-left: 0; overflow: visible; padding: 1.6rem 1.4rem 2rem; justify-content: flex-start; }
  .pdialog__blurb { max-width: none; }
}

/* Focus: no ring on open, clear ring for keyboard users */
.pdialog:focus, .pdialog__body:focus { outline: none; }
.pdialog .btn:focus { outline: none; }
.pdialog .btn:focus-visible, .pdialog__close:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.pdialog__close:focus:not(:focus-visible) { outline: none; }

/* KOGI variant: dish photo with the pack overlapping */
.kdialog__media { position: relative; }
.kdialog__pack { position: absolute; right: 1.2rem; bottom: 1.2rem; width: 34% !important; height: auto !important; object-fit: contain !important; filter: drop-shadow(0 16px 20px rgba(0,0,0,.45)); rotate: 6deg; }
.kdialog--packonly .kdialog__pack { display: none; }
.kdialog--packonly .kdialog__media { background: var(--sand); }
.kdialog--packonly #kd-dish { object-fit: contain; padding: 2.5rem; filter: drop-shadow(0 20px 26px rgba(0,0,0,.3)); }
.kdialog__steps { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.kdialog__steps figure { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; }
.kdialog__steps img { width: 100%; height: 100%; object-fit: cover; }
.kdialog__steps figcaption { position: absolute; left: .4rem; bottom: .4rem; background: rgba(255,255,255,.92); padding: .1rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 700; }

/* Mobile fix: stop wide images forcing the sheet wider than the screen */
@media (max-width: 820px) {
  .pdialog { inset: auto 0 0 0; width: 100%; max-width: 100%; }
  .pdialog__inner { grid-template-columns: minmax(0, 1fr); }
  .pdialog__body, .pdialog__media { min-width: 0; }
  .kdialog__pack { width: 30% !important; right: .8rem; bottom: .8rem; }
}
