/* TrainYourIA — estética cálida y editorial: crema, tinta, terracota. */
:root {
  --bg: #F7F5EF;
  --surface: #FFFFFF;
  --surface-2: #F0EDE4;
  --ink: #23211D;
  --muted: #6B665C;
  --line: #E3DED2;
  --accent: #A24C2E;
  --accent-ink: #FFFFFF;
  --accent-soft: #F4E4DB;
  --ok: #3F7D58;
  --shadow: 0 1px 2px rgba(35, 33, 29, .05), 0 8px 24px rgba(35, 33, 29, .06);
  --radius: 14px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1C1B19; --surface: #252421; --surface-2: #2E2C29; --ink: #EDEAE2; --muted: #A39E93;
    --line: #3A3833; --accent: #E08A66; --accent-ink: #1C1B19; --accent-soft: #3A2A22; --ok: #7DBB93;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1C1B19; --surface: #252421; --surface-2: #2E2C29; --ink: #EDEAE2; --muted: #A39E93;
  --line: #3A3833; --accent: #E08A66; --accent-ink: #1C1B19; --accent-soft: #3A2A22; --ok: #7DBB93;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; transition: background .3s, color .3s; }
img, svg { display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; line-height: 1.15; margin: 0; }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.5rem); }
h3 { font-size: 1.2rem; }
p { margin: 0; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(760px, 100% - 32px); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid transparent; transition: border-color .3s; }
.top-in { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 600 1.15rem/1 var(--serif); }
.brand b { color: var(--accent); font-weight: 600; }
.mark { width: 28px; height: 28px; color: var(--ink); }
.mark path, .mark circle { stroke-linecap: round; }
.nav { display: flex; align-items: center; gap: 22px; }
.nav a { text-decoration: none; color: var(--muted); font-size: .94rem; transition: color .2s; }
.nav a:hover { color: var(--ink); }
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); transition: background .2s, transform .2s; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.96); }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 12px; border: 1px solid transparent; font-weight: 500; font-size: .95rem; text-decoration: none; transition: background .2s, border-color .2s, transform .15s, box-shadow .2s; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 0 rgba(0,0,0,.08), 0 6px 18px color-mix(in srgb, var(--accent) 28%, transparent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn.ghost { background: var(--surface); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.block { width: 100%; padding: 14px; font-size: 1rem; }
.btn[disabled] { opacity: .75; cursor: progress; }
.link { background: none; border: 0; color: var(--muted); padding: 8px 0; margin-top: 6px; }
.link:hover { color: var(--ink); }
.spin { width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Hero */
.hero { padding: clamp(56px, 10vw, 120px) 0 clamp(48px, 8vw, 88px); text-align: center; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; top: -60px; left: 50%; width: min(1100px, 140vw); height: 640px; margin-left: calc(min(1100px, 140vw) / -2); background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%); pointer-events: none; animation: float 14s ease-in-out infinite alternate; }
@keyframes float { from { transform: translateY(0) scale(1); opacity: .85; } to { transform: translateY(24px) scale(1.05); opacity: 1; } }
.hero .wrap { position: relative; }
.eyebrow { display: inline-block; font-size: .82rem; letter-spacing: .02em; color: var(--muted); border: 1px solid var(--line); background: var(--surface); padding: 6px 14px; border-radius: 999px; margin-bottom: 26px; }
.hero h1 { font-size: clamp(2.4rem, 6.4vw, 4.4rem); font-weight: 400; max-width: 16ch; margin-inline: auto; }
.hero h1 em { font-style: italic; color: var(--accent); }
.lead { max-width: 640px; margin: 22px auto 0; font-size: clamp(1.02rem, 1.6vw, 1.15rem); color: var(--muted); }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 34px; }
.stats { list-style: none; padding: 0; margin: 46px auto 0; display: flex; justify-content: center; gap: clamp(18px, 5vw, 56px); flex-wrap: wrap; color: var(--muted); font-size: .92rem; }
.stats strong { display: block; font: 500 2rem/1.1 var(--serif); color: var(--ink); }
.works { margin-top: 34px; color: var(--muted); font-size: .88rem; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; align-items: center; }
.works span { border: 1px solid var(--line); border-radius: 8px; padding: 3px 10px; background: var(--surface); color: var(--ink); }

/* Secciones */
section { padding: clamp(56px, 8vw, 96px) 0; }
.how { background: var(--surface); border-block: 1px solid var(--line); }
.how h2, .why h2, .faq h2, .improver h2 { text-align: center; }
.steps { list-style: none; padding: 0; margin: 44px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.steps li { padding: 26px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); }
.steps .n { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font: 600 1rem/1 var(--serif); margin-bottom: 16px; }
.steps h3 { margin-bottom: 8px; }
.steps p { color: var(--muted); font-size: .96rem; }

.sec-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; min-width: min(340px, 100%); transition: border-color .2s, box-shadow .2s; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search svg { color: var(--muted); flex: none; }
.search input { border: 0; outline: 0; background: none; padding: 12px 0; width: 100%; font: inherit; color: var(--ink); }
.cats { display: flex; gap: 8px; flex-wrap: wrap; margin: 26px 0 24px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .9rem; color: var(--muted); transition: all .2s; }
.chip svg { width: 16px; height: 16px; }
.chip:hover { color: var(--ink); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card { text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: 0 0 0 transparent; transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s, border-color .25s; animation: pop .4s both; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.card-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); margin-bottom: 8px; }
.card-cat { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.card-title { font: 500 1.22rem/1.25 var(--serif); }
.card-desc { color: var(--muted); font-size: .93rem; flex: 1; }
.card-go { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: .9rem; font-weight: 500; color: var(--accent); }
.card-go svg { width: 16px; height: 16px; transition: transform .2s; }
.card:hover .card-go svg { transform: translateX(3px); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
.empty { grid-column: 1 / -1; padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

.improver { background: var(--surface); border-block: 1px solid var(--line); }
.sub { text-align: center; color: var(--muted); margin: 14px auto 30px; max-width: 600px; }
.panel { background: var(--bg); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
textarea, input[type="text"], select { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; resize: vertical; transition: border-color .2s, box-shadow .2s; }
textarea:focus, input[type="text"]:focus, select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 15px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.mono { font: 13.5px/1.55 var(--mono); }
.row-end { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.score { display: flex; align-items: baseline; gap: 12px; margin: 20px 0 10px; }
.score-n { font: 500 2.4rem/1 var(--serif); color: var(--accent); }
.score-n small { font-size: 1rem; color: var(--muted); }
.score-l { font-weight: 500; }
.checks { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .9rem; }
.checks .ok { color: var(--ok); }
.checks .no { color: var(--muted); }
.suggest { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; margin: 0 0 12px; font-size: .92rem; }
.link-inline { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.why-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 40px; }
.why article { padding: 22px; border-top: 2px solid var(--accent); background: var(--surface); border-radius: 0 0 var(--radius) var(--radius); }
.why h3 { margin-bottom: 8px; }
.why p { color: var(--muted); font-size: .95rem; }

.faq details { border-bottom: 1px solid var(--line); padding: 18px 0; }
.faq h2 { margin-bottom: 26px; }
.faq summary { cursor: pointer; font: 500 1.12rem/1.4 var(--serif); list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.4rem; line-height: 1; transition: transform .25s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--muted); margin-top: 10px; }

.foot { border-top: 1px solid var(--line); padding: 36px 0 44px; }
.foot-in { display: grid; gap: 10px; }
.foot b { color: var(--accent); }
.fine { color: var(--muted); font-size: .83rem; max-width: 820px; }

/* Constructor (diálogo) */
.builder { width: min(720px, 100% - 24px); max-height: min(92vh, 900px); padding: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.builder[open] { animation: rise .32s cubic-bezier(.2,.8,.2,1); }
.builder::backdrop { background: rgba(28, 27, 25, .45); backdrop-filter: blur(3px); animation: fade .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
.b-in { padding: 26px; }
.b-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; margin-bottom: 20px; }
.b-cat { display: flex; align-items: center; gap: 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 6px; }
.b-cat svg { width: 16px; height: 16px; }
.b-head h2 { font-size: 1.7rem; }
.b-desc { color: var(--muted); margin-top: 4px; }
.fields { display: grid; gap: 14px; }
.field span { display: block; font-size: .9rem; font-weight: 500; margin-bottom: 6px; }
.field em { color: var(--accent); font-style: normal; }
.field.err textarea, .field.err input, .field.err select { border-color: #C2453A; box-shadow: 0 0 0 4px rgba(194, 69, 58, .14); }
.toggle { display: flex; align-items: center; gap: 12px; margin: 18px 0; font-size: .92rem; color: var(--muted); cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.tg { flex: none; width: 40px; height: 23px; border-radius: 999px; background: var(--line); position: relative; transition: background .2s; }
.tg::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked + .tg { background: var(--accent); }
.toggle input:checked + .tg::after { transform: translateX(17px); }
.toggle input:focus-visible + .tg { outline: 2px solid var(--accent); outline-offset: 2px; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 10px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; margin-bottom: 12px; overflow-x: auto; }
.tab { flex: 1; white-space: nowrap; border: 0; background: none; padding: 9px 12px; border-radius: 9px; font-size: .88rem; color: var(--muted); transition: all .2s; }
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.b-help { font-size: .9rem; color: var(--muted); margin-bottom: 10px; }
.b-help strong { color: var(--ink); font-weight: 500; }
.b-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 12px; font-size: .92rem; opacity: 0; pointer-events: none; transition: all .3s cubic-bezier(.2,.8,.2,1); z-index: 100; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.8,.2,1); }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .why-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .nav a { display: none; }
  .why-grid { grid-template-columns: 1fr; }
  .b-in { padding: 20px 16px; }
  .b-actions .btn { flex: 1 1 calc(50% - 8px); }
  .hero-cta .btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* Recientes, meta del resultado, tarjeta personalizada */
.recent { margin: 22px 0 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.recent-head { display: flex; justify-content: space-between; align-items: center; font-size: .86rem; color: var(--muted); margin-bottom: 10px; }
.recent-head .link { margin: 0; padding: 0; font-size: .82rem; }
.recent-list { display: flex; gap: 8px; flex-wrap: wrap; }
.recent-item { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-size: .88rem; transition: border-color .2s, background .2s; }
.recent-item:hover { border-color: var(--accent); }
.recent-item svg { width: 16px; height: 16px; color: var(--accent); }
.recent-item small { color: var(--muted); }
.b-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.b-meta .hint { margin-top: 6px; }
kbd { font: 500 .75rem/1 var(--mono); padding: 2px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); }
.card-custom { border-style: dashed; background: transparent; }
.card-custom .card-ico { background: var(--ink); color: var(--bg); }
