/* =============================================================
   OpoPlan · hoja de estilo unica
   1 Tokens · 2 Reset · 3 Utilidades · 4 Tipografia · 5 Componentes
   6 Herramienta · 7 Secciones · 8 Anuncios · 9 Responsive · 10 Motion
   ============================================================= */

/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --paper:      #f5f6f2;
  --surface:    #ffffff;
  --surface-2:  #fafbf8;
  --ink:        #14181f;
  --ink-soft:   #3d4653;
  --muted:      #626d7d;
  --line:       #e2e5dd;
  --line-soft:  #eef0ea;

  --accent:     #0e5c4a;
  --accent-ink: #0a4638;
  --accent-bg:  #e7f1ed;
  --gold:       #a8781f;
  --warn:       #a85a17;
  --warn-bg:    #fbf0e2;
  --danger:     #9d2f24;
  --danger-bg:  #fbeae7;
  --ok:         #0e5c4a;
  --ok-bg:      #e7f1ed;

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;

  --r-sm: 8px;
  --r:    14px;
  --r-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(20, 24, 31, .05), 0 1px 3px rgba(20, 24, 31, .04);
  --shadow:    0 2px 4px rgba(20, 24, 31, .04), 0 12px 28px -12px rgba(20, 24, 31, .16);
  --shadow-lg: 0 4px 8px rgba(20, 24, 31, .05), 0 30px 60px -24px rgba(20, 24, 31, .28);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(1rem, 4vw, 2rem);
  --maxw: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #0d1015;
    --surface:    #151a21;
    --surface-2:  #1b212a;
    --ink:        #e9edf2;
    --ink-soft:   #c2cad4;
    --muted:      #8e9aa8;
    --line:       #262e39;
    --line-soft:  #1f262f;

    --accent:     #4fbf9f;
    --accent-ink: #7fd8bd;
    --accent-bg:  #12291f;
    --gold:       #d8ac54;
    --warn:       #e0a05a;
    --warn-bg:    #2b2013;
    --danger:     #ef8a7c;
    --danger-bg:  #2c1815;
    --ok:         #4fbf9f;
    --ok-bg:      #12291f;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow:    0 2px 4px rgba(0, 0, 0, .3), 0 12px 28px -12px rgba(0, 0, 0, .6);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, .35), 0 30px 60px -24px rgba(0, 0, 0, .75);
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; 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;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img, svg { 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 { text-wrap: balance; line-height: 1.15; letter-spacing: -0.02em; font-weight: 600; }
::selection { background: var(--accent); color: #fff; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* =============================================================
   3. Utilidades
   ============================================================= */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.container--narrow { max-width: 760px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  padding: .6rem 1rem; border-radius: var(--r-sm);
  background: var(--ink); color: var(--paper); font-weight: 600;
}
.skip-link:focus { top: 1rem; }

.label-alt { font-weight: 400; color: var(--muted); }

/* =============================================================
   4. Cabecera
   ============================================================= */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0; z-index: 40;
}
.site-header__in {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 60px;
}
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--accent); }
.brand__mark { width: 26px; height: 26px; flex: none; }
.brand__name { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.site-header__claim { font-size: .82rem; color: var(--muted); display: none; }

/* =============================================================
   5. Hero + herramienta
   ============================================================= */
.hero { padding: clamp(1.5rem, 4vw, 2.75rem) 0 1.5rem; }

.hero__title {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 5.2vw, 2.9rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-bottom: .6rem;
}
.hero__sub {
  color: var(--ink-soft);
  font-size: clamp(.95rem, 2.4vw, 1.06rem);
  max-width: 62ch;
  margin-bottom: clamp(1.25rem, 3vw, 1.75rem);
}
.hero__sub strong { color: var(--ink); font-weight: 600; }

.tool-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.noscript-note {
  margin: 1.25rem; padding: 1rem 1.15rem;
  background: var(--warn-bg); color: var(--warn);
  border-radius: var(--r); font-size: .92rem;
}

/* --- formulario --- */
.tool-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem 1.25rem;
  padding: clamp(1.15rem, 3vw, 1.75rem);
}
.field { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.field--wide { grid-column: 1 / -1; }

.field label { font-size: .85rem; font-weight: 600; color: var(--ink-soft); }

.field input,
.field select {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: .68rem .8rem;
  transition: border-color .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.field select { cursor: pointer; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.2rem;
}
.field input:focus,
.field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.field input:invalid { border-color: var(--danger); }

.field__hint { font-size: .78rem; color: var(--muted); line-height: 1.45; }
.field__hint strong { color: var(--ink-soft); font-weight: 600; }

.tool-advanced { border-top: 1px dashed var(--line); padding-top: 1rem; }
.tool-advanced > summary {
  cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--accent);
  list-style: none; display: inline-flex; align-items: center; gap: .4rem;
}
.tool-advanced > summary::-webkit-details-marker { display: none; }
.tool-advanced > summary::before { content: "+"; font-size: 1.05rem; line-height: 1; }
.tool-advanced[open] > summary::before { content: "−"; }
.tool-advanced__in { display: grid; gap: .5rem; margin-top: .9rem; max-width: 34rem; }

/* --- resultado --- */
.result {
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  padding: clamp(1.15rem, 3vw, 1.75rem);
  display: grid;
  /* minmax(0,1fr): sin esto la tabla ancha de las semanas estira la columna
     del grid y desborda la tarjeta en movil (queda tapado por overflow-x: clip). */
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}
.result > * { min-width: 0; }

.verdict {
  display: flex; gap: .85rem; align-items: flex-start;
  padding: 1rem 1.15rem;
  border-radius: var(--r);
  background: var(--ok-bg);
  border: 1px solid color-mix(in srgb, var(--ok) 22%, transparent);
}
.verdict__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; margin-top: .48rem; }
.verdict__title { font-weight: 700; font-size: 1.06rem; color: var(--ok); letter-spacing: -0.01em; }
.verdict__text { font-size: .92rem; color: var(--ink-soft); margin-top: .15rem; }

.verdict[data-tone="warn"]   { background: var(--warn-bg);   border-color: color-mix(in srgb, var(--warn) 26%, transparent); }
.verdict[data-tone="warn"] .verdict__dot   { background: var(--warn); }
.verdict[data-tone="warn"] .verdict__title { color: var(--warn); }
.verdict[data-tone="bad"]    { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 26%, transparent); }
.verdict[data-tone="bad"] .verdict__dot    { background: var(--danger); }
.verdict[data-tone="bad"] .verdict__title  { color: var(--danger); }

/* --- cifras --- */
.stats { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: .85rem .9rem; display: flex; flex-direction: column; gap: .1rem;
}
.stat__num { font-family: var(--serif); font-size: clamp(1.35rem, 4.5vw, 1.75rem); font-weight: 600; color: var(--ink); letter-spacing: -0.02em; line-height: 1.1; }
.stat__lbl { font-size: .76rem; color: var(--muted); line-height: 1.35; }

.block-title { font-size: 1.02rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: .8rem; }

/* --- fases --- */
.phases__bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--line-soft); margin-bottom: .9rem; }
.phases__bar span { display: block; height: 100%; }
.phases__bar span:nth-child(1) { background: var(--accent); }
.phases__bar span:nth-child(2) { background: color-mix(in srgb, var(--accent) 65%, var(--surface)); }
.phases__bar span:nth-child(3) { background: var(--gold); }
.phases__bar span:nth-child(4) { background: color-mix(in srgb, var(--gold) 55%, var(--surface)); }

.phases__list { list-style: none; padding: 0; display: grid; gap: .55rem; }
.phase {
  display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .75rem; align-items: baseline;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .7rem .9rem;
}
.phase__chip { width: 10px; height: 10px; border-radius: 3px; align-self: center; }
.phase__chip[data-i="0"] { background: var(--accent); }
.phase__chip[data-i="1"] { background: color-mix(in srgb, var(--accent) 65%, var(--surface)); }
.phase__chip[data-i="2"] { background: var(--gold); }
.phase__chip[data-i="3"] { background: color-mix(in srgb, var(--gold) 55%, var(--surface)); }
.phase__name { font-weight: 600; font-size: .94rem; }
.phase__meta { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.phase__desc { grid-column: 2 / -1; font-size: .82rem; color: var(--muted); }

/* --- semanas --- */
.weeks__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .3rem; }
.weeks__head .block-title { margin-bottom: 0; }
.weeks__wrap { min-width: 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.weeks__wrap[data-collapsed="true"] { max-height: 21rem; overflow-y: hidden; position: relative; }
.weeks__wrap[data-collapsed="true"]::after {
  content: ""; position: sticky; bottom: 0; left: 0; display: block; height: 4rem; margin-top: -4rem;
  background: linear-gradient(to bottom, transparent, var(--surface));
  pointer-events: none;
}
.weeks__table { width: 100%; border-collapse: collapse; font-size: .87rem; min-width: 34rem; }
.weeks__table th, .weeks__table td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.weeks__table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; }
.weeks__table tbody tr:last-child td { border-bottom: 0; }
.weeks__table td:first-child { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.weeks__table td:nth-child(2), .weeks__table td:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.weeks__table tr[data-fase="f1"] td:nth-child(3) { color: var(--accent); font-weight: 600; }
.weeks__table tr[data-fase="f2"] td:nth-child(3) { color: var(--accent); font-weight: 600; opacity: .8; }
.weeks__table tr[data-fase="f3"] td:nth-child(3) { color: var(--gold); font-weight: 600; }
.weeks__table tr[data-fase="f4"] td:nth-child(3) { color: var(--gold); font-weight: 600; opacity: .85; }
.weeks__table tr[data-hito="1"] td { background: var(--accent-bg); }

/* --- botones --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .8rem 1.25rem; border-radius: var(--r-sm);
  font-weight: 600; font-size: .95rem; line-height: 1.2;
  border: 1px solid transparent;
  transition: transform .18s var(--ease-out), background-color .18s var(--ease-out), border-color .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.btn svg { width: 19px; height: 19px; flex: none; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--accent-ink); box-shadow: var(--shadow); }
.btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn--secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn--ghost { padding: .45rem .8rem; font-size: .84rem; color: var(--accent); border-color: var(--line); background: var(--surface); }
.btn--ghost:hover { border-color: var(--accent); }
.btn--full { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; transform: none; }

@media (prefers-color-scheme: dark) {
  .btn--primary { color: #06231b; }
}

.downloads { display: grid; gap: .7rem; }

.privacy-badge,
.disclaimer { display: flex; gap: .6rem; font-size: .82rem; color: var(--muted); line-height: 1.5; }
.privacy-badge svg { width: 18px; height: 18px; flex: none; color: var(--accent); margin-top: .1rem; }
.privacy-badge strong { color: var(--ink-soft); }
.disclaimer { padding-top: .1rem; border-top: 1px dashed var(--line); padding-top: 1rem; }

/* =============================================================
   6. Secciones
   ============================================================= */
.section { padding: clamp(2.5rem, 6vw, 4rem) 0; }
.section--alt { background: var(--surface); border-block: 1px solid var(--line); }
.section__title { font-family: var(--serif); font-size: clamp(1.4rem, 3.6vw, 2rem); font-weight: 600; margin-bottom: .7rem; letter-spacing: -0.022em; }
.section__lead { color: var(--muted); max-width: 60ch; margin-bottom: 1.75rem; }

/* pasos */
.steps { list-style: none; padding: 0; display: grid; gap: 1rem; margin-top: 1.5rem; }
.steps__item {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.5rem 1.35rem 1.35rem;
}
.section--alt .steps__item { background: var(--surface-2); }
.steps__num {
  position: absolute; top: -.85rem; left: 1.35rem;
  width: 1.85rem; height: 1.85rem; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: .88rem; font-weight: 700;
}
@media (prefers-color-scheme: dark) { .steps__num { color: #06231b; } }
.steps__icon { width: 26px; height: 26px; color: var(--accent); margin-bottom: .8rem; }
.steps__item h3 { font-size: 1.06rem; margin-bottom: .4rem; }
.steps__item p { font-size: .91rem; color: var(--muted); }

/* usos */
.uses { list-style: none; padding: 0; display: grid; gap: 1rem; }
.uses__item { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 1.15rem 1.25rem; }
.uses__item h3 { font-size: .98rem; margin-bottom: .35rem; color: var(--accent); }
.uses__item p { font-size: .89rem; color: var(--muted); }

/* prosa */
.prose h3 { font-size: 1.12rem; margin: 1.9rem 0 .55rem; }
.prose p { color: var(--ink-soft); margin-bottom: 1rem; font-size: 1rem; }
.prose p strong { color: var(--ink); font-weight: 600; }

/* faq */
.faq {
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); margin-bottom: .6rem; overflow: hidden;
}
.faq > summary {
  cursor: pointer; list-style: none; padding: 1rem 2.9rem 1rem 1.15rem;
  font-weight: 600; font-size: .97rem; position: relative;
}
.faq > summary::-webkit-details-marker { display: none; }
.faq > summary::after {
  content: ""; position: absolute; right: 1.2rem; top: 50%;
  width: 9px; height: 9px; margin-top: -6px;
  border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: rotate(45deg); transition: transform .22s var(--ease-out);
}
.faq[open] > summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq > p { padding: 0 1.15rem 1.15rem; color: var(--muted); font-size: .92rem; }

/* =============================================================
   7. Pie
   ============================================================= */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 2.5rem 0; }
.site-footer__in { display: grid; gap: .8rem; }
.site-footer__brand { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; }
.site-footer__nav { display: flex; flex-wrap: wrap; gap: 1.25rem; font-size: .89rem; }
.site-footer__nav a { color: var(--accent); }
.site-footer__nav a:hover { text-decoration: underline; }
.site-footer__legal { font-size: .8rem; color: var(--muted); max-width: 60ch; }

/* =============================================================
   8. Huecos de anuncios (vacios: los rellena el dueño con AdSense)
   ============================================================= */
.ad-slot {
  position: relative;
  display: grid; place-items: center;
  border: 1px dashed color-mix(in srgb, var(--muted) 45%, transparent);
  border-radius: var(--r);
  background: color-mix(in srgb, var(--muted) 6%, transparent);
  color: var(--muted);
}
.ad-slot__label { font-size: .68rem; font-weight: 700; letter-spacing: .18em; color: var(--muted); }

.ad-slot--leaderboard { min-height: 100px; margin: clamp(1.5rem, 4vw, 2.25rem) 0 0; }
.ad-slot--incontent  { min-height: 250px; margin: 0 0 clamp(1.5rem, 4vw, 2.25rem); }
.ad-slot--modal      { min-height: 200px; width: 100%; }

/* aviso pequeño en la esquina */
.ad-toast {
  position: fixed; z-index: 60;
  right: clamp(.75rem, 3vw, 1.25rem); bottom: clamp(.75rem, 3vw, 1.25rem);
  width: min(300px, calc(100vw - 1.5rem)); min-height: 104px;
  display: grid; place-items: center;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  animation: toast-in .45s var(--ease-out) both;
}
.ad-toast[hidden] { display: none; }
.ad-toast__close {
  position: absolute; top: -.6rem; right: -.6rem;
  width: 1.85rem; height: 1.85rem; border-radius: 50%;
  background: var(--ink); color: var(--paper);
  display: grid; place-items: center; box-shadow: var(--shadow-sm);
}
.ad-toast__close svg { width: 14px; height: 14px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ventana al descargar */
.ad-modal {
  border: 0; padding: 0; background: transparent;
  max-width: min(420px, calc(100vw - 2rem));
  margin: auto;
  color: var(--ink);
}
.ad-modal::backdrop { background: rgba(10, 14, 20, .55); backdrop-filter: blur(2px); }
.ad-modal__in {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.6rem 1.35rem 1.35rem;
  display: grid; gap: .8rem;
  animation: modal-in .3s var(--ease-out) both;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.ad-modal__close {
  position: absolute; top: .7rem; right: .7rem;
  width: 2rem; height: 2rem; border-radius: 50%;
  display: grid; place-items: center; color: var(--muted);
}
.ad-modal__close:hover { background: var(--surface-2); color: var(--ink); }
.ad-modal__close svg { width: 17px; height: 17px; }
.ad-modal__title { font-weight: 700; font-size: 1.05rem; padding-right: 2rem; }
.ad-modal__text { font-size: .88rem; color: var(--muted); margin-top: -.4rem; }

/* =============================================================
   9. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .downloads { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 720px) {
  .site-header__claim { display: block; }
  .tool-form { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .uses { grid-template-columns: repeat(2, 1fr); }
  .site-footer__in { grid-template-columns: 1fr auto; align-items: center; }
  .site-footer__legal { grid-column: 1 / -1; }
}

@media (min-width: 960px) {
  .tool-form { grid-template-columns: repeat(3, 1fr); }
  .field--wide { grid-column: span 3; }
  .uses { grid-template-columns: repeat(3, 1fr); }
  .phase { grid-template-columns: auto 1fr auto; }
}

/* =============================================================
   10. Motion reducido — solo lo intrusivo
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ad-toast, .ad-modal__in { animation: none; }
}

/* =============================================================
   11. Impresion — el plan en papel
   ============================================================= */
@media print {
  .site-header, .ad-slot, .ad-toast, .ad-modal, .downloads,
  .section, .site-footer, .tool-advanced, .skip-link { display: none !important; }
  body { background: #fff; }
  .tool-card { border: 0; box-shadow: none; }
  .weeks__wrap[data-collapsed="true"] { max-height: none; }
  .weeks__wrap[data-collapsed="true"]::after { display: none; }
}
