/* Highmart Price Check — kiosco de tienda
   Paleta: naranja de marca sobre negro de la placa del logo.
   Elemento distintivo: la etiqueta de góndola con perforado que se rasga
   mientras corre el temporizador de reinicio. */

:root {
  --ink:        #0A0A0B;
  --ink-2:      #16161A;
  --paper:      #F5F2ED;
  --paper-2:    #E4DFD6;
  --orange:     #FC5C06;
  --ember:      #FF9247;
  --muted:      #8B8B94;
  --reset:      12s;

  --pad: clamp(1rem, 3vw, 2.5rem);
  --radius: 14px;

  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --display: "Archivo", "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(120% 80% at 50% -10%, #1E1206 0%, var(--ink) 55%),
    var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

/* Franja superior: destella con cada lectura, como el bip del lector ---------- */
.beam {
  height: 4px;
  flex: 0 0 auto;
  background: linear-gradient(90deg, transparent, var(--orange), var(--ember), var(--orange), transparent);
  opacity: .25;
  transition: opacity .2s ease;
}
body[data-flash="on"] .beam { opacity: 1; }

/* Barra de identidad --------------------------------------------------------- */
.bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: calc(var(--pad) * .6) var(--pad);
}

.bar__mark {
  height: clamp(28px, 4.2vh, 46px);
  width: auto;
}

.bar__store {
  font-size: clamp(.75rem, 1.4vh, .95rem);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.bar__status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--mono);
  font-size: clamp(.65rem, 1.3vh, .8rem);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.bar__status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.bar__status[data-state="ready"] { color: var(--ember); }
.bar__status[data-state="down"]  { color: #E5484D; }

/* Escenario ------------------------------------------------------------------ */
.stage {
  flex: 1 1 auto;
  position: relative;
  display: grid;
  place-items: center;
  padding: 0 var(--pad) var(--pad);
  min-height: 0;
}

.panel {
  grid-area: 1 / 1;
  width: 100%;
  max-width: 900px;
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stage[data-view="idle"]   .panel[data-panel="idle"],
.stage[data-view="busy"]   .panel[data-panel="busy"],
.stage[data-view="result"] .panel[data-panel="result"],
.stage[data-view="miss"]   .panel[data-panel="miss"] {
  display: flex;
  animation: rise .28s cubic-bezier(.2, .8, .3, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* Reposo: código de barras con haz que barre ---------------------------------- */
.glyph {
  width: min(60vw, 340px);
  height: auto;
  margin-bottom: clamp(1rem, 3vh, 2rem);
}
.glyph__bars {
  stroke: var(--paper);
  stroke-width: 56;
  opacity: .82;
}
.glyph__laser {
  stroke: var(--orange);
  stroke-width: 3;
  filter: drop-shadow(0 0 8px var(--orange));
  animation: sweep 2.6s ease-in-out infinite;
}
@keyframes sweep {
  0%, 100% { transform: translateX(-150px); }
  50%      { transform: translateX(150px); }
}

.prompt {
  font-family: var(--display);
  font-weight: 800;
  font-style: italic;
  font-size: clamp(2rem, 6.5vh, 4rem);
  line-height: 1;
  margin: 0 0 .5rem;
  letter-spacing: -.02em;
}

.prompt__alt {
  margin: 0;
  color: var(--muted);
  font-size: clamp(.9rem, 2vh, 1.15rem);
}

/* Buscando ------------------------------------------------------------------- */
.pulse {
  display: flex;
  gap: .55rem;
  margin-bottom: 1.25rem;
}
.pulse i {
  width: 10px;
  height: 34px;
  border-radius: 3px;
  background: var(--orange);
  animation: bounce 1s ease-in-out infinite;
}
.pulse i:nth-child(2) { animation-delay: .12s; }
.pulse i:nth-child(3) { animation-delay: .24s; }
@keyframes bounce {
  0%, 100% { transform: scaleY(.45); opacity: .45; }
  50%      { transform: scaleY(1); opacity: 1; }
}

/* La etiqueta ---------------------------------------------------------------- */
.tag {
  position: relative;
  width: 100%;
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .85);
  text-align: left;
  overflow: hidden;
  transform: rotate(-.5deg);
  animation: stamp .34s cubic-bezier(.18, .9, .24, 1.04) both;
}
@keyframes stamp {
  from { opacity: 0; transform: rotate(-2.4deg) scale(1.05); }
  to   { opacity: 1; transform: rotate(-.5deg) scale(1); }
}

.tag__punch {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6);
}

.tag__head {
  background: var(--orange);
  color: #fff;
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(.7rem, 1.5vh, .85rem);
  letter-spacing: .22em;
  text-transform: uppercase;
  padding: .6rem 1.1rem;
}

.tag__body {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
  padding: clamp(1rem, 3vh, 1.9rem) clamp(1.1rem, 3vw, 2rem);
}

.tag__shot {
  width: clamp(72px, 14vh, 132px);
  height: clamp(72px, 14vh, 132px);
  object-fit: contain;
  flex: 0 0 auto;
  background: #fff;
  border-radius: 10px;
  padding: 6px;
}

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

.tag__name {
  margin: 0 0 .25rem;
  font-size: clamp(1rem, 2.6vh, 1.45rem);
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tag__amount {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-style: italic;
  font-size: clamp(3.4rem, 15vh, 8rem);
  line-height: .92;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
}

.tag__tax {
  margin: .35rem 0 0;
  font-family: var(--mono);
  font-size: clamp(.8rem, 1.9vh, 1rem);
  color: #5A5A62;
}

/* Perforado: el rasgado es el temporizador de reinicio */
.tag__perf {
  position: relative;
  height: 1px;
  margin: 0 1.1rem;
  background-image: linear-gradient(90deg, #B9B3A8 0 8px, transparent 8px 16px);
  background-size: 16px 1px;
}
.tag__tear {
  position: absolute;
  inset: -1px auto -1px 0;
  width: 100%;
  background: var(--orange);
  transform-origin: left center;
  animation: tear var(--reset) linear forwards;
}
@keyframes tear {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

.tag__stub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem 1.1rem .9rem;
  font-family: var(--mono);
  font-size: clamp(.68rem, 1.5vh, .82rem);
  letter-spacing: .06em;
  color: #6E6A62;
}
.tag__hint { color: #9A948A; }

/* Sin resultado -------------------------------------------------------------- */
.miss__code {
  margin: 0 0 .75rem;
  font-family: var(--mono);
  font-size: clamp(.8rem, 1.8vh, 1rem);
  letter-spacing: .18em;
  color: var(--muted);
}
.miss__line {
  font-family: var(--display);
  font-weight: 800;
  font-style: italic;
  font-size: clamp(1.6rem, 5.5vh, 3.2rem);
  line-height: 1.05;
  margin: 0 0 .7rem;
  color: var(--ember);
  max-width: 18ch;
}

/* Campo oculto que recibe el lector ------------------------------------------ */
.capture {
  position: fixed;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  border: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
}

/* Pantallas altas o verticales: la etiqueta se apila -------------------------- */
@media (max-aspect-ratio: 3/4) {
  .tag__body {
    flex-direction: column;
    align-items: flex-start;
  }
  .tag__amount { font-size: clamp(3.2rem, 12vh, 6rem); }
}

@media (prefers-reduced-motion: reduce) {
  .glyph__laser,
  .pulse i { animation: none; }
  .panel,
  .tag { animation-duration: .01ms; }
  .tag__tear { animation-timing-function: steps(1, end); }
}
