/* Home page: H-02 3D book hero, promo tiles, services, book rails.
   Phones (≤720px, end of file): the M-02 Stories home. */

.home-main {
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding-top: 20px;
  padding-bottom: 40px;
}

/* ---------- Hero: showcase + two promo tiles ---------- */

.hero {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.promos {
  flex: 1 1 280px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.promo {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-height: 132px;
  padding: 22px 24px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

.promo:hover {
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.promo__kicker {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.promo__title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}

.promo__line {
  font-size: 14px;
  color: var(--muted);
}

.promo__go {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}

.promo__go .ic {
  transition: transform 0.25s ease;
}

.promo:hover .promo__go .ic {
  transform: translateX(4px);
}

/* ---------- H-02 3D book showcase (WS02HeroH2 sample) ---------- */

.showcase {
  flex: 2 1 560px;
  min-width: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding: 32px 44px;
  border-radius: var(--radius-xl);
  background: var(--tint);
}

.showcase__text {
  flex: 1 1 300px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.showcase__slide {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Replays every time a slide is un-hidden */
.showcase__swap,
.showcase__swap > * {
  animation: swap 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.showcase__swap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.showcase__swap > :nth-child(2) {
  animation-delay: 0.08s;
}
.showcase__swap > :nth-child(3) {
  animation-delay: 0.16s;
}
@keyframes swap {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.showcase__kicker {
  align-self: flex-start;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  background: var(--surface);
  padding: 2px 12px;
  border-radius: 999px;
}

.showcase__title {
  margin: 0;
  font-size: 44px;
  line-height: 1.2;
  font-weight: 700;
}

.showcase__byline {
  font-size: 16px;
  color: var(--muted);
}

.showcase__author + .showcase__line::before {
  content: " · ";
}

.showcase__price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.showcase__now {
  font-size: 28px;
  font-weight: 700;
}

.showcase__mrp {
  color: var(--muted);
}

.showcase__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.showcase__controls {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.showcase__dot {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.showcase__dot span {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted);
  opacity: 0.45;
  transition:
    width 0.3s ease,
    opacity 0.3s ease,
    background 0.3s ease;
}
.showcase__dot[aria-current="true"] span {
  width: 28px;
  opacity: 1;
  background: var(--accent);
}

/* Pause / play: one icon at a time */
[data-hero-toggle] [data-icon="play"],
[data-hero-toggle][data-paused] [data-icon="pause"] {
  display: none;
}
[data-hero-toggle][data-paused] [data-icon="play"] {
  display: inline;
}

/* Stage */
.showcase__stagebox {
  flex: 1 1 340px;
  min-width: 260px;
  height: 380px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.showcase__disc {
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: var(--surface);
  opacity: 0.75;
}

.showcase__ring {
  position: absolute;
  width: 356px;
  height: 356px;
  border-radius: 50%;
  border: 2px dashed var(--accent);
  opacity: 0.35;
  animation: spin 40s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.showcase__floor {
  position: absolute;
  left: 50%;
  bottom: 22px;
  width: 190px;
  height: 24px;
  margin-left: -95px;
  border-radius: 50%;
  background: var(--cast-shadow);
  opacity: 0.16;
  filter: blur(9px);
  animation: floor 8s ease-in-out infinite;
}
@keyframes floor {
  0%,
  100% {
    transform: scaleX(1);
  }
  50% {
    transform: scaleX(0.82);
  }
}

.showcase__stage {
  position: relative;
  width: 200px;
  height: 300px;
  perspective: 1100px;
}

.showcase__book {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  opacity: 0;
  transform: translateY(26px) scale(0.9);
  transition:
    opacity 0.6s ease,
    transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.showcase__book.is-on {
  opacity: 1;
  transform: none;
}

.showcase__turn {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  animation: turn 8s ease-in-out infinite;
}
@keyframes turn {
  0%,
  100% {
    transform: rotateY(-34deg) rotateX(6deg);
  }
  50% {
    transform: rotateY(-10deg) rotateX(3deg);
  }
}

.showcase__face {
  position: absolute;
  top: 0;
  height: 100%;
}

.showcase__front {
  left: 0;
  width: 100%;
  border-radius: 3px;
  outline: 0;
  transform: translateZ(16px);
  box-shadow: inset 3px 0 0 rgba(0, 0, 0, 0.15);
}

.showcase__back {
  left: 0;
  width: 100%;
  transform: rotateY(180deg) translateZ(16px);
}

.showcase__spine {
  left: -16px;
  width: 32px;
  transform: rotateY(-90deg);
  filter: brightness(0.78);
}

.showcase__pages {
  right: -16px;
  width: 32px;
  transform: rotateY(90deg);
  background: repeating-linear-gradient(to right, var(--paper) 0 2px, var(--paper-line) 2px 3px);
}

.showcase__top {
  left: 0;
  width: 100%;
  height: 32px;
  top: -16px;
  transform: rotateX(90deg);
  background: repeating-linear-gradient(to bottom, var(--paper) 0 2px, var(--paper-line) 2px 3px);
}

/* ---------- Services ---------- */

.services {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.service {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.service__icon {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: var(--radius);
  background: var(--tint);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.service__text {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.service__title {
  font-weight: 600;
}

.service__line {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Phones: M-02 Stories home (WS02M2 sample) ---------- */

@media (max-width: 720px) {
  .home-main {
    gap: 20px;
    padding-top: 12px;
  }

  /* Stories, showcase and new books first; promo tiles and services after
     them (services hold no links, so the keyboard order is unchanged). */
  .home-main > .promos {
    order: 1;
  }

  .services-section {
    order: 2;
  }

  /* Stories: round subject links, scrolling sideways edge to edge */
  .stories__list {
    display: flex;
    gap: 12px;
    margin: 0 calc(var(--gutter) * -1);
    padding: 2px var(--gutter);
    list-style: none;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .stories__list::-webkit-scrollbar {
    display: none;
  }

  .story {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 72px;
    color: var(--ink);
    font-size: 12px;
    line-height: 1.3;
    text-align: center;
  }

  .story:hover {
    text-decoration: none;
  }

  .story__ring {
    position: relative;
    width: 68px;
    height: 68px;
    padding: 3px;
    border-radius: 50%;
    border: 2px solid var(--accent);
  }

  .story--new .story__ring {
    border-color: transparent;
  }

  .story--new .story__ring::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 2px dashed var(--accent);
    animation: spin 9s linear infinite;
  }

  .story__dot {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tint);
    color: var(--accent);
    font-size: 21px;
    font-weight: 700;
    line-height: 1;
    object-fit: cover;
  }

  .story--new .story__dot {
    background: var(--accent);
    color: var(--on-accent);
  }

  .story__name {
    overflow-wrap: anywhere;
  }

  /* Showcase: compact card — text | small turning book, controls below */
  .showcase {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    grid-template-areas:
      "text stage"
      "controls controls";
    align-items: center;
    gap: 0 14px;
    padding: 18px 16px 4px;
  }

  .showcase__text {
    display: contents;
  }

  .showcase [data-hero-live] {
    grid-area: text;
  }

  .showcase__controls {
    grid-area: controls;
    margin: 0 0 0 -12px;
  }

  .showcase__slide {
    gap: 8px;
  }

  .showcase__swap {
    gap: 2px;
  }

  .showcase__kicker {
    font-size: 12px;
    padding: 1px 10px;
  }

  .showcase__title {
    margin-top: 4px;
    font-size: 23px;
  }

  .showcase__byline {
    font-size: 13px;
    line-height: 1.35;
  }

  .showcase__line {
    display: none;
  }

  .showcase__price {
    gap: 2px 6px;
  }

  .showcase__now {
    font-size: 20px;
  }

  .showcase__mrp {
    font-size: 12px;
  }

  /* One action, as in M-02: the grid below has the add buttons */
  .showcase__actions > :not(.showcase__view) {
    display: none;
  }

  .showcase__view {
    min-height: 44px;
    padding: 0 16px;
    font-size: 15px;
    background: var(--accent);
    color: var(--on-accent);
  }

  .showcase__dot span {
    width: 8px;
    height: 6px;
  }

  .showcase__dot[aria-current="true"] span {
    width: 22px;
  }

  .showcase__stagebox {
    grid-area: stage;
    flex: none;
    min-width: 0;
    height: 196px;
  }

  .showcase__disc,
  .showcase__ring {
    display: none;
  }

  .showcase__floor {
    bottom: 4px;
    width: 96px;
    height: 14px;
    margin-left: -48px;
    filter: blur(6px);
  }

  .showcase__stage {
    width: 112px;
    height: 168px;
    perspective: 700px;
  }

  .showcase__front {
    transform: translateZ(9px);
  }

  .showcase__back {
    transform: rotateY(180deg) translateZ(9px);
  }

  .showcase__spine {
    left: -9px;
    width: 18px;
  }

  .showcase__pages {
    right: -9px;
    width: 18px;
  }

  .showcase__top {
    top: -9px;
    height: 18px;
  }

  .showcase .book-cover--lg .book-cover__title {
    font-size: 16px;
  }

  .showcase .book-cover--lg .book-cover__author {
    font-size: 10px;
  }

  /* Compact promo pair */
  .promos {
    flex: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .promo {
    justify-content: flex-start;
    gap: 2px;
    min-height: 0;
    padding: 14px;
    border-radius: var(--radius-lg);
  }

  .promo__kicker {
    font-size: 12px;
  }

  .promo__title {
    font-size: 17px;
  }

  .promo__line {
    display: none;
  }

  .promo__go {
    margin-top: auto;
    padding-top: 4px;
    font-size: 13px;
  }

  /* Compact services, 2 × 2 */
  .services {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .service {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
  }

  .service__icon {
    width: 36px;
    height: 36px;
  }

  .service__title {
    font-size: 14px;
  }

  .service__line {
    font-size: 12px;
  }

  /* M-02 grid: the first six books */
  .rail--grid > li:nth-child(n + 7) {
    display: none;
  }
}
