/* cain-motion.css — shared motion, training video and API-key card.
   Loaded on the three homepages. Everything is opt-in via html.cain-motion,
   so the page is fully visible if JS is blocked. */

html.cain-motion .cain-reveal {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition: opacity .6s cubic-bezier(.2,.7,.2,1), transform .6s cubic-bezier(.2,.7,.2,1);
  transition-delay: var(--cain-d, 0ms);
}
html.cain-motion .cain-reveal.cain-in { opacity: 1; transform: none; }

.c42-card, .c42-benefit, .c42-premier-card {
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.c42-card:hover, .c42-premier-card:hover { transform: translateY(-3px); }

.c42-btn.primary { position: relative; overflow: hidden; }
.c42-btn.primary::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 20%, rgba(255,255,255,.20) 42%, transparent 64%);
  transform: translateX(-130%); animation: cain-shimmer 5s ease-in-out infinite;
}
@keyframes cain-shimmer {
  0%, 68% { transform: translateX(-130%); }
  86%, 100% { transform: translateX(130%); }
}

@keyframes cain-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.82); }
}
.cain-live-dot { animation: cain-pulse 2.2s ease-in-out infinite; }

/* ---------------------------------------------------------------- video */
.cain-video-shell { margin: 6px 0 0; }
.cain-video-frame {
  position: relative; border: 1px solid #1a2342; border-radius: 16px; overflow: hidden;
  background: #05080f; box-shadow: 0 28px 90px -46px rgba(34,211,238,.55);
}
.cain-video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: #05080f; }
.cain-video-chapters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cain-chapter {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: #0d1328; border: 1px solid #1a2342; color: #c3ccdf; border-radius: 9px;
  padding: 9px 13px; font: 700 12.5px/1 ui-monospace, Menlo, monospace;
}
.cain-chapter span { color: #7c86a6; font-weight: 600; }
.cain-chapter:hover { border-color: #2b3a63; color: #fff; }
.cain-chapter.is-active {
  background: linear-gradient(135deg, #0e7490, #22d3ee); color: #04121a; border-color: transparent;
}
.cain-chapter.is-active span { color: rgba(4,18,26,.7); }
.cain-video-note { color: #8b94ad; font-size: 12.5px; margin: 10px 0 0; }

/* ------------------------------------------------------------- key card */
.cain-key-card {
  margin-top: 16px; border: 1px solid #1a2342; border-radius: 14px; background: #070b13; padding: 16px 18px;
}
.cain-key-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; justify-content: space-between; }
.cain-key-head b { color: #eef1f8; font-size: 16px; }
.cain-key-head span { color: #7c86a6; font: 600 12px/1.4 ui-monospace, Menlo, monospace; }
.cain-key-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.cain-key-out { margin-top: 12px; font: 12.5px/1.6 ui-monospace, Menlo, monospace; color: #93a1bb; overflow-wrap: anywhere; }
.cain-key-out.ok { color: #3fb68b; }
.cain-key-out.warn { color: #e0b842; }
.cain-key-out.err { color: #ff7b8a; }
.cain-key-out code {
  display: inline-block; background: #05080f; border: 1px solid #1e293b; border-radius: 7px;
  padding: 6px 9px; color: #d7e3f4; margin: 4px 6px 4px 0;
}
.cain-key-copy {
  background: #111a2e; color: #cfe0f5; border: 1px solid #26324f; border-radius: 7px;
  padding: 6px 10px; font: 700 11.5px/1 ui-monospace, Menlo, monospace; cursor: pointer;
}

/* ------------------------------------------------- training animations */
.cain-train-anim { border: 1px solid #1a2342; border-radius: 14px; background: #070b13; padding: 16px 18px; }
.cain-train-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; }
@media (max-width: 900px) { .cain-train-grid { grid-template-columns: 1fr; } }
.cain-train-label { font: 700 10.5px/1.4 ui-monospace, Menlo, monospace; letter-spacing: .16em; text-transform: uppercase; color: #7c86a6; margin: 14px 0 8px; }
.cain-train-label:first-child { margin-top: 0; }
.cain-loop { display: flex; flex-wrap: wrap; gap: 6px; }
.cain-loop-s, .cain-flow-s {
  border: 1px solid #1a2342; border-radius: 7px; background: #0b1020; color: #7c86a6;
  padding: 6px 8px; font: 700 10.5px/1 ui-monospace, Menlo, monospace;
  animation: cain-stage 7s linear infinite; animation-delay: calc(var(--i) * .40s);
}
.cain-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cain-flow-s { color: #9aa4bb; font-size: 11px; animation-duration: 4.5s; animation-delay: calc(var(--i) * .8s); }
.cain-flow-arrow { color: #3a4664; font-style: normal; }
@keyframes cain-stage {
  0%, 100% { border-color: #1a2342; color: #7c86a6; background: #0b1020; box-shadow: none; }
  6% { border-color: #22d3ee; color: #e6eefb; background: #0b2130; box-shadow: 0 0 18px -6px #22d3ee; }
}

/* ------------------------------------------------- beginner sections */
.cain-paths { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0 0; }
@media (max-width: 800px) { .cain-paths { grid-template-columns: 1fr; } }
.cain-path { display: block; border: 1px solid #1a2342; border-radius: 12px; background: #0b0f16; padding: 14px 16px; text-decoration: none; color: #cfd6ea; transition: border-color .2s, transform .2s; }
.cain-path:hover, .cain-path:focus { border-color: #22d3ee; transform: translateY(-2px); }
.cain-path b { display: block; color: #22d3ee; font: 800 12px/1.2 ui-monospace, Menlo, monospace; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 4px; }
.cain-path span { color: #a3adc8; font-size: 13.5px; line-height: 1.5; }
.cain-objects { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 16px 0 0; }
@media (max-width: 1000px) { .cain-objects { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .cain-objects { grid-template-columns: 1fr; } }
.cain-object { border: 1px solid #1a2342; border-radius: 11px; background: #0b1020; padding: 13px; outline: none; transition: border-color .2s, background .2s; }
.cain-object:hover, .cain-object:focus { border-color: #22d3ee; background: #0b1626; }
.cain-object b { display: block; color: #eef1f8; font: 800 12.5px/1.3 ui-monospace, Menlo, monospace; margin-bottom: 5px; }
.cain-object span { display: block; color: #a3adc8; font-size: 13px; line-height: 1.5; }
.cain-object em { display: block; margin-top: 8px; color: #3fb68b; font-size: 12px; font-style: normal; line-height: 1.45; opacity: 0; max-height: 0; overflow: hidden; transition: opacity .2s, max-height .2s; }
.cain-object:hover em, .cain-object:focus em { opacity: 1; max-height: 90px; }
.cain-steps { margin: 16px 0 0; padding-left: 22px; color: #cfd6ea; }
.cain-steps li { margin: 12px 0; line-height: 1.65; }
.cain-learn-btn { background: #111a2e; color: #cfe0f5; border: 1px solid #26324f; border-radius: 7px; padding: 8px 12px; font: 700 12px/1 ui-monospace, Menlo, monospace; cursor: pointer; margin: 0 4px; }
.cain-learn-btn:hover { border-color: #22d3ee; }
.cain-learn-btn:disabled { opacity: .55; cursor: default; }
.cain-inline-out { font: 12.5px/1.5 ui-monospace, Menlo, monospace; color: #93a1bb; }
.cain-inline-out.ok { color: #3fb68b; } .cain-inline-out.err { color: #ff7b8a; } .cain-inline-out.warn { color: #e0b842; }
.cain-inline-out code { background: #05080f; border: 1px solid #1e293b; border-radius: 6px; padding: 3px 6px; color: #d7e3f4; }
.cain-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0 0; }
@media (max-width: 860px) { .cain-two { grid-template-columns: 1fr; } }
.cain-panel { border: 1px solid #1a2342; border-radius: 12px; background: #070b13; padding: 16px 18px; }
.cain-panel-h { font-size: 18px; margin: 0 0 8px; color: #eef1f8; }
.cain-panel p { color: #a3adc8; font-size: 14px; line-height: 1.6; }
.cain-note { color: #7c86a6; font-size: 12.5px; line-height: 1.55; }
.cain-glossary { display: grid; grid-template-columns: minmax(120px, 180px) minmax(0, 1fr); gap: 8px 16px; margin: 16px 0 0; }
@media (max-width: 640px) { .cain-glossary { grid-template-columns: 1fr; } }
.cain-glossary dt { color: #22d3ee; font: 700 12px/1.6 ui-monospace, Menlo, monospace; }
.cain-glossary dd { margin: 0; color: #a3adc8; font-size: 13px; line-height: 1.6; }
.cain-glossary dd em { display: block; color: #7c86a6; font-style: normal; font-size: 12px; margin-top: 2px; }
.cain-code-tabs { display: flex; gap: 7px; margin: 14px 0 10px; }
.cain-code-tab { background: #0d1328; border: 1px solid #1a2342; color: #c3ccdf; border-radius: 7px; padding: 7px 11px; font: 700 11.5px/1 ui-monospace, Menlo, monospace; cursor: pointer; }
.cain-code-tab.is-active { background: linear-gradient(135deg, #0e7490, #22d3ee); color: #04121a; border-color: transparent; }
.cain-pre { background: #05080f; border: 1px solid #1e293b; border-radius: 9px; padding: 12px; overflow: auto; color: #d7e3f4; font: 12.5px/1.55 ui-monospace, Menlo, monospace; white-space: pre; }
.cain-levels { margin: 16px 0 0; padding-left: 22px; color: #cfd6ea; }
.cain-levels li { margin: 10px 0; line-height: 1.65; }

@media (prefers-reduced-motion: reduce) {
  html.cain-motion .cain-reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .c42-btn.primary::after, .cain-live-dot { animation: none !important; }
  .c42-card:hover, .c42-premier-card:hover { transform: none; }
}
