/*
 * QHSE Proactiva SAS.
 * Layout: bandas a ancho completo con contenido a 1200px. Mismas secciones del sitio original.
 * Colores de marca tomados del logo: verde #006930, azul #00539E, petróleo #004465.
 */

@view-transition { navigation: auto; }

/* Fuentes variables alojadas en el sitio (licencia OFL), subconjunto latino */
@font-face { font-family: "Archivo"; src: url("../fonts/archivo-latin.woff2") format("woff2"); font-weight: 400 800; font-stretch: 75% 125%; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/ibm-plex-sans-latin.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }

:root {
  --green: #006930;
  --blue: #00539e;
  --petrol: #004465;
  --paper: #f2f6f4;
  --surface: #ffffff;
  --ink: #0b2330;
  --muted: #4b6270;
  --line: #d2ddd9;
  --tint: #e2efe7;
  --on-brand: #eef6f3;
  --on-brand-muted: #c3dbd7;
  --crit: #b3121b;

  --display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --max: 1200px;
  --r: 8px;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --green: #4cc27a;
    --blue: #74a9f0;
    --paper: #06161e;
    --surface: #0c2430;
    --ink: #e3eef0;
    --muted: #9db5bd;
    --line: #1d3d4a;
    --tint: #0f3328;
    --crit: #ff6b70;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.65 var(--body); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; text-wrap: balance; margin: 0; }
p, ul, ol, dl, figure, address { margin: 0; }
address { font-style: normal; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; border-radius: 2px; }

.wrap { max-width: var(--max); margin-inline: auto; padding-left: var(--gutter); padding-right: var(--gutter-r); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }

/* Botones y enlaces */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 15px var(--body); padding: 12px 22px; border-radius: var(--r); text-decoration: none; border: 1.5px solid transparent; cursor: pointer; }
.btn-primary { background: #006930 linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .28) 50%, transparent 65%) 120% 0 / 250% 100% no-repeat; color: #fff; transition: background-position .6s, transform .15s; }
.btn-primary:hover { background-position: -20% 0; transform: translateY(-1px); }
.more { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 15px; text-decoration: none; color: var(--green); }
.more svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; transition: transform .2s var(--ease); }
a:hover .more svg, .more:hover svg { transform: translateX(4px); }

/* Encabezado */
.site-head { position: sticky; top: 0; z-index: 40; background: color-mix(in oklab, var(--surface) 88%, transparent); backdrop-filter: blur(14px) saturate(1.4); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.head-row { display: flex; align-items: center; gap: 24px; padding-block: 10px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo img { height: 48px; width: auto; background: #fff; border-radius: 6px; padding: 2px 4px; }
.logo span { font: 700 17px/1.1 var(--display); font-stretch: 90%; }
.nav { margin-left: auto; }
.nav-list { list-style: none; padding: 0; display: flex; align-items: center; gap: 4px; }
.nav-list > li { position: relative; display: flex; align-items: center; }
.nav-list a { display: block; color: var(--ink); text-decoration: none; font-weight: 500; font-size: 15px; padding: 10px 12px; border-radius: 6px; }
.nav-list a:hover { background: var(--tint); }
.nav-list a[aria-current="page"] { color: var(--green); font-weight: 600; }
.nav-portal { border: 1.5px solid var(--blue); color: var(--blue) !important; margin-left: 8px; }
.sub-toggle { background: none; border: 0; padding: 6px; margin-left: -8px; cursor: pointer; color: var(--ink); border-radius: 6px; }
.sub-toggle svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; transition: transform .2s; }
.has-sub.is-open .sub-toggle svg { transform: rotate(180deg); }
.sub { list-style: none; margin: 0; padding: 8px; position: absolute; top: 100%; left: 0; min-width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 20px 40px -20px rgba(0, 30, 45, .4); opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .18s, transform .18s var(--ease), visibility .18s; }
.has-sub:hover .sub, .has-sub:focus-within .sub, .has-sub.is-open .sub { opacity: 1; visibility: visible; transform: none; }
.sub a { padding: 9px 12px; }
.menu-toggle { display: none; margin-left: auto; font: 600 14px var(--body); background: transparent; color: var(--ink); border: 1.5px solid var(--line); border-radius: var(--r); padding: 10px 14px; cursor: pointer; }

/* Carrusel de la portada */
.slider { position: relative; background: var(--petrol); color: #fff; min-height: clamp(460px, 62vw, 640px); overflow: hidden; display: grid; }
.slide { grid-area: 1 / 1; position: relative; display: flex; align-items: center; opacity: 0; visibility: hidden; transition: opacity .9s var(--ease), visibility .9s; }
.slide.is-active { opacity: 1; visibility: visible; }
.slide-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.slide::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0, 40, 60, .82) 0%, rgba(0, 40, 60, .55) 45%, rgba(0, 40, 60, 0) 80%); }
.slide-body { position: relative; z-index: 1; width: 100%; padding-block: 64px 120px; }
.slide-title { font-size: clamp(36px, 5.4vw, 68px); font-weight: 800; font-stretch: 84%; max-width: 14ch; margin-bottom: 18px; }
.slide-body p { font-size: 18px; max-width: 52ch; color: #e6f0ef; margin-bottom: 28px; }
.slider-tabs { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding-bottom: 28px; }
.slider-tabs button { all: unset; cursor: pointer; display: grid; gap: 10px; font: 600 14px var(--body); color: rgba(255, 255, 255, .7); }
.slider-tabs button[aria-selected="true"] { color: #fff; }
.slider-tabs button:focus-visible { outline: 3px solid #8fe0ad; outline-offset: 4px; }
.tab-bar { display: block; height: 3px; background: rgba(255, 255, 255, .28); border-radius: 2px; overflow: hidden; }
.tab-bar span { display: block; height: 100%; width: 0; background: #8fe0ad; }
.slider-tabs button[aria-selected="true"] .tab-bar span { width: 100%; }

/* Secciones */
.block { padding-block: 88px; }
.sec-head { display: grid; grid-template-columns: 1fr 1.2fr; gap: 32px; align-items: end; margin-bottom: 36px; }
.sec-head h2 { font-size: clamp(28px, 3.4vw, 42px); font-weight: 760; font-stretch: 88%; }
.sec-head h2 span { color: var(--green); display: block; }
.sec-head p { color: var(--muted); }

/* Tres destacados */
.highlights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; transition: transform .3s var(--ease), box-shadow .3s; }
.card:hover { transform: translateY(-6px); box-shadow: 0 24px 50px -28px rgba(0, 40, 60, .55); }
.card-img { position: relative; overflow: hidden; aspect-ratio: 16 / 9; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.card:hover .card-img img { transform: scale(1.06); }
.card-img figcaption { position: absolute; left: 14px; bottom: 14px; background: var(--petrol); color: #fff; font: 700 13px var(--display); letter-spacing: .08em; text-transform: uppercase; padding: 6px 10px; border-radius: 4px; }
.card-body { padding: 24px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.card-body h2 { font-size: 22px; font-weight: 720; font-stretch: 92%; }
.card-body p { color: var(--muted); font-size: 15px; }
.card-body .more { margin-top: auto; }

/* Q H S E */
.qhse-band { background: var(--surface); border-block: 1px solid var(--line); }
.qhse-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; padding-block: 64px; }
.qhse-item { display: grid; gap: 10px; justify-items: start; align-content: start; }
.qhse-item img { width: 64px; height: 64px; transition: transform .4s var(--ease); }
.qhse-item:hover img { transform: translateY(-4px) rotate(-6deg); }
.qhse-item h2 { font-size: 22px; font-weight: 720; }
.qhse-item p { color: var(--muted); font-size: 15px; }

/* Juegos */
.games { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.game { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; transition: transform .3s var(--ease), box-shadow .3s; }
a.game:hover { transform: translateY(-6px); box-shadow: 0 24px 50px -28px rgba(0, 40, 60, .55); }
.game img { aspect-ratio: 1; object-fit: cover; width: 100%; }
.game-body { padding: 20px 22px 24px; display: grid; gap: 6px; }
.game-body strong { font: 720 21px var(--display); font-stretch: 92%; }
.game-body > span:not(.more) { color: var(--muted); font-size: 15px; }

/* Cabecera de páginas internas */
.page-head { position: relative; background: var(--petrol); color: var(--on-brand); padding-block: 56px; overflow: hidden; }
.page-head.has-img { padding-block: 96px 72px; }
.page-head-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.page-head.has-img::after { content: ""; position: absolute; inset: 0; background: rgba(0, 50, 75, .55); }
.page-head .wrap { position: relative; z-index: 1; }
.page-head h1 { font-size: clamp(34px, 5vw, 58px); font-weight: 800; font-stretch: 84%; margin-top: 10px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--on-brand-muted); }
.crumbs a { color: var(--on-brand-muted); text-decoration: none; }
.crumbs a:hover { color: #fff; text-decoration: underline; }

/* Páginas de servicio y nosotros */
.detail { display: grid; gap: 32px; }
.detail-intro { display: grid; gap: 16px; max-width: 78ch; font-size: 17px; }
.lead-in { font-weight: 600; }
.groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 26px; }
.panel h2 { font-size: 21px; font-weight: 720; margin-bottom: 14px; }
.panel h3 { font: 600 16px var(--body); margin: 16px 0 8px; }
.panel p { color: var(--muted); }
.ticks { list-style: none; padding: 0; display: grid; gap: 8px; font-size: 15.5px; }
.ticks li { padding-left: 22px; position: relative; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 8px; height: 8px; border: 2px solid var(--green); transform: rotate(45deg); }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.gallery img { width: 100%; border-radius: 12px; aspect-ratio: 5 / 3; object-fit: cover; }
.about-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.about-grid .panel p { color: var(--ink); }
.games-detail .game { color: var(--ink); }

/* Índice de servicios */
.service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.service-card { position: relative; border-radius: 14px; overflow: hidden; color: #fff; text-decoration: none; min-height: 200px; display: flex; align-items: flex-end; }
.service-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.service-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0, 40, 60, .85), rgba(0, 40, 60, .15)); }
.service-card:hover img { transform: scale(1.06); }
.service-card-body { position: relative; z-index: 1; padding: 22px; display: grid; gap: 6px; }
.service-card strong { font: 720 24px var(--display); font-stretch: 90%; }
.service-card .more { color: #8fe0ad; }

/* Clientes */
.logos { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.logos li { background: #fff; border: 1px solid var(--line); border-radius: 12px; height: 120px; display: grid; place-items: center; padding: 18px; transition: transform .3s var(--ease), box-shadow .3s; }
.logos li:hover { transform: translateY(-4px); box-shadow: 0 18px 40px -24px rgba(0, 40, 60, .5); }
.logos img { max-height: 76px; width: auto; object-fit: contain; filter: grayscale(1); opacity: .8; transition: filter .3s, opacity .3s; }
.logos li:hover img { filter: none; opacity: 1; }

/* Contacto */
.contact-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 40px; align-items: start; }
.lead-form { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.lead-form h2 { font-size: 24px; }
.full { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field label { font-size: 14px; font-weight: 600; }
.field input, .field textarea { font: 15px var(--body); padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); width: 100%; }
.field textarea { min-height: 140px; resize: vertical; }
.field [aria-invalid="true"] { border-color: var(--crit); }
.field-error { color: var(--crit); font-size: 13.5px; }
.check { grid-template-columns: auto 1fr; align-items: start; column-gap: 10px; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--green); }
.check label { font-weight: 400; color: var(--muted); }
.check .field-error { grid-column: 2; }
.lead-form .btn { justify-self: start; }
.form-ok { background: var(--tint); border-radius: 10px; padding: 14px 16px; font-weight: 600; }
.form-alert { color: var(--crit); font-weight: 600; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-info { display: grid; gap: 14px; border-left: 3px solid var(--green); padding-left: 20px; }

/* Pie */
.site-foot { background: #04202d; color: #cfe0e2; font-size: 15px; padding-bottom: env(safe-area-inset-bottom, 0px); }
.foot-grid { display: grid; grid-template-columns: 1fr 1.2fr 1.4fr 1.2fr; gap: 32px; padding-block: 48px 32px; align-items: start; }
.foot-logo { background: #fff; border-radius: 8px; padding: 6px; width: 96px; height: auto; margin-bottom: 10px; }
.foot-brand { font: 700 18px var(--display); }
.site-foot a { color: #cfe0e2; }
.social { display: flex; gap: 14px; margin-top: 12px; }
.foot-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 18px 28px; border-top: 1px solid #16394a; font-size: 13px; color: #9fb8bd; }

/*
 * Movimiento: CSS nativo y mejora progresiva. Sin soporte o con
 * "reducir movimiento", el contenido aparece quieto y completo.
 */

/* Carrusel: zoom lento (Ken Burns) como el original y entrada del texto */
.slide.is-active .slide-img { animation: kenburns 16s ease-out both; }
@keyframes kenburns { from { transform: scale(1.14) translateX(1.5%); } to { transform: scale(1); } }
.slide.is-active .slide-title { animation: enter .8s var(--ease) .15s backwards; }
.slide.is-active .slide-body p { animation: enter .8s var(--ease) .3s backwards; }
.slide.is-active .slide-body .btn { animation: enter .8s var(--ease) .45s backwards; }
@keyframes enter { from { opacity: 0; transform: translateY(18px); } }
.is-ticking .slider-tabs button[aria-selected="true"] .tab-bar span { animation: progress var(--slide-ms, 8000ms) linear both; }
@keyframes progress { from { width: 0; } to { width: 100%; } }

/* Cabeceras internas */
.page-head h1 { animation: lift .7s var(--ease) backwards; } /* sin fundido: el título es el LCP */
@keyframes lift { from { transform: translateY(14px); } }
.page-head .crumbs { animation: enter .6s var(--ease) backwards; }
.page-head-img { animation: kenburns 14s ease-out both; }

/* Animaciones ligadas al scroll */
@supports (animation-timeline: view()) {
  .reveal { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 40%; }
  @keyframes rise { from { opacity: .3; transform: translateY(28px); } to { opacity: 1; transform: none; } }
  .qhse-item:nth-child(2), .highlights .card:nth-child(2), .games > :nth-child(2) { animation-range: entry 8% entry 48%; }
  .qhse-item:nth-child(3), .highlights .card:nth-child(3), .games > :nth-child(3) { animation-range: entry 16% entry 56%; }
  .qhse-item:nth-child(4) { animation-range: entry 24% entry 64%; }
}

/* El encabezado se compacta al bajar */
@supports (animation-timeline: scroll()) {
  .site-head { animation: head-shadow linear both; animation-timeline: scroll(); animation-range: 0 140px; }
  .head-row { animation: head-tight linear both; animation-timeline: scroll(); animation-range: 0 140px; }
  .logo img { animation: logo-small linear both; animation-timeline: scroll(); animation-range: 0 140px; }
  @keyframes head-shadow { to { box-shadow: 0 10px 30px -18px rgba(0, 30, 45, .5); } }
  @keyframes head-tight { to { padding-block: 4px; } }
  @keyframes logo-small { to { height: 38px; } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  @view-transition { navigation: none; }
}

/* Responsive */
@media (max-width: 1020px) {
  .menu-toggle { display: inline-block; }
  .js .nav { display: none; }
  .nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px var(--gutter-r) 16px var(--gutter); max-height: calc(100dvh - 70px); overflow-y: auto; }
  .js .nav.is-open { display: block; }
  .nav-list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav-list > li { flex-wrap: wrap; border-bottom: 1px solid var(--line); }
  .nav-list > li > a { flex: 1; padding-block: 14px; }
  .sub { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; padding: 0 0 8px 12px; width: 100%; display: none; }
  .has-sub.is-open .sub { display: block; }
  .has-sub:hover .sub, .has-sub:focus-within .sub { display: none; }
  .has-sub.is-open:hover .sub, .has-sub.is-open:focus-within .sub { display: block; }
  .sub-toggle { padding: 12px; }
  .nav-portal { margin: 12px 0 0; text-align: center; }
  .highlights, .games, .about-grid { grid-template-columns: 1fr; }
  .qhse-grid { grid-template-columns: 1fr 1fr; }
  .sec-head, .contact-grid { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .block { padding-block: 64px; }
  .slide-body { padding-block: 48px 132px; }
  .slider-tabs { gap: 10px; font-size: 12px; }
  .slider-tabs button { font-size: 12px; }
  .qhse-grid, .foot-grid, .lead-form { grid-template-columns: 1fr; }
}
