/* ==========================================================================
   FotoExpress — hoja de estilos única
   Papel cálido + tinta casi negra + un solo acento mandarina, reservado
   para lo accionable (soltar fotos, descargar).
   ========================================================================== */

:root {
  --paper:       #F7F5F2;
  --card:        #FFFFFF;
  --ink:         #16161D;
  --ink-60:      #5B5B66;
  --ink-30:      #9A9AA4;
  --line:        #E4E0DA;
  --accent:      #FF5A1F;
  --accent-dark: #E8480F;
  --accent-soft: #FFF0E9;
  --ok:          #0E9F6E;
  --ok-soft:     #E7F6F0;
  --warn:        #B45309;
  --warn-soft:   #FEF3E2;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Manrope", var(--sans);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22,22,29,.05), 0 12px 32px -12px rgba(22,22,29,.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--sans); font-size: 16px; line-height: 1.6;
  color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased; overflow-x: clip;
}
img, svg, 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 { font-family: var(--display); text-wrap: balance; line-height: 1.12; letter-spacing: -0.02em; }
select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.skip-link { position: fixed; top: -100px; left: 1rem; z-index: 999; padding: .6rem 1rem; background: var(--ink); color: #fff; border-radius: 8px; }
.skip-link:focus { top: 1rem; }

.wrap { width: min(100% - 2rem, 1080px); margin-inline: auto; }

/* ---------- Cabecera ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 58px; }
.logo { display: flex; align-items: center; gap: .55rem; font-family: var(--display); font-size: 1.08rem; }
.logo-text { font-weight: 700; letter-spacing: -.02em; }
.logo-text strong { color: var(--accent); font-weight: 800; }
.logo-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); position: relative; flex: none; }
.logo-mark::after { content: ""; position: absolute; inset: 5px; background: #fff; border-radius: 2px; }
.site-header nav { display: flex; gap: 1.1rem; font-size: .88rem; color: var(--ink-60); }
.site-header nav a:hover { color: var(--ink); }
@media (max-width: 600px) { .site-header nav a.hide-sm { display: none; } }

/* ---------- Zona principal ---------- */
.hero { padding: 1.75rem 0 1.25rem; text-align: center; }
.eyebrow {
  display: inline-block; font-size: .76rem; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent);
  background: var(--accent-soft); padding: .3rem .7rem; border-radius: 100px;
}
h1 { font-size: clamp(1.7rem, 5.6vw, 2.7rem); font-weight: 800; margin: .75rem 0 .55rem; }
.sub { max-width: 48ch; margin: 0 auto 1.4rem; color: var(--ink-60); }
.sub strong { color: var(--ink); font-weight: 600; }

.tool-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); padding: clamp(1rem, 3vw, 1.5rem); text-align: left;
}
.pane { display: none; }
.tool-card[data-state="idle"]    .pane-idle    { display: block; }
.tool-card[data-state="editing"] .pane-editing { display: block; }
.tool-card[data-state="error"]   .pane-error   { display: block; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .35rem; text-align: center; min-height: 190px; padding: 1.4rem;
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--paper);
  cursor: pointer;
  transition: border-color .25s var(--ease), background .25s var(--ease), transform .25s var(--ease);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.is-over { transform: scale(1.01); }
.dz-icon { width: 32px; height: 32px; color: var(--accent); margin-bottom: .25rem; }
.dz-title { font-family: var(--display); font-weight: 700; font-size: 1.12rem; }
.dz-sub { font-size: .84rem; color: var(--ink-60); }

.privacy-badge {
  margin-top: .85rem; text-align: center; font-size: .84rem; color: var(--ink-60);
  background: var(--ok-soft); border-radius: 10px; padding: .55rem .8rem;
}
.privacy-badge strong { color: var(--ok); }
.limits { margin-top: .8rem; font-size: .79rem; color: var(--ink-30); text-align: center; }

/* ---------- Controles ---------- */
.controls { display: grid; gap: 1rem; margin-bottom: 1rem; }
@media (min-width: 720px) { .controls { grid-template-columns: 1fr 1fr; } }
.control label, .control-label { display: block; font-size: .81rem; font-weight: 600; margin-bottom: .35rem; }
.control select { width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.control-note { font-size: .77rem; color: var(--ink-30); margin-top: .35rem; }

.segmented { display: flex; gap: .3rem; background: var(--paper); padding: .25rem; border-radius: 11px; border: 1px solid var(--line); }
.segmented button {
  flex: 1; padding: .5rem .4rem; border-radius: 8px; font-size: .84rem; font-weight: 500; color: var(--ink-60);
  transition: background .2s var(--ease), color .2s var(--ease);
}
.segmented button.is-active { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.chip-group { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  padding: .5rem .85rem; border-radius: 100px; border: 1px solid var(--line);
  font-size: .83rem; font-weight: 500; color: var(--ink-60); background: var(--card);
  transition: border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease);
}
.chip.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }

.toggle-line { display: flex; align-items: center; gap: .5rem; font-size: .84rem; margin-top: .7rem; }
.toggle-line input { width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.control-row { display: flex; align-items: center; gap: .55rem; margin-top: .5rem; }
.control-row input[type="number"] { width: 96px; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 9px; }
.control-row .x { font-size: .8rem; color: var(--ink-30); }

.counter { font-size: .84rem; color: var(--ink-60); margin-bottom: .7rem; }
.counter strong { color: var(--ink); }
.counter .c-ok { color: var(--ok); font-weight: 600; }
.counter .c-warn { color: var(--warn); font-weight: 600; }

/* ---------- Tarjetas de imagen ---------- */
.file-list { display: grid; gap: .7rem; }
@media (min-width: 640px) { .file-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .file-list { grid-template-columns: repeat(3, 1fr); } }

.file-item { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; display: flex; flex-direction: column; }
.fi-preview { position: relative; background: #EBE8E3; aspect-ratio: 1; display: grid; place-items: center; padding: .5rem; }
.fi-preview canvas { max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0,0,0,.05); }
.fi-spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fi-badge { position: absolute; top: .45rem; left: .45rem; background: var(--ink); color: #fff; font-size: .69rem; font-weight: 600; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; }

.fi-body { padding: .6rem .7rem .7rem; display: flex; flex-direction: column; gap: .42rem; flex: 1; }
.fi-name { font-size: .79rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fi-meta { font-size: .75rem; color: var(--ink-60); }
.fi-meta .saved { color: var(--ok); font-weight: 600; }
.fi-flag { font-size: .72rem; border-radius: 7px; padding: .3rem .45rem; line-height: 1.35; }
.fi-flag.is-warn { background: var(--warn-soft); color: var(--warn); }
.fi-flag.is-ok { background: var(--ok-soft); color: var(--ok); }
.fi-actions { display: flex; gap: .32rem; margin-top: auto; }
.fi-actions button {
  flex: 1; font-size: .74rem; padding: .38rem .3rem; border-radius: 8px;
  border: 1px solid var(--line); color: var(--ink-60);
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.fi-actions button:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Botones ---------- */
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.05rem; }
.btn { padding: .75rem 1.15rem; border-radius: 11px; font-weight: 600; font-size: .91rem; transition: transform .2s var(--ease), background .2s var(--ease); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; flex: 1 1 240px; text-align: center; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary.is-busy { background: var(--ink-30); cursor: progress; }
.btn-ghost { border: 1px solid var(--line); color: var(--ink-60); }
.btn-ghost:hover { border-color: var(--ink-30); color: var(--ink); }
.error-msg { background: var(--warn-soft); color: var(--warn); padding: .8rem 1rem; border-radius: 10px; margin-bottom: .8rem; }

/* ==========================================================================
   HUECOS DE ANUNCIO
   Reservados y visibles como placeholders. El dueño del sitio pega acá el
   código de su red de publicidad. Nunca por encima de la herramienta.
   ========================================================================== */
.ad {
  display: grid; place-items: center; position: relative;
  border: 1px dashed var(--line); border-radius: 12px;
  background: repeating-linear-gradient(45deg, transparent, transparent 9px, rgba(22,22,29,.022) 9px, rgba(22,22,29,.022) 18px);
  color: var(--ink-30);
}
.ad::before {
  content: "ANUNCIO";
  font-size: .68rem; font-weight: 600; letter-spacing: .16em;
}
.ad::after {
  content: attr(data-format);
  position: absolute; bottom: .4rem;
  font-size: .6rem; letter-spacing: .08em; color: var(--ink-30); opacity: .65;
}

/* Formato 1 — banner ancho, debajo de la herramienta */
.ad-leaderboard { width: 100%; max-width: 728px; height: 90px; margin: 1.75rem auto; }
@media (max-width: 600px) { .ad-leaderboard { max-width: 320px; height: 100px; } }

/* Formato 2 — rectángulo dentro del contenido */
.ad-rectangle { width: 100%; max-width: 336px; height: 280px; margin: 1.5rem auto; }

/* Formato 3 — vertical, pegado al costado (solo en pantallas anchas) */
.ad-skyscraper { display: none; }
@media (min-width: 1280px) {
  .ad-skyscraper {
    display: grid; position: sticky; top: 80px;
    width: 160px; height: 600px; margin: 0;
  }
  .layout-with-rail { display: grid; grid-template-columns: 1fr 160px; gap: 2rem; align-items: start; }
}

/* Formato 4 — banner inferior, antes del pie */
.ad-footer { width: 100%; max-width: 970px; height: 250px; margin: 2rem auto 0; }
@media (max-width: 600px) { .ad-footer { max-width: 320px; height: 250px; } }

/* ---------- Secciones ---------- */
.section { padding: 2.4rem 0; }
.section-alt { background: var(--card); border-block: 1px solid var(--line); }
.section h2 { font-size: clamp(1.35rem, 4vw, 1.85rem); font-weight: 800; margin-bottom: 1.1rem; }
.prose { max-width: 68ch; }
.prose h3 { font-size: 1.06rem; font-weight: 700; margin: 1.5rem 0 .4rem; }
.prose p { color: var(--ink-60); margin-bottom: .8rem; }
.prose p strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 2px; }

.steps { list-style: none; padding: 0; display: grid; gap: 1.1rem; counter-reset: paso; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.section-alt .steps li { background: var(--paper); }
.step-n { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .9rem; margin-bottom: .55rem; }
.steps h3 { font-size: 1.03rem; font-weight: 700; margin-bottom: .25rem; }
.steps p { font-size: .88rem; color: var(--ink-60); }

details { border-bottom: 1px solid var(--line); padding: .85rem 0; }
details summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; color: var(--accent); font-size: 1.2rem; line-height: 1; }
details[open] summary::after { content: "–"; }
details p { margin-top: .55rem; color: var(--ink-60); font-size: .92rem; }

.tool-links { display: grid; gap: .75rem; }
@media (min-width: 640px) { .tool-links { grid-template-columns: repeat(2, 1fr); } }
.tool-link { display: block; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); transition: border-color .2s var(--ease), transform .2s var(--ease); }
.section-alt .tool-link { background: var(--paper); }
.tool-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-link strong { display: block; font-size: 1rem; margin-bottom: .22rem; }
.tool-link span { font-size: .84rem; color: var(--ink-60); }

/* ---------- Pie ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 1.8rem 0 2.4rem; font-size: .84rem; color: var(--ink-60); }
.footer-inner { display: grid; gap: .65rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 1rem; }
.site-footer nav a:hover { color: var(--accent); }
.disclaimer { font-size: .75rem; color: var(--ink-30); max-width: 72ch; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
