/*
 * VARKAEN Digital — demo pública (/demo). Se carga después de site.css y app.css y reutiliza sus
 * componentes (panel, stats, table, form-field, btn, status). Acá solo va lo propio de la demo.
 * El sitio de ejemplo (.ds) usa container queries: se adapta al ancho de su caja, así funciona
 * igual en la vista previa del panel y a pantalla completa.
 */

.demo-body {
  background: var(--surface-2);
}

/* ---- Barra de la demo ---- */
.demo-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.demo-bar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  max-width: 100rem;
  margin-inline: auto;
  padding: 0.6rem clamp(1rem, 3vw, 2rem);
}

.demo-home {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}

.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
}

.demo-tabs {
  flex: 1 1 auto;
  min-width: 0;
}

.demo-tabs ul {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.demo-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.9rem;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  color: var(--muted);
}

.demo-tabs a:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.demo-tabs a[aria-current="page"] {
  color: var(--bg);
  background: var(--ink);
}

.demo-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-left: auto;
}

.demo-storage {
  margin: 0;
  padding: 0.5rem clamp(1rem, 3vw, 2rem);
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 0.875rem;
}

@media (max-width: 52rem) {
  .demo-tabs {
    order: 3;
    flex-basis: 100%;
  }
  .demo-tools .btn:last-child {
    display: none;
  }
}

.demo-main {
  min-height: calc(100vh - 4rem);
}

.demo-main:focus {
  outline: none;
}

.demo-loading,
.demo-noscript {
  max-width: 48rem;
  margin: 3rem auto;
  padding: 0 1.5rem;
}

.demo-noscript h1 {
  font-size: var(--step-xl);
  margin-bottom: 1rem;
}

.demo-noscript-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.js .demo-loading:not(:only-child) {
  display: none;
}

.demo-toast {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 60;
  max-width: min(36rem, calc(100vw - 2rem));
  padding: 0.85rem 1.1rem;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.9375rem;
  font-weight: 500;
  transform: translateX(-50%);
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.25);
}

.demo-note {
  max-width: 70ch;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--border-control);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.875rem;
}

.demo-note strong {
  color: var(--ink);
}

.demo-sim {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 0.75rem;
  font-weight: 700;
}

/* ---- Panel de ejemplo (web del negocio y área de clientes) ---- */
.dp {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  max-width: 100rem;
  margin-inline: auto;
  min-height: calc(100vh - 4rem);
}

.dp-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem 1rem;
  background: #1b1e23;
  color: #eef0ec;
  --focus: #eef0ec;
}

.dp-side-title {
  padding: 0 0.6rem;
  font-size: 0.8125rem;
  color: #a3aab4;
}

.dp-side-title strong {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--font-display);
  font-size: 1.125rem;
  color: #eef0ec;
}

.dp-side ul {
  display: grid;
  gap: 0.15rem;
}

.dp-side a {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 0.5rem;
  min-height: 2.75rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  color: #eef0ec;
  text-decoration: none;
  font-size: 0.9375rem;
}

.dp-side a small {
  flex-basis: 100%;
  color: #a3aab4;
  font-size: 0.75rem;
}

.dp-side a:hover {
  background: #ffffff12;
}

.dp-side a[aria-current="page"] {
  background: #2c323b;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #eef0ec;
}

.dp-count {
  margin-left: auto;
  min-width: 1.5rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: #ffffff1f;
  font-size: 0.75rem;
  text-align: center;
}

.dp-side-foot {
  margin-top: auto;
  padding: 0 0.6rem;
}

.dp-side-foot a {
  min-height: 2.5rem;
  padding: 0;
  font-weight: 600;
}

.dp-main {
  display: grid;
  gap: 1.5rem;
  align-content: start;
  min-width: 0;
  padding: clamp(1.25rem, 3vw, 2.5rem);
}

.dp-main h1:focus {
  outline: none;
}

.dp-lede {
  max-width: 64ch;
  color: var(--muted);
}

.dp-draft {
  margin: 0;
}

.dp-steps {
  display: grid;
  gap: 0.35rem;
}

.dp-steps li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
}

.dp-steps a {
  font-weight: 500;
}

.dp-step-n {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border: 1.5px solid var(--border-control);
  border-radius: 50%;
  font-size: 0.8125rem;
  font-weight: 700;
}

.dp-steps li.is-done .dp-step-n {
  border-color: var(--success);
  background: var(--success);
  color: var(--bg);
}

.dp-steps li.is-done a {
  color: var(--muted);
}

.dp-editor {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 75rem) {
  .dp-editor {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }
  .dp-preview {
    position: sticky;
    top: 5.5rem;
  }
}

.dp-form .panel-title + .form-field {
  margin-top: 0;
}

.dp-counter {
  justify-self: end;
}

.dp-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.dp-choices > legend {
  width: 100%;
  margin-bottom: 0.25rem;
}

.dp-choice {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  min-width: 6.5rem;
  padding: 0.5rem;
  border: 2px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.dp-choice input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.dp-choice:has(input:checked) {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--ink) inset;
}

.dp-choice:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.dp-choice img {
  width: 6rem;
  height: 3.75rem;
  object-fit: cover;
  border-radius: 4px;
}

.dp-swatch {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--swatch, #888);
}

.dp-preview-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.dp-size {
  display: flex;
  gap: 0.35rem;
}

.dp-size [aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

/* El sitio se dibuja a su tamaño real (escritorio 1100 px, celular 390 px) y se escala para entrar. */
.dp-preview-frame {
  max-height: 36rem;
  overflow: auto;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface-2);
}

.dp-preview-frame[data-size="mobile"] {
  display: grid;
  justify-items: center;
  padding: 1rem 0;
}

.dp-preview-scale {
  overflow: hidden;
}

.dp-preview-frame[data-size="desktop"] .dp-preview-scale > .ds {
  width: 1100px;
}

.dp-preview-frame[data-size="mobile"] .dp-preview-scale {
  border: 8px solid #1b1e23;
  border-radius: 22px;
}

.dp-preview-frame[data-size="mobile"] .dp-preview-scale > .ds {
  width: 390px;
}

.dp-products {
  display: grid;
  gap: 0.75rem;
}

.dp-product-form {
  display: grid;
  grid-template-columns: 6rem minmax(10rem, 1fr) 9rem auto auto;
  gap: 0.5rem 1rem;
  align-items: center;
}

.dp-product-form img {
  width: 6rem;
  height: 4.5rem;
  border-radius: 4px;
  object-fit: cover;
}

.dp-product-name {
  display: grid;
}

.dp-product-form .form-field {
  gap: 0.25rem;
}

@media (max-width: 52rem) {
  .dp-product-form {
    grid-template-columns: 4.5rem minmax(0, 1fr);
  }
  .dp-product-form img {
    width: 4.5rem;
    height: 3.4rem;
  }
  .dp-product-form .form-field,
  .dp-product-form .choice,
  .dp-product-form .btn {
    grid-column: 2;
    justify-self: start;
  }
}

.dp-total {
  font-size: 1.125rem;
}

@media (max-width: 52rem) {
  .dp {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }
  .dp-side {
    min-width: 0;
    padding: 0.75rem;
    gap: 0.5rem;
  }
  .dp-side ul {
    position: relative; /* keeps .sr-only texts inside the scroller */
    display: flex;
    overflow-x: auto;
    gap: 0.25rem;
  }
  .dp-side a {
    white-space: nowrap;
  }
  .dp-side a small,
  .dp-side-foot {
    display: none;
  }
}

/* ---- Sitio de ejemplo «Trigo & Miel» ---- */
.ds {
  --brand: #b4532a;
  container-type: inline-size;
  color: #2a211c;
  background: #fbf7f1;
  font-family: var(--font-sans);
  line-height: 1.55;
}

.ds h1,
.ds h2,
.ds h3 {
  color: #2a211c;
  letter-spacing: -0.02em;
}

.ds-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 1rem 5%;
  border-bottom: 3px solid var(--brand);
  background: #fff;
}

.ds-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.375rem;
  color: var(--brand);
}

.ds-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.ds-nav-item {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
  color: #2a211c;
  text-decoration: none;
}

.ds-nav-item[aria-current="page"],
.ds-nav-item.is-current {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.3em;
}

.ds-hero {
  display: grid;
  gap: 1.5rem;
  padding: 2rem 5%;
}

.ds-hero-img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 12px;
}

.ds-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 7cqw, 3.25rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.ds-title--page {
  font-size: clamp(1.6rem, 5cqw, 2.5rem);
  margin-bottom: 1.25rem;
}

.ds-lede {
  margin-top: 1rem;
  font-size: 1.0625rem;
  max-width: 46ch;
  overflow-wrap: anywhere;
}

.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.875rem;
  margin-top: 1.25rem;
  padding: 0.6rem 1.2rem;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.ds-btn:hover {
  filter: brightness(0.92);
}

.ds-btn:disabled {
  background: #bdb6ad;
  cursor: not-allowed;
}

.ds-section {
  padding: 1.5rem 5% 2rem;
}

.ds-section h2 {
  font-size: 1.375rem;
  margin-bottom: 1rem;
}

.ds-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
}

.ds-product {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 0 #e7ded1;
}

.ds-product.is-off img {
  filter: grayscale(1);
  opacity: 0.6;
}

.ds-product img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.ds-product-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0.9rem 1rem 1rem;
}

.ds-product h3 {
  font-size: 1.0625rem;
}

.ds-product .ds-btn {
  margin-top: auto;
  align-self: flex-start;
}

.ds-muted {
  color: #6b5d52;
  font-size: 0.9375rem;
}

.ds-price {
  margin: 0.4rem 0 0.75rem;
  font-weight: 700;
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
}

.ds-tag {
  margin-top: auto;
  align-self: flex-start;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 15%, #fff);
  color: var(--brand);
  font-size: 0.8125rem;
  font-weight: 700;
}

.ds-tag.is-off {
  background: #eee;
  color: #6b5d52;
}

.ds-info {
  display: grid;
  gap: 1.5rem;
  background: #fff;
}

.ds-footer {
  padding: 1.5rem 5%;
  background: #2a211c;
  color: #f4ece2;
  font-size: 0.9375rem;
}

.ds-footer .ds-muted {
  color: #cbbcae;
  margin-top: 0.25rem;
}

.ds-cart {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.ds-cart li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: #fff;
}

.ds-cart-name {
  flex: 1 1 12rem;
  font-weight: 600;
}

.ds-cart .ds-price {
  margin: 0;
}

.ds-qty {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.ds-qty-btn {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1.5px solid #d8cdbf;
  border-radius: 50%;
  background: #fff;
  font-size: 1.25rem;
  color: #2a211c;
}

.ds-checkout {
  display: grid;
  gap: 1rem;
  max-width: 34rem;
  padding: 1.25rem;
  border-radius: 12px;
  background: #fff;
  color: #2a211c;
  --muted: #6b5d52;
  --surface: #fff;
  --ink: #2a211c;
  --border-control: #8a7c70;
}

.ds-checkout input[type="text"] {
  background: #fff;
  color: #2a211c;
}

.ds-total {
  font-size: 1.125rem;
}

.ds-confirm p + p {
  margin-top: 0.75rem;
}

@container (min-width: 700px) {
  .ds-hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    align-items: center;
    padding: 3rem 5%;
  }
  .ds-info {
    grid-template-columns: 1fr 1fr;
  }
}

/* Sitio a pantalla completa */
.demo-site-page {
  max-width: 100rem;
  margin-inline: auto;
}

.demo-site-note {
  margin: 1rem 5%;
}

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