/* ==========================================================================
   Attomos Academy — mismo sistema visual que Attomos Finance (iOS 27, blanco)
   ========================================================================== */

:root {
  --accent: #06b6d4;
  --accent-strong: #0891b2;
  --accent-soft: rgba(6, 182, 212, 0.10);
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.12);
  --bg: #ffffff;

  --glass-bg: rgba(255, 255, 255, 0.62);
  --glass-border: rgba(255, 255, 255, 0.85);
  --glass-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(15, 23, 42, 0.04),
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 10px 30px rgba(15, 23, 42, 0.08);

  --radius-lg: 24px;
  --radius-md: 16px;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;

  --p: 0; /* progreso de colapso del título (0 → 1), lo controla JS */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 520px;
  background:
    radial-gradient(600px 260px at 12% -40px, rgba(6, 182, 212, 0.14), transparent 70%),
    radial-gradient(520px 240px at 92% 0, rgba(56, 189, 248, 0.10), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

.page {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) 24px 72px;
}

.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

[hidden] { display: none !important; }

/* --------------------------------------------------------------------------
   Barra compacta + título grande que colapsa
   -------------------------------------------------------------------------- */

.compact-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  height: calc(52px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, calc(var(--p) * 0.72));
  -webkit-backdrop-filter: blur(calc(var(--p) * 22px)) saturate(calc(100% + var(--p) * 80%));
  backdrop-filter: blur(calc(var(--p) * 22px)) saturate(calc(100% + var(--p) * 80%));
  border-bottom: 0.5px solid rgba(15, 23, 42, calc(var(--p) * 0.10));
  pointer-events: none;
}

.compact-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  opacity: clamp(0, calc((var(--p) - 0.55) * 2.4), 1);
  transform: translateY(calc((1 - var(--p)) * 8px));
}

.compact-back {
  position: absolute;
  left: 12px;
  bottom: 9px;
  border: 0;
  background: none;
  color: var(--accent-strong);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
  opacity: clamp(0, calc((var(--p) - 0.4) * 2), 1);
}

.compact-back span { font-size: 24px; line-height: 0; margin-right: 2px; position: relative; top: 2px; }

.hero { padding: 8px 0 28px; }

.eyebrow {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent-strong);
  opacity: calc(1 - var(--p) * 1.6);
}

.large-title {
  margin: 0;
  font-size: clamp(34px, 6vw, 52px);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.035em;
  transform-origin: left bottom;
  transform: translateY(calc(var(--p) * -6px)) scale(calc(1 - var(--p) * 0.12));
  opacity: calc(1 - var(--p) * 1.25);
  will-change: transform, opacity;
}

.large-title span {
  background: linear-gradient(100deg, var(--accent-strong), var(--accent) 55%, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  max-width: 620px;
  margin: 12px 0 0;
  font-size: 17px;
  color: var(--ink-2);
}

/* --------------------------------------------------------------------------
   Vista 1: cursos
   -------------------------------------------------------------------------- */

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.course-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 12px 32px rgba(15, 23, 42, 0.06);
  transition: transform 0.5s var(--spring), box-shadow 0.3s var(--ease-out);
  animation: cardIn 0.55s var(--ease-out) both;
  -webkit-tap-highlight-color: transparent;
}

.course-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.04), 0 22px 44px rgba(15, 23, 42, 0.10);
}

.course-card:active { transform: scale(0.97); }

.course-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.course-media {
  position: relative;
  aspect-ratio: 16 / 10;
  padding: 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #f8fdff, #ecfbfe);
}

.course-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 0 0 1px var(--line-strong), 0 14px 30px rgba(15, 23, 42, 0.14);
}

/* Brillo sutil sobre la bandera */
.course-media::after {
  content: "";
  position: absolute;
  inset: 22px;
  border-radius: 14px;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.35) 0%, transparent 40%, transparent 60%, rgba(255, 255, 255, 0.18) 100%);
  pointer-events: none;
}

.course-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.course-body { padding: 16px 20px 20px; }

.course-name {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.course-native { margin: 2px 0 0; font-size: 14px; color: var(--muted); }

.course-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 650;
  color: var(--accent-strong);
}

.course-foot .arrow {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  font-size: 18px;
  transition: transform 0.45s var(--spring);
}

.course-card:hover .arrow { transform: translateX(3px); }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Vista 2: videos del curso
   -------------------------------------------------------------------------- */

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px 8px 12px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-strong);
  cursor: pointer;
  transition: transform 0.4s var(--spring);
  opacity: calc(1 - var(--p) * 1.5);
}

.back-btn span { font-size: 22px; line-height: 0; position: relative; top: 1px; }
.back-btn:active { transform: scale(0.95); }

.course-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 22px 0 28px;
}

.course-header-img {
  width: 96px;
  height: 64px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 0 0 1px var(--line-strong), 0 10px 24px rgba(15, 23, 42, 0.12);
  flex: none;
}

.course-title { font-size: clamp(32px, 5vw, 46px); }
.course-meta { margin: 6px 0 0; color: var(--muted); font-size: 15px; }

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

@media (min-width: 700px) {
  .video-card:has(.is-landscape) { grid-column: span 2; }
}

.video-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 12px 32px rgba(15, 23, 42, 0.06);
  animation: cardIn 0.55s var(--ease-out) both;
}

.video-frame {
  position: relative;
  aspect-ratio: 9 / 16;
  max-height: 640px;
  background: #0f172a;
}

.video-frame.is-landscape { aspect-ratio: 16 / 9; }

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-body { padding: 14px 16px 16px; }

.video-num {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.video-title {
  margin: 4px 0 2px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.video-author { margin: 0; font-size: 13px; color: var(--muted); }

.video-actions { display: flex; gap: 8px; margin-top: 14px; }

.btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.35s var(--spring), background 0.2s, border-color 0.2s;
}

.btn:active { transform: scale(0.95); }

.btn-primary {
  background: linear-gradient(180deg, #22c3dd, var(--accent-strong));
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 4px 14px rgba(6, 182, 212, 0.3);
}

.btn-secondary { background: #fff; border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover { border-color: var(--accent); }

.btn svg { width: 16px; height: 16px; flex: none; }

.empty-state {
  grid-column: 1 / -1;
  padding: 56px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
}

/* Transición entre vistas (View Transitions API, si el navegador la soporta) */
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 0.35s; animation-timing-function: var(--ease-out); }

@media (max-width: 560px) {
  .page { padding-left: 16px; padding-right: 16px; }
  .course-grid { grid-template-columns: 1fr; }
  .video-grid { grid-template-columns: 1fr; }
  .course-header { gap: 14px; }
  .course-header-img { width: 72px; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
/* ==========================================================================
   Navbar y footer de Attomos (micronicho dentro del sitio)
   La barra compacta propia queda oculta: el navbar flotante ocupa la parte
   de arriba y el título grande sigue colapsando al hacer scroll.
   ========================================================================== */
.niche-page .compact-bar { display: none !important; }

.niche-page .page {
  padding-top: calc(118px + env(safe-area-inset-top));
}

.niche-page .footer {
  position: relative;
  z-index: 1;
  margin-top: 24px;
}

/* El navbar trae su propia tipografía; que no la herede de esta página */
.niche-page .navbar,
.niche-page .nav-more-menu {
  line-height: normal;
}

@media (max-width: 768px) {
  .niche-page .page {
    padding-top: calc(96px + env(safe-area-inset-top));
  }
}

/* ==========================================================================
   iOS 27 — contenedores redondeados sin borde y animaciones de resorte
   ========================================================================== */
:root {
  --ios-spring: linear(0, 0.04, 0.139, 0.271, 0.416, 0.56, 0.691, 0.805, 0.897, 0.969, 1.021, 1.055, 1.074, 1.082, 1.081, 1.075, 1.065, 1.053, 1.041, 1.03, 1.02, 1.011, 1.005, 1, 0.996, 0.994, 0.993, 0.993, 0.994, 0.994, 0.995, 0.996, 0.997, 0.998, 0.999, 0.999, 1, 1, 1, 1.001, 1.001, 1.001, 1.001, 1, 1, 1, 1, 1, 1);
  --radius-lg: 32px;
  --card-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 20px 46px -26px rgba(15, 23, 42, 0.22);
  --card-shadow-hover: 0 2px 4px rgba(15, 23, 42, 0.04), 0 30px 56px -26px rgba(6, 182, 212, 0.38);
}
@supports not (animation-timing-function: linear(0, 1)) {
  :root { --ios-spring: cubic-bezier(0.34, 1.35, 0.64, 1); }
}

@keyframes iosRise { from { opacity: 0; transform: translateY(24px) scale(0.965); filter: blur(8px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes iosPop { 0% { transform: scale(0.85); } 55% { transform: scale(1.06); } 100% { transform: scale(1); } }

.niche-page .hero > * { animation: iosRise 0.8s var(--ios-spring) backwards; }
.niche-page .hero > *:nth-child(2) { animation-delay: 0.05s; }
.niche-page .hero > *:nth-child(3) { animation-delay: 0.1s; }
.niche-page .hero > *:nth-child(4) { animation-delay: 0.15s; }

.niche-page .chip,
.niche-page .btn,
.niche-page .back-btn {
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.3s ease, transform 0.45s var(--ios-spring);
}
.niche-page .chip:active,
.niche-page .btn:active,
.niche-page .back-btn:active { transform: scale(0.92, 0.86); }
.niche-page .chip.is-active { animation: iosPop 0.45s var(--ios-spring); }

/* Tarjetas de curso y de video: sin borde, esquinas amplias, se inclinan y rebotan */
.course-grid { perspective: 1000px; }
.course-card {
  border: 0;
  border-radius: 32px;
  box-shadow: var(--card-shadow);
  animation: iosRise 0.8s var(--ios-spring) backwards;
  --rx: 0deg; --ry: 0deg;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.6s var(--ios-spring), box-shadow 0.3s ease;
}
.course-card.is-tilting { transition: transform 0.12s linear, box-shadow 0.3s ease; }
.course-card:hover { transform: rotateX(var(--rx)) rotateY(var(--ry)) translateY(-6px); box-shadow: var(--card-shadow-hover); }
.course-card:active { transform: scale(0.96); }
.course-media { margin: 10px 10px 0; border-radius: 24px; overflow: hidden; }
.course-media img { border-radius: 18px; transition: transform 0.7s var(--ios-spring); }
.course-media::after { border-radius: 18px; }
.course-card:hover .course-media img { transform: scale(1.05) rotate(-1.5deg); }
.course-badge { animation: iosPop 0.6s var(--ios-spring) 0.25s backwards; }
.course-foot .arrow { transition: transform 0.45s var(--ios-spring), background 0.2s ease, color 0.2s ease; }
.course-card:hover .arrow { transform: translateX(4px) scale(1.1); background: var(--accent); color: #fff; }

.back-btn { border: 0; }
.course-header { animation: iosRise 0.7s var(--ios-spring) backwards; }
.course-header-img { border-radius: 50%; width: 76px; height: 76px; animation: iosPop 0.7s var(--ios-spring) 0.1s backwards; }

.video-card {
  border: 0;
  border-radius: 32px;
  box-shadow: var(--card-shadow);
  animation: iosRise 0.8s var(--ios-spring) backwards;
  transition: box-shadow 0.3s ease, transform 0.6s var(--ios-spring);
}
.video-card:hover { transform: translateY(-4px); box-shadow: var(--card-shadow-hover); }
.video-frame { margin: 10px 10px 0; border-radius: 24px; overflow: hidden; }
.empty-state { border: 0; border-radius: 32px; background: #fff; box-shadow: var(--card-shadow); }

@media (prefers-reduced-motion: reduce) {
  .course-card, .video-card, .course-header, .course-header-img, .course-badge, .niche-page .hero > * { animation: none !important; }
}

/* Botones "Cursos" y "Ver en YouTube / TikTok": cápsulas iOS con resorte */
.back-btn,
.video-actions .btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.3s ease, transform 0.5s var(--ios-spring);
}
.back-btn {
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 20px -12px rgba(15, 23, 42, 0.35);
  animation: iosRise 0.6s var(--ios-spring) backwards;
}
.back-btn span { display: inline-block; transition: transform 0.5s var(--ios-spring); }
.back-btn:hover { transform: translateY(-2px); background: #fff; box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05), 0 14px 26px -12px rgba(6, 182, 212, 0.5); }
.back-btn:hover span { transform: translateX(-5px); }
.back-btn:active { transform: scale(0.92, 0.86); }

.video-actions .btn-secondary {
  border: 0;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08), 0 8px 18px -12px rgba(15, 23, 42, 0.35);
}
.video-actions .btn-secondary:hover {
  transform: translateY(-2px);
  color: #0891b2;
  box-shadow: 0 0 0 1.5px rgba(6, 182, 212, 0.55), 0 14px 26px -12px rgba(6, 182, 212, 0.5);
}
.video-actions .btn-secondary:active { transform: scale(0.93, 0.87); }
.video-actions .btn svg { transition: transform 0.5s var(--ios-spring); }
.video-actions .btn:hover svg { transform: translate(2px, -2px) scale(1.12); }

/* Brillo que cruza el botón al pasar el cursor */
.back-btn::after,
.video-actions .btn::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 -60%;
  width: 45%;
  z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(6, 182, 212, 0.16), transparent);
  transform: skewX(-16deg);
  transition: left 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.back-btn:hover::after,
.video-actions .btn:hover::after { left: 120%; }

/* Ondita al tocar (la agrega academy.js) */
.ios-ripple {
  position: absolute;
  z-index: -1;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.28);
  pointer-events: none;
  animation: iosRipple 0.6s ease-out forwards;
}
@keyframes iosRipple { from { transform: scale(0); opacity: 1; } to { transform: scale(22); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .back-btn, .ios-ripple { animation: none !important; }
  .back-btn::after, .video-actions .btn::after { display: none; }
}