/* Reloj Portable FO - CSS optimizado para integración */
:root{
  --fo-size: 575px;
  --fo-page-bg: transparent;
  --fo-face-bg: #ffffff;
  --fo-tick: #111318;
  --fo-numbers: #111318;
  --fo-hour: #7a7a7a;   /* verde compatible con thooClock */
  --fo-minute: #e74c3c; /* rojo compatible con thooClock */
  --fo-second: #F3A829; /* ámbar compatible con thooClock */
  --fo-center: #F3A829;
  --fo-show-seconds: 1;
  --fo-show-numbers: 1;
  --fo-shadow: 1;
  --fo-face-opacity: 1;
  --fo-shadow-strength: 0.8;
}

/* Contenedor principal portable - se adapta al espacio disponible */
.fo-clock-portable {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 250px;
}

/* Clock container */
.fo-portable-clock {
  width: var(--fo-size);
  height: var(--fo-size);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  perspective: 1200px;
  max-width: 100%;
  max-height: 100%;
}

/* Card con flip animation */
.fo-portable-card { 
  position: relative; 
  width: var(--fo-size); 
  height: var(--fo-size); 
  aspect-ratio: 1 / 1; 
  transform-style: preserve-3d; 
  transition: transform .6s ease;
  max-width: 100%;
  max-height: 100%;
}

.fo-portable-card.fo-flipped { 
  transform: rotateY(180deg); 
}

/* Caras del reloj */
.fo-portable-face, .fo-portable-digital-face { 
  position: absolute; 
  inset: 0; 
  backface-visibility: hidden; 
  border-radius: 50%; 
  overflow: hidden; 
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset, 
              0 8px 30px rgba(0,0,0, calc(.15 * var(--fo-shadow) * var(--fo-shadow-strength))); 
}

.fo-portable-face::before, .fo-portable-digital-face::before { 
  content: ""; 
  position: absolute; 
  inset: 0; 
  border-radius: 50%; 
  background: var(--fo-face-bg); 
  opacity: var(--fo-face-opacity); 
  pointer-events: none;
}

.fo-portable-digital-face.fo-digital-back { 
  display: flex; 
  flex-direction: column; 
  justify-content: center; 
  align-items: center; 
  transform: rotateY(180deg); 
  width: 100%; 
  height: 100%; 
  padding: 20px; 
}

/* Centro del reloj */
.fo-portable-center {
  position: absolute; 
  inset: 0; 
  margin: auto;
  width: 18px; 
  height: 18px; 
  border-radius: 50%;
  background: var(--fo-center);
  box-shadow: 0 0 0 6px rgba(240,170,42,.15);
  z-index: 10;
}

/* Marcas del reloj */
.fo-portable-ticks, .fo-portable-numbers {
  position: absolute; 
  inset: 0;
}

.fo-portable-ticks div {
  position: absolute; 
  left: 50%; 
  top: 10px; 
  translate: -50% 0;
  width: 4px; 
  height: 16px; 
  background: var(--fo-tick);
  border-radius: 2px;
  transform-origin: 50% calc(var(--fo-size)/2 - 10px);
}

.fo-portable-ticks div.fo-major {
  height: 26px; 
  width: 8px; 
  border-radius: 4px;
}

/* Números */
.fo-portable-numbers span {
  position: absolute; 
  left: 50%; 
  top: 50%;
  translate: -50% -50%;
  font-weight: 600; 
  font-size: clamp(18px, calc(var(--fo-size)/18), 28px);
  color: var(--fo-numbers);
  opacity: calc(.999 * var(--fo-show-numbers));
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Agujas del reloj */
.fo-portable-hand { 
  position: absolute; 
  left: 50%; 
  top: 50%; 
  translate: -50% -100%; 
  transform-origin: 50% 100%;
  z-index: 5;
}

.fo-portable-hand.fo-hour { 
  width: 16px; 
  height: 34%; 
  background: var(--fo-hour); 
  border-radius: 10px; 
}

.fo-portable-hand.fo-minute { 
  width: 12px; 
  height: 44%; 
  background: var(--fo-minute); 
  border-radius: 10px; 
}

.fo-portable-hand.fo-second { 
  width: 3px; 
  height: 46%; 
  background: var(--fo-second); 
  border-radius: 2px; 
  opacity: var(--fo-show-seconds);
}

.fo-portable-hand::after { 
  content: ""; 
  position: absolute; 
  bottom: -10px; 
  left: 50%; 
  translate: -50% 0; 
  width: 60%; 
  height: 10px; 
  border-radius: 8px; 
  background: inherit; 
  opacity: .9;
}

/* Aro y brillo */
.fo-portable-face::after, .fo-portable-digital-face::after { 
  content: ""; 
  position: absolute; 
  inset: 18px; 
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0,0,0,.06) inset,
              0 0 0 10px rgba(255,255,255, calc(.7*var(--fo-shadow) * var(--fo-shadow-strength))) inset;
}

/* Branding y fecha */
.fo-portable-label-wrap { 
  position: absolute; 
  left: 50%; 
  top: 62%; 
  translate: -50% 0; 
  text-align: center;
}

.fo-portable-brand { 
  font-weight: 600; 
  color: var(--fo-numbers); 
  font-size: clamp(12px, calc(var(--fo-size)/28), 16px);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.fo-portable-date-front { 
  color: var(--fo-numbers); 
  opacity: .65; 
  font-size: clamp(10px, calc(var(--fo-size)/38), 13px); 
  margin-top: 2px;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Reloj digital (cara trasera) */
.fo-portable-digital-back-wrap { 
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  width: 100%;
  height: 100%;
  padding: 20px;
}

.fo-portable-brand-big { 
  font-weight: 700; 
  color: var(--fo-numbers); 
  font-size: clamp(14px, calc(var(--fo-size)/22), 22px); 
  margin-bottom: 4px;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.fo-portable-digital-big { 
  font-weight: 700; 
  font-feature-settings: "tnum" 1; 
  font-variant-numeric: tabular-nums; 
  font-size: clamp(28px, calc(var(--fo-size)/6), 80px); 
  color: var(--fo-numbers);
  line-height: 1.2;
  margin: 10px 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.fo-portable-tz-big, .fo-portable-date-big { 
  color: var(--fo-numbers); 
  opacity: .65; 
  font-size: clamp(14px, calc(var(--fo-size)/24), 24px);
  line-height: 1.4;
  margin: 5px 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .fo-clock-portable {
    min-height: 200px;
  }
  
  :root {
    --fo-size: 575px;
  }
}

@media (max-width: 480px) {
  .fo-clock-portable {
    min-height: 180px;
  }
  
  :root {
    --fo-size: 320px;
  }
}

/* Auto-size cuando el contenedor lo requiera */
.fo-clock-portable[data-auto-size="1"] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.fo-clock-portable[data-auto-size="1"] .fo-portable-clock,
.fo-clock-portable[data-auto-size="1"] .fo-portable-card {
  width: var(--fo-size);
  height: var(--fo-size);
  max-width: 100%;
  max-height: 100%;
}
