/* ==========================================================================
   DTI Barcelona · Página 3DTI (3dti.php)
   Enfoque oscuro, dorado y amarillo: el relieve es el protagonista.
   Base y cabecera en header.css · Secciones compartidas en componentes.css
   Referencia: láminas DTIBCN 11 y 12 (3DTI)
   ========================================================================== */

/* ==========================================================================
   HERO: escudo en 3D con brillo dinámico
   ========================================================================== */
.t3hero { position: relative; overflow: hidden; padding: clamp(40px, 6vw, 80px) 0 clamp(64px, 8vw, 110px); background: radial-gradient(70% 80% at 72% 40%, #2a2210 0%, #151208 38%, var(--bg) 72%); }
.t3hero__ghost { position: absolute; right: -2vw; bottom: -6vw; font-family: var(--display); font-size: clamp(180px, 34vw, 520px); line-height: .8; color: transparent; -webkit-text-stroke: 1.5px rgba(255, 194, 0, .12); pointer-events: none; user-select: none; }
.t3hero__grid { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(32px, 5vw, 64px); align-items: center; }
.t3hero__title { font-size: clamp(56px, 7.2vw, 120px); }
.t3hero__title .line { display: block; overflow: hidden; padding: .12em 0 .04em; margin-top: -.12em; }
.t3hero__title .line > span { display: inline-block; }
.t3hero__title .y { text-shadow: 0 0 60px rgba(255, 194, 0, .35); }
.t3hero__sub { font-size: clamp(20px, 2.2vw, 30px); color: var(--cream); margin: 18px 0 0; padding-bottom: 14px; position: relative; display: inline-block; }
.t3hero__sub::after { content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--yellow), #B88700); transform-origin: left; }
.t3hero__lead { color: var(--muted); max-width: 520px; margin: 24px 0 32px; font-size: 17px; }
.t3hero__ctas { display: flex; flex-wrap: wrap; gap: 12px; }

.t3hero__stage { display: grid; justify-items: center; gap: 22px; }
.crest { --rx: 0deg; --ry: 0deg; --sx: 50%; position: relative; width: min(560px, 100%); perspective: 1100px; }
.crest__tilt { position: relative; transform: rotateX(var(--rx)) rotateY(var(--ry)); transform-style: preserve-3d; transition: transform .35s cubic-bezier(.2, .7, .2, 1); animation: crestFloat 6s ease-in-out infinite; }
.crest__img { display: block; width: 100%; height: auto; filter: drop-shadow(0 30px 40px rgba(0, 0, 0, .65)) drop-shadow(0 0 1px rgba(255, 194, 0, .3)); transition: filter .5s ease; }
.crest__shine { position: absolute; inset: 0; pointer-events: none; -webkit-mask: url("../img/3dti-aguila.webp") center / 100% 100% no-repeat; mask: url("../img/3dti-aguila.webp") center / 100% 100% no-repeat; background: linear-gradient(115deg, transparent 28%, rgba(255, 255, 255, .7) 44%, rgba(255, 236, 170, .35) 50%, transparent 64%) no-repeat; background-size: 260% 100%; background-position: var(--sx) 0; mix-blend-mode: overlay; transition: opacity .5s ease, background-position .2s linear; }
.crest__shadow { display: block; width: 70%; height: 26px; margin: -6px auto 0; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, .7), transparent); animation: shadowPulse 6s ease-in-out infinite; }
@keyframes crestFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -12px; } }
@keyframes shadowPulse { 0%, 100% { transform: scaleX(1); opacity: .9; } 50% { transform: scaleX(.86); opacity: .6; } }
.crest[data-finish="brillo"] .crest__shine { opacity: 1; }
.crest[data-finish="mate"] .crest__shine { opacity: .18; }
.crest[data-finish="mate"] .crest__img { filter: drop-shadow(0 30px 40px rgba(0, 0, 0, .65)) saturate(.82) contrast(.92) brightness(.96); }

.finish { display: inline-flex; align-items: center; gap: 4px; padding: 6px; border-radius: 999px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line-2); }
.finish__label { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted-2); padding: 0 10px 0 12px; font-weight: 700; }
.finish__btn { border: 0; border-radius: 999px; padding: 9px 18px; background: none; color: var(--cream); font: 700 13px/1 var(--body); cursor: pointer; transition: background .25s ease, color .25s ease; }
.finish__btn[aria-checked="true"] { background: var(--yellow); color: var(--bg); }
.finish__btn:hover:not([aria-checked="true"]) { background: rgba(255, 255, 255, .1); }

@media (max-width: 900px) {
  .t3hero__grid { grid-template-columns: 1fr; }
  .t3hero__stage { order: -1; }
  .crest { width: min(440px, 92%); }
}

/* ==========================================================================
   CINTA DE CLAVES
   ========================================================================== */
.t3keys { background: #0b0b0b; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); overflow: hidden; padding: 22px 0; }
.t3keys__track { display: flex; width: max-content; animation: keys 38s linear infinite; }
.t3keys:hover .t3keys__track { animation-play-state: paused; }
.t3keys__list { list-style: none; margin: 0; padding: 0 28px 0 0; display: flex; gap: 56px; }
.t3keys__list li { display: flex; align-items: center; gap: 14px; white-space: nowrap; font-family: var(--display); text-transform: uppercase; font-size: clamp(20px, 2vw, 28px); color: var(--cream); }
.t3keys__list svg { width: 34px; height: 34px; flex: none; fill: none; stroke: var(--yellow); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
@keyframes keys { to { transform: translateX(-50%); } }

/* ==========================================================================
   CONSTRUCCIÓN DE CAPAS: despiece 3D anclado al scroll (3dti.js fija --p)
   ========================================================================== */
.layers3d { --p: 0; position: relative; height: 320vh; background: radial-gradient(60% 60% at 70% 50%, #1b1a17 0%, var(--bg) 70%); }
.layers3d__pin { position: sticky; top: var(--header-h); min-height: calc(100vh - var(--header-h)); display: flex; align-items: center; padding: 32px 0; overflow: hidden; }
.layers3d__grid { width: 100%; display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.2fr); gap: clamp(24px, 4vw, 56px); align-items: center; }
.layers3d__title { font-size: clamp(42px, 5.4vw, 80px); }
.layers3d__text > p { color: var(--muted); margin: 20px 0 28px; max-width: 460px; }
.layers3d__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.layers3d__list li { display: flex; align-items: center; gap: 16px; padding: 10px 14px; border-radius: 14px; border: 1px solid transparent; opacity: .4; transition: opacity .35s ease, background .35s ease, border-color .35s ease, transform .35s ease; }
.layers3d__list li span { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--yellow); color: var(--yellow); font-size: 18px; transition: background .35s ease, color .35s ease; }
.layers3d__list li strong { display: block; font-size: 16px; }
.layers3d__list li small { color: var(--muted-2); font-size: 13px; }
.layers3d__list li.is-active { opacity: 1; background: rgba(255, 194, 0, .07); border-color: rgba(255, 194, 0, .35); transform: translateX(6px); }
.layers3d__list li.is-active span { background: var(--yellow); color: var(--bg); }

.stack { position: relative; height: min(70vh, 640px); display: grid; place-items: center; perspective: 1600px; }
.stack__scene { --gap: calc(6px + var(--p) * 118px); position: relative; width: min(400px, 74vw); aspect-ratio: 1100 / 809; transform-style: preserve-3d; transform: rotateX(calc(58deg - var(--p) * 6deg)) rotateZ(calc(-34deg + var(--p) * 10deg)); }
.stack__layer { position: absolute; inset: 0; transform-style: preserve-3d; transform: translateZ(calc((var(--i) - 3) * var(--gap))); transition: box-shadow .35s ease, outline-color .35s ease; outline: 2px solid transparent; outline-offset: 6px; }
.stack__layer img { display: block; width: 100%; height: 100%; object-fit: contain; }
.stack__layer--1 { --i: 1; inset: -14% -12%; border-radius: 18px; background-color: #1d2a44; background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, .06) 0 2px, transparent 2px 6px), repeating-linear-gradient(90deg, rgba(0, 0, 0, .25) 0 2px, transparent 2px 6px); box-shadow: 0 40px 80px rgba(0, 0, 0, .6); }
.stack__layer--2 { --i: 2; border-radius: 46% / 48%; background: linear-gradient(145deg, #ffffff, #dcdcdc); box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.stack__layer--3 { --i: 3; }
.stack__layer--3 img { filter: grayscale(1) brightness(2.2) contrast(.75) drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); }
.stack__layer--4 { --i: 4; }
.stack__layer--4 img { filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .4)); }
.stack__layer--5 { --i: 5; border-radius: 46% / 48%; background: linear-gradient(120deg, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, .08) 38%, rgba(255, 255, 255, .45) 52%, rgba(255, 255, 255, .06) 70%); border: 1.5px solid rgba(255, 255, 255, .7); backdrop-filter: blur(1px); }
.stack__layer.is-active { outline-color: var(--yellow); }
.stack__layer--3.is-active, .stack__layer--4.is-active { outline-color: transparent; }
.stack__layer--3.is-active img { filter: grayscale(1) brightness(2.2) contrast(.75) drop-shadow(0 0 14px rgba(255, 194, 0, .9)); }
.stack__layer--4.is-active img { filter: drop-shadow(0 0 16px rgba(255, 194, 0, .85)); }
.stack__layer--3 img, .stack__layer--4 img { transition: filter .35s ease; }

/* Base y barniz con la silueta exacta del escudo */
.stack__layer--2, .stack__layer--5 { border-radius: 0; -webkit-mask: url("../img/3dti-aguila.webp") center / 100% 100% no-repeat; mask: url("../img/3dti-aguila.webp") center / 100% 100% no-repeat; }
.stack__layer--2 { transform: translateZ(calc((var(--i) - 3) * var(--gap))) scale(1.04); }
.stack__layer--5 { border: 0; background: linear-gradient(120deg, rgba(255, 255, 255, .7) 0%, rgba(255, 255, 255, .1) 36%, rgba(255, 255, 255, .55) 50%, rgba(255, 255, 255, .08) 68%, rgba(255, 255, 255, .35) 100%); }
.stack__layer--5.is-active { outline-color: transparent; filter: brightness(1.35); }

@media (max-width: 900px) {
  .layers3d { height: auto; }
  .layers3d__pin { position: relative; top: 0; min-height: 0; padding: clamp(64px, 9vw, 96px) 0; }
  .layers3d__grid { grid-template-columns: 1fr; }
  .stack { height: 380px; order: -1; }
  .stack__scene { width: min(300px, 70vw); }
}

/* ==========================================================================
   GALERÍA DE ESCUDOS
   ========================================================================== */
.crests { background: var(--bg); padding: clamp(72px, 9vw, 128px) 0; }
.crests__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.crests__item { position: relative; margin: 0; }
.crests__item .ph { aspect-ratio: 16 / 10; border-radius: 20px; }
.crests__item figcaption { position: absolute; left: 14px; right: 14px; bottom: 14px; display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 14px; background: rgba(10, 10, 10, .82); backdrop-filter: blur(6px); font-size: 14px; color: var(--cream); pointer-events: none; }
.crests__item figcaption strong { color: var(--yellow); }
.crests__item figcaption svg { width: 40px; height: 40px; flex: none; padding: 8px; border-radius: 50%; border: 1.5px solid var(--yellow); fill: none; stroke: var(--yellow); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.tiltable { transform-style: preserve-3d; transition: transform .3s ease-out, box-shadow .3s ease; position: relative; }
.tiltable::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(420px circle at var(--lx, 50%) var(--ly, 50%), rgba(255, 220, 120, .22), transparent 45%); opacity: 0; transition: opacity .3s ease; }
.tiltable:hover::after { opacity: 1; }
.tiltable:hover { box-shadow: 0 30px 60px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 194, 0, .35); }
@media (max-width: 640px) {
  .crests__grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   MACRO ZOOM + IMPRESIÓN 3DTI
   ========================================================================== */
.t3macro { padding: clamp(72px, 9vw, 128px) 0; }
.t3macro__grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
.t3macro__media { position: relative; }
.t3macro__photo { aspect-ratio: 526 / 267; border-radius: 22px; box-shadow: 0 40px 80px rgba(60, 45, 20, .25); }
.t3macro__badge { position: absolute; top: -16px; left: 22px; background: var(--bg); color: var(--yellow); font-family: var(--display); font-size: 18px; letter-spacing: .06em; padding: 10px 18px; border-radius: 999px; box-shadow: 0 12px 30px rgba(0, 0, 0, .3); }
.t3macro__text > p { margin: 22px 0 28px; }
.t3attrs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.t3attrs li { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: #E7DCCB; font-weight: 700; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; transition: background .3s ease, color .3s ease, transform .3s ease; }
.t3attrs li:hover { background: var(--bg); color: var(--cream); transform: translateY(-3px); }
.t3attrs svg { width: 26px; height: 26px; flex: none; fill: none; stroke: #8A6400; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.t3attrs li:hover svg { stroke: var(--yellow); }
@media (max-width: 900px) { .t3macro__grid { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .t3attrs { grid-template-columns: 1fr; } }

/* ==========================================================================
   CÓMO FUNCIONA + VENTAJAS + CITA
   ========================================================================== */
.t3how { background: var(--bg); padding: clamp(72px, 9vw, 128px) 0; }
.t3how__title { margin-bottom: clamp(36px, 5vw, 56px); }
.t3how__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.t3how__col { background: var(--bg-2); border: 1px solid var(--line); border-radius: 22px; padding: clamp(24px, 3vw, 36px); }
.t3how__h { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 24px; padding: 10px 18px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line-2); font-family: var(--display); font-weight: 400; font-size: 20px; letter-spacing: .03em; text-transform: uppercase; color: var(--yellow); }
.t3how__h svg { width: 22px; height: 22px; fill: none; stroke: var(--yellow); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.t3steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; position: relative; }
.t3steps::before { content: ""; position: absolute; left: 17px; top: 18px; bottom: 18px; width: 2px; background: linear-gradient(var(--yellow), rgba(255, 194, 0, .1)); }
.t3steps li { position: relative; display: flex; align-items: center; gap: 16px; font-size: 16px; }
.t3steps li span { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--yellow); color: var(--bg); font-size: 18px; }
.t3how .checks { grid-template-columns: 1fr; gap: 12px; font-size: 16px; }
.t3how .checks svg { stroke: var(--yellow); }
.t3quote { margin: clamp(48px, 6vw, 80px) auto 0; max-width: 980px; text-align: center; position: relative; padding-top: 40px; }
.t3quote::before { content: "\201C"; position: absolute; top: -30px; left: 50%; translate: -50% 0; font-family: var(--serif); font-size: 120px; line-height: 1; color: var(--yellow); }
.t3quote p { margin: 0; font-family: var(--serif); font-size: clamp(26px, 3.4vw, 46px); line-height: 1.2; color: var(--cream); }
.t3quote em { font-style: italic; color: var(--yellow); }
@media (max-width: 760px) { .t3how__grid { grid-template-columns: 1fr; } }

/* Sectores: 6 tarjetas */
.items__grid.items__grid--six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 960px) { .items__grid.items__grid--six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 520px) { .items__grid.items__grid--six { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ==========================================================================
   CTA con la sudadera
   ========================================================================== */
.t3cta__side { flex: 0 1 420px; display: grid; gap: 22px; justify-items: stretch; }
.t3cta__img { width: 100%; height: auto; border-radius: 18px; box-shadow: 0 30px 60px rgba(0, 0, 0, .3); transform: rotate(-3deg); transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.t3cta__side:hover .t3cta__img { transform: rotate(0) scale(1.03); }
.t3cta .cta__actions { flex: none; }

/* ==========================================================================
   ENTRADA DEL HERO (3dti.js añade .is-ready)
   ========================================================================== */
.js .t3hero__title .line > span { transform: translateY(105%); transition: transform 1.1s cubic-bezier(.19, 1, .22, 1); }
.js .t3hero__title .line:nth-child(2) > span { transition-delay: .12s; }
.js .t3hero.is-ready .t3hero__title .line > span { transform: none; }
.js .t3hero__sub::after { transform: scaleX(0); transition: transform .9s cubic-bezier(.2, .7, .2, 1) .7s; }
.js .t3hero.is-ready .t3hero__sub::after { transform: none; }
.js .t3hero__eyebrow, .js .t3hero__sub, .js .t3hero__lead, .js .t3hero__ctas, .js .t3hero .crumbs { opacity: 0; transform: translateY(14px); transition: opacity .8s ease, transform .8s ease; }
.js .t3hero.is-ready .t3hero__eyebrow, .js .t3hero.is-ready .crumbs { opacity: 1; transform: none; }
.js .t3hero.is-ready .t3hero__sub { opacity: 1; transform: none; transition-delay: .35s; }
.js .t3hero.is-ready .t3hero__lead { opacity: 1; transform: none; transition-delay: .5s; }
.js .t3hero.is-ready .t3hero__ctas { opacity: 1; transform: none; transition-delay: .65s; }
.js .t3hero__stage { opacity: 0; transform: scale(.85) rotate(-6deg); transition: opacity 1.2s cubic-bezier(.2, .7, .2, 1) .1s, transform 1.4s cubic-bezier(.34, 1.3, .64, 1) .1s; }
.js .t3hero.is-ready .t3hero__stage { opacity: 1; transform: none; }
.js .t3hero__ghost { opacity: 0; transform: translateX(8%); transition: opacity 1.6s ease .2s, transform 1.6s cubic-bezier(.2, .7, .2, 1) .2s; }
.js .t3hero.is-ready .t3hero__ghost { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .crest__tilt, .crest__shadow, .t3keys__track { animation: none; }
  .js .t3hero__title .line > span, .js .t3hero__sub::after, .js .t3hero__eyebrow, .js .t3hero__sub, .js .t3hero__lead, .js .t3hero__ctas, .js .t3hero .crumbs, .js .t3hero__stage, .js .t3hero__ghost { opacity: 1; transform: none; transition: none; }
  .layers3d { --p: 1; height: auto; }
  .layers3d__pin { position: relative; top: 0; }
}
