/* ==========================================================================
   Melodix Software — sections.css
   Hero, factbar, products, approach grid, team (with hover video), CTA band.
   ========================================================================== */

/* ------------------------------------------------------------------ hero */

.hero { padding-top: clamp(56px, 9vh, 110px); }

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(32px, 5vw, 70px);
  align-items: center;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 36px;
}

/* three gently floating product cards */
.hero-visual {
  position: relative;
  min-height: 430px;
}

.float-card {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(300px, 82%);
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(22, 22, 42, 0.92), rgba(11, 11, 22, 0.85));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-lg);
  animation: float-y 7s ease-in-out infinite;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease),
              filter 0.3s var(--ease);
}

.float-card:hover,
.float-card:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 32px 88px color-mix(in srgb, var(--accent) 22%, rgba(0, 0, 0, 0.55));
  filter: brightness(1.08);
}

.float-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, var(--accent), transparent 55%);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  pointer-events: none;
}

.float-card--1 { top: 4%;  left: 0;    animation-delay: 0s; }
.float-card--2 { top: 37%; right: 0;   animation-delay: -2.3s; }
.float-card--3 { top: 70%; left: 8%;   animation-delay: -4.6s; }

.fc-glyph {
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  height: 46px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  font-size: 1.4rem;
}

.float-card h3 { font-size: 1.02rem; }
.float-card p { font-size: 0.85rem; color: var(--text-dim); }

.float-card-arrow {
  margin-left: auto;
  color: color-mix(in srgb, var(--accent) 72%, #fff);
  font-size: 1.15rem;
  line-height: 1;
  transition: transform 0.25s var(--ease), color 0.25s var(--ease);
}

.float-card:hover .float-card-arrow,
.float-card:focus-visible .float-card-arrow {
  color: #fff;
  transform: translate(3px, -3px);
}

@keyframes float-y {
  0%, 100% { transform: translateY(-9px); }
  50%      { transform: translateY(9px); }
}

/* --------------------------------------------------------------- factbar */

.factbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: clamp(48px, 8vh, 90px);
  padding-block: 26px;
  border-block: 1px solid var(--border);
}

.factbar li {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: center;
}

.factbar strong {
  font-size: 1.5rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.factbar span {
  font-size: 0.83rem;
  color: var(--text-dim);
}

/* -------------------------------------------------------------- sections */

.section { padding-block: clamp(70px, 11vh, 130px); }
.section--tight { padding-block: clamp(48px, 7vh, 80px); }

.section--alt {
  position: relative;
  background: linear-gradient(180deg, transparent, rgba(124, 92, 255, 0.045), transparent);
}

.section-head {
  max-width: 700px;
  margin-bottom: clamp(38px, 5vw, 62px);
}

.section-lead {
  margin-top: 20px;
  color: var(--text-mid);
  font-size: clamp(1rem, 1.3vw, 1.13rem);
}

/* -------------------------------------------------------------- products */

.product-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.product {
  position: relative;
  padding: clamp(26px, 3.4vw, 42px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 160% at 0% 0%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 58%),
    linear-gradient(180deg, var(--surface), var(--bg-soft));
  overflow: hidden;
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease),
              box-shadow 0.4s var(--ease);
}

.product::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
  opacity: 0.9;
}

.product:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  box-shadow: 0 24px 60px color-mix(in srgb, var(--accent) 14%, transparent);
}

.product-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.product-glyph {
  display: grid;
  place-items: center;
  flex: 0 0 58px;
  height: 58px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  font-size: 1.7rem;
}

.product-head h3 {
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  letter-spacing: -0.025em;
}

.product-tag {
  margin-top: 4px;
  color: color-mix(in srgb, var(--accent) 72%, #fff);
  font-size: 0.93rem;
  font-weight: 600;
}

/* "Open source" flag, pinned to the right of the product header */
.os-flag {
  margin-left: auto;
  align-self: flex-start;
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--mint) 38%, transparent);
  background: color-mix(in srgb, var(--mint) 12%, transparent);
  color: color-mix(in srgb, var(--mint) 76%, #fff);
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.soon {
  font-size: 0.88rem;
  color: var(--text-dim);
  font-style: italic;
}

.product-body {
  max-width: 62em;
  color: var(--text-mid);
}

.product-links {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  margin-top: 26px;
}

/* ------------------------------------------------------------ approach */

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* ---------------------------------------------------------------- team */

.team {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(16px, 2vw, 28px);
}

.member { text-align: center; }

/* 4:5 like an Instagram portrait — taller than wide */
.member-media {
  position: relative;
  aspect-ratio: 4 / 5;
  margin-bottom: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease),
              box-shadow 0.4s var(--ease);
}

.member-media:hover,
.member-media.is-playing {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 22px 50px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* still portrait + motion layer stacked on top of each other */
.member-still,
.member-motion {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.55s var(--ease), transform 0.8s var(--ease);
}

/* The clip sits above the still and starts invisible. It is faded in only once
   its first frame has actually decoded (JS adds .is-revealed), so a hover never
   flashes a blank or half-loaded video. The still simply stays underneath —
   fading it out as well would let the card background bleed through mid-fade. */
.member-motion {
  opacity: 0;
  transform: scale(1.03);
}

.member-media.is-revealed .member-motion { opacity: 1; transform: scale(1); }
.member-media.is-revealed .member-still { transform: scale(1.04); }

/* little play hint in the corner — hidden when no motion file is available */
.member-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(7, 7, 15, 0.72);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 0.7rem;
  color: var(--text);
  transition: opacity 0.3s var(--ease), background 0.3s var(--ease);
}

.member-media.is-playing .member-badge {
  background: color-mix(in srgb, var(--accent) 78%, transparent);
}

.member-media.has-no-motion { cursor: default; }
.member-media.has-no-motion .member-badge { opacity: 0; }

/* only visible when the browser actually refused audible playback */
.sound-note {
  margin-top: 28px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.sound-note-btn {
  padding: 0;
  border-bottom: 1px dashed currentColor;
  color: var(--violet-light);
  font: inherit;
  font-weight: 650;
}

.sound-note-btn:hover { color: var(--text); }

/* soft pulse while a clip is actually audible */
.member-media.has-sound .member-badge {
  animation: sound-pulse 1.6s ease-in-out infinite;
}

@keyframes sound-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  50%      { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 0%, transparent); }
}

.member h3 { font-size: 1.12rem; }

.member-role {
  margin-top: 4px;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 70%, #fff);
}

.member-bio {
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--text-mid);
}

/* ------------------------------------------------------------- CTA band */

.cta-band {
  position: relative;
  padding: clamp(38px, 5vw, 64px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(100% 140% at 15% 0%, rgba(124, 92, 255, 0.22), transparent 62%),
    radial-gradient(90% 120% at 100% 100%, rgba(34, 211, 238, 0.14), transparent 60%),
    linear-gradient(180deg, var(--surface-2), var(--bg-soft));
  text-align: center;
}

.cta-band p {
  margin: 20px auto 0;
  max-width: 44em;
  color: var(--text-mid);
}

.cta-band .hero-ctas { justify-content: center; }

/* ----------------------------------------------------------- responsive */

@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .team   { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }

  /* the children are absolutely positioned, so an explicit width is required —
     `margin-inline: auto` alone would shrink-to-fit this box to 0 px */
  .hero-visual {
    min-height: 300px;
    width: 100%;
    max-width: 460px;
    margin-inline: auto;
  }

  .float-card--1 { top: 0;   left: 0; }
  .float-card--2 { top: 34%; right: 0; }
  .float-card--3 { top: 68%; left: 6%; }

  .eq { margin-top: 40px; height: 36px; }

  .factbar { grid-template-columns: repeat(2, 1fr); gap: 24px; }
}

@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr; }

  .product-head { flex-direction: column; align-items: flex-start; gap: 14px; }

  .hero-visual { min-height: 340px; }
  .float-card { width: 100%; }
  .float-card--3 { left: 0; }
}
