/* ================================================================= */
/*  Reloj Interactivo · Master Hub Training                          */
/*  Hoja de estilos principal                                        */
/* ================================================================= */


/* ----------------------------------------------------------------- */
/*  Variables de identidad visual                                    */
/* ----------------------------------------------------------------- */
:root {
  --color-primary:   #0B1F3A;  /* azul marino corporativo */
  --color-secondary: #00AEEF;  /* azul cielo (acento principal) */
  --color-accent:    #F5A623;  /* naranja (acento secundario) */
  --color-light:     #F7F9FC;  /* fondo claro */
  --color-dark:      #111827;  /* texto oscuro */
  --color-success:   #22C55E;  /* verde de confirmación */

  /* Derivados de apoyo */
  --color-muted:     #6B7280;
  --color-border:    #E2E8F0;
  --color-surface:   #FFFFFF;

  /* Bordes y sombras suaves */
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-soft: 0 10px 30px rgba(11, 31, 58, 0.10);
  --shadow-card: 0 4px 16px rgba(11, 31, 58, 0.08);

  /* Tipografía: usa las fuentes de marca si están instaladas,
     con alternativas seguras del sistema. */
  /* --font-base: "Avenir", "Futura", "Gotham", "Segoe UI", system-ui, -apple-system, sans-serif; */
  --font-base: 'Poppins', sans-serif;
}

/* ----------------------------------------------------------------- */
/*  Reset básico                                                     */
/* ----------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font-base);
  color: var(--color-dark);
  background: #FFFFFF;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

/* ----------------------------------------------------------------- */
/*  Encabezado                                                       */
/* ----------------------------------------------------------------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.75rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
}

.brand {
    display: flex;
    align-items: center;
    height: 70px;
}

.brand__logo {
    height: 120px;
    width: auto;
    display: block;
    padding: 0 50px;
    transform: none;
}

/* Texto de respaldo cuando no hay logo (lo activa el onerror del <img>) */
.brand__fallback {
  display: none;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: var(--color-primary);
}
.brand__fallback::first-letter { color: var(--color-secondary); }

.app-header__title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-primary);
}

/* Botón "Volver al sitio" (encabezado del reloj y pantalla de inicio) */
.btn-back-site {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--color-primary);
  background: var(--color-light);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-back-site:hover {
  background: var(--color-primary);
  color: #FFFFFF;
  border-color: var(--color-primary);
}
.btn-back-site:focus-visible {
  outline: 3px solid rgba(0, 174, 239, 0.45);
  outline-offset: 2px;
}

/* ----------------------------------------------------------------- */
/*  Layout del dashboard                                             */
/* ----------------------------------------------------------------- */
.dashboard {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 1.75rem;
  align-items: start;
}

/* ----------------------------------------------------------------- */
/*  Panel del reloj                                                  */
/* ----------------------------------------------------------------- */
.clock-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.clock {
  width: 100%;
  max-width: 420px;
  height: auto;
  touch-action: none;          /* evita scroll al arrastrar en táctil */
  user-select: none;
}

/* Partes de la esfera */
.clock__bezel  { fill: var(--color-primary); }
.clock__face   { fill: #FFFFFF; }
.clock__ticks line.major { stroke: var(--color-primary); stroke-width: 3; }
.clock__ticks line.minor { stroke: var(--color-muted);   stroke-width: 1.5; }

.clock__numbers text {
  fill: var(--color-primary);
  font-family: var(--font-base);
  font-weight: 700;
  font-size: 26px;
  text-anchor: middle;
  dominant-baseline: central;
}

.clock__center      { fill: var(--color-primary); }
.clock__center-dot  { fill: var(--color-accent); }

/* Manecillas */
.hand { stroke-linecap: round; cursor: grab; }
.hand--hour   { stroke: var(--color-primary);   stroke-width: 9; }
.hand--minute { stroke: var(--color-secondary); stroke-width: 6; }
.hand.is-dragging { cursor: grabbing; }

/* ----------------------------------------------------------------- */
/*  Reloj digital                                                    */
/* ----------------------------------------------------------------- */
.digital {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  background: var(--color-primary);
  color: #FFFFFF;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.digital__time {
  font-variant-numeric: tabular-nums;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 1px;
}

.digital__meridiem {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-secondary);
  text-transform: uppercase;
}

/* ----------------------------------------------------------------- */
/*  Tarjetas de información (la hora escrita en inglés / francés)    */
/* ----------------------------------------------------------------- */
.info-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.2rem;
  border-radius: var(--radius-md);
  border: 1px dashed var(--color-border);
  background: var(--color-light);
}

.info-card__label { font-weight: 600; color: var(--color-muted); }
.info-card__value {
  font-size: 1.4rem;
  font-weight: 800;
}

/* Variante para idiomas: etiqueta arriba y la frase debajo (puede ser larga) */
.info-card--lang {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  text-align: left;
  cursor: pointer;          /* la caja es clickable (revela/oculta) */
  user-select: none;
}
.info-card--lang:hover { border-color: var(--color-secondary); }
.info-card--lang:focus-visible {
  outline: 3px solid rgba(0, 174, 239, 0.45);
  outline-offset: 2px;
}

/* Estado oculto: la frase aún no se revela (se ve el aviso "Toca para mostrar") */
.info-card--lang.is-hidden .info-card__value {
  color: var(--color-muted);
  font-weight: 600;
  font-size: 1.05rem;
}
.info-card--lang .info-card__label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.info-card--lang .info-card__value {
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: 700;
}

/* Colores por idioma */
.info-card--english { border-left: 4px solid var(--color-secondary); }
.info-card--english .info-card__value { color: var(--color-secondary); }
.info-card--french  { border-left: 4px solid var(--color-accent); }
.info-card--french  .info-card__value { color: var(--color-accent); }

/* ----------------------------------------------------------------- */
/*  Panel de controles                                               */
/* ----------------------------------------------------------------- */
.controls {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.controls__group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.controls__title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-muted);
}

.controls__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* ----------------------------------------------------------------- */
/*  Botones                                                          */
/* ----------------------------------------------------------------- */
.btn {
  flex: 1 1 auto;
  min-width: 110px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--color-light);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease,
              color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover   { border-color: var(--color-secondary); }
.btn:active  { transform: translateY(1px); }
.btn:focus-visible {
  outline: 3px solid rgba(0, 174, 239, 0.45);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--color-secondary);
  border-color: var(--color-secondary);
  color: #FFFFFF;
}
.btn--primary:hover { background: #0098cf; }

/* Estado activo (modos / toggles encendidos) */
.btn--toggle.is-active,
.btn.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #FFFFFF;
  box-shadow: inset 0 0 0 2px rgba(0, 174, 239, 0.5);
}

/* Resalte del botón de tiempo real cuando está activo */
.btn--primary.is-active {
  background: var(--color-success);
  border-color: var(--color-success);
  box-shadow: none;
}

/* ----------------------------------------------------------------- */
/*  Pie de página                                                    */
/* ----------------------------------------------------------------- */
.app-footer {
  text-align: center;
  padding: 1.25rem;
  color: var(--color-muted);
  font-size: 0.85rem;
}

/* ----------------------------------------------------------------- */
/*  Pantalla de inicio (selección de idioma)                         */
/* ----------------------------------------------------------------- */
.lang-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
/* Cuando se elige idioma, se oculta (el atributo hidden manda) */
.lang-screen[hidden] { display: none; }

.lang-screen__card {
  text-align: center;
  max-width: 460px;
  width: 100%;
}

.lang-screen__logo {
  width: min(320px, 80%);
  height: auto;
  display: block;
  margin: 0 auto 1.75rem;
}

/* Enlace de regreso al sitio (pantalla de inicio: debajo de los botones) */
.lang-screen__back {
  margin-top: 2rem;
}

.lang-screen__brand {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 1rem;
}

.lang-screen__title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
}

.lang-screen__subtitle {
  color: var(--color-muted);
  line-height: 1.4;
  margin-bottom: 1.75rem;
}
.lang-screen__subtitle span {
  font-size: 0.95rem;
  opacity: 0.85;
}

.lang-screen__buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.lang-screen__btn {
  flex: 1 1 150px;
  max-width: 200px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.9rem 1.5rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-primary);
  background: #FFFFFF;
  color: var(--color-primary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.lang-screen__btn:hover {
  background: var(--color-primary);
  color: #FFFFFF;
}
.lang-screen__btn:focus-visible {
  outline: 3px solid rgba(0, 174, 239, 0.45);
  outline-offset: 2px;
}

/* ----------------------------------------------------------------- */
/*  Responsive                                                       */
/* ----------------------------------------------------------------- */

/* Tablet y pantallas medianas: los controles pasan debajo del reloj.
   Hacemos el panel del reloj "sticky": se queda pegado en la parte
   superior mientras se desplazan los controles, para verlo siempre. */
@media (max-width: 900px) {
  .dashboard {
    grid-template-columns: 1fr;
  }
  .clock-panel {
    position: sticky;
    top: 0;
    z-index: 5;
    gap: 0.9rem;
  }
  .clock { max-width: 300px; }
}

/* Celular */
@media (max-width: 560px) {
  .app-header {
    padding: 0.85rem 1rem;
    justify-content: center;
    text-align: center;
  }
  .app-header__title { width: 100%; font-size: 1.15rem; }
  .dashboard { padding: 0.75rem; gap: 0.75rem; }
  .clock-panel {
    padding: 0.85rem;
    gap: 0.6rem;
    border-radius: var(--radius-md);
  }
  /* Reloj más pequeño para que el reloj + acciones quepan juntos */
  .clock { max-width: 240px; }
  .digital { padding: 0.4rem 1rem; }
  .digital__time { font-size: 1.7rem; }
  .info-card--lang .info-card__value { font-size: 1.1rem; }
  .controls { padding: 1.1rem; }
  .btn { min-width: 0; flex-basis: calc(50% - 0.3rem); }
}

/* Pantallas muy bajas (móvil en horizontal): reloj aún más compacto */
@media (max-height: 520px) and (max-width: 900px) {
  .clock { max-width: 200px; }
  .clock-panel { gap: 0.5rem; }
}

/* Respeta la preferencia de menos animación */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
