/* Estilos del sitio público. El color de acento y el CSS propio se añaden desde el panel. */

:root {
  --bg: #0c0d10;
  --surface: #14161b;
  --surface-2: #1c1f26;
  --line: #272b34;
  --text: #ecedf0;
  --muted: #9da3b0;
  --accent: #ff8a1f;
  --accent-ink: #111;
  --code-bg: #101216;
  --radius: 10px;
  --wrap: 1120px;
  --narrow: 760px;
  --gutter: clamp(16px, 4vw, 32px);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

:root[data-scheme="light"] {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #eeece6;
  --line: #dcd9d0;
  --text: #17181b;
  --muted: #5b6170;
  --code-bg: #f0eee8;
}

@media (prefers-color-scheme: light) {
  :root[data-scheme="auto"] {
    --bg: #f6f5f1;
    --surface: #ffffff;
    --surface-2: #eeece6;
    --line: #dcd9d0;
    --text: #17181b;
    --muted: #5b6170;
    --code-bg: #f0eee8;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--sans);
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; padding-bottom: 96px; }

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.6rem); font-weight: 750; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: calc(var(--wrap) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.wrap.narrow { max-width: calc(var(--narrow) + var(--gutter) * 2); }
.measure { max-width: var(--narrow); }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 6px; z-index: 10; }
.skip:focus { left: 8px; }

/* Franja de barras de color: la firma del sitio. */
.bars { display: flex; height: 4px; }
.bars i { flex: 1; }
.bars i:nth-child(1) { background: #c9c9c9; }
.bars i:nth-child(2) { background: #c9c400; }
.bars i:nth-child(3) { background: #00c4c6; }
.bars i:nth-child(4) { background: #00c400; }
.bars i:nth-child(5) { background: #c600c4; }
.bars i:nth-child(6) { background: #c90000; }
.bars i:nth-child(7) { background: #0000c9; }

/* Cabecera */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px 32px; flex-wrap: wrap; padding-block: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; text-decoration: none; font-size: 1.05rem; }
.brand img { height: 52px; width: auto; margin-block: -8px; }
.brand-mark { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.site-header ul { display: flex; flex-wrap: wrap; gap: 4px 24px; list-style: none; margin: 0; padding: 0; }
.site-header nav a { text-decoration: none; color: var(--muted); font-size: 0.95rem; padding-block: 6px; display: inline-block; }
.site-header nav a:hover, .site-header nav a[aria-current] { color: var(--text); }
.site-header nav a[aria-current] { box-shadow: 0 2px 0 var(--accent); }
.site-header nav { margin-left: auto; }
.site-header .social { gap: 2px 10px; align-items: center; }
.site-header .social a { color: var(--muted); padding: 6px 3px; }
.site-header .social a:hover { color: var(--text); }
.social-link { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; }
.social-link svg { width: 18px; height: 18px; flex: none; }

/* Elementos comunes */
.kicker { font: 500 0.78rem/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin: 0 0 14px; }
.lead { font-size: clamp(1.1rem, 2vw, 1.3rem); color: var(--muted); max-width: 60ch; margin: 18px 0 0; line-height: 1.5; }
.lead p:last-child { margin-bottom: 0; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 0; }
.btn { display: inline-flex; align-items: center; gap: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 650; text-decoration: none; padding: 11px 20px; border-radius: 8px; border: 1px solid var(--accent); line-height: 1.3; }
.btn:hover { color: var(--accent-ink); filter: brightness(1.1); }
.btn small { font-weight: 400; opacity: 0.8; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); filter: none; }

.chip { display: inline-block; font: 500 0.74rem/1 var(--mono); letter-spacing: 0.04em; padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); text-decoration: none; white-space: nowrap; }
a.chip:hover { border-color: var(--accent); color: var(--accent); }

.notice { background: color-mix(in srgb, var(--accent) 16%, transparent); border: 1px solid var(--accent); border-radius: 8px; padding: 10px 14px; font-size: 0.92rem; margin-bottom: 24px; }
.empty { color: var(--muted); }

/* Portada */
.hero { position: relative; padding-block: clamp(56px, 11vw, 132px) clamp(48px, 9vw, 104px); border-bottom: 1px solid var(--line); overflow: hidden; }
/* Retícula de monitor de forma de onda, muy tenue, con un halo del color de acento. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 80% at 85% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    repeating-linear-gradient(to bottom, color-mix(in srgb, var(--text) 7%, transparent) 0 1px, transparent 1px 56px);
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent);
  mask-image: linear-gradient(to bottom, #000 30%, transparent);
  pointer-events: none;
}
.hero .wrap { position: relative; }
.hero h1 { font-size: clamp(2.4rem, 7vw, 4.8rem); max-width: 16ch; letter-spacing: -0.035em; line-height: 1.02; }
.hero .lead { margin-top: 24px; }

/* Fondo de la cabecera (imagen, vídeo subido o de YouTube): la llena de lado a lado, oscurecido para que el texto se lea. */
.hero-bg { position: absolute; inset: 0; overflow: hidden; background: #0c0d10; container-type: size; }
.hero-bg img, .hero-bg video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Un iframe no sabe recortarse solo: se le da el tamaño de un 16:9 que cubra el recuadro y se centra. */
.hero-bg iframe { position: absolute; top: 50%; left: 50%; width: max(100cqw, 177.78cqh); height: max(100cqh, 56.25cqw); transform: translate(-50%, -50%); border: 0; pointer-events: none; }
/* El vídeo aparece cuando ya se está reproduciendo; hasta entonces se ve la imagen. */
.hero-bg video, .hero-bg iframe { opacity: 0; transition: opacity 0.6s; }
.hero-bg.is-playing video, .hero-bg.is-playing iframe { opacity: 1; }
.hero-bg::after { content: ""; position: absolute; inset: 0; background: rgb(0 0 0 / var(--hero-dim, 0.5)); }
.hero.has-bg::before { content: none; }
@media screen {
  /* Sobre el fondo el texto va en blanco, sea cual sea el tema del sitio. */
  .hero.has-bg { --text: #fff; --muted: rgb(255 255 255 / 0.86); --line: rgb(255 255 255 / 0.4); color: var(--text); display: grid; align-items: center; min-height: clamp(420px, 72vh, 820px); border-bottom: 0; }
  .hero.has-bg h1, .hero.has-bg .lead { text-shadow: 0 1px 24px rgb(0 0 0 / 0.4); }
}
.hero-toggle { position: absolute; right: var(--gutter); bottom: 16px; width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border-radius: 50%; border: 1px solid rgb(255 255 255 / 0.4); background: rgb(0 0 0 / 0.45); color: #fff; cursor: pointer; }
.hero-toggle[hidden] { display: none; }
.hero-toggle:hover { background: rgb(0 0 0 / 0.7); }
.hero-toggle::before { content: ""; width: 4px; height: 12px; border-inline: 4px solid currentColor; box-sizing: content-box; }
.hero-toggle.is-paused::before { width: 0; height: 0; border-style: solid; border-width: 7px 0 7px 12px; border-color: transparent transparent transparent currentColor; transform: translateX(2px); }

.section { padding-top: clamp(48px, 8vw, 88px); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.section-title { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: 28px; }
.more { font-size: 0.95rem; color: var(--muted); text-decoration: none; white-space: nowrap; }

.services { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.services li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.service-n { font: 500 0.8rem var(--mono); color: var(--accent); letter-spacing: 0.1em; }
.services h3 { font-size: 1.15rem; margin: 10px 0 8px; }
.services p { color: var(--muted); margin: 0; font-size: 0.97rem; }

/* Tarjetas de proyecto */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; position: relative; transition: border-color 0.15s, transform 0.15s; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); transform: translateY(-2px); }
.ratio-16x9 { --ratio: 16 / 9; }
.ratio-4x3 { --ratio: 4 / 3; }
.ratio-1x1 { --ratio: 1; }
.ratio-9x16 { --ratio: 9 / 16; }
.card-media { display: block; position: relative; overflow: hidden; text-decoration: none; aspect-ratio: var(--ratio, 16 / 9); background: var(--surface-2); }
/* La imagen llena el recuadro, con la proporción elegida en su ficha, sea cual sea la suya (las carátulas de YouTube son 4:3 con franjas negras). */
.card-media img, .card-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-media.is-video::before { content: ""; position: absolute; z-index: 1; inset: 0; margin: auto; width: 56px; height: 56px; border-radius: 50%; background: rgb(0 0 0 / 0.62); }
.card-media.is-video::after { content: ""; position: absolute; z-index: 1; inset: 0; margin: auto; width: 0; height: 0; border-style: solid; border-width: 10px 0 10px 17px; border-color: transparent transparent transparent #fff; transform: translateX(2px); }
.card-placeholder { display: grid; place-items: center; height: 100%; font: 600 2rem var(--mono); color: var(--muted); background: linear-gradient(135deg, var(--surface-2), var(--surface)); }
.card-body { padding: 18px 20px 20px; }
.card-body .kicker { margin-bottom: 8px; font-size: 0.7rem; }
.card-title { font-size: 1.2rem; }
.card-title a { text-decoration: none; }
/* Toda la tarjeta es clicable sin repetir el enlace para los lectores de pantalla. */
.card-title a::after { content: ""; position: absolute; inset: 0; }
.card-body p:not(.kicker) { color: var(--muted); font-size: 0.95rem; margin: 8px 0 0; }
.group + .group { margin-top: 56px; }

/* Listados de entradas */
.items { display: grid; }
.item { padding-block: 26px; border-top: 1px solid var(--line); }
.item:last-child { border-bottom: 1px solid var(--line); }
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font: 0.8rem var(--mono); color: var(--muted); margin: 0 0 10px; }
.item-title { font-size: clamp(1.25rem, 2.6vw, 1.55rem); }
.item-title a { text-decoration: none; }
.item > p:last-child { color: var(--muted); margin: 10px 0 0; }
/* Vídeo de una entrada del blog en el listado: carátula con el botón de reproducir, que se cambia por el reproductor al pulsarla. */
.item-video { margin: 4px 0 18px; }
.item-video video { display: block; width: 100%; max-height: 70vh; background: #000; border-radius: var(--radius); }
.embed-facade { display: block; cursor: pointer; }
.embed-facade img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.embed-facade::before { content: ""; position: absolute; z-index: 1; inset: 0; margin: auto; width: 64px; height: 64px; border-radius: 50%; background: rgb(0 0 0 / 0.62); transition: background 0.15s; }
.embed-facade::after { content: ""; position: absolute; z-index: 1; inset: 0; margin: auto; width: 0; height: 0; border-style: solid; border-width: 11px 0 11px 19px; border-color: transparent transparent transparent #fff; transform: translateX(2px); }
.embed-facade:hover::before, .embed-facade:focus-visible::before { background: var(--accent); }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 32px; }
.feed-link { margin-top: 32px; font-size: 0.9rem; color: var(--muted); }

/* Cabecera de página interior */
.page-head { padding-top: clamp(32px, 6vw, 64px); padding-bottom: clamp(28px, 5vw, 48px); }
.page-head .item-meta { margin: 20px 0 0; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0 0 22px; padding: 0; font: 0.78rem var(--mono); color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 8px; opacity: 0.5; }
.crumbs a { text-decoration: none; }
.facts { display: flex; flex-wrap: wrap; gap: 0; margin: 32px 0 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; width: fit-content; max-width: 100%; }
.facts div { padding: 12px 20px; border-right: 1px solid var(--line); margin-right: -1px; }
.facts dt { font: 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; }
/* Foto de producto: a la izquierda del título, el precio y los botones; en pantallas estrechas, encima. */
.sale { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: clamp(20px, 4vw, 44px); align-items: start; }
.sale-info { min-width: 0; }
.product-shot { margin: 0; }
.product-shot img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.wrap.narrow .sale { grid-template-columns: minmax(0, 260px) minmax(0, 1fr); }
@media (max-width: 700px) {
  .sale, .wrap.narrow .sale { grid-template-columns: minmax(0, 1fr); }
  .product-shot { max-width: 340px; }
}
.cover { margin: 0 0 clamp(32px, 6vw, 56px); }
.cover img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }
.cover video { display: block; width: 100%; max-height: 85vh; background: #000; border-radius: var(--radius); }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 48px 0 0; }
.not-found { text-align: left; padding-block: clamp(64px, 14vw, 160px); }

/* Texto largo */
.prose { overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h2 { font-size: clamp(1.45rem, 3vw, 1.85rem); margin: 2.2em 0 0.7em; }
.prose h3 { font-size: 1.25rem; margin: 1.9em 0 0.6em; }
.prose h4 { font-size: 1.05rem; margin: 1.6em 0 0.5em; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose figure, .prose .table-wrap, .prose .embed { margin: 0 0 1.3em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 0.35em; }
.prose li::marker { color: var(--accent); }
.prose blockquote { border-left: 3px solid var(--accent); padding: 4px 0 4px 20px; color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose img { border-radius: 8px; border: 1px solid var(--line); }
.prose figcaption { font-size: 0.88rem; color: var(--muted); margin-top: 8px; }
.prose code { font: 0.88em var(--mono); background: var(--code-bg); border: 1px solid var(--line); border-radius: 5px; padding: 0.12em 0.36em; }
.prose pre { position: relative; background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; overflow-x: auto; font: 0.86rem/1.6 var(--mono); tab-size: 4; }
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.prose .table-wrap { overflow-x: auto; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.prose th { font: 0.74rem var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.embed { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Código: botón de copiar y colores que pone site.js */
.copy { position: absolute; top: 8px; right: 8px; font: 0.72rem var(--mono); background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; cursor: pointer; opacity: 0; transition: opacity 0.15s; }
pre:hover .copy, .copy:focus-visible { opacity: 1; }
.copy:hover { color: var(--text); }
.tok-c { color: var(--muted); font-style: italic; }
.tok-s { color: #9ccc7a; }
.tok-n { color: #e0a45c; }
.tok-k { color: #7fb4f5; }
.tok-p { color: #d38fd8; }
:root[data-scheme="light"] .tok-s { color: #3d7a22; }
:root[data-scheme="light"] .tok-n { color: #a85e00; }
:root[data-scheme="light"] .tok-k { color: #1d5fb8; }
:root[data-scheme="light"] .tok-p { color: #8d2f95; }
@media (prefers-color-scheme: light) {
  :root[data-scheme="auto"] .tok-s { color: #3d7a22; }
  :root[data-scheme="auto"] .tok-n { color: #a85e00; }
  :root[data-scheme="auto"] .tok-k { color: #1d5fb8; }
  :root[data-scheme="auto"] .tok-p { color: #8d2f95; }
}

/* Alta en la lista de correo */
.signup { display: grid; gap: 8px; max-width: 520px; }
.signup label { font-size: 0.85rem; color: var(--muted); }
.signup input[type="email"], .signup input[type="text"] { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 11px 14px; min-width: 0; }
.contact textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 11px 14px; resize: vertical; }
.contact textarea:focus-visible { outline-offset: 0; border-color: var(--accent); }
.contact .btn { cursor: pointer; font: inherit; font-weight: 650; justify-self: start; margin-top: 8px; }
.signup input:focus-visible { outline-offset: 0; border-color: var(--accent); }
.signup-row { display: flex; gap: 10px; flex-wrap: wrap; }
.signup-row input { flex: 1 1 220px; }
.signup-row .btn { cursor: pointer; font: inherit; font-weight: 650; }
.signup-consent { display: flex; gap: 8px; align-items: baseline; margin-top: 4px; line-height: 1.45; }
.signup-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.signup-band { border-top: 1px solid var(--line); background: var(--surface); padding-block: clamp(36px, 6vw, 56px); }
.signup-band .wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 24px 48px; align-items: center; }
.signup-band h2 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); margin-bottom: 8px; }
.signup-band p { color: var(--muted); margin: 0; max-width: 46ch; }
.signup-band .signup { justify-self: end; width: 100%; }
.signup-band .signup input { background: var(--bg); }
main:has(+ .signup-band) { padding-bottom: 72px; }
form.actions { align-items: center; }
form.actions .btn { cursor: pointer; font: inherit; font-weight: 650; }
/* Botón de compra: un formulario entre los demás botones de la ficha. */
.buy { display: flex; margin: 0; }
.buy .btn { cursor: pointer; font: inherit; font-weight: 650; line-height: 1.3; }

/* Aviso de cookies de la analítica */
.cookie-bar { position: fixed; z-index: 40; left: 16px; right: 16px; bottom: 16px; max-width: 720px; margin-inline: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; box-shadow: 0 8px 32px rgb(0 0 0 / 0.35); font-size: 0.92rem; line-height: 1.5; }
.cookie-bar[hidden] { display: none; }
.cookie-bar p { flex: 1 1 280px; margin: 0; }
.cookie-bar div { display: flex; gap: 10px; }
.cookie-bar .btn { cursor: pointer; font: inherit; font-weight: 650; line-height: 1.3; padding: 8px 16px; }

/* Pie */
.site-footer { border-top: 1px solid var(--line); padding-block: 36px; color: var(--muted); font-size: 0.92rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 24px 48px; flex-wrap: wrap; }
.site-footer p { margin: 0; }
.footer-name { color: var(--text); font-weight: 650; margin-bottom: 4px !important; }
.footer-links { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; padding: 0; }
.footer-links a { text-decoration: none; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .facts { width: 100%; }
  .facts div { flex: 1 1 50%; border-bottom: 1px solid var(--line); margin-bottom: -1px; }
  .copy { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media print {
  .site-header nav, .site-header .social, .site-footer, .signup-band, .bars, .actions, .copy, .hero-bg, .hero-toggle, .cookie-bar { display: none; }
  body { background: #fff; color: #000; }
}
