/* Base + shared components. Colours come only from tokens.css (var(--…)). */
@import url('./tokens.css');

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

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--blush);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

img, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }

/* ── Phone column: full width on phones, a centred 390px column on desktop ── */
.phone {
  position: relative;
  width: 100%;
  max-width: var(--phone-w);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--blush);
  overflow-x: hidden;
}
@media (min-width: 520px) {
  body { background: var(--petal); }
  .phone { box-shadow: var(--shadow-lg); }
}

/* ── Type ── */
.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--wordmark);
  font-size: 40px;
  margin: 0;
}
.title-display {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 34px;
  line-height: 1.1;
  margin: 0;
}
.muted { color: var(--muted); }
.link {
  border: 0;
  background: transparent;
  padding: 6px 0;
  color: var(--lavender);
  text-decoration: none;
}
.link:hover { text-decoration: underline; }

/* ── Page header (menu button + title + counter) ── */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 8px;
}
.page-header__meta { margin-left: auto; font-size: 14px; color: var(--muted); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 22px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}
.btn-primary { background: var(--rose); color: var(--white); }
.btn-secondary { background: var(--petal); color: var(--rose-deep); }
.btn-ghost { background: var(--white); border-color: var(--line-strong); color: var(--ink); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-icon {
  width: var(--tap);
  height: var(--tap);
  flex: none;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon.is-glass { border: 0; background: var(--glass); box-shadow: var(--shadow-sm); }
.btn-icon svg { width: 20px; height: 20px; }

/* ── Chips (sizes, hashtags, filters) ── */
.chip {
  display: inline-flex;
  align-items: center;
  min-width: 40px;
  min-height: 34px;
  padding: 0 12px;
  justify-content: center;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--white);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.chip.is-selected, .chip[aria-pressed="true"] { background: var(--petal); border-color: var(--petal); color: var(--rose-deep); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
}
.badge-used { background: var(--sage-bg); color: var(--sage-deep); }
.badge-status-procesando { background: var(--amber-bg); color: var(--ink); }
.badge-status-enviado { background: var(--petal); color: var(--rose-deep); }
.badge-status-entregado { background: var(--sage-bg); color: var(--sage-deep); }

/* ── Cards & grids ── */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 10px 16px 28px;
}
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ── Forms ── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; }
.input {
  min-height: var(--tap);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--white);
}

/* ── Media frame (video/photo + tag dots), always 9:16 cover ── */
.media-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: var(--ink);
}
.media-fill {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-frame.is-placing { cursor: crosshair; }

/* Tag dot: a 44px tap target around a 16px glowing white dot */
.tag-dot {
  position: absolute;
  width: var(--tap);
  height: var(--tap);
  transform: translate(-50%, -50%);
  border: 0;
  padding: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.tag-dot::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 0 0 5px var(--dot-ring), 0 0 22px 8px var(--dot-glow);
  animation: dot-pulse 2.4s ease-in-out infinite;
}
.tag-dot.is-numbered::before { width: 24px; height: 24px; }
.tag-dot__num { position: relative; font-size: 12px; font-weight: 700; color: var(--rose-deep); }
@keyframes dot-pulse { 50% { transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .tag-dot::before { animation: none; } }

/* Bottom gradient for text over media */
.media-scrim {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 230px;
  background: linear-gradient(to top, var(--scrim), var(--scrim-0));
  pointer-events: none;
}

/* ── Modal & bottom sheet: use native <dialog>, open with showModal() ── */
dialog { color: var(--ink); }
dialog::backdrop { background: var(--backdrop); }
.modal {
  width: min(340px, calc(100vw - 32px));
  border: 0;
  border-radius: var(--radius);
  padding: 20px;
  background: var(--white);
  box-shadow: var(--shadow-lg);
}
.sheet {
  width: 100%;
  max-width: var(--phone-w);
  max-height: 85dvh;
  margin: auto auto 0;
  border: 0;
  border-radius: 24px 24px 0 0;
  padding: 10px 18px 24px;
  background: var(--white);
  overflow-y: auto;
}
.sheet::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 2px;
  background: var(--line-strong);
}

/* ── Toast (shared/js/toast.mjs) ── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  max-width: calc(min(100vw, var(--phone-w)) - 32px);
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--white);
  font-size: 14px;
  font-weight: 500;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ── Landing (index.html) ── */
.landing {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 24px;
  text-align: center;
}
.landing__tagline { font-size: 16px; color: var(--muted); margin: 0 0 18px; }
.landing__actions { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 280px; }
