/* Home page simplification, 2026-11-12.
 * Hero: heading, one short line, two actions, a clean product photo.
 * Sound preview: one player (play button, sound set, four clips).
 * The four ESRC-V2 advantages sit in their own band below the player.
 * Loaded last so it wins over the older home layers without !important.
 */

/* ---------- Hero ---------- */
body.storefront #home .home-canvas {
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  grid-template-areas: "lead art" "why art" "player player" "tools tools";
  gap: 28px 48px;
  padding-top: 40px;
}
body.storefront #home .home-lead {
  padding: 20px 0 0;
}
body.storefront #home .home-canvas [data-region="hero-description"] {
  max-width: 34ch;
  margin-top: 20px;
  font: 400 18px/1.6 YSTBody, sans-serif;
  color: #43506a;
  text-wrap: pretty;
}
body.storefront #home .rc-hero-actions {
  margin-top: 28px;
}
body.storefront #home .home-art {
  height: 444px;
  align-self: center;
  background: var(--rc-ground);
  border-radius: 20px;
}
body.storefront #home .home-canvas [data-region="hardware-kit"] {
  inset: 12px;
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  object-fit: contain;
  mix-blend-mode: multiply;
}

/* ---------- Sound player ---------- */
body.storefront #home .home-player {
  grid-area: player;
  display: grid;
  gap: 16px;
  padding: 20px 24px 24px;
  background: var(--rc-blue-ground);
  border-radius: 20px;
  min-width: 0;
}
body.storefront #home .hp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
}
body.storefront #home .hp-head h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font: 650 20px/1.3 YSTBody, sans-serif;
  letter-spacing: -.015em;
  color: var(--yst-ink);
}
body.storefront #home .hp-wave {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--yst-blue);
}
body.storefront #home .hp-wave path {
  transform-box: fill-box;
  transform-origin: center;
}
body.storefront #home .home-player:has(.hp-clip-btn.is-playing) .hp-wave path {
  animation: yst-sound-pulse 780ms ease-in-out infinite alternate;
}

body.storefront #home .hp-vehicles {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #fff;
  border-radius: 12px;
}
body.storefront #home .hp-vehicle {
  min-height: 44px;
  margin: 0;
  padding: 8px 16px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
  color: #2b3854;
  font: 600 14px/1.4 YSTBody, sans-serif;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}
body.storefront #home .hp-vehicle:hover:not(.is-active) {
  background: #f1f5fc;
}
body.storefront #home .hp-vehicle.is-active {
  background: var(--yst-yellow);
  color: var(--yst-ink);
}

body.storefront #home .hp-deck {
  display: grid;
  grid-template-columns: 56px minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

/* main play button */
body.storefront #home .hp-main {
  position: relative;
  width: 56px;
  height: 56px;
  min-height: 56px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--yst-blue);
  box-shadow: 0 6px 16px rgb(0 87 217 / .28);
  cursor: pointer;
  transition: background-color 160ms ease, transform 140ms var(--rc-ease, ease), box-shadow 160ms ease;
}
body.storefront #home .hp-main:hover:not(:disabled) {
  background: #0049b8;
}
body.storefront #home .hp-main:active:not(:disabled) {
  transform: scale(.95);
}
body.storefront #home .hp-main:disabled {
  background: #9db4d8;
  box-shadow: none;
  cursor: default;
}
body.storefront #home .hp-main::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  translate: -35% -50%;
  border-style: solid;
  border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent #fff;
}
body.storefront #home .hp-main.is-playing::before {
  width: 16px;
  height: 16px;
  translate: -50% -50%;
  border: 0;
  border-radius: 3px;
  background: #fff;
}
body.storefront #home .hp-main.is-loading::before {
  width: 20px;
  height: 20px;
  translate: -50% -50%;
  border: 2.5px solid #fff;
  border-right-color: transparent;
  border-radius: 50%;
  animation: hp-spin 800ms linear infinite;
}
@keyframes hp-spin { to { rotate: 360deg; } }

/* sound set */
body.storefront #home .hp-track {
  min-width: 0;
}
body.storefront #home .home-player #homePresetSelect {
  position: static;
  width: 100%;
  height: auto;
  min-height: 52px;
  margin: 0;
  padding: 12px 40px 12px 16px;
  border: 0;
  border-radius: 12px;
  background-color: #fff;
  color: var(--yst-ink);
  font: 600 16px/1.5 YSTBody, sans-serif;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* clips */
body.storefront #home .hp-clips {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #fff;
  border-radius: 12px;
}
body.storefront #home .hp-clip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1 0 auto;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 9px;
  color: #2b3854;
  font: 600 14px/1.4 YSTBody, sans-serif;
  white-space: nowrap;
  transition: background-color 160ms ease, color 160ms ease;
}
body.storefront #home .hp-clip:hover:not(.is-selected):not(:has(:disabled)) {
  background: #f1f5fc;
}
body.storefront #home .hp-clip.is-selected {
  background: var(--yst-blue);
  color: #fff;
}
body.storefront #home .hp-clip:has(:disabled) {
  color: #8a94a8;
}
body.storefront #home .hp-clip-btn {
  position: static;
  flex: none;
  width: 10px;
  height: 12px;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: inherit;
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  overflow: visible;
}
body.storefront #home .hp-clip-btn:disabled {
  cursor: default;
}
/* the glyph */
body.storefront #home .hp-clip-btn::before {
  content: "";
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent currentColor;
  opacity: .9;
}
body.storefront #home .hp-clip-btn.is-playing::before {
  width: 10px;
  height: 10px;
  margin-top: 1px;
  border: 0;
  border-radius: 2px;
  background: currentColor;
}
body.storefront #home .hp-clip-btn.is-loading::before {
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: hp-spin 800ms linear infinite;
}
/* the whole chip is the hit area */
body.storefront #home .hp-clip-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
body.storefront #home .hp-clip:has(.hp-clip-btn:focus-visible) {
  outline: 2px solid var(--yst-blue);
  outline-offset: 2px;
}
body.storefront #home .hp-clip.is-selected:has(.hp-clip-btn:focus-visible) {
  outline-color: var(--yst-ink);
}
body.storefront #home .hp-clip-btn:focus-visible {
  outline: 0;
}
body.storefront #home :is(.hp-main, .hp-vehicle, .hp-configure):focus-visible {
  outline: 2px solid var(--yst-ink);
  outline-offset: 3px;
}

/* configure link */
body.storefront #home .hp-configure {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  margin: 0;
  padding: 8px 4px 8px 8px;
  border: 0;
  border-radius: 9px;
  background: none;
  box-shadow: none;
  color: var(--yst-blue);
  font: 650 15px/1.4 YSTBody, sans-serif;
  white-space: nowrap;
  cursor: pointer;
}
body.storefront #home .hp-configure svg {
  width: 18px;
  height: 18px;
  flex: none;
  transition: translate 160ms var(--rc-ease, ease);
}
body.storefront #home .hp-configure:hover svg {
  translate: 3px 0;
}

/* ---------- ESRC-V2 advantages band ---------- */
body.storefront #home .home-why {
  grid-area: why;
  display: grid;
  gap: 20px;
  min-width: 0;
}
body.storefront #home .home-why-head {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
body.storefront #home .home-why .home-features {
  grid-area: auto;
  grid-column: auto;
  grid-row: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 16px;
  margin: 0;
  padding: 0;
}
body.storefront #home .home-why .home-feature {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  column-gap: 12px;
  align-content: start;
}
body.storefront #home .home-why .feature-icon {
  grid-row: 1 / 3;
  width: 40px;
  height: 40px;
}
body.storefront #home .home-why [data-region^="feature-"][data-region$="-title"] {
  font: 600 15px/1.45 YSTBody, sans-serif;
  color: var(--yst-ink);
}
body.storefront #home .home-why [data-region^="feature-"][data-region$="-description"] {
  font: 400 14px/1.5 YSTBody, sans-serif;
  color: var(--yst-muted);
}

/* Wide screens: one row, same proportions as the old strip. */
@media (min-width: 1181px) {
  body.storefront #home .home-player {
    grid-template-columns: 250px minmax(0, 1fr);
    align-items: center;
    gap: 16px 24px;
    padding: 24px;
  }
  body.storefront #home .hp-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  body.storefront #home .hp-deck {
    grid-template-columns: 56px 295px auto auto;
    justify-content: space-between;
  }
}

/* ---------- Tablet ---------- */
@media (max-width: 1200px) {
  body.storefront #home .home-art { height: 400px; }
}
@media (max-width: 1180px) {
  body.storefront #home .hp-deck {
    grid-template-columns: 56px minmax(0, 1fr) auto;
  }
  body.storefront #home .hp-clips { grid-column: 1 / 3; grid-row: 2; }
  body.storefront #home .hp-configure { grid-column: 3; grid-row: 1 / 3; align-self: center; }
}

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  body.storefront #home .home-canvas {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "lead" "art" "why" "player" "tools";
    gap: 28px;
    padding-top: 20px;
  }
  body.storefront #home .home-canvas [data-region="hero-description"] {
    max-width: none;
    margin-top: 12px;
    font-size: 16px;
  }
  body.storefront #home .rc-hero-actions { margin-top: 20px; }
  body.storefront #home .home-art { height: 260px; border-radius: 16px; }
  body.storefront #home .home-canvas [data-region="hardware-kit"] {
    inset: 8px;
    width: calc(100% - 16px);
    height: calc(100% - 16px);
  }
  body.storefront #home .home-player { padding: 16px; border-radius: 16px; }
  body.storefront #home .hp-head h2 { font-size: 18px; }
  body.storefront #home .hp-vehicles { width: 100%; }
  body.storefront #home .hp-vehicle { flex: 1; }
  body.storefront #home .hp-deck {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px;
  }
  body.storefront #home .hp-clips { grid-column: 1 / -1; grid-row: 2; }
  body.storefront #home .hp-clip { flex: 1 1 0; min-width: 0; padding: 0 6px; gap: 6px; font-size: 13px; }
  body.storefront #home .hp-configure { grid-column: 1 / -1; grid-row: 3; justify-self: center; }
  body.storefront #home .home-why .home-features { gap: 20px 14px; }
}
@media (max-width: 420px) {
  body.storefront #home .home-art { height: 230px; }
}
/* Narrow phones, and longer labels in other languages: two clips per row. */
@media (max-width: 480px) {
  body.storefront #home .hp-clips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.storefront #home .hp-clip { font-size: 14px; padding: 0 10px; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  body.storefront #home .home-player:has(.hp-clip-btn.is-playing) .hp-wave path { animation: none; }
  body.storefront #home :is(.hp-main, .hp-clip, .hp-vehicle, .hp-configure svg) { transition: none; }
  body.storefront #home :is(.hp-main, .hp-clip-btn).is-loading::before { animation-duration: 1600ms; }
}

/* Other languages: the new photo carries no Vietnamese text, so it is shown
 * as is and the older cropped stand-in from site-i18n.js stays hidden. */
html:not([lang="vi"]) body.storefront #home .home-art > [data-region="hardware-kit"] { display: block; }
html:not([lang="vi"]) body.storefront #home .home-art .international-kit { display: none; }
