/* =========================================================
   RelieveQR — styles
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  --ink: #15171c;
  --ink-2: #2a2d35;
  --muted: #5d6370;
  --line: #e5e2db;
  --line-2: #d6d2c8;
  --bg: #faf9f6;
  --card: #ffffff;
  --soft: #f3f1ec;
  --accent: #e4572e;
  --accent-2: #c9461f;
  --ok: #1f7a4a;
  --warn: #9a6200;
  --bad: #b3261e;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(21, 23, 28, .04), 0 8px 30px rgba(21, 23, 28, .07);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-2); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(228, 87, 46, .45); outline-offset: 2px; }

.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); background: rgba(250, 249, 246, .92); position: sticky; top: 0; z-index: 20; backdrop-filter: saturate(1.4) blur(8px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.logo { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.logo b { color: var(--accent); }
.nav { display: flex; gap: 22px; }
.nav a { color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500; }
.nav a:hover { color: var(--ink); }

/* ---------- Hero ---------- */
.hero { padding: 26px 0 18px; text-align: center; }
.hero h1 {
  font-family: var(--display);
  font-size: clamp(28px, 4.4vw, 46px);
  line-height: 1.08;
  letter-spacing: -.025em;
  margin: 0 0 10px;
}
.hero .sub { margin: 0 auto; max-width: 720px; color: var(--muted); font-size: clamp(15px, 1.6vw, 18px); }
.hero .sub strong { color: var(--ink-2); font-weight: 600; }

/* ---------- Tool card ---------- */
.tool-card {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.noscript { grid-column: 1 / -1; margin: 0; padding: 14px; border-radius: var(--radius-sm); background: #fff4e5; color: var(--warn); font-weight: 600; }
.tool-left { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.tool-right { display: flex; flex-direction: column; gap: 16px; min-width: 0; position: sticky; top: 76px; align-self: start; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 18px; background: #fff; }
.panel-title { display: flex; align-items: center; gap: 10px; font-size: 17px; margin: 0 0 12px; letter-spacing: -.01em; }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 14px; font-weight: 700; flex: none; }

.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 12px 0 6px; }
.field-label.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }

.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 16px; /* evita zoom en iOS */
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(21, 23, 28, .08); }
.select { width: auto; padding-right: 34px; appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2315171c' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat right 12px center; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px; background: var(--soft); border-radius: 12px; }
.tab { flex: 1 1 auto; border: 0; background: transparent; padding: 9px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tab.is-on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.mode-pane { margin-top: 2px; }

/* Style chips */
.styles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chip-style {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 6px; border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.chip-style svg { width: 28px; height: 28px; fill: var(--ink); }
.chip-style.is-on { border-color: var(--ink); background: var(--soft); box-shadow: inset 0 0 0 1px var(--ink); }

/* Colors */
.colors { margin-top: 4px; }
.color-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.color-row .field-label { width: 100%; }
.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.sw {
  width: 30px; height: 30px; border-radius: 50%; border: 0; padding: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18);
  position: relative;
}
.sw.is-on::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2.5px solid var(--ink); }
.custom-color { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; cursor: pointer; }
.custom-color input { width: 32px; height: 32px; padding: 0; border: 1.5px solid var(--line-2); border-radius: 50%; background: none; cursor: pointer; overflow: hidden; }
.custom-color input::-webkit-color-swatch-wrapper { padding: 0; }
.custom-color input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.custom-color input::-moz-color-swatch { border: 0; border-radius: 50%; }
.color-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.contrast { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--soft); }
.contrast.good { color: var(--ok); background: #e7f4ec; }
.contrast.mid { color: var(--warn); background: #fff4df; }
.contrast.bad { color: var(--bad); background: #fde8e6; }

.btn-ghost { border: 1.5px solid var(--line-2); background: #fff; border-radius: 99px; padding: 7px 14px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--ink); }

/* Segmented */
.seg { display: inline-flex; padding: 4px; background: var(--soft); border-radius: 12px; gap: 4px; }
.seg-btn { border: 0; background: transparent; padding: 8px 16px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg-btn.is-on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.center-pane { margin-top: 10px; }
.emoji-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.emo { aspect-ratio: 1; border: 1.5px solid transparent; border-radius: 9px; background: var(--soft); font-size: 20px; line-height: 1; padding: 0; display: grid; place-items: center; }
.emo.is-on { border-color: var(--ink); background: #fff; }
.input-emoji { width: 76px; text-align: center; font-size: 20px; }

.upload { display: block; cursor: pointer; }
.upload input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.upload-box { display: block; padding: 16px; border: 1.5px dashed var(--line-2); border-radius: 12px; text-align: center; color: var(--muted); font-size: 14px; background: var(--soft); }
.upload-box b { display: block; color: var(--ink); font-size: 15px; }
.upload:hover .upload-box, .upload:focus-within .upload-box { border-color: var(--ink); }
.logo-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.logo-row img { width: 48px; height: 48px; object-fit: contain; border-radius: 8px; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 12px 12px; border: 1px solid var(--line); }

/* Formats */
.formats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fmt {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px;
  padding: 12px 8px; border: 1.5px solid var(--line-2); border-radius: 14px; background: #fff; color: var(--ink);
}
.fmt svg { width: 48px; height: 36px; margin-bottom: 4px; color: var(--ink); }
.fmt b { font-size: 14px; }
.fmt small { font-size: 12px; color: var(--muted); line-height: 1.3; }
.fmt.is-on { border-color: var(--accent); background: #fff6f2; box-shadow: inset 0 0 0 1px var(--accent); }
.fmt.is-on svg { color: var(--accent-2); }

.sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.slider { display: flex; flex-direction: column; gap: 6px; }
.slider output { font-weight: 700; color: var(--ink); }
input[type="range"] { width: 100%; accent-color: var(--ink); height: 28px; }
.row-label { display: flex; gap: 10px; align-items: flex-end; margin-top: 2px; }
.row-label .grow { flex: 1; min-width: 0; }

/* ---------- Previews ---------- */
.preview { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--soft); }
.preview-2d { display: grid; grid-template-columns: 168px 1fr; grid-template-rows: auto 1fr; column-gap: 14px; align-items: start; }
.qr-frame { grid-row: 1 / 3; position: relative; width: 168px; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.qr-holder, .qr-holder canvas { width: 100% !important; height: 100% !important; }
.sample-badge { position: absolute; top: 6px; left: 6px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; letter-spacing: .02em; }
.preview-cap { margin: 2px 0 10px; font-size: 13px; color: var(--muted); }
.dl-row { display: flex; flex-wrap: wrap; gap: 8px; align-self: end; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 700; font-size: 14px;
  transition: transform .08s, background .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover:not(:disabled) { background: var(--ink-2); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-2); }
.btn-big { width: 100%; padding: 15px 18px; font-size: 16px; border-radius: 14px; margin-top: 10px; }
.link-btn { display: block; margin: 8px auto 0; border: 0; background: none; color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover:not(:disabled) { color: var(--ink); }
.link-btn:disabled { opacity: .5; cursor: not-allowed; }

.viewer { position: relative; height: 300px; border-radius: 12px; overflow: hidden; background: radial-gradient(120% 90% at 50% 20%, #ffffff 0%, #e9e6df 100%); touch-action: none; }
.viewer canvas { width: 100% !important; height: 100% !important; }
.viewer-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 20px; text-align: center; color: var(--muted); font-size: 14px; font-weight: 500; }
.viewer-msg.is-error { color: var(--ink-2); }
.viewer-hint { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); font-size: 11.5px; color: var(--muted); background: rgba(255, 255, 255, .8); padding: 3px 10px; border-radius: 99px; white-space: nowrap; pointer-events: none; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.dims { margin: 10px 0 6px; font-size: 13px; color: var(--ink-2); font-weight: 600; text-align: center; }
.warnings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.warnings li { font-size: 13px; line-height: 1.4; padding: 7px 10px; border-radius: 9px; background: #fff; border-left: 3px solid var(--line-2); }
.warnings li.ok { border-left-color: var(--ok); }
.warnings li.warn { border-left-color: #e0a100; background: #fffaf0; }
.warnings li.bad { border-left-color: var(--bad); background: #fff3f2; color: #7a1b15; }
.warnings li.info { border-left-color: #6b7a99; }

.privacy { margin: 14px 4px 0; font-size: 14px; color: var(--muted); text-align: center; }
.privacy strong { color: var(--ok); }

/* ---------- Ad slots (placeholders) ---------- */
.ad-slot {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 1.5px dashed #c9c4b8; border-radius: 12px; background: repeating-linear-gradient(45deg, #f6f4ef 0 10px, #f1eee7 10px 20px);
  color: #8b8577; text-align: center;
}
.ad-label { font-size: 13px; font-weight: 800; letter-spacing: .18em; }
.ad-size { font-size: 11px; opacity: .8; }
.ad-leaderboard { min-height: 100px; max-width: 728px; margin: 28px auto 0; }
.ad-incontent { min-height: 280px; max-width: 336px; margin: 8px auto 0; }

.ad-dialog { border: 0; padding: 0; background: transparent; max-width: calc(100% - 24px); }
.ad-dialog::backdrop { background: rgba(21, 23, 28, .55); }
.ad-dialog[open] { display: block; }
.ad-dialog-box { position: relative; background: #fff; border-radius: 18px; padding: 22px; width: 344px; max-width: 100%; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.ad-dialog-ok { margin: 0 30px 0 0; font-weight: 700; }
.ad-popup { width: 300px; max-width: 100%; height: 250px; margin: 0 auto; }
.ad-close { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--soft); font-size: 22px; line-height: 1; color: var(--ink); display: grid; place-items: center; z-index: 2; }
.ad-close:hover { background: var(--line); }

.ad-toast { position: fixed; right: 16px; bottom: 16px; z-index: 30; width: 340px; max-width: calc(100% - 24px); background: #fff; border-radius: 14px; padding: 10px; box-shadow: 0 10px 40px rgba(0, 0, 0, .2); animation: toast-in .35s ease-out; }
.ad-toast .ad-close { top: -10px; right: -10px; width: 28px; height: 28px; font-size: 18px; background: var(--ink); color: #fff; }
.ad-toast-slot { height: 100px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ad-toast { animation: none; } }

/* ---------- Content sections ---------- */
.section { padding: 56px 0 8px; }
.section h2 { font-family: var(--display); font-size: clamp(24px, 3vw, 32px); letter-spacing: -.02em; line-height: 1.15; margin: 0 0 22px; text-align: center; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: none; }
.steps li { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.steps svg { width: 40px; height: 40px; color: var(--accent); margin-bottom: 10px; }
.steps h3 { margin: 0 0 6px; font-size: 18px; }
.steps p { margin: 0; color: var(--muted); }

.ideas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.idea { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.idea-ico { font-size: 28px; display: block; margin-bottom: 8px; }
.idea h3 { margin: 0 0 6px; font-size: 17px; }
.idea p { margin: 0; color: var(--muted); font-size: 15px; }

.guide { max-width: 780px; }
.guide h2 { text-align: left; }
.guide h3 { font-size: 19px; margin: 26px 0 6px; }
.guide p { margin: 0 0 12px; color: var(--ink-2); }

.faq { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 0 18px; }
.faq summary { cursor: pointer; list-style: none; padding: 16px 30px 16px 0; font-weight: 600; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 0; top: 50%; transform: translateY(-50%); font-size: 22px; font-weight: 400; color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 0 16px; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { margin-top: 64px; border-top: 1px solid var(--line); padding: 26px 0 90px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); }
.footer-inner p { margin: 0; }
.footer-inner nav { display: flex; gap: 18px; }
.footer-inner a { color: var(--muted); }

/* ---------- Legal pages ---------- */
.legal { max-width: 760px; padding: 40px 0; }
.legal h1 { font-family: var(--display); font-size: 34px; letter-spacing: -.02em; }
.legal .todo { background: #fff4df; padding: 2px 6px; border-radius: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .tool-card { grid-template-columns: 1fr; padding: 14px; gap: 14px; }
  /* Orden en móvil: contenido → vista QR → diseño → objeto → vista 3D */
  .tool-left, .tool-right { display: contents; }
  .panel-content { order: 1; }
  .preview-2d { order: 2; }
  .panel-design { order: 3; }
  .panel-object { order: 4; }
  .preview-3d { order: 5; }
  .tool-right { position: static; }
  .steps, .ideas { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .wrap { width: calc(100% - 24px); }
  .nav { display: none; }
  .hero { padding: 16px 0 12px; }
  .hero .sub { font-size: 14.5px; }
  .tool-card { border-radius: 18px; padding: 10px; }
  .panel { padding: 12px 12px 14px; }
  .panel-title { font-size: 16px; margin-bottom: 10px; }
  .tabs { flex-wrap: nowrap; gap: 4px; }
  .tab { padding: 8px 4px; font-size: 13px; flex: 1 1 0; }
  .hide-sm { display: none; }
  .chip-style { font-size: 11.5px; letter-spacing: -.01em; }
  .preview-2d { grid-template-columns: 120px 1fr; column-gap: 12px; padding: 12px; }
  .qr-frame { width: 120px; }
  .preview-cap { font-size: 12px; margin-bottom: 8px; }
  .dl-row .btn { padding: 9px 12px; font-size: 13px; flex: 1 1 auto; }
  .styles { gap: 6px; }
  .chip-style { padding: 8px 0; }
  .emoji-grid { grid-template-columns: repeat(8, 1fr); }
  .sliders { grid-template-columns: 1fr; gap: 8px; }
  .row2 { grid-template-columns: 1fr; }
  .fmt small { display: none; }
  .viewer { height: 260px; }
  .steps, .ideas { grid-template-columns: 1fr; }
  .section { padding-top: 44px; }
  .ad-leaderboard { min-height: 100px; max-width: 320px; }
  .ad-toast { right: 12px; bottom: 12px; }
}
