/* Webs nicho (3dcastellon.es / automatizacastellon.es) · v3 · 01/12/2026
   Sustituye a niche-20261130-v2.css. Primera vista animada como en trascendent.es: escenario que
   rota solo, carruseles automáticos en cada caso y aparición suave al entrar en pantalla.
   Tokens del sistema Trascendent (styles.css / brand.css); un único acento por web. */

/* ---- Cabecera y pie ---- */
.niche-site-header .niche-nav { flex-wrap: nowrap; }
.niche-site-header .niche-nav a:not(.subpage-header-cta) { white-space: nowrap; }
.niche-site-footer p a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.niche-footer-contact { flex-basis: 100%; }
@media (max-width: 860px) {
  .niche-site-header .niche-nav a:not(.subpage-header-cta) { display: none; }
}
@media (max-width: 560px) {
  .niche-site-header .subpage-brand { flex: 1 1 auto; }
  .niche-site-header .subpage-brand strong { white-space: normal; line-height: 1.25; letter-spacing: .06em; }
  .niche-site-header .niche-nav { flex-shrink: 0; }
  .niche-site-header .subpage-header-cta { white-space: nowrap; }
}
@media (max-width: 360px) {
  .niche-site-header .subpage-brand { gap: 9px; }
  .niche-site-header .subpage-brand img { width: 32px; height: 32px; }
  .niche-site-header .subpage-header-cta { padding: 0 10px; font-size: .7rem; }
  .niche-site-header .subpage-header-cta span { display: none; }
}

/* ---- Superficies y acento ---- */
.niche-site { scrollbar-color: #3a3f4b var(--night, #090b10); --nx-ease: var(--ease, cubic-bezier(.16, 1, .3, 1)); --nx-mono: ui-monospace, SFMono-Regular, Menlo, monospace; }
.niche-site ::selection { background: color-mix(in srgb, var(--local-accent, #ffad8a) 78%, transparent); color: #090b10; }
.niche-3d { --local-accent: #ffad8a; --local-line: #ff4b0a; --local-glow: #ff6a2a; }
.niche-digital { --local-accent: #a5baff; --local-line: #3867ff; --local-glow: #4f7dff; }

/* ---- Hero ---- */
.nx-home .nx-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); align-items: center; gap: clamp(28px, 4vw, 64px); padding-top: 28px; }
.nx-home .nx-hero h1 { max-width: 13ch; }

/* ---- Slides (escenario y carruseles) ---- */
.nx-slides { position: absolute; inset: 0; }
.nx-slide { position: absolute; inset: 0; margin: 0; overflow: hidden; opacity: 0; visibility: hidden; transition: opacity .9s var(--nx-ease), visibility 0s linear .9s; }
.nx-slide.is-active { z-index: 1; opacity: 1; visibility: visible; transition: opacity .9s var(--nx-ease); }
.nx-slide-pic { position: absolute; inset: 0; overflow: hidden; }
.nx-slide-media, .nx-slide-bg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.nx-slide--fit .nx-slide-media { object-fit: contain; }
.nx-slide-bg { transform: scale(1.18); filter: blur(24px) saturate(1.2) brightness(.48); }
.nx-slide--pixel { background: #05060a; }
.nx-slide--pixel img { image-rendering: pixelated; }
.nx-slide--bottom .nx-slide-media { object-position: 50% 100%; }

/* ---- Escenario de portada ---- */
.nx-stage { position: relative; display: grid; gap: 14px; min-width: 0; }
.nx-stage-top { display: flex; justify-content: space-between; gap: 16px; font: 600 .72rem/1.3 var(--nx-mono); letter-spacing: .16em; text-transform: uppercase; color: #a9adb9; }
.nx-stage-count { flex: none; color: var(--local-accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nx-stage-frame { position: relative; overflow: hidden; isolation: isolate; border: 1px solid #ffffff1f; border-radius: 20px; background: #0b0e14; box-shadow: 0 46px 90px -48px color-mix(in srgb, var(--local-glow) 55%, transparent), inset 0 0 0 1px #ffffff08; }
.nx-stage-frame::before { content: ""; position: absolute; inset: 0 0 auto; z-index: 3; height: 2px; background: linear-gradient(90deg, transparent, var(--local-line) 30%, var(--local-accent) 70%, transparent); opacity: .85; }
/* Todos los slides comparten celda: el escenario mide lo que la leyenda más larga, sin recortes */
.nx-stage .nx-slides { position: relative; inset: auto; display: grid; }
.nx-stage .nx-slide { position: relative; inset: auto; grid-area: 1 / 1; display: grid; grid-template-rows: auto 1fr; }
.nx-stage .nx-slide-pic { position: relative; inset: auto; aspect-ratio: 16 / 9; }
.nx-stage-caption { display: grid; align-content: start; justify-items: start; gap: 5px; overflow: hidden; padding: 16px 22px 18px; border-top: 1px solid #ffffff14; background: linear-gradient(180deg, #10131b, #0b0e14); }
.nx-stage-caption small { font: 600 .72rem/1.35 var(--nx-mono); letter-spacing: .13em; text-transform: uppercase; color: var(--local-accent); }
.nx-stage-caption strong { max-width: 34ch; color: var(--white, #f7f6f1); font-size: clamp(1.02rem, 1.45vw, 1.26rem); line-height: 1.3; font-weight: 650; letter-spacing: -.015em; text-wrap: balance; }
.nx-stage-caption a { margin-top: 4px; color: var(--white, #f7f6f1); font-size: .8rem; font-weight: 550; text-decoration: underline; text-decoration-color: var(--local-accent); text-underline-offset: 4px; }
.nx-stage-caption a:focus-visible { outline: 3px solid var(--local-accent); outline-offset: 3px; border-radius: 4px; }
.nx-stage-pause { position: absolute; top: 14px; right: 14px; z-index: 4; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid #ffffff33; border-radius: 50%; background: #090b10b3; backdrop-filter: blur(8px); color: var(--white, #f7f6f1); cursor: pointer; transition: background-color .2s ease, border-color .2s ease; }
.nx-stage-pause:hover { border-color: var(--local-accent); }
.nx-stage-pause:focus-visible { outline: 3px solid var(--local-accent); outline-offset: 3px; }
.nx-stage-pause span { position: relative; width: 10px; height: 12px; border-inline: 3px solid currentColor; }
.nx-stage-pause[aria-pressed="true"] span { width: 0; height: 0; margin-left: 3px; border: 0; border-block: 7px solid transparent; border-left: 11px solid currentColor; }
.nx-stage-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.nx-stage-steps button { position: relative; display: grid; justify-items: center; gap: 3px; min-height: 52px; padding: 9px 8px 11px; overflow: hidden; border: 1px solid #ffffff1c; border-radius: 12px; background: #ffffff08; color: #d9dbe2; font-family: inherit; font-size: .78rem; font-weight: 650; line-height: 1.3; letter-spacing: .01em; cursor: pointer; transition: background-color .3s ease, color .3s ease, border-color .3s ease; }
.nx-stage-steps button { hyphens: auto; text-align: center; }
.nx-stage-steps button span { font: 600 .7rem/1.1 var(--nx-mono); letter-spacing: .08em; color: #9a9fad; }
.nx-stage-steps button:hover { border-color: color-mix(in srgb, var(--local-accent) 60%, transparent); }
.nx-stage-steps button:focus-visible { outline: 3px solid var(--local-accent); outline-offset: 3px; }
.nx-stage-steps button[aria-current="true"] { border-color: transparent; background: var(--white, #f7f6f1); color: #0b0d12; }
.nx-stage-steps button[aria-current="true"] span { color: #4b4f5c; }
.nx-stage-steps button::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: linear-gradient(90deg, var(--local-line), var(--local-accent)); }
.nx-stage-steps button.is-timing::after { animation: nx-progress var(--nx-dur, 6s) linear forwards; }

/* ---- Carruseles de casos y repositorios ---- */
.nx-case-media { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: #0b0e14; }
.nx-slide-caption { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 10px; border-radius: 9px; background: #090b10d9; backdrop-filter: blur(6px); color: #e9eaee; font-size: .72rem; line-height: 1.35; }
.nx-slide-caption > span:first-child { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nx-slide-caption > span:first-child:empty { display: none; }
.nx-slide-count { margin-left: auto; flex: none; font: 600 .72rem/1.2 var(--nx-mono); letter-spacing: .08em; color: var(--local-accent); font-variant-numeric: tabular-nums; }
.nx-dots { position: absolute; top: 6px; left: 8px; right: 8px; z-index: 3; display: flex; gap: 4px; }
.nx-dots button { flex: 1; min-width: 0; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; }
.nx-dots button span { position: relative; display: block; height: 3px; overflow: hidden; border-radius: 3px; background: #ffffff40; box-shadow: 0 1px 4px #0000004d; }
.nx-dots button span::after { content: ""; position: absolute; inset: 0; width: 0; background: var(--white, #f7f6f1); }
.nx-dots button.is-past span::after, .nx-dots button[aria-current="true"]:not(.is-timing) span::after { width: 100%; }
.nx-dots button.is-timing span::after { animation: nx-progress var(--nx-dur, 5s) linear forwards; }
.nx-dots button:focus-visible { outline: 2px solid var(--local-accent); outline-offset: 1px; border-radius: 4px; }
@keyframes nx-progress { from { width: 0; } to { width: 100%; } }

/* ---- Cabeceras de sección ---- */
.nx-section-head { display: flex; align-items: end; justify-content: space-between; gap: 40px; margin-bottom: 36px; }
.nx-section-head h2 { margin: 0; max-width: 18ch; font-size: clamp(2rem, 3.3vw, 3.1rem); line-height: 1.08; letter-spacing: -.035em; font-weight: 650; text-wrap: balance; }
.nx-section-head p { margin: 0; max-width: 42ch; color: #bfc3cd; font-size: .95rem; line-height: 1.65; }

/* ---- Galería de casos ---- */
.nx-gallery { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 22px; }
.nx-gallery > .nx-case { grid-column: span 4; min-width: 0; max-width: none; margin: 0; scroll-margin-top: 96px; }
.nx-gallery > .nx-case--feature { grid-column: span 6; }
.nx-case, .nx-repo { position: relative; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #ffffff1c; border-radius: 18px; background: var(--night-2, #11141b); transition: border-color .3s ease, box-shadow .5s var(--nx-ease), transform .5s var(--nx-ease); }
.nx-case:hover, .nx-repo:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--local-accent) 50%, transparent); box-shadow: 0 34px 64px -40px color-mix(in srgb, var(--local-glow) 70%, transparent); }
.nx-case--feature .nx-case-media { aspect-ratio: 16 / 10; }
.nx-case-body, .nx-repo-body { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; flex: 1; padding: 22px 24px 24px; }
.nx-case-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .74rem; line-height: 1.4; letter-spacing: .01em; color: var(--local-accent); }
.nx-case-meta span + span { color: #a9adb9; }
.nx-case-title { margin: 0; font-size: clamp(1.15rem, 1.5vw, 1.35rem); line-height: 1.22; letter-spacing: -.02em; font-weight: 650; text-wrap: balance; }
.nx-case--feature .nx-case-title { font-size: clamp(1.3rem, 1.9vw, 1.65rem); }
.nx-case-title a, .nx-repo-name a { color: inherit; text-decoration: none; }
.nx-case-title a::after, .nx-repo-name a::after { content: ""; position: absolute; inset: 0; border-radius: 0 0 17px 17px; }
.nx-case-title a:focus-visible, .nx-repo-name a:focus-visible { outline: none; }
.nx-case-title a:focus-visible::after, .nx-repo-name a:focus-visible::after { outline: 3px solid var(--local-accent); outline-offset: -3px; }
.nx-case-text { display: block; max-width: 62ch; color: #b9bdc8; font-size: .9rem; line-height: 1.65; }
.nx-case-text strong { color: #e6e7ec; font-weight: 600; }
.nx-case-link, .nx-repo-go { margin-top: auto; padding-top: 6px; font-size: .8rem; font-weight: 550; color: var(--local-accent); }
.nx-case-link span, .nx-repo-go span { display: inline-block; transition: transform .3s var(--nx-ease); }
.nx-case:hover .nx-case-link span, .nx-repo:hover .nx-repo-go span { transform: translate(3px, -3px); }

/* Automatiza: el último caso ocupa la fila completa en horizontal */
.nx-gallery-digital > .nx-case:last-child:not(.nx-case--feature) { grid-column: 1 / -1; flex-direction: row; }
.nx-gallery-digital > .nx-case:last-child:not(.nx-case--feature) .nx-case-media { flex: 0 0 54%; aspect-ratio: 16 / 9; }
.nx-gallery-digital > .nx-case:last-child:not(.nx-case--feature) .nx-case-body { justify-content: center; padding: 32px 36px; }
.nx-gallery-digital .nx-slide--fit { background: #0b1013; }

/* ---- Diseños publicados (3D) ---- */
.seo-service .nx-published, .nx-published { display: flex; align-items: center; justify-content: space-between; gap: 24px 40px; flex-wrap: wrap; margin-top: 22px; padding: 24px 28px; border: 1px solid #ffffff1c; border-radius: 18px; }
.nx-published p { margin: 0; max-width: 60ch; color: #c9ccd5; font-size: .95rem; line-height: 1.6; }
.nx-published nav { display: flex; flex-wrap: wrap; gap: 12px; }
.niche-cases .nx-published { margin-top: 28px; }

/* ---- Código abierto (Automatiza) ---- */
.nx-repos { list-style: none; margin: 0 0 26px; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.nx-repo { max-width: none; margin: 0; scroll-margin-top: 96px; }
.nx-repo .nx-case-media { aspect-ratio: 16 / 10; }
.nx-repo-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: .74rem; color: #a9adb9; }
.nx-repo-lang { padding: 3px 9px; border: 1px solid color-mix(in srgb, var(--local-accent) 55%, transparent); border-radius: 99px; font: 600 .72rem/1.3 var(--nx-mono); color: var(--local-accent); }
.nx-repo-name { margin: 0; font-size: clamp(1.45rem, 2.2vw, 1.9rem); line-height: 1.1; letter-spacing: -.03em; font-weight: 700; }
.nx-repo-text { margin: 0; max-width: 58ch; color: #b9bdc8; font-size: .92rem; line-height: 1.65; }
.nx-repo-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.nx-repo-facts li { margin: 0; padding: 5px 10px; border-radius: 8px; background: #ffffff0d; color: #dfe1e7; font-size: .76rem; line-height: 1.35; }
.nx-oss { list-style: none; margin: 0; padding: 0; border-top: 1px solid #ffffff26; }
.nx-oss > li { max-width: none; margin: 0; border-bottom: 1px solid #ffffff1c; }
.nx-oss a { display: grid; grid-template-columns: minmax(170px, 1fr) 100px minmax(0, 2.4fr) 130px auto; align-items: baseline; gap: 8px 26px; padding: 20px 4px; color: inherit; text-decoration: none; transition: background-color .25s ease; }
.nx-oss a:hover { background: #ffffff05; }
.nx-oss a:focus-visible { outline: 3px solid var(--local-accent); outline-offset: 2px; }
.nx-oss-name { margin: 0; font-size: 1.05rem; line-height: 1.3; font-weight: 600; letter-spacing: -.01em; transition: color .2s ease; }
.nx-oss-lang, .nx-oss-date { font: 500 .74rem/1.4 var(--nx-mono); color: #a9adb9; }
.nx-oss-text { color: #b9bdc8; font-size: .9rem; line-height: 1.6; max-width: 70ch; }
.nx-oss-go { font-size: .8rem; color: var(--local-accent); white-space: nowrap; }
.nx-oss-go span { display: inline-block; transition: transform .25s var(--nx-ease); }
.nx-oss a:hover .nx-oss-name { color: var(--local-accent); }
.nx-oss a:hover .nx-oss-go span { transform: translate(3px, -3px); }
.nx-home .nx-oss-section { padding-top: clamp(56px, 7vw, 96px); }

/* ---- Secciones heredadas: un solo acento por web ---- */
.niche-site .subpage-section-number { color: var(--local-accent); }
.niche-site .subpage-main .subpage-faq summary::after { color: var(--local-accent); }
.niche-site .subpage-main .subpage-story-section li::marker { color: var(--local-accent); }

/* ---- Página /casos ---- */
.nx-cases-hero { padding: 28px 0 44px; }
.nx-cases-hero h1 { margin: 0; max-width: 18ch; font-size: clamp(2.5rem, 4.4vw, 4.2rem); line-height: 1.05; letter-spacing: -.04em; font-weight: 700; text-wrap: balance; }
.nx-cases-hero .subpage-lead { max-width: 62ch; margin: 22px 0 0; color: #c3c7d0; line-height: 1.7; }
.nx-cases-hero .subpage-actions { margin-top: 26px; }
.niche-cases .nx-oss-section { padding-top: 80px; }

/* ---- Movimiento ---- */
@media (prefers-reduced-motion: no-preference) {
  /* Deriva lenta de fotos y renders (no de capturas de interfaz, que deben leerse enteras); se congela con la pausa */
  .niche-3d .nx-slide.is-active:not(.nx-slide--video):not(.nx-slide--fit):not(.nx-slide--pixel) .nx-slide-media { animation: nx-drift 9s ease-out both; }
  .nx-slide.is-active.nx-slide--fit .nx-slide-bg { animation: nx-drift-bg 9s ease-out both; }
  .is-paused .nx-slide-media, .is-paused .nx-slide-bg { animation-play-state: paused; }
  .nx-slide.is-active .nx-stage-caption > * { animation: nx-caption .7s var(--nx-ease) backwards; }
  .nx-slide.is-active .nx-stage-caption > :nth-child(2) { animation-delay: .08s; }
  .nx-slide.is-active .nx-stage-caption > :nth-child(3) { animation-delay: .16s; }
  /* Aparición de secciones y tarjetas; sin script no se oculta nada */
  .nx-motion .nx-reveal:not(.is-in) { opacity: 0; }
  .nx-motion .nx-reveal.is-in { animation: nx-rise .8s var(--nx-ease) var(--nx-stagger, 0ms) backwards; }
  .nx-motion .nx-hero .local-hero-copy > * { animation: nx-rise .9s var(--nx-ease) backwards; }
  .nx-motion .nx-hero .local-hero-copy > :nth-child(2) { animation-delay: .06s; }
  .nx-motion .nx-hero .local-hero-copy > :nth-child(3) { animation-delay: .12s; }
  .nx-motion .nx-hero .local-hero-copy > :nth-child(n + 4) { animation-delay: .18s; }
  .nx-motion .nx-stage { animation: nx-stage-in 1.1s var(--nx-ease) .1s backwards; }
}
@keyframes nx-drift { from { transform: scale(1.001); } to { transform: scale(1.065) translate3d(-1%, -.8%, 0); } }
@keyframes nx-drift-bg { from { transform: scale(1.18); } to { transform: scale(1.26); } }
@keyframes nx-caption { from { opacity: 0; transform: translateY(10px); } }
@keyframes nx-rise { from { opacity: 0; transform: translateY(26px); } }
@keyframes nx-stage-in { from { opacity: 0; transform: translateY(18px) scale(.985); } }
@media (prefers-reduced-motion: reduce) {
  .nx-slide, .nx-slide.is-active { transition: none; }
  .nx-case, .nx-repo { transition: border-color .3s ease; }
  .nx-case:hover, .nx-repo:hover { transform: none; }
}

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  .nx-home .nx-hero { grid-template-columns: 1fr; }
  .nx-home .nx-hero h1 { max-width: 16ch; }
  .nx-stage { max-width: 760px; }
  .nx-gallery { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .nx-gallery > .nx-case { grid-column: span 3; }
  .nx-gallery > .nx-case--feature { grid-column: 1 / -1; }
  .nx-gallery-3d > .nx-case:last-child:nth-child(odd):not(.nx-case--feature) { grid-column: 1 / -1; }
  .nx-gallery-digital > .nx-case:last-child:not(.nx-case--feature) { grid-column: span 3; flex-direction: column; }
  .nx-gallery-digital > .nx-case:last-child:not(.nx-case--feature) .nx-case-media { flex: none; aspect-ratio: 4 / 3; }
  .nx-gallery-digital > .nx-case:last-child:not(.nx-case--feature) .nx-case-body { justify-content: flex-start; padding: 22px 24px 24px; }
}
@media (max-width: 860px) {
  .nx-repos { grid-template-columns: 1fr; }
  .nx-oss a { grid-template-columns: minmax(150px, 1fr) 90px minmax(0, 2fr) auto; }
  .nx-oss-date { display: none; }
}
@media (max-width: 760px) {
  /* El escenario sube tras el titular para que la animación entre en la primera pantalla */
  .nx-home .nx-hero { row-gap: 0; }
  .nx-home .nx-hero .local-hero-copy { display: contents; }
  .nx-home .nx-hero .local-hero-copy > * { order: 3; }
  .nx-home .nx-hero .local-hero-copy > h1 { order: 1; }
  .nx-home .nx-hero .local-hero-copy > .local-promise { order: 2; }
  .nx-home .nx-hero > .nx-stage { order: 2; margin: 22px 0 6px; }
  .nx-section-head { display: block; }
  .nx-section-head p { margin-top: 16px; }
  .nx-oss a { grid-template-columns: 1fr auto; }
  .nx-oss-lang { grid-column: 2; grid-row: 1; justify-self: end; }
  .nx-oss-text, .nx-oss-go { grid-column: 1 / -1; }
  .nx-gallery-digital > .nx-case:last-child:not(.nx-case--feature) { flex-direction: column; }
  .nx-gallery-digital > .nx-case:last-child:not(.nx-case--feature) .nx-case-media { flex: none; aspect-ratio: 16 / 10; }
  .nx-gallery-digital > .nx-case:last-child:not(.nx-case--feature) .nx-case-body { padding: 22px 24px 24px; }
}
@media (max-width: 640px) {
  .nx-gallery { grid-template-columns: 1fr; gap: 16px; }
  .nx-gallery > .nx-case, .nx-gallery > .nx-case--feature, .nx-gallery-3d > .nx-case:last-child:nth-child(odd):not(.nx-case--feature) { grid-column: 1 / -1; }
  .nx-stage-frame { border-radius: 16px; }
  .nx-stage-caption { padding: 13px 16px 14px; }
  .nx-stage-caption strong { font-size: 1rem; }
  .nx-stage-steps { gap: 6px; }
  .nx-stage-steps button { min-height: 50px; padding: 8px 4px 10px; font-size: .72rem; }
  .nx-published { padding: 20px; }
  .nx-case-body, .nx-repo-body { padding: 20px; }
}
@media (max-width: 480px) {
  /* Pasos en 2 × 2, con número y nombre en línea: ningún nombre se parte */
  .nx-stage-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .nx-stage-steps button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 10px 10px; font-size: .78rem; }
}
@media (max-width: 380px) {
  .nx-stage-top > span:first-child { letter-spacing: .1em; }
}
