@font-face { font-family: 'Bowlby One'; src: url('/assets/fonts/BowlbyOne-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Aleo'; src: url('/assets/fonts/Aleo-Regular.otf') format('opentype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Aleo'; src: url('/assets/fonts/Aleo-Bold.otf') format('opentype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Coluna'; src: url('/assets/fonts/Coluna.otf') format('opentype'); font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('/assets/fonts/Poppins-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('/assets/fonts/Poppins-600.woff2') format('woff2'); font-weight: 600 700; font-display: swap; }
@font-face { font-family: 'Cooper'; src: url('/assets/fonts/CooperStd-Black.woff2') format('woff2'); font-weight: 400 900; font-display: swap; }

/* ---------- brand tokens ---------- */
:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --gap: 10px;
  --pad: 16px;
  color-scheme: dark;
}
[data-brand='balus'] {
  --ground: #102a4c;
  --ground-2: #2a2a2a;
  --ink: #fbf7f0;
  --ink-soft: #c9c3b8;
  --accent: #c23370;
  --accent-ink: #ffffff;
  --today: #e8b666;
  --today-ink: #1f1f1f;
  --num: #fbf7f0;
  --field: #fbf7f0;
  --field-ink: #1f1f1f;
  --display: 'Bowlby One', 'Arial Black', sans-serif;
  --text: 'Aleo', Georgia, serif;
  --button: var(--display);
  --radius: 0px;
}
[data-brand='salchicheria'] {
  --ground: #082a38;
  --ground-2: #092e3e;
  --ink: #ffffff;
  --ink-soft: #e6f5fc;
  --accent: #eb6907;
  --accent-ink: #ffffff;
  --today: #ffffff;
  --today-ink: #eb6907;
  --num: #ffffff;
  --field: #ffffff;
  --field-ink: #092e3e;
  --display: 'Coluna', 'Arial Narrow', sans-serif;
  /* same pairing as salchicheria.com: Coluna titles, Poppins text, Cooper accents */
  --text: 'Poppins', system-ui, sans-serif;
  --button: 'Cooper', 'Cooper Black', Georgia, serif;
  --radius: 14px;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--text);
  font-size: 17px;
  line-height: 1.5;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
img, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--today); outline-offset: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

[data-brand='salchicheria'] body { font-size: 20px; }
[data-brand='salchicheria'] .lead, [data-brand='salchicheria'] .today-bar p { font-size: 21px; line-height: 1.35; }
[data-brand='salchicheria'] .foot { font-size: 18px; }
/* Christmas night behind both houses: warm bokeh over the brand's night colour */
body {
  background:
    radial-gradient(circle at 12% 18%, rgb(255 196 110 / 0.16), transparent 22%),
    radial-gradient(circle at 88% 8%, rgb(255 196 110 / 0.12), transparent 20%),
    radial-gradient(circle at 80% 70%, rgb(255 196 110 / 0.1), transparent 24%),
    var(--ground);
}

.page { max-width: 1240px; margin: 0 auto; padding: 0 var(--pad) 48px; }


/* ---------- header ---------- */
.top {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 20px;
  align-items: center;
  padding: 14px 0 12px;
}
.logo { width: 84px; height: auto; }
[data-brand='salchicheria'] .logo { width: 170px; }
.top h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lead { margin: 0; max-width: 52ch; font-size: 16px; line-height: 1.4; }
.lead strong { font-weight: 700; }
.lead::before { /* holly sprig as the Christmas accent of the text */
  content: '';
  display: inline-block;
  width: 1.9em;
  height: 1.2em;
  margin-right: 0.35em;
  vertical-align: -0.2em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 40'%3E%3Cpath d='M32 24C24 10 10 7 2 13c6 2 6 8 2 12 8 0 16 6 28-1z' fill='%232e7d32'/%3E%3Cpath d='M32 24c8-14 22-17 30-11-6 2-6 8-2 12-8 0-16 6-28-1z' fill='%231f5f27'/%3E%3Ccircle cx='28' cy='22' r='5' fill='%23d32f2f'/%3E%3Ccircle cx='37' cy='22' r='5' fill='%23c62828'/%3E%3Ccircle cx='32.5' cy='15' r='5' fill='%23e53935'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* language switch: its own row above the logo, so it never covers the text */
.lang { grid-column: 1 / -1; order: -1; justify-self: end; display: flex; gap: 4px; }
.lang button {
  min-width: 44px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--ink) 35%, transparent);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: 700 14px/1 var(--text);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}
.lang button[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.lang button:focus-visible { outline: 2px solid var(--today); outline-offset: 2px; }
@media (hover: hover) { .lang button[aria-pressed='false']:hover { border-color: var(--ink); } }
.today-bar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
}
.today-bar p { margin: 0; font-size: 18px; font-family: var(--display); }
[data-brand='salchicheria'] .today-bar p { font-family: var(--text); font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 26px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--button);
  font-size: 18px;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), background-color 160ms ease;
}
[data-brand='salchicheria'] .btn { font-size: 19px; letter-spacing: 0; border-radius: 999px; }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.btn.secondary { background: transparent; color: inherit; box-shadow: inset 0 0 0 3px currentColor; }
.link-btn { background: none; border: 0; padding: 8px 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 16px; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { filter: brightness(1.08); }
}

/* ---------- calendar: the generated facade (hut freed from its background, tools/freistellen.py), doors cut out and hinged ---------- */
.calendar { margin: 4px calc(-1 * var(--pad)) 0; }
.scene { position: relative; aspect-ratio: var(--ar, 2 / 3); margin: 0 auto; container: scene / inline-size; }
.scene .bg { position: absolute; inset: 0; width: 100%; height: 100%; }
@media (min-width: 769px) {
  .calendar { margin-inline: 0; }
  .scene { width: min(100%, calc((100svh - 40px) * var(--ar))); } /* the whole hut fits the screen, roof included */
}
.doors { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; }
.doors > li { position: absolute; perspective: var(--persp, 300px); }
.doors > li.is-open, .doors > li[data-state='opened'] { z-index: 2; }
.door {
  position: absolute;
  inset: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: default;
  transform-style: preserve-3d;
  transition: transform 160ms var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
/* the hole behind the door and the inside of the leaf share the door's outline, notch included */
.room, .back { -webkit-mask: var(--mask) center / 100% 100% no-repeat; mask: var(--mask) center / 100% 100% no-repeat; }
.room {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 42%, #ffe9b3, #f2a64a 52%, #7a3510);
  box-shadow: inset 0 0 1.4cqi 0.3cqi rgb(0 0 0 / 0.65);
}
/* the room only exists where a door can move: elsewhere the blank door of the picture shows while a leaf loads */
li:not([data-state='today']):not([data-state='opened']):not(.is-open) .room { visibility: hidden; }
.room::after { /* the light inside, switched on as the door opens */
  content: '';
  position: absolute;
  inset: 0;
  background: #140a04;
  transition: opacity 700ms var(--ease-out) 220ms;
}
.gift {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14%;
  opacity: 0;
  transform: scale(0.86);
  transition: opacity 400ms var(--ease-out) 450ms, transform 600ms var(--ease-out) 450ms;
}
.gift img { width: 100%; height: auto; filter: drop-shadow(0 0.4cqi 0.5cqi rgb(80 30 0 / 0.45)); }
.leaf {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform-style: preserve-3d;
  pointer-events: none;
  transition: transform 1150ms cubic-bezier(0.5, 0.05, 0.2, 1.08); /* unlatch, swing, settle */
}
.front, .back { position: absolute; inset: 0; width: 100%; height: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.front { display: block; user-select: none; }
.back { background: linear-gradient(90deg, #3b2414, #5e3d22); transform: rotateY(180deg); }
/* shadow the open leaf casts on the wall */
.doors > li::before {
  content: '';
  position: absolute;
  top: 4%;
  bottom: -3%;
  right: 100%;
  width: 46%;
  background: linear-gradient(to left, rgb(0 0 0 / 0.45), transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 700ms var(--ease-out) 200ms;
}
li.is-open .leaf, li[data-state='opened'] .leaf { transform: rotateY(-108deg); }
li.is-open .room::after, li[data-state='opened'] .room::after { opacity: 0; }
li.is-open .gift, li[data-state='opened'] .gift { opacity: 1; transform: none; }
li.is-open::before, li[data-state='opened']::before { opacity: 1; }
li[data-state='opened'] .door, li[data-own] .door { cursor: pointer; }

/* today: a warm light around the door, a sign, a little knock */
li[data-state='today'] .door { cursor: pointer; }
li[data-state='today']::after {
  content: '';
  position: absolute;
  inset: -7%;
  z-index: -1;
  border-radius: 14%;
  box-shadow: 0 0 0 0.45cqi #ffd36e, 0 0 3.2cqi 0.9cqi rgb(255 205 110 / 0.75);
  animation: glow 2.4s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes glow { from { opacity: 0.6; } to { opacity: 1; } }
li[data-state='today']:not(.is-open) .leaf { animation: knock 4s var(--ease-in-out) 1.2s 3; }
@keyframes knock {
  0%, 14%, 30%, 100% { transform: none; }
  7%, 21% { transform: rotateY(-18deg); }
}
li[data-state='today'] .door:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  li[data-state='today']:not(.is-open) .door:hover .leaf { animation: none; transform: rotateY(-18deg); transition-duration: 300ms; transition-timing-function: var(--ease-out); }
}
.hoy {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 0;
  translate: -50% -60%;
  padding: 1px 8px;
  background: #c62f2f;
  color: #fff;
  font-family: var(--display);
  font-size: clamp(10px, 1.1cqi + 6px, 16px);
  line-height: 1.4;
  text-transform: uppercase;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.35);
}
.flakes { position: absolute; z-index: 3; inset: 0; overflow: hidden; pointer-events: none; }
.flakes i { position: absolute; top: -10px; border-radius: 50%; background: #fff; opacity: 0.8; animation: fall linear infinite; }
@keyframes fall { to { transform: translate3d(var(--drift), 1400px, 0); } }

.foot { margin-top: 28px; font-size: 15px; color: var(--ink-soft); max-width: 70ch; }
.foot a { color: var(--ink); }

/* ---------- dialogs ---------- */
dialog {
  width: min(520px, 100vw - 24px);
  max-height: calc(100dvh - 24px);
  padding: 28px 24px 24px;
  border: 0;
  border-radius: var(--radius);
  background: var(--field);
  color: var(--field-ink);
  overflow: auto;
  transition: opacity 220ms var(--ease-out), transform 260ms var(--ease-out), display 260ms allow-discrete, overlay 260ms allow-discrete;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
}
dialog[open] { opacity: 1; transform: none; }
@starting-style { dialog[open] { opacity: 0; transform: translateY(16px) scale(0.98); } }
dialog::backdrop { background: rgb(0 0 0 / 0.62); }
dialog h2 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
[data-brand='salchicheria'] dialog h2 { text-transform: uppercase; font-size: 36px; }
dialog p { margin: 0 0 16px; overflow-wrap: anywhere; }
.close-x {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
}
form { display: grid; gap: 14px; }
label.field { display: grid; gap: 6px; font-weight: 700; }
input[type='email'], input[type='password'], input.code, .pin { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; }
input[type='email'], input.code {
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 2px solid currentColor;
  border-radius: var(--radius);
  background: #fff;
  color: #1f1f1f;
  font-size: 18px;
}
input.code { font-size: 30px; letter-spacing: 0.35em; text-align: center; font-variant-numeric: tabular-nums; }
.check { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; font-size: 15px; line-height: 1.45; }
.check input { width: 24px; height: 24px; margin: 0; accent-color: var(--accent); }
.error { color: #b3261e; font-weight: 700; margin: 0; min-height: 0; }
.error:empty { display: none; }
.hint { font-size: 15px; }

/* ---------- voucher card ---------- */
.voucher {
  display: grid;
  gap: 4px;
  justify-items: start;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--ground-2);
  color: var(--ink);
}
[data-brand='balus'] .voucher { background-color: #1f1f1f; }
/* Christmas: snow cap along the top, holly in the corner */
.voucher { position: relative; overflow: hidden; padding-top: 34px; }
.voucher::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 16px;
  background: radial-gradient(circle at 50% 0, #fff 11px, transparent 11.5px) 0 0 / 22px 16px repeat-x, linear-gradient(#fff, #fff) 0 0 / 100% 5px no-repeat;
}
.voucher::after {
  content: '';
  position: absolute;
  top: 18px;
  right: 14px;
  width: 78px;
  height: 49px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 40'%3E%3Cpath d='M32 24C24 10 10 7 2 13c6 2 6 8 2 12 8 0 16 6 28-1z' fill='%232e7d32'/%3E%3Cpath d='M32 24c8-14 22-17 30-11-6 2-6 8-2 12-8 0-16 6-28-1z' fill='%231f5f27'/%3E%3Ccircle cx='28' cy='22' r='5' fill='%23d32f2f'/%3E%3Ccircle cx='37' cy='22' r='5' fill='%23c62828'/%3E%3Ccircle cx='32.5' cy='15' r='5' fill='%23e53935'/%3E%3C/svg%3E") center / contain no-repeat;
}
.voucher > * { position: relative; }
.voucher .v-logo { height: 54px; width: auto; margin-bottom: 8px; }
.voucher .v-icon { width: 120px; height: 120px; margin: 4px 0 6px; }
.voucher .v-icon img { width: 100%; height: 100%; }
.voucher .v-title {
  font-family: var(--display);
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.01em;
  margin: 0;
}
[data-brand='salchicheria'] .voucher .v-title { text-transform: uppercase; font-size: 40px; }
.voucher .v-cond { margin: 6px 0 10px; font-size: 18px; line-height: 1.35; }
.voucher .v-meta { font-size: 16px; color: var(--ink-soft); }
.voucher .v-number { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.voucher .v-qr { width: 180px; height: 180px; margin-top: 12px; background: #fff; padding: 8px; image-rendering: pixelated; }
.voucher-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.voucher-actions .btn.secondary { color: var(--field-ink); }
#png-preview { margin: 16px 0 0; }
#png-preview img { width: 100%; max-width: 320px; height: auto; }
#other-mail { margin-top: 12px; color: inherit; }

/* ---------- redeem page ---------- */
.redeem-page { max-width: 560px; margin: 0 auto; padding: 20px var(--pad) 48px; }
.status {
  margin: 18px 0;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--field);
  color: var(--field-ink);
}
.status .big-word {
  font-family: var(--display);
  font-size: clamp(40px, 12vw, 88px);
  overflow-wrap: anywhere;
  line-height: 0.9;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}
[data-brand='salchicheria'] .status .big-word { text-transform: uppercase; }
.status.ok { background: #1f8a4c; color: #fff; }
.status.used { background: #b3261e; color: #fff; }
.status.gone { background: #5b5b5b; color: #fff; }
.status.ok .big-word { animation: stamp 420ms var(--ease-out); }
@keyframes stamp { from { transform: scale(1.25); opacity: 0; } to { transform: none; opacity: 1; } }
.pin { font-size: 40px; letter-spacing: 0.5em; text-align: center; width: 100%; min-height: 64px; border: 3px solid currentColor; border-radius: var(--radius); background: #fff; color: #1f1f1f; }

/* ---------- admin ---------- */
.admin { max-width: 900px; margin: 0 auto; padding: 24px var(--pad) 48px; }
.admin table { border-collapse: collapse; width: 100%; font-size: clamp(14px, 4.4vw, 16px); font-variant-numeric: tabular-nums; background: var(--field); color: var(--field-ink); }
.admin th, .admin td { padding: 8px clamp(6px, 2vw, 12px); text-align: right; border-bottom: 1px solid rgb(0 0 0 / 0.12); }
.admin th:first-child, .admin td:first-child { text-align: left; }
.admin td:not(:first-child) { white-space: nowrap; }
.totals { display: flex; flex-wrap: wrap; gap: 28px; margin: 16px 0 24px; }
.totals b { display: block; font-family: var(--display); font-size: 44px; line-height: 1; }

@media (min-width: 760px) {
  :root { --gap: 14px; --pad: 32px; }
  .logo { width: 120px; }
  [data-brand='salchicheria'] .logo { width: 260px; }
  .top { padding: 24px 0 18px; }
}
@media (max-width: 560px) {
  [data-brand='salchicheria'] .top { grid-template-columns: 1fr; }
  [data-brand='salchicheria'] .logo { width: 210px; }
}
@media (max-width: 420px) {
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--radius) var(--radius) 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .leaf { transition: opacity 400ms ease; animation: none !important; }
  li[data-state='today'] .door:active { transform: none; }
  li[data-state='today']::after { animation: none; }
  li.is-open .leaf, li[data-state='opened'] .leaf { transform: none; opacity: 0; }
  .gift { transform: none; transition: opacity 400ms ease 200ms; }
  .flakes { display: none; }
  dialog, dialog[open] { transform: none; }
  .status.ok .big-word { animation: none; }
}

/* ---------- embedded on the brand's website (app.js sets data-embed once the host page talks to the frame) ---------- */
/* the frame grows with the page, so nothing here may depend on the frame's own height */
[data-embed] body { min-height: 0; overflow: hidden; background: transparent; } /* the host page paints the same night sky behind the frame */
[data-embed] .brand-link { display: none; } /* the website's header already carries the logo */
[data-embed] .scene { width: 100%; }
/* centred on the part of the frame the visitor can see */
[data-embed] dialog {
  top: calc(var(--vis-top) + var(--vis-h) / 2);
  bottom: auto;
  margin-block: 0;
  translate: 0 -50%;
  max-height: calc(var(--vis-h) - 24px);
}
@media (max-width: 420px) {
  /* the bottom sheet sits on the lower edge of what is visible, above the website's order bar */
  [data-embed] dialog { top: calc(var(--vis-top) + var(--vis-h)); translate: 0 -100%; max-height: calc(var(--vis-h) - 12px); }
}
