/* Escaparate comercial. Concepto: un estudio de papelería de boda, con la web real
   funcionando en un móvil junto al argumento, y los estilos como pruebas de imprenta. */
:root {
  /* Escaparate siempre en claro, aunque el sistema esté en modo oscuro. */
  color-scheme: light;
  --bg: #f6f4f1;
  --surface: #ffffff;
  --ink: #1f1a24;
  --muted: #675f6d;
  --line: #ddd6d6;
  --accent: #7d2a4b;
  --accent-ink: #ffffff;
  --accent-soft: #f1e3e8;
  --error: #a8322b;
  --scrim: rgb(31 26 36 / .55);
  --shadow: rgb(31 26 36 / .14);

  --font-display: "Gloock", "Didot", Georgia, serif;
  --font-body: "Hanken Grotesk", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --radius: 10px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.6 var(--font-body); }
body.locked { overflow: hidden; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; margin: 0; text-wrap: balance; line-height: 1.08; }
p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.wrap {
  width: 100%; max-width: 1160px; margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
.opt { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  border-radius: 999px; padding: 13px 24px; font: 600 15px/1 var(--font-body);
  text-decoration: none; cursor: pointer; transition: filter .15s;
}
.btn:hover { filter: brightness(1.1); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink); filter: none; }
.btn--small { padding: 9px 16px; font-size: 14px; }
.btn--wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; filter: none; }

/* Cabecera */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; }
.brand { font-family: var(--font-display); font-size: 22px; text-decoration: none; }
.top__nav { display: flex; align-items: center; gap: 20px; font-size: 15px; }
.top__nav a { text-decoration: none; color: var(--muted); }
.top__nav a:hover { color: var(--ink); }

main { display: grid; gap: 112px; padding-block: 56px 96px; }
main section, .contact { scroll-margin-top: 80px; }

/* Intro */
.intro { display: grid; grid-template-columns: 1.15fr 1fr; gap: 56px; align-items: center; }
.intro__text { display: grid; gap: 22px; min-width: 0; }
.intro h1 { font-size: clamp(40px, 6vw, 72px); letter-spacing: -.01em; }
.lead { font-size: 19px; color: var(--muted); max-width: 52ch; }
.intro__cta { display: flex; flex-wrap: wrap; gap: 12px; }
.phone { margin: 0; justify-self: center; display: grid; gap: 12px; justify-items: center; width: min(320px, 100%); }
.phone .scaled { width: 100%; aspect-ratio: 390 / 780; border: 10px solid var(--ink); border-radius: 40px; box-shadow: 0 30px 60px var(--shadow); }
.phone figcaption { font-size: 13px; color: var(--muted); text-align: center; }

/* Iframes escalados (miniaturas) */
.scaled { position: relative; overflow: hidden; max-width: 100%; background: var(--surface); }
.scaled iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; transform: scale(var(--s, .3)); pointer-events: none; }

/* Cabeceras de sección */
.section-head { display: grid; gap: 10px; margin-bottom: 36px; max-width: 62ch; }
.section-head h2, .section-head h1 { font-size: clamp(32px, 4.4vw, 48px); }
.section-note { color: var(--muted); }

/* Estilos */
.styles__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 28px; }
.top__nav a.btn { color: var(--accent-ink); }
.styles__more { display: flex; justify-content: center; margin-top: 40px; }
.style-card { display: grid; gap: 14px; align-content: start; min-width: 0; }
.style-card .scaled { aspect-ratio: 4 / 3; border-radius: var(--radius); border: 1px solid var(--line); }
.style-card h3 { font-size: 26px; }
.style-card__meta { font-size: 13px; color: var(--muted); }
.style-card__desc { color: var(--muted); font-size: 15px; }
.style-card__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.style-card--soon .soon-box {
  aspect-ratio: 4 / 3; border-radius: var(--radius); border: 1px dashed var(--line);
  display: grid; place-items: center; color: var(--muted); font-size: 14px; text-align: center; padding: 16px;
  background: repeating-linear-gradient(-45deg, transparent 0 12px, color-mix(in srgb, var(--line) 40%, transparent) 12px 13px);
}
.tag { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .06em; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

/* Pasos (secuencia real, de ahí los números) */
.steps__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; counter-reset: step; }
.steps__list li { display: grid; gap: 6px; align-content: start; border-top: 1px solid var(--ink); padding-top: 18px; counter-increment: step; }
.steps__list li::before { content: counter(step); font-family: var(--font-display); font-size: 40px; line-height: 1; color: var(--accent); }
.steps__list strong { font-size: 19px; font-weight: 600; }
.steps__list span { color: var(--muted); }

/* Tarifas */
.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.tier { display: grid; grid-template-rows: auto auto auto 1fr auto; gap: 14px; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.tier h3 { font-size: 26px; }
.tier__price { font-family: var(--font-display); font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }
.tier__summary { color: var(--muted); }
.tier ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; align-content: start; font-size: 15px; }
.tier li { padding-left: 22px; position: relative; }
.tier li::before { content: ""; position: absolute; left: 2px; top: .55em; width: 10px; height: 6px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }
.tier.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* Contacto */
.contact { margin-top: 56px; display: grid; grid-template-columns: 1fr 1.3fr; gap: 48px; padding-top: 48px; border-top: 1px solid var(--line); }
.contact__intro { display: grid; gap: 12px; align-content: start; }
.contact__intro h3 { font-size: 32px; }
.contact__intro p { color: var(--muted); }
.chosen { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: center; padding: 12px; border-radius: var(--radius); background: var(--accent-soft); }
.chosen img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; display: block; }
.chosen p { color: var(--ink); font-size: 15px; }
.chosen strong { display: block; font-family: var(--font-display); font-weight: 400; font-size: 20px; }
.contact__form, #builder-form { display: grid; gap: 18px; min-width: 0; }
.contact__thanks { display: grid; gap: 10px; align-content: start; }
.contact__thanks h3 { font-size: 30px; }
.contact__thanks .note { font-size: 14px; color: var(--muted); }

/* Campos */
.field { display: grid; gap: 6px; min-width: 0; border: 0; margin: 0; padding: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field label, .label { font-size: 13px; font-weight: 600; letter-spacing: .04em; color: var(--ink); padding: 0; }
.field input[type="text"], .field input[type="email"], .field input[type="tel"], .field input[type="date"], .field input[type="time"], .field select, .field textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.hint { font-size: 13px; color: var(--muted); }
.consent { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; font-size: 14px; color: var(--muted); cursor: pointer; }
.consent input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.checkout, .billing { display: grid; gap: 16px; }
.billing { padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.error { color: var(--error); font-size: 14px; min-height: 1.2em; }

/* Fotos del formulario */
.photos { display: flex; flex-wrap: wrap; gap: 10px; }
.photos__item, .photos__add { position: relative; width: 92px; height: 92px; border-radius: 8px; overflow: hidden; }
.photos__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos__item button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--scrim); color: #fff; cursor: pointer; font-size: 16px; line-height: 1; }
.photos__item .first { position: absolute; left: 4px; bottom: 4px; font-size: 11px; font-weight: 600; background: var(--scrim); color: #fff; padding: 2px 6px; border-radius: 4px; }
.photos__add { display: grid; place-content: center; text-align: center; gap: 2px; border: 1px dashed var(--muted); color: var(--muted); font-size: 13px; cursor: pointer; }
.photos__add span { font-size: 24px; line-height: 1; }
.photos__add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photos__add:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.photos.is-busy .photos__add { opacity: .5; }

/* Selector de estilo del formulario */
.style-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: 14px; cursor: pointer; background: var(--surface); color: var(--ink); font-family: inherit; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked), .chip[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip[aria-disabled="true"], .chip:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.swatch { width: 14px; height: 14px; border-radius: 50%; background: var(--sw-a); box-shadow: inset -7px 0 0 var(--sw-b); flex: none; }

/* Aviso al hacer scroll */
.nudge {
  position: fixed; z-index: 30; display: grid; gap: 10px;
  left: max(16px, env(safe-area-inset-left, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: min(360px, calc(100vw - 32px)); padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 18px 50px var(--shadow);
  animation: rise .35s ease-out;
}
.nudge__title { font-family: var(--font-display); font-size: 24px; line-height: 1.1; }
.nudge p:not(.nudge__title) { color: var(--muted); font-size: 15px; }
.nudge__actions { display: flex; gap: 8px; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }

/* Capas */
.overlay {
  position: fixed; inset: 0; z-index: 40; overflow: auto; background: var(--scrim);
  padding: calc(24px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: grid; place-items: start center;
}
.overlay--solid { background: var(--bg); place-items: center; z-index: 60; }
.sheet { position: relative; width: min(640px, 100%); background: var(--bg); border-radius: 14px; padding: 32px; display: grid; gap: 8px; box-shadow: 0 30px 80px var(--shadow); }
.sheet h2 { font-size: 36px; }
.sample-fill { justify-self: start; margin-bottom: 16px; }
.close { background: none; border: 0; font-size: 28px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.sheet > .close { position: absolute; top: 14px; right: 14px; }

/* Generando */
.loading { display: grid; gap: 22px; justify-items: center; text-align: center; width: min(460px, 100%); }
.loading__names { font-family: var(--font-display); font-size: clamp(36px, 7vw, 60px); line-height: 1.05; }
.bar { width: 100%; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; }
.loading__msg { color: var(--muted); min-height: 1.6em; }

/* Resultado */
.stage { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); background: var(--bg); }
.stage__bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface);
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
}
.stage__title { min-width: 0; }
.stage__names { font-family: var(--font-display); font-size: 22px; line-height: 1.1; }
/* Con muchos estilos, una sola fila que se desliza (con la rueda, el dedo o el teclado) */
.stage__styles {
  display: flex; flex-wrap: nowrap; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; padding-block: 2px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 40px), transparent);
}
.stage__styles::-webkit-scrollbar { display: none; }
.stage__styles .chip { flex: none; }
.stage__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: none; color: var(--muted); font: 500 13px var(--font-body); padding: 8px 12px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.stage__view { min-height: 0; overflow: auto; display: grid; justify-items: center; padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.stage__frame { position: relative; width: 100%; height: 100%; min-height: 480px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: 0 20px 50px var(--shadow); transition: width .3s ease; }
.stage__frame.is-mobile { width: min(390px, 100%); border: 10px solid var(--ink); border-radius: 36px; }
.stage__frame iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--surface); }
.switching { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(6px); font-family: var(--font-display); font-size: 26px; }

@media (max-width: 900px) {
  main { gap: 80px; padding-top: 32px; }
  .intro { grid-template-columns: 1fr; gap: 40px; }
  .tiers, .steps__list { grid-template-columns: 1fr; }
  .contact { grid-template-columns: 1fr; gap: 28px; }
  .stage__styles { order: 3; flex-basis: 100%; }
}
@media (max-width: 560px) {
  .top__nav a { display: none; }
  .top__nav a.btn { display: inline-flex; }
  .field-row { grid-template-columns: 1fr; }
  .sheet { padding: 24px 18px; }
  .stage__actions .seg { display: none; }
  /* Estilos en una fila que se desliza, para que la web se vea más */
  .stage__styles { max-width: calc(100% + 32px); margin-inline: -16px; padding-inline: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Campo trampa para bots: invisible para personas y lectores de pantalla */
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.fineprint { font-size: 13px; color: var(--muted); margin: 0; }
.fineprint a, .consent a { color: inherit; }
.foot__legal { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; }
.foot__legal a { color: var(--muted); }
.foot { display: grid; gap: 10px; }
.tiers__note { margin-top: 14px; }

/* Secciones que la pareja enciende y apaga en la vista previa (app/stage.js) */
.stage__view { position: relative; }
.sections-panel { position: absolute; z-index: 3; top: 12px; right: max(16px, env(safe-area-inset-right, 0px)); width: min(340px, calc(100% - 32px));
  display: grid; gap: 12px; padding: 18px 18px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 24px 60px var(--shadow); animation: panel-in .35s cubic-bezier(.16, 1, .3, 1); }
@keyframes panel-in { from { opacity: 0; transform: translateY(-8px); } }
.sections-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sections-panel__title { font-family: var(--font-display); font-size: 22px; line-height: 1.1; }
.sections-panel__list { list-style: none; margin: 0; padding: 0; display: grid; }
.sections-panel__list li + li { border-top: 1px solid var(--line); }
.sections-panel__note { font-size: 13px; color: var(--muted); }
.switch { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 11px 0; cursor: pointer; }
.switch strong { display: block; font-weight: 600; font-size: 15px; }
.switch small { display: block; font-size: 13px; color: var(--muted); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--line); transition: background-color .25s ease; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .3s cubic-bezier(.16, 1, .3, 1); }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch.is-fixed { cursor: default; }
.switch.is-fixed .switch__track { opacity: .45; }
@media (max-width: 560px) {
  .sections-panel { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; border-radius: 20px 20px 0 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); animation-name: sheet-up; }
  /* Hoja baja para seguir viendo la web detrás: sin las fijas y con filas más justas */
  .sections-panel { max-height: 55svh; overflow: auto; gap: 6px; padding-top: 14px; }
  .sections-panel__title { font-size: 19px; }
  .sections-panel__list li:has(.is-fixed) { display: none; }
  .sections-panel__list li:has(.is-fixed) + li { border-top: 0; }
  .switch { padding: 8px 0; }
  .switch small { display: none; }
  @keyframes sheet-up { from { transform: translateY(100%); } }
}
