/* Estilos del portal de Taller de Perlitas. PALETA PROVISORIA: todo el color sale de estas variables; cambiando este bloque
   se cambia todo el sitio (y los colores de los mails están en src/email.mjs). */
:root {
  --bg: #fff8ee;          /* fondo crema */
  --paper: #ffffff;       /* tarjetas */
  --ink: #2b2d42;         /* texto */
  --muted: #5c5f7a;       /* texto secundario (contraste 6:1 sobre blanco) */
  --brand: #e8478b;       /* rosa: botones y marca */
  --brand-dark: #c2306f;  /* rosa oscuro: hover y texto sobre claro */
  --brand-soft: #ffe3ee;  /* rosa suave: fondos y bordes */
  --sun: #ffc83d;         /* amarillo */
  --sky: #2ec4b6;         /* turquesa */
  --sky-dark: #0f766e;
  --grape: #7c5cff;       /* violeta */
  --line: #f0dfd0;
  --radius: 20px;
  --font-display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); background: var(--bg); font-family: var(--font-body); font-size: 16px; line-height: 1.55;
  background-image: radial-gradient(var(--brand-soft) 2px, transparent 2.5px), radial-gradient(#fff0c2 2px, transparent 2.5px);
  background-size: 46px 46px, 46px 46px; background-position: 0 0, 23px 23px;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: 0; }
p { margin: 0; }
a { color: var(--brand-dark); }
em { font-style: normal; color: var(--brand); }
:focus-visible { outline: 3px solid var(--grape); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.shell { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px 40px; }

/* Guirnalda de banderines: 14 triángulos que toman color de la paleta. */
.bunting { display: flex; height: 38px; margin: 0 -16px; overflow: hidden; border-top: 3px solid var(--ink); position: relative; }
.bunting::before { content: ""; position: absolute; left: 0; right: 0; top: -3px; height: 3px; background: var(--ink); }
.bunting i { flex: 1 0 0; margin: 0 2px; background: var(--brand); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.bunting i:nth-child(4n+2) { background: var(--sun); }
.bunting i:nth-child(4n+3) { background: var(--sky); }
.bunting i:nth-child(4n+4) { background: var(--grape); }
.bunting i:nth-child(n+9) { display: none; }
@media (min-width: 700px) { .bunting i:nth-child(n+9) { display: block; } }

.site-header { display: flex; align-items: center; gap: 12px; padding: 18px 0 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 0; }
.mark { width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 20px; flex: none; box-shadow: 0 3px 0 var(--brand-dark); }
.brand-name { display: flex; flex-direction: column; font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: .02em; line-height: 1.1; }
.brand-sub { font-family: var(--font-body); font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--muted); margin-top: 3px; }
.portal-header .admin-link { margin-left: auto; font-weight: 800; font-size: 13px; text-decoration: none; background: var(--sun); color: var(--ink); padding: 8px 14px; border-radius: 999px; }
.portal-badge { margin-left: auto; font-size: 11px; font-weight: 800; letter-spacing: .1em; color: var(--sky-dark); background: #d8f5f1; padding: 6px 12px; border-radius: 999px; }
.admin-link:not([hidden]) + .portal-badge { margin-left: 0; }
.portal-header { flex-wrap: nowrap; }
@media (max-width: 520px) { .portal-header { flex-wrap: wrap; } .portal-badge, .portal-header .admin-link { margin-left: 0; } }

.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .12em; color: var(--brand-dark); text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.tiny-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sun); display: inline-block; }
.lead { font-size: 17px; color: var(--muted); margin-top: 12px; max-width: 54ch; }

/* Botones */
.cta, .secondary, .buy-btn, .dl-btn { font-family: var(--font-body); font-weight: 800; border-radius: 999px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; }
.cta { background: var(--brand); color: #fff; border: 0; padding: 12px 26px; font-size: 15px; box-shadow: 0 4px 0 var(--brand-dark); transition: transform .12s, box-shadow .12s; }
.cta:hover { transform: translateY(2px); box-shadow: 0 2px 0 var(--brand-dark); }
.cta:disabled { opacity: .6; cursor: wait; }
.secondary { background: #fff; color: var(--ink); border: 2px solid var(--line); padding: 10px 22px; font-size: 14px; }
.secondary:hover { border-color: var(--brand); }

/* Tarjeta simple (login, panel) */
.card { background: var(--paper); border: 2px solid var(--brand-soft); border-radius: var(--radius); padding: 28px 22px; box-shadow: 0 8px 0 var(--brand-soft); }
.login-card { max-width: 520px; margin: 28px auto 0; display: grid; gap: 14px; }
.result-title { font-size: 32px; }
.result-copy { color: var(--muted); }
.priority { background: #fff6dc; border: 2px solid #ffe49a; border-radius: 14px; padding: 12px 14px; font-size: 14px; color: #5b4300; white-space: pre-line; }
.login-form { display: grid; gap: 10px; }
label { font-weight: 800; font-size: 14px; }
input[type=email], textarea { width: 100%; font: inherit; padding: 13px 14px; border: 2px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); min-height: 48px; }
input[type=email]:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.login-help { font-size: 13px; color: var(--muted); }

/* Portal */
.portal-welcome { display: grid; gap: 20px; padding: 26px 0 8px; }
.portal-welcome h1 { font-size: 38px; margin-top: 10px; }
.portal-start-card { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 22px; display: grid; gap: 12px; align-content: start; }
.portal-start-card span { font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--sun); }
.portal-start-card strong { font-family: var(--font-display); font-weight: 500; font-size: 19px; line-height: 1.3; }
.portal-start-card .cta { justify-self: start; }
@media (min-width: 860px) { .portal-welcome { grid-template-columns: 1.4fr 1fr; align-items: center; gap: 32px; padding-top: 38px; } .portal-welcome h1 { font-size: 52px; } }

.portal-section { margin-top: 36px; }
.portal-section-head { display: grid; gap: 6px; margin-bottom: 16px; }
.portal-section-head h2 { font-size: 28px; }
.portal-section-head p { color: var(--muted); font-size: 15px; }
@media (min-width: 860px) { .portal-section-head { grid-template-columns: 1fr 1fr; align-items: end; } .portal-section-head > p { text-align: right; } }
.product-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .product-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .product-grid { grid-template-columns: repeat(3, 1fr); } .product-grid.is-single { grid-template-columns: minmax(0, 1fr); } }

.product-card { --c: var(--brand); background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 6px 0 var(--line); }
.product-card[data-tone="sun"] { --c: var(--sun); }
.product-card[data-tone="sky"] { --c: var(--sky); }
.product-card[data-tone="grape"] { --c: var(--grape); }
.product-cover { background: var(--c); padding: 16px 18px 14px; display: flex; align-items: center; gap: 12px; color: #fff; position: relative; }
.product-card[data-tone="sun"] .product-cover { color: var(--ink); }
.product-cover::after { content: ""; position: absolute; right: -18px; top: -22px; width: 80px; height: 80px; border-radius: 50%; background: rgba(255,255,255,.22); }
.product-type { font-size: 11px; font-weight: 800; letter-spacing: .12em; position: relative; z-index: 1; }
.product-body { padding: 18px; display: grid; gap: 10px; flex: 1; align-content: start; }
.product-body h3 { font-size: 21px; }
.product-body > p { color: var(--muted); font-size: 15px; }
.files { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 10px; }
.file-row { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; background: #fffaf3; border: 2px solid var(--line); border-radius: 16px; padding: 12px; }
.kind { font-size: 11px; font-weight: 800; letter-spacing: .06em; border-radius: 10px; padding: 6px 8px; min-width: 46px; text-align: center; color: #fff; background: var(--brand); }
.kind-zip, .kind-svg { background: var(--sky-dark); }
.file-name { font-weight: 800; font-size: 15px; line-height: 1.25; }
.file-about { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.file-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.file-use { font-size: 12px; color: var(--muted); }
.dl-btn { background: var(--brand); color: #fff; padding: 8px 18px; font-size: 14px; min-height: 44px; box-shadow: 0 3px 0 var(--brand-dark); }
.dl-btn:hover { background: var(--brand-dark); }
.dl-btn[aria-disabled=true] { background: #b9b4c4; box-shadow: none; pointer-events: none; }

/* Candado: la tarjeta no tiene archivos y el botón lleva al checkout de ese producto. */
.lock-box { display: none; align-items: center; gap: 10px; background: #f6f1ea; border: 2px dashed #d9cbb9; border-radius: 16px; padding: 12px; font-size: 14px; color: var(--muted); }
.product-card.is-locked .lock-box { display: flex; }
.product-card.is-locked .files { display: none; }
.product-card.is-locked .product-cover { filter: grayscale(.55); }
.lock-box svg { flex: none; color: var(--ink); }
.buy-btn { background: #fff; color: var(--brand-dark); border: 2px solid var(--brand); padding: 8px 18px; font-size: 14px; justify-self: start; }
.buy-btn:hover { background: var(--brand-soft); }

/* Cómo editar en Canva e imprimir */
.canva { background: var(--paper); border: 2px solid var(--brand-soft); border-radius: var(--radius); padding: 22px 18px; box-shadow: 0 6px 0 var(--brand-soft); display: grid; gap: 16px; }
.steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; counter-reset: paso; }
.steps li { counter-increment: paso; display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; font-size: 15px; }
.steps li::before { content: counter(paso); width: 36px; height: 36px; border-radius: 50%; background: var(--sun); color: var(--ink); font-family: var(--font-display); font-weight: 700; display: grid; place-items: center; }
.steps b { display: block; }
.canva .tip { background: #e8faf7; border-radius: 14px; padding: 12px 14px; font-size: 14px; color: #0b4f49; }
.canva .cta { justify-self: start; }
@media (min-width: 860px) { .canva { grid-template-columns: 1.3fr 1fr; padding: 28px; } .canva-side { display: grid; gap: 14px; align-content: start; } }

.portal-note { display: flex; gap: 14px; margin-top: 36px; background: #fff6dc; border: 2px solid #ffe49a; border-radius: var(--radius); padding: 18px; font-size: 14px; color: #5b4300; }
.portal-note > span { font-size: 22px; line-height: 1; }
.portal-note strong { display: block; margin-bottom: 4px; font-size: 15px; }
#auth-status.portal-status:empty { display: none; }
.portal-logout { margin-top: 20px; }
.site-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-top: 36px; padding-top: 16px; border-top: 2px dashed var(--line); font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }

/* Panel de administración */
.admin-cursos { border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; display: grid; gap: 4px; }
.admin-cursos legend { font-weight: 800; font-size: 14px; padding: 0 6px; }
.admin-cursos label { font-weight: 600; display: flex; gap: 8px; align-items: center; min-height: 36px; }
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-mensaje { display: grid; gap: 10px; }
textarea { min-height: 150px; }

/* Archivos agrupados y [PENDIENTE] «Próximamente» */
.file-group { list-style: none; }
.file-group details { border: 2px solid var(--line); border-radius: 16px; background: #fff; }
.file-group summary { cursor: pointer; font-weight: 800; font-size: 15px; padding: 12px 14px; min-height: 44px; display: flex; align-items: center; }
.file-group details[open] summary { border-bottom: 2px dashed var(--line); }
.file-group .files { padding: 10px; margin: 0; }
.file-row.is-soon { opacity: .75; background: #f6f1ea; border-style: dashed; }
.is-soon .kind { background: #8b8799; }
.soon-tag { font-size: 12px; font-weight: 800; letter-spacing: .06em; color: var(--muted); background: #fff; border-radius: 999px; padding: 4px 12px; }
/* Materiales recomendados */
.portal-note-text { background: #fff6dc; border: 2px solid #ffe49a; border-radius: 14px; padding: 12px 14px; font-size: 14px; color: #5b4300; }
.store-card .product-body { padding: 18px; }
.store-links { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.store-note { font-size: 14px; color: var(--muted); }
.canva-side .secondary { justify-self: start; }
