/* ¿Y mi pasta? · El súper del Estado
   Amarillo de cartel de oferta, rojo de precio, papel térmico y boli azul. */

:root {
  --amarillo: #ffe11a;
  --rojo: #e30613;
  --negro: #000000;
  --papel: #fbfbf8;
  --termica: #34322f;
  --boli: #1b3fd1;
  --gris-sobre-amarillo: rgba(0, 0, 0, 0.68);

  --f-sans: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'Azeret Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --f-boli: 'Nanum Pen Script', 'Comic Sans MS', cursive;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1240px;
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--amarillo);
  color: var(--negro);
  font-family: var(--f-sans);
  font-size: 18px;
  line-height: 1.5;
  font-stretch: 100%;
  overflow-x: hidden;
}

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--boli);
  outline-offset: 3px;
  border-radius: 2px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  background: var(--negro); color: var(--amarillo); padding: 10px 14px; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ── Cabecera ─────────────────────────────────────────── */

.brand {
  max-width: var(--max);
  margin: 0 auto;
  padding: 18px var(--gutter) 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.logo {
  font-weight: 900;
  font-stretch: 125%;
  font-size: 22px;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand__fine {
  font-size: 15px;
  text-underline-offset: 3px;
}

/* ── Frase principal ──────────────────────────────────── */

.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(40px, 9vh, 110px) var(--gutter) clamp(32px, 6vh, 64px);
}

.sentence__text {
  margin: 0;
  font-weight: 850;
  font-stretch: 112%;
  font-size: clamp(46px, 8.4vw, 124px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  max-width: 13ch;
}

.sentence__text .w { white-space: nowrap; }

.field {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
}

/* Flecha a boli que señala lo que se puede editar */
.tap-hint {
  font-family: var(--f-boli);
  font-weight: 400;
  font-stretch: 100%;
  letter-spacing: 0;
  line-height: 1;
  color: var(--boli);
  white-space: nowrap;
  pointer-events: none;
}
.tap-hint svg { overflow: visible; flex: none; }
.tap-hint path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tap-hint--side {
  position: absolute;
  left: calc(100% + 0.14em);
  top: 0.16em;
  font-size: 0.42em;
  display: inline-flex;
  align-items: center;
  gap: 0.1em;
  transform: rotate(-6deg);
  transform-origin: left center;
}
.tap-hint--side svg { width: 1.6em; height: 0.62em; }
.tap-hint--below {
  display: none;
  align-items: flex-end;
  gap: 6px;
  margin: 12px 0 0 0.4em;
  font-size: clamp(24px, 6.4vw, 44px);
  white-space: normal;
  transform: rotate(-2deg);
}
.tap-hint--below svg { width: 0.55em; height: 1.05em; }

/* Si la flecha lateral no cabe, app.js pasa a la de abajo */
.sentence.hint-below .tap-hint--side { visibility: hidden; }
.sentence.hint-below .tap-hint--below { display: flex; }

#amount {
  font: inherit;
  letter-spacing: inherit;
  color: var(--negro);
  background: transparent;
  border: 0;
  border-bottom: 0.07em solid var(--negro);
  border-radius: 0;
  padding: 0;
  margin: 0 0.06em 0 0;
  width: 4.2ch;
  min-width: 2ch;
  caret-color: var(--rojo);
  font-variant-numeric: tabular-nums;
  outline: none;
}
#amount::placeholder { color: rgba(0, 0, 0, 0.26); }
#amount:focus-visible { border-bottom-color: var(--boli); }

.field__eur { margin-right: 0.12em; }

.pick {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-decoration: underline dashed var(--boli);
  text-decoration-thickness: 0.055em;
  text-underline-offset: 0.11em;
  white-space: nowrap;
  border-radius: 0.08em;
  transition: background-color 120ms;
}
.pick:hover { background: rgba(0, 0, 0, 0.07); }
.pick:active { background: rgba(0, 0, 0, 0.12); }

.pagas-wrap { white-space: nowrap; }
.pagas-wrap[hidden] { display: none; }

.hint {
  margin: 22px 0 0;
  font-size: 18px;
  color: var(--gris-sobre-amarillo);
  min-height: 1.5em;
  max-width: 60ch;
}
.hint button {
  font: inherit;
  color: var(--negro);
  background: none;
  border: 0;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.hint--warn { color: var(--negro); }

.print-btn {
  margin-top: 26px;
  font-family: var(--f-sans);
  font-weight: 800;
  font-stretch: 112%;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--amarillo);
  background: var(--negro);
  border: 0;
  border-radius: 999px;
  padding: 18px 30px 19px;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--rojo);
  transition: transform 80ms, box-shadow 80ms;
}
.print-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 0 var(--rojo); }
.print-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--rojo); }

/* ── Resultado ────────────────────────────────────────── */

.result {
  max-width: var(--max);
  margin: 0 auto;
  padding: 8px var(--gutter) 72px;
  display: grid;
  gap: 40px 64px;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  grid-template-areas:
    'side ticket'
    'share ticket';
  grid-template-rows: auto 1fr;
  align-items: start;
}
.result[hidden] { display: none; }
.result__side { grid-area: side; }
.result__ticket { grid-area: ticket; }
.share { grid-area: share; }

/* Etiqueta de precio con el total */
.pricetag {
  display: inline-block;
  background: #fff;
  border: 3px solid var(--negro);
  transform: rotate(-1.2deg);
  transform-origin: left top;
  max-width: 100%;
}
.pricetag__name {
  margin: 0;
  background: var(--rojo);
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  padding: 7px 16px 8px;
}
.pricetag__price {
  margin: 0;
  padding: 4px 16px 0;
  font-weight: 900;
  font-stretch: 62%;
  font-size: clamp(84px, 13vw, 168px);
  line-height: 0.92;
  letter-spacing: -0.02em;
  color: var(--rojo);
  font-variant-numeric: lining-nums;
  white-space: nowrap;
}
.pricetag__price .cents {
  font-size: 0.42em;
  vertical-align: 0.95em;
  letter-spacing: 0;
  margin-left: 0.04em;
}
.pricetag__unit {
  margin: 0;
  padding: 4px 16px 12px;
  font-size: 16px;
  color: var(--negro);
}

.parts {
  list-style: none;
  margin: 34px 0 0;
  padding: 0;
  max-width: 560px;
  border-top: 2px solid var(--negro);
}
.parts li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 18px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.35);
}
.parts .p-name { font-weight: 700; }
.parts .p-amount {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.parts .p-note {
  grid-column: 1 / -1;
  font-size: 15px;
  color: var(--gris-sobre-amarillo);
  line-height: 1.4;
}
.parts li.is-off { opacity: 0.38; }
.parts li.is-off .p-amount { text-decoration: line-through; }

.toggles {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  max-width: 560px;
}
.switch {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  cursor: pointer;
}
.switch input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 42px;
  height: 24px;
  margin: 0;
  border-radius: 999px;
  border: 2px solid var(--negro);
  background: #fff;
  position: relative;
  cursor: pointer;
  transition: background-color 120ms;
}
.switch input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--negro);
  transition: transform 140ms;
}
.switch input:checked { background: var(--negro); }
.switch input:checked::after { transform: translateX(18px); background: var(--amarillo); }

/* Calendario de taco */
.calendar {
  margin-top: 40px;
  display: flex;
  gap: 22px;
  align-items: center;
  max-width: 560px;
}
.calendar__sheet {
  flex: none;
  width: 128px;
  background: #fff;
  border: 2px solid var(--negro);
  text-align: center;
  position: relative;
  box-shadow: 4px 4px 0 var(--negro);
}
.calendar__sheet::before {
  /* anillas */
  content: '';
  position: absolute;
  top: -9px;
  left: 24px;
  right: 24px;
  height: 14px;
  background:
    radial-gradient(circle at 7px 7px, var(--negro) 5px, transparent 5.5px) 0 0 / 26px 14px repeat-x;
}
.calendar__month {
  margin: 0;
  background: var(--rojo);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  padding: 8px 4px 6px;
}
.calendar__day {
  margin: 0;
  font-weight: 900;
  font-stretch: 62%;
  font-size: 84px;
  line-height: 1;
  padding-top: 6px;
}
.calendar__weekday {
  margin: 0;
  font-size: 14px;
  padding: 0 4px 10px;
}
.calendar__text { margin: 0; font-size: 18px; }
.calendar__text strong { font-weight: 800; }

/* ── Ticket ───────────────────────────────────────────── */

.result__ticket {
  position: relative;
  width: 100%;
  max-width: 420px;
  justify-self: center;
}

.printer {
  position: relative;
  z-index: 2;
  height: 30px;
  margin: 0 -14px;
  background: var(--negro);
  border-radius: 10px 10px 6px 6px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.18);
}
.printer__slot {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 7px;
  height: 5px;
  border-radius: 3px;
  background: #3a3a3a;
}

.ticket-clip {
  position: relative;
  overflow: hidden;
  margin-top: -6px;
  padding: 0 10px 30px;
  margin-left: -10px;
  margin-right: -10px;
}

.ticket {
  --edge: 9px;
  position: relative;
  background: var(--papel);
  color: var(--termica);
  font-family: var(--f-mono);
  font-size: 13.5px;
  line-height: 1.55;
  padding: 26px 22px calc(28px + var(--edge));
  filter: drop-shadow(0 14px 14px rgba(0, 0, 0, 0.22));
  -webkit-mask:
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--edge)) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--edge) * 2) var(--edge) repeat-x;
  mask:
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--edge)) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--edge) * 2) var(--edge) repeat-x;
  outline: none;
}
/* La sombra no se ve con mask: la ponemos en el contenedor */
.ticket-clip::after {
  content: '';
  position: absolute;
  inset: 0 10px 30px;
  z-index: -1;
  box-shadow: 0 16px 24px -12px rgba(0, 0, 0, 0.35);
}

.t-head { text-align: center; }
.t-logo {
  margin: 0 0 2px;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.t-head p { margin: 0; }
.t-muted { opacity: 0.75; }
.t-rule {
  border: 0;
  border-top: 1.5px dashed var(--termica);
  margin: 14px 0;
  opacity: 0.8;
}
.t-rule--double {
  border-top: 3px double var(--termica);
  opacity: 1;
}
.t-sec {
  margin: 0 0 6px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.t-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  position: relative;
}
.t-row .t-label { flex: 0 1 auto; min-width: 0; }
.t-row .t-dots {
  flex: 1 1 12px;
  min-width: 12px;
  border-bottom: 1.5px dotted var(--termica);
  transform: translateY(-4px);
  opacity: 0.55;
}
.t-row .t-val {
  flex: none;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.t-emoji {
  display: inline-block;
  width: 1.5em;
  filter: grayscale(1) contrast(1.25) brightness(0.95);
}
.t-row--total {
  font-weight: 800;
  font-size: 16px;
  margin-top: 4px;
}
.t-row--total .t-dots { opacity: 0; }
.t-center { text-align: center; margin: 0; }
.t-small { font-size: 11.5px; opacity: 0.8; }
.t-big {
  font-weight: 800;
  font-size: 15px;
  margin-top: 14px;
}

.barcode {
  height: 54px;
  margin: 16px auto 8px;
  width: 82%;
}

/* Anotación a boli */
.boli {
  position: absolute;
  pointer-events: none;
  color: var(--boli);
}
.boli--circle {
  left: -10px;
  right: -12px;
  top: -9px;
  bottom: -9px;
}
.boli--circle svg { width: 100%; height: 100%; overflow: visible; }
.boli--circle path {
  fill: none;
  stroke: var(--boli);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
}
.boli--circle.is-drawn path {
  transition: stroke-dashoffset 700ms cubic-bezier(.6,.1,.3,1);
  stroke-dashoffset: 0;
}
.boli--note {
  right: -4px;
  top: calc(100% + 4px);
  font-family: var(--f-boli);
  font-size: 30px;
  line-height: 1;
  white-space: nowrap;
  transform: rotate(-4deg);
  opacity: 0;
  transition: opacity 200ms 500ms;
}
.boli--note.is-drawn { opacity: 1; }
.t-row--marked { margin-bottom: 42px; }

/* ── Compartir ────────────────────────────────────────── */

.share { max-width: 560px; }
.share__title {
  margin: 0 0 14px;
  font-weight: 850;
  font-stretch: 112%;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.share__buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  font-family: var(--f-sans);
  font-weight: 750;
  font-size: 17px;
  color: var(--negro);
  background: #fff;
  border: 2px solid var(--negro);
  border-radius: 999px;
  padding: 12px 20px;
  cursor: pointer;
  transition: transform 80ms;
}
.btn:active { transform: translateY(2px); }
.btn--solid { background: var(--negro); color: var(--amarillo); }
.btn--quiet { background: transparent; }
.share__note {
  margin: 12px 0 0;
  min-height: 1.5em;
  font-size: 15px;
  color: var(--gris-sobre-amarillo);
}

/* ── Folleto ──────────────────────────────────────────── */

.flyer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px var(--gutter) 96px;
}
.flyer[hidden] { display: none; }
.flyer__title {
  margin: 0;
  font-weight: 900;
  font-stretch: 125%;
  font-size: clamp(40px, 7.4vw, 104px);
  line-height: 0.95;
  letter-spacing: -0.045em;
  max-width: 12ch;
}
.flyer__lede {
  margin: 18px 0 36px;
  max-width: 56ch;
  font-size: 19px;
}
.flyer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  grid-auto-flow: dense;
  gap: 18px;
}

.tag {
  position: relative;
  background: #fff;
  border: 2px solid var(--negro);
  display: flex;
  flex-direction: column;
}
.tag--big {
  grid-column: span 2;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    'name name'
    'price blurb'
    'unit blurb'
    'foot foot';
  grid-template-rows: auto auto 1fr auto;
  column-gap: 8px;
}
.tag--big .tag__name { grid-area: name; }
.tag--big .tag__price { grid-area: price; }
.tag--big .tag__unit { grid-area: unit; }
.tag--big .tag__blurb { grid-area: blurb; margin-top: 16px; padding-left: 8px; font-size: 16.5px; }
.tag--big .tag__foot { grid-area: foot; }
.tag__name {
  margin: 0;
  padding: 12px 16px 10px;
  border-bottom: 2px solid var(--negro);
  font-weight: 800;
  font-size: 19px;
  line-height: 1.2;
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.tag__price {
  margin: 0;
  padding: 10px 16px 0;
  font-weight: 900;
  font-stretch: 62%;
  font-size: 76px;
  line-height: 0.95;
  color: var(--rojo);
  letter-spacing: -0.015em;
  white-space: nowrap;
}
.tag--big .tag__price { font-size: clamp(84px, 8vw, 120px); }
.tag__price .cents {
  font-size: 0.42em;
  vertical-align: 0.95em;
  margin-left: 0.03em;
  letter-spacing: 0;
}
.tag--capita .tag__price { color: var(--negro); }
.tag--estimate .tag__name { padding-right: 96px; }
.tag__unit {
  margin: 0;
  padding: 2px 16px 0;
  font-size: 15px;
  font-weight: 700;
}
.tag__blurb {
  margin: 12px 0 0;
  padding: 0 16px;
  font-size: 15.5px;
  line-height: 1.45;
}
.tag__foot {
  margin-top: auto;
  padding: 14px 16px 14px;
  font-size: 13.5px;
  line-height: 1.4;
  display: grid;
  gap: 4px;
}
.tag__stat { font-weight: 700; margin: 0; }
.tag__src { margin: 0; color: rgba(0, 0, 0, 0.7); }
.tag__src a { text-underline-offset: 2px; }

.sticker {
  position: absolute;
  top: -16px;
  right: -12px;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  text-align: center;
  background: var(--rojo);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  line-height: 1.1;
  border-radius: 50%;
  transform: rotate(10deg);
  padding: 8px;
}

/* ── Letra pequeña ────────────────────────────────────── */

.fine {
  background: #fff;
  border-top: 2px solid var(--negro);
  padding: 44px var(--gutter) 64px;
  font-size: 14.5px;
  line-height: 1.55;
}
.fine > h2,
.fine__cols {
  max-width: var(--max);
  margin-left: auto;
  margin-right: auto;
}
.fine > h2 {
  margin-top: 0;
  margin-bottom: 22px;
  font-size: 15px;
  font-weight: 800;
}
.fine__cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px 40px;
}
.fine h3 {
  font-size: 14.5px;
  font-weight: 800;
  margin: 0 0 6px;
}
.fine p { margin: 0 0 14px; max-width: 62ch; }
.fine ul { padding-left: 18px; margin: 0 0 14px; }
.fine li { margin-bottom: 8px; }
.sources a { text-underline-offset: 2px; word-break: break-word; }
.fine__disclaimer {
  margin-top: 18px !important;
  padding-top: 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.25);
}

/* ── Móvil ────────────────────────────────────────────── */

@media (max-width: 860px) {
  .result {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'side' 'ticket' 'share';
    grid-template-rows: auto;
  }
  .fine__cols { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  body { font-size: 17px; }
  .tag--big { grid-column: auto; display: flex; }
  .tag--big .tag__blurb { padding-left: 16px; margin-top: 12px; font-size: 15.5px; }
  .flyer__grid { grid-template-columns: minmax(0, 1fr); }
  .sticker { width: 78px; height: 78px; font-size: 12.5px; right: 6px; top: -14px; }
  .tag--estimate .tag__name { padding-right: 90px; }
  .calendar { gap: 16px; }
  .calendar__sheet { width: 108px; }
  .calendar__day { font-size: 70px; }
  .ticket { font-size: 12.5px; padding-left: 16px; padding-right: 16px; }
  .boli--note { font-size: 26px; }
  .print-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
}
