/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #0e0f14;
  --bg-alt: #14161d;
  --card: #1a1c24;
  --card-2: #20222c;
  --text: #f1efe8;
  --text-dim: #a9aab3;
  --accent: #e8a23c;
  --line: #2c2e39;
  --line-soft: #23252f;
  --ok: #7bc98f;
  --warn: #e8b23c;
  --danger: #e2685c;
  --display: "Space Grotesk", "Manrope", -apple-system, sans-serif;
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow: 0 14px 34px -18px rgba(0,0,0,.55);
  --press: transform 160ms var(--ease-out);
  --accent-text: var(--accent);
  --ok-text: var(--ok);
  --focus-ring: var(--accent);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f6f8; --bg-alt: #eceef2; --card: #ffffff; --card-2: #eef0f3;
    --text: #14161b; --text-dim: #565a64; --line: #dfe2e8; --line-soft: #e8eaef;
    --shadow: 0 14px 34px -18px rgba(20,22,30,.16);
    --accent-text: #93590f; --ok-text: #2c6b3e; --focus-ring: #93590f;
  }
}

/* =============================================================
   2. Reset
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, video, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.08; letter-spacing: -0.01em; font-family: var(--display); font-weight: 600; }

.icon { stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; fill: none; flex-shrink: 0; }
.icon-inline { display: inline-block; vertical-align: -3px; margin-right: .3em; }
::selection { background: var(--accent); color: #1a1305; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; border-radius: 4px; }

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

.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 9999;
  padding: .6rem 1rem; background: var(--accent); color: #1a1305;
  border-radius: 8px; font-weight: 700;
}
.skip-link:focus { top: 1rem; }

.container { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }

/* =============================================================
   3. Header / footer
   ============================================================= */
.site-header { padding: 1.1rem 0; border-bottom: 1px solid var(--line-soft); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.15rem; }
.brand em { font-style: normal; color: var(--accent-text); }
.brand-mark { color: var(--accent); flex-shrink: 0; }
.header-nav { display: flex; gap: 1.4rem; font-size: .92rem; font-weight: 600; color: var(--text-dim); }
.header-nav a:hover { color: var(--text); }
@media (max-width: 719px) { .header-nav { display: none; } }

.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 2.75rem; height: 2.75rem; border-radius: 8px; color: var(--text);
  transition: var(--press), background-color 150ms ease;
}
.nav-toggle:hover { background: var(--card-2); }
.nav-toggle:active { transform: scale(.94); }
@media (max-width: 719px) { .nav-toggle { display: inline-flex; } }

.mobile-nav {
  display: flex; flex-direction: column; gap: .2rem;
  margin-top: .8rem; padding: .5rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); box-shadow: var(--shadow);
}
.mobile-nav a {
  padding: .7rem .8rem; border-radius: 8px; font-size: .95rem; font-weight: 600; color: var(--text);
  transition: background-color 150ms ease;
}
.mobile-nav a:hover, .mobile-nav a:focus-visible { background: var(--card-2); }
@media (min-width: 720px) { .mobile-nav { display: none !important; } }

.site-footer { border-top: 1px solid var(--line-soft); padding: 2rem 0; margin-top: 3rem; color: var(--text-dim); font-size: .9rem; }
.footer-row { display: flex; flex-wrap: wrap; gap: .8rem 1.4rem; align-items: center; justify-content: space-between; }
.footer-row nav { display: flex; gap: 1.2rem; align-items: center; }
.footer-row a:hover { color: var(--text); }
.footer-link-btn { color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--line); }
.footer-link-btn:hover { color: var(--text); text-decoration-color: var(--text-dim); }

/* =============================================================
   4. Hero
   ============================================================= */
.hero { padding: 2.6rem 0 1.6rem; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 4.4vw, 2.9rem); max-width: 20ch; margin-inline: auto; }
.hero-sub { color: var(--text-dim); max-width: 56ch; margin: 1rem auto 0; font-size: 1.02rem; }

/* =============================================================
   5. Tool card
   ============================================================= */
.tool-section { padding-bottom: 1.6rem; }
.tool-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.6rem;
}
@media (min-width: 720px) { .tool-card { padding: 2.2rem; } }

.tc-upload, .tc-workspace, .tc-error {
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
  @starting-style {
    opacity: 0;
    transform: translateY(8px);
  }
}

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem;
  text-align: center; padding: 3rem 1.5rem; border: 2px dashed var(--line);
  border-radius: var(--radius-sm); cursor: pointer; transition: border-color .2s var(--ease-out), background .2s var(--ease-out);
  color: var(--text-dim);
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); color: var(--text); }
.dropzone strong { color: var(--text); font-size: 1.05rem; }
.dropzone svg { color: var(--accent); }
.privacy-badge { display: flex; align-items: flex-start; justify-content: center; gap: .4rem; margin: 1rem auto 0; max-width: 46ch; font-size: .86rem; color: var(--ok-text); text-align: left; }
.privacy-badge .icon { color: var(--ok-text); margin-top: .15rem; }

.workspace-grid { display: grid; gap: 1.6rem; grid-template-columns: 1fr; }
.workspace-viewer { order: -1; }
@media (min-width: 960px) {
  .workspace-grid { grid-template-columns: 1fr 320px; }
  .workspace-viewer { order: 0; }
}

.preview-thumb-block { display: flex; flex-direction: column; gap: .7rem; align-items: center; }
.preview-thumb { width: 100%; max-width: 160px; aspect-ratio: 1; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg-alt); }

.control-block { display: flex; flex-direction: column; gap: .45rem; margin-bottom: 1.1rem; }
.control-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.control-label { font-size: .84rem; font-weight: 600; color: var(--text-dim); }
.control-label b { color: var(--text); font-weight: 700; }

input[type="range"] { width: 100%; accent-color: var(--accent); height: 1.4rem; }
input[type="text"], input[type="color"] {
  border: 1px solid var(--line); background: var(--bg-alt); color: var(--text);
  border-radius: 8px; padding: .55rem .7rem; font: inherit;
}
input[type="color"] { padding: .25rem; height: 2.6rem; cursor: pointer; }

.format-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
@media (min-width: 540px) { .format-grid { grid-template-columns: repeat(4, 1fr); } }
.format-btn {
  display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center;
  padding: .9rem .5rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: .78rem; font-weight: 600; color: var(--text-dim);
  transition: var(--press), border-color .15s, color .15s, background .15s;
}
.format-btn svg { color: var(--text-dim); transition: color .15s; }
.format-btn:hover { border-color: var(--accent); color: var(--text); }
.format-btn:active { transform: scale(.97); }
.format-btn.is-active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--text); }
.format-btn.is-active svg { color: var(--accent); }
.format-desc { font-size: .84rem; color: var(--text-dim); margin-top: .5rem; }
.sub-shape { margin-top: .8rem; margin-bottom: 0; }
.pill-group { display: flex; gap: .5rem; }
.pill { padding: .4rem .9rem; border: 1px solid var(--line); border-radius: 999px; font-size: .82rem; font-weight: 600; color: var(--text-dim); transition: var(--press), border-color .15s, color .15s, background .15s; }
.pill.is-active { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.pill:active { transform: scale(.97); }

.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .85rem 1.3rem; border-radius: 999px; font-weight: 700; font-size: .95rem;
  transition: var(--press), opacity .15s;
}
.btn-primary { background: var(--accent); color: #1a1305; width: 100%; }
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .5; pointer-events: none; }
.btn-secondary { background: var(--card-2); border: 1px solid var(--line); color: var(--text); }
.btn-secondary:active { transform: scale(.97); }
.btn-secondary:disabled { opacity: .5; pointer-events: none; }
.btn-ghost { border: 1px solid var(--line); color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); }
.btn-ghost:active { transform: scale(.97); }
.btn-small { padding: .5rem .9rem; font-size: .82rem; }
.btn-stack { flex-direction: column; gap: .15rem; padding-block: .75rem; line-height: 1.3; }
.btn-stack .btn-label { display: inline-flex; align-items: center; }
.btn-stack small { font-weight: 500; opacity: .8; font-size: .78rem; }
.limits-note { font-size: .8rem; color: var(--text-dim); margin-top: .8rem; }

/* resultado / visor 3D */
.viewer-wrap { position: relative; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); }
.viewer3d:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--focus-ring); }
.viewer3d { width: 100%; height: 400px; background: #11131a; }
@media (min-width: 720px) { .viewer3d { height: 480px; } }
.viewer-fallback { display: flex; align-items: center; justify-content: center; height: 100%; padding: 2rem; text-align: center; color: var(--text-dim); font-size: .9rem; }
.viewer-overlay { position: absolute; inset: auto 0 0 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; background: linear-gradient(to top, rgba(0,0,0,.55), transparent); }
.backlight-toggle { display: flex; align-items: center; gap: .4rem; font-size: .84rem; font-weight: 600; color: #fff; cursor: pointer; }
.backlight-toggle .icon { color: #fff; margin: 0; }
.viewer-hint { font-size: .76rem; color: rgba(255,255,255,.75); }
@media (max-width: 539px) { .viewer-hint { display: none; } }
.viewer-progress {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: .6rem;
  background: rgba(10,11,15,.72); color: #fff; font-size: .9rem; font-weight: 600;
  transition: opacity 150ms var(--ease-out);
  @starting-style { opacity: 0; }
}
.viewer-progress span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.warnings-box { margin-top: 1rem; padding: .8rem 1rem; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--warn) 14%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); font-size: .84rem; color: var(--text); }
.warnings-box p + p { margin-top: .4rem; }
.warnings-box--danger { background: color-mix(in srgb, var(--danger) 14%, transparent); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

.download-row { display: grid; gap: .7rem; margin-top: 1.2rem; }
@media (min-width: 620px) { .download-row { grid-template-columns: 1fr 1fr; } }

.tc-error { text-align: center; padding: 2rem 1rem; display: flex; flex-direction: column; gap: 1rem; align-items: center; }
.icon-error { color: var(--danger); }

/* =============================================================
   6. Ad slots (placeholders)
   ============================================================= */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 0 1rem;
  color: var(--text-dim); font-size: .78rem; letter-spacing: .12em; font-weight: 700;
  background: repeating-linear-gradient(45deg, var(--card-2), var(--card-2) 10px, var(--bg-alt) 10px, var(--bg-alt) 20px);
}
.ad-slot--leaderboard { min-height: 90px; margin: 1.8rem auto; }
.ad-slot--incontent { min-height: 250px; margin: 2.2rem auto; }
.ad-slot--popup { min-height: 180px; margin: 1rem 0; border-radius: 10px; }

.corner-toast {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 500;
  display: flex; align-items: center; gap: .8rem;
  background: var(--card); border: 1px dashed var(--line); border-radius: 12px;
  padding: .8rem 1rem; box-shadow: var(--shadow); font-size: .78rem; font-weight: 700; letter-spacing: .1em; color: var(--text-dim);
  min-width: 200px;
  transition: opacity 250ms var(--ease-out), transform 250ms var(--ease-out);
  @starting-style { opacity: 0; transform: translateY(8px); }
}
.corner-toast.is-suppressed { opacity: 0; transform: translateY(8px); pointer-events: none; }
.corner-toast button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.75rem; height: 2.75rem; margin: -0.6rem -0.5rem -0.6rem 0; border-radius: 8px;
  font-size: 1.1rem; line-height: 1; color: var(--text-dim); transition: var(--press), color 150ms ease;
}
.corner-toast button:hover { color: var(--text); }
.corner-toast button:active { transform: scale(.9); }

.download-dialog {
  margin: auto;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text);
  padding: 1.4rem; width: min(380px, 90vw); position: relative;
  box-shadow: var(--shadow);
  opacity: 1; transform: scale(1);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out),
    display 200ms allow-discrete, overlay 200ms allow-discrete;
  @starting-style { opacity: 0; transform: scale(.95); }
}
.download-dialog:not([open]) { opacity: 0; transform: scale(.95); }
.download-dialog::backdrop {
  background: rgba(0,0,0,.55); opacity: 1;
  transition: opacity 200ms var(--ease-out), display 200ms allow-discrete, overlay 200ms allow-discrete;
  @starting-style { opacity: 0; }
}
.dialog-close {
  position: absolute; top: .3rem; right: .3rem; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem;
  font-size: 1.3rem; color: var(--text-dim); transition: var(--press), color 150ms ease;
}
.dialog-close:hover { color: var(--text); }
.dialog-close:active { transform: scale(.9); }
.dialog-kicker { font-weight: 700; padding-right: 1.5rem; }
.dialog-filename { font-size: .84rem; color: var(--text-dim); margin-top: .3rem; word-break: break-all; }
.dialog-tip { margin-top: .8rem; padding: .7rem .8rem; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--warn) 14%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); font-size: .82rem; color: var(--text); }
.download-dialog .btn-primary { margin-top: .2rem; }

/* =============================================================
   7. Content sections
   ============================================================= */
.content-section { padding: 3rem 0; }
.content-section--alt { background: var(--bg-alt); }
.content-section h2 { font-size: clamp(1.5rem, 3vw, 2rem); text-align: center; margin-bottom: 2rem; }

.steps-grid { display: grid; gap: 2rem 1.6rem; grid-template-columns: 1fr; position: relative; }
@media (min-width: 720px) { .steps-grid { grid-template-columns: repeat(3, 1fr); } }
.step { position: relative; padding-top: .2rem; }
.step-num {
  font-family: var(--display); font-size: .95rem; font-weight: 700; color: var(--accent-text);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 999px;
  width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center; margin-bottom: 1rem;
}
.step h3 { font-size: 1.08rem; margin-bottom: .4rem; }
.step p { color: var(--text-dim); font-size: .92rem; }
@media (min-width: 720px) {
  .step:not(:last-child)::after {
    content: ""; position: absolute; top: 1rem; left: calc(100% + .8rem); width: calc(1.6rem - .8rem);
    border-top: 1px dashed var(--line);
  }
}

.ideas-grid { display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
@media (min-width: 620px) { .ideas-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .ideas-grid { grid-template-columns: repeat(3, 1fr); } }
.idea-card { padding: 1.3rem; border-radius: var(--radius-sm); background: var(--card); border: 1px solid var(--line); }
.idea-card h3 { font-size: 1.02rem; margin-bottom: .4rem; }
.idea-card p { color: var(--text-dim); font-size: .88rem; }
.icon-idea { color: var(--accent); margin-bottom: .8rem; }
.idea-card--feature {
  background: color-mix(in srgb, var(--accent) 8%, var(--card));
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}

.faq-list { max-width: 760px; margin-inline: auto; display: flex; flex-direction: column; gap: .6rem; }
.faq-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .2rem 1rem; background: var(--card); }
.faq-item summary { cursor: pointer; padding: .9rem 0; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--accent-text); font-size: 1.3rem; flex-shrink: 0; }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { color: var(--text-dim); padding-bottom: 1rem; font-size: .92rem; max-width: 65ch; }

/* =============================================================
   8. Reduced motion
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .viewer-progress span { animation-duration: 1.6s; }
  .tc-upload, .tc-workspace, .tc-error,
  .corner-toast, .download-dialog, .download-dialog::backdrop {
    transition-duration: 1ms, 1ms;
    @starting-style { transform: none; }
  }
  .btn-primary:active, .btn-secondary:active, .btn-ghost:active,
  .pill:active, .format-btn:active, .corner-toast button:active, .dialog-close:active {
    transform: none;
  }
}
