/* "Mis cursos": large cover cards with the title and summary below, revealed as they scroll in. */

.course-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 38rem));
  justify-content: center;
  gap: 3.5rem 2rem;
}

.course-card {
  display: block;
  color: var(--ink);
}

.course-media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius-ui);
  background-color: var(--surface);
}

.course-media img {
  width: 100%;
  height: 112%;
  object-fit: cover;
  /* --shift is set while scrolling (a slow parallax); hover only adds a gentle zoom. */
  transform: translateY(var(--shift, 0)) scale(1.02);
  transition: transform 700ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.course-card:hover .course-media img,
.course-card:focus-visible .course-media img {
  transform: translateY(var(--shift, 0)) scale(1.07);
}

.course-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.1rem 0 1.4rem;
  border-bottom: 1px solid var(--line-strong);
}

.course-text {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.course-title {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.course-summary {
  max-width: 46ch;
  color: var(--ink-muted);
  line-height: 1.45;
}

.course-arrow {
  flex: none;
  margin-top: 0.3rem;
  transition: transform 300ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.course-card:hover .course-arrow,
.course-card:focus-visible .course-arrow {
  transform: translate(3px, 3px);
}

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

/* Reveal: the cover opens from the top and the text rises, once, when the card enters. */
@media (prefers-reduced-motion: no-preference) {
  .js-reveal .course-media {
    clip-path: inset(0 0 100% 0);
    transition: clip-path 1000ms cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .js-reveal .course-body {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 700ms 250ms, transform 700ms 250ms cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .js-reveal .course-card.is-in .course-media {
    clip-path: inset(0 0 0 0);
  }

  .js-reveal .course-card.is-in .course-body {
    opacity: 1;
    transform: none;
  }
}

/* Unseen-style finish: film grain over the page, and the cover leans with scroll speed and cursor. */
.course-grain {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.course-card {
  perspective: 1100px;
}

.course-media {
  transform: skewY(var(--lean, 0deg)) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transform-origin: 50% 50%;
  will-change: transform;
}

.course-title {
  font-size: 1.0625rem;
  font-weight: 700;
}

.course-summary {
  color: var(--ink);
  font-size: 1.0625rem;
}

@media (prefers-reduced-motion: reduce) {
  .course-media { transform: none; }
}

/* Opening a course: the card's cover grows to fill the screen while the course page loads. */
.course-zoom {
  position: fixed;
  z-index: 60;
  overflow: hidden;
  border-radius: var(--radius-ui);
  background-color: var(--scene-veil);
  transition:
    top 900ms cubic-bezier(0.65, 0, 0.2, 1),
    left 900ms cubic-bezier(0.65, 0, 0.2, 1),
    width 900ms cubic-bezier(0.65, 0, 0.2, 1),
    height 900ms cubic-bezier(0.65, 0, 0.2, 1),
    border-radius 900ms;
}

.course-zoom img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The same darkening the course page has, so nothing jumps when the page takes over. */
.course-zoom-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, var(--scene-veil), transparent 35%, transparent 55%, var(--scene-veil));
  opacity: 0;
  transition: opacity 900ms;
}

.course-zoom.is-open {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0;
}

.course-zoom.is-open .course-zoom-veil {
  opacity: 0.62;
}

/* Two columns on tablets and computers; phones read one card after another. */
.course-grid > li {
  min-width: 0;
}

/* The right column arrives a moment after the left one, so the grid pours in like a cascade. */
.js-reveal .course-grid > li:nth-child(even) .course-media {
  transition-delay: 160ms;
}

.js-reveal .course-grid > li:nth-child(even) .course-body {
  transition-delay: 410ms;
}

/* A card still waiting for its picture. */
.course-media.is-blank {
  background-color: var(--media-blank);
}

@media (max-width: 760px) {
  .course-grid {
    grid-template-columns: minmax(0, 38rem);
  }
}

/* Says an offering cannot be booked yet. */
.course-status {
  align-self: flex-start;
  padding: 0.1rem 0.5rem;
  border: 1px solid currentcolor;
  border-radius: var(--radius-ui);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Cloth mode (js/card_cascade.js): the canvas paints the cards. The HTML cards keep their place,
   clicks and focus ring, but are not seen, and nothing transforms them while they are measured. */
.card-cascade {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  pointer-events: none;
}

.course-grid.is-cloth .course-card {
  transform: none;
}

.course-grid.is-cloth .course-card > .course-media,
.course-grid.is-cloth .course-card > .course-body {
  clip-path: none;
  transform: none;
  transition: none;
  opacity: 0;
}


/* Gold marks each card: a short rule over the line under its text. */
.landing-end .course-body {
  position: relative;
}

.landing-end .course-body::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 2.5rem;
  height: 2px;
  background-color: var(--mark);
}
