/*
 * Plataforma GG · Portal empresarial (Fase 1)
 * Hoja de estilos propia: sin frameworks, CDN ni fuentes externas.
 */

:root {
  --navy-900: #0A2540;
  --blue-700: #1742B8;
  --blue-600: #1D4ED8;
  --blue-500: #2563EB;
  --blue-100: #DBE7FF;
  --green-700: #15803D;
  --green-500: #22A559;
  --green-50: #EAF7EF;
  --white: #FFFFFF;

  --bg: #F4F7FB;
  --surface: #FFFFFF;
  --border: #DCE3EC;
  --border-strong: #C5D0DE;
  --divider: #EEF2F7;
  --text: #0F1B2D;
  --text-muted: #56657A;
  --soon-text: #475569;
  --soon-bg: #EEF2F7;
  --warning-bg: #FFF7E6;
  --warning-border: #F5C26B;
  --warning-text: #7A4B00;

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.06);
  --shadow: 0 1px 2px rgba(15, 27, 45, 0.05), 0 8px 24px rgba(15, 27, 45, 0.06);
  --shadow-hover: 0 2px 4px rgba(15, 27, 45, 0.08), 0 16px 40px rgba(29, 78, 216, 0.14);
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.45);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Liberation Sans",
    "Helvetica Neue", Arial, sans-serif;

  color-scheme: light;
}

/* ---------- Base ---------- */

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

a {
  color: var(--blue-600);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 32px);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  z-index: 10;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  color: var(--navy-900);
  background: var(--white);
  box-shadow: var(--shadow);
}

.skip-link:focus {
  top: 12px;
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ---------- Barra superior ---------- */

.topbar {
  color: var(--white);
  background: var(--navy-900);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.brand:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* El logo oficial es un JPEG con fondo blanco: se enmarca en una placa blanca
   para que no aparezca como un recorte sobre la barra azul. */
.brand__mark {
  display: grid;
  flex: none;
  place-items: center;
  padding: 3px 5px;
  border-radius: var(--radius-sm);
  background: var(--white);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Altura fija y ancho automático: conserva la proporción sin recortar. */
.brand__logo {
  width: auto;
  max-width: none;
  height: 52px;
  object-fit: contain;
}

.brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.brand__name {
  overflow: hidden;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.brand__product {
  font-size: 0.8125rem;
  color: #A9C1E8;
}

.env-badge {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid rgba(34, 165, 89, 0.45);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #D7F5E3;
  background: rgba(34, 165, 89, 0.16);
}

.env-badge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-500);
  box-shadow: 0 0 0 3px rgba(34, 165, 89, 0.25);
}

/* ---------- Portada ---------- */

.hero {
  position: relative;
  color: var(--white);
  /* Cuadrícula tipo plano técnico sobre degradado azul con acento verde */
  background:
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px) 0 0 / 32px 32px,
    radial-gradient(ellipse 60% 90% at 90% 0%, rgba(34, 165, 89, 0.38), transparent 70%),
    linear-gradient(135deg, var(--navy-900) 0%, #123C8F 55%, var(--blue-600) 100%);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 4px;
  background: linear-gradient(90deg, var(--blue-500), var(--green-500));
}

.hero__inner {
  display: grid;
  align-items: center;
  gap: 20px;
  padding-block: clamp(40px, 7vw, 72px) clamp(48px, 8vw, 84px);
}

/* Logo oficial con fondo transparente (derivado de assets/branding/logo-gg.jpg).
   En móvil va centrado encima del texto; desde 720 px ocupa la columna izquierda. */
.hero__media {
  display: flex;
  justify-content: center;
}

.hero__logo {
  width: clamp(96px, 28vw, 120px);
  height: auto;
}

.hero__content {
  min-width: 0;
}

.hero__eyebrow {
  margin-bottom: 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9FE3BC;
}

.hero__title {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero__lead {
  max-width: 40rem;
  margin-top: 14px;
  font-size: clamp(1rem, 1.6vw, 1.1875rem);
  color: #D6E2F5;
}

.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
}

.stat__value {
  font-size: 1.375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat__label {
  font-size: 0.875rem;
  color: #C9D7EE;
}

.stat--ok .stat__value {
  color: #7EE2A8;
}

/* ---------- Contenido ---------- */

.main {
  flex: 1;
  padding-block: clamp(32px, 5vw, 48px) 64px;
}

.main:focus {
  outline: none;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.section-head__title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-head__hint {
  margin-top: 4px;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.search {
  flex: 0 1 320px;
}

.search__input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 42px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2356657A' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E")
    no-repeat 14px 50% / 18px 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search__input::placeholder {
  color: #6B7A8F;
}

.search__input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: var(--focus-ring);
}

.notice {
  margin-bottom: 24px;
  padding: 12px 16px;
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  color: var(--warning-text);
  background: var(--warning-bg);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 20px;
}

/* ---------- Tarjetas ---------- */

.card {
  --accent: var(--blue-600);
  --accent-2: var(--blue-500);

  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.card--green {
  --accent: var(--green-700);
  --accent-2: var(--green-500);
}

.card--navy {
  --accent: var(--navy-900);
  --accent-2: var(--blue-600);
}

.card:not(.card--soon):hover {
  transform: translateY(-3px);
  border-color: var(--blue-100);
  box-shadow: var(--shadow-hover);
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.card__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 14px -6px var(--accent);
}

.card__icon img {
  width: 24px;
  height: 24px;
}

.card__category {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: right;
  text-transform: uppercase;
  color: var(--text-muted);
}

.card__title {
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card__description {
  flex: 1;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 55px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--divider);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status--ok {
  color: var(--green-700);
  background: var(--green-50);
}

.status--soon {
  color: var(--soon-text);
  background: var(--soon-bg);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.button--primary {
  color: var(--white);
  background: var(--blue-600);
}

.button--primary:hover {
  background: var(--blue-700);
}

.button--primary:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.button__arrow {
  transition: transform 0.15s ease;
}

.card:hover .button__arrow {
  transform: translateX(3px);
}

/* Tarjeta disponible: el enlace «Abrir» se extiende a toda la tarjeta, así
   cualquier punto es clicable sin añadir otro elemento enfocable. */
.card__link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card:has(.card__link:focus-visible) {
  border-color: var(--blue-500);
  box-shadow: var(--focus-ring), var(--shadow-hover);
}

.empty {
  padding: 40px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  color: var(--text-muted);
  background: var(--surface);
}

/* ---------- Pie de página ---------- */

.footer {
  font-size: 0.875rem;
  color: var(--text-muted);
  background: var(--white);
  border-top: 1px solid var(--border);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 20px;
}

.footer__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

/* ---------- Adaptación ---------- */

@media (min-width: 720px) {
  .hero__inner {
    grid-template-columns: clamp(180px, 25%, 240px) minmax(0, 1fr);
    column-gap: clamp(32px, 4vw, 56px);
    padding-block: clamp(28px, 3vw, 36px) clamp(36px, 3.5vw, 44px);
  }

  .hero__logo {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .topbar__inner {
    min-height: 64px;
  }

  .brand__logo {
    height: 44px;
  }

  .brand__product {
    display: none;
  }

  .search {
    flex-basis: 100%;
  }

  .card {
    padding: 20px;
  }
}

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

  .card:not(.card--soon):hover {
    transform: none;
  }
}
