/* ==========================================================================
   FrameX — Home page only: rotating hero, ticker, featured frame rail, trust strip
   ========================================================================== */

/* Rotating hero ----------------------------------------------------------------
   The shared .page-hero (components.css) with several slides in it, one per
   part of the catalogue. ui/hero.js builds the slides from the list in
   assets/data/site.seed.js, moves between them and pauses when asked.
   Every slide sits in the same grid cell, so the hero keeps one height. */
@property --hero-glow {
  syntax: "<color>";
  inherits: true;
  initial-value: rgba(234, 120, 14, 0.18);
}

/* The slide's soft colour (ui/hero.js sets it from "tint" in site.seed.js) */
@property --hero-tint {
  syntax: "<color>";
  inherits: true;
  initial-value: #e2ecfb;
}

.home-hero {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0) 100%),
    var(--hero-tint);
  transition:
    --hero-glow 900ms var(--ease-out),
    --hero-tint 900ms var(--ease-out);
}

/* Each headline is two lines: the second one is the highlighted line */
.home-hero .page-hero__title span {
  display: block;
}

.home-hero__stage {
  display: grid;
  touch-action: pan-y; /* sideways swipes change the slide, vertical ones scroll the page */
}

.home-hero__slide {
  grid-area: 1 / 1;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 420ms var(--ease-out),
    visibility 0s linear 420ms;
}

.home-hero__slide.is-active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0s;
}

/* The words rise in one after another; the frames settle onto the wall */
.home-hero__copy > *,
.home-hero__slide .page-hero__piece {
  opacity: 0;
  transition:
    opacity 560ms var(--ease-out),
    translate 560ms var(--ease-out),
    scale 800ms var(--ease-spring),
    rotate 800ms var(--ease-spring),
    transform var(--dur-slow) var(--ease-out),
    box-shadow var(--dur-slow) var(--ease-out);
}

.home-hero__copy > * {
  translate: 0 18px;
}

.home-hero__slide .page-hero__piece {
  scale: 0.8;
  rotate: var(--in-turn, 0deg);
}

.home-hero__slide.is-active .home-hero__copy > *,
.home-hero__slide.is-active .page-hero__piece {
  opacity: 1;
  translate: none;
  scale: 1;
  rotate: none;
}

.home-hero__slide.is-active .home-hero__copy > :nth-child(1) {
  transition-delay: 80ms;
}

.home-hero__slide.is-active .home-hero__copy > :nth-child(2) {
  transition-delay: 150ms;
}

.home-hero__slide.is-active .home-hero__copy > :nth-child(3) {
  transition-delay: 220ms;
}

.home-hero__slide.is-active .home-hero__copy > :nth-child(4) {
  transition-delay: 290ms;
}

.home-hero__slide.is-active .page-hero__piece:nth-child(1) {
  transition-delay: 160ms;
}

.home-hero__slide.is-active .page-hero__piece:nth-child(2) {
  transition-delay: 240ms;
}

.home-hero__slide.is-active .page-hero__piece:nth-child(3) {
  transition-delay: 320ms;
}

/* A personalised design shown as a piece: the design on a warm mat */
.page-hero__piece--design {
  display: grid;
  place-items: center;
  padding: 9%;
  background: var(--beige);
}

.page-hero__piece--design .tpl-canvas {
  width: 100%;
  box-shadow: 0 10px 22px -12px rgba(74, 52, 28, 0.45);
}

/* Bar under the slides: one tab per slide, then previous / next / pause */
.home-hero__bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-top: clamp(40px, 4vw, 48px); /* room for the frames that hang a little low */
  padding-top: var(--space-lg);
  border-top: 1px solid var(--line);
}

.home-hero__tabs {
  flex: 1;
  min-width: 0;
  margin-block: -4px;
  padding-block: 4px;
}

.home-hero__tab {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-lg);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--white);
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  transition:
    border-color var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out),
    background-color var(--dur-base) var(--ease-out);
}

.home-hero__tab:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.home-hero__tab[aria-current="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--white);
}

/* How long until the next slide: a warm tint fills the current tab from left to right */
.home-hero__tab[aria-current="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(255, 255, 255, 0.2);
  transform-origin: left;
  transform: scaleX(0);
}

.home-hero.is-playing .home-hero__tab[aria-current="true"]::after {
  animation: hero-progress var(--hero-interval, 6s) linear both;
}

.home-hero.is-playing.is-held .home-hero__tab[aria-current="true"]::after {
  animation-play-state: paused;
}

@keyframes hero-progress {
  to {
    transform: scaleX(1);
  }
}

.home-hero__controls {
  display: flex;
  flex: none;
  gap: var(--space-sm);
}

.home-hero__control {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  transition:
    background-color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.home-hero__control:hover {
  border-color: var(--ink);
}

.home-hero__control:active {
  transform: scale(0.94);
}

.hero__socials {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-sm);
}

.hero__socials[hidden],
.hero__social[hidden] {
  display: none;
}

.hero__socials-label {
  color: var(--muted);
  font-size: var(--text-xs);
}

.hero__social {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  transition:
    background-color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out);
}

.hero__social:hover {
  border-color: var(--ink);
}

/* Phones: the arrows give way to swiping; the tabs run to the left edge of the screen */
@media (max-width: 639px) {
  .home-hero__tabs {
    margin-left: calc(-1 * var(--gutter));
    padding-left: var(--gutter);
  }

  .home-hero__control[data-hero-prev],
  .home-hero__control[data-hero-next] {
    display: none;
  }

  .home-hero .hero__socials-label {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-hero,
  .home-hero__slide,
  .home-hero__copy > *,
  .home-hero__slide .page-hero__piece {
    transition: none;
  }

  .home-hero__tab[aria-current="true"]::after {
    animation: none;
  }
}

/* Marquee (shared by ticker + featured rail) ------------------------------------ */
.marquee {
  overflow: hidden;
}

.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee var(--marquee-duration, 40s) linear infinite;
}

.marquee__group {
  display: flex;
  flex: none;
}

.marquee:hover .marquee__track,
.marquee:focus-within .marquee__track {
  animation-play-state: paused;
}

@keyframes marquee {
  to {
    transform: translate3d(calc(var(--marquee-distance, 50%) * -1), 0, 0);
  }
}

/* Ticker ------------------------------------------------------------------- */
.ticker {
  border-block: 1px solid var(--line);
  background: var(--white);
  color: var(--muted);
}

.ticker__item {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding-right: 34px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ticker__item:nth-child(even) {
  color: var(--ink);
}

.ticker__item::before {
  content: "•";
  margin-right: 10px;
  color: var(--amber);
}

/* Showcase (featured frame styles: auto-scroll + arrows + drag, ui/showcase.js) ---- */
.showcase {
  padding-top: clamp(36px, 5vw, 64px);
  background: var(--ivory);
}

.showcase__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(8px, 1.6vw, 16px);
}

.showcase__nav {
  display: flex;
  flex: none;
  gap: 10px;
}

.showcase__arrow {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line-warm);
  border-radius: 50%;
  background: var(--white);
  color: var(--charcoal);
  transition:
    background-color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.showcase__arrow .icon {
  transition: transform var(--dur-base) var(--ease-out);
}

@media (hover: hover) {
  .showcase__arrow:hover {
    background: var(--charcoal);
    border-color: var(--charcoal);
    color: var(--champagne);
  }

  .showcase__arrow[data-showcase-prev]:hover .icon {
    transform: translateX(-2px);
  }

  .showcase__arrow[data-showcase-next]:hover .icon {
    transform: translateX(2px);
  }
}

.showcase__arrow:active {
  transform: scale(0.94);
}

/* Vertical padding leaves room for the card lift + shadow inside the clip. */
.showcase__viewport {
  overflow: hidden;
  padding-block: 16px clamp(36px, 5vw, 60px);
  touch-action: pan-y; /* horizontal swipes drive the rail, vertical ones scroll the page */
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.showcase.is-dragging .showcase__viewport {
  cursor: grabbing;
}

.showcase__track {
  display: flex;
  width: max-content;
  will-change: transform;
}

.showcase__group {
  display: flex;
  flex: none;
  gap: clamp(16px, 2vw, 24px);
  padding-right: clamp(16px, 2vw, 24px);
}

/* Until the script runs (or without it) the rail is a plain scrollable row. */
.showcase:not(.is-ready) .showcase__viewport {
  overflow-x: auto;
  touch-action: auto;
}

.frame-card {
  position: relative;
  flex: none;
  width: clamp(200px, 60vw, 264px);
  transition: transform 420ms var(--ease-out);
}

.frame-card__media {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--beige);
  box-shadow: 0 1px 2px rgba(43, 43, 43, 0.06);
  transition: box-shadow 420ms var(--ease-out);
}

.frame-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms var(--ease-out);
  -webkit-user-drag: none;
}

.frame-card__wish {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
}

.frame-card__caption {
  display: grid;
  gap: 2px;
  padding: 14px 2px 0;
}

/* The name link stretches over the whole card so the image is clickable too. */
.frame-card__open::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.frame-card__name {
  display: block;
  overflow: hidden;
  font-size: var(--text-card);
  font-weight: var(--weight-strong);
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--dur-base) var(--ease-out);
}

.frame-card__from {
  color: var(--taupe);
  font-size: var(--text-sm);
}

@media (hover: hover) {
  .frame-card__wish {
    opacity: 0;
    transition:
      opacity var(--dur-base) var(--ease-out),
      transform var(--dur-fast) var(--ease-out),
      background-color var(--dur-base) var(--ease-out),
      color var(--dur-base) var(--ease-out);
  }

  .frame-card:hover .frame-card__wish,
  .frame-card__wish:focus-visible,
  .frame-card__wish[aria-pressed="true"] {
    opacity: 1;
  }

  .showcase:not(.is-dragging) .frame-card:hover {
    transform: translateY(-6px);
  }

  .showcase:not(.is-dragging) .frame-card:hover .frame-card__media {
    box-shadow: 0 18px 36px -14px rgba(74, 52, 28, 0.38);
  }

  .showcase:not(.is-dragging) .frame-card:hover .frame-card__image {
    transform: scale(1.04);
  }

  .frame-card:hover .frame-card__name {
    color: var(--brown-deep);
  }
}

@media (prefers-reduced-motion: reduce) {
  .marquee__track {
    animation: none;
  }

  .marquee--scrollable {
    overflow-x: auto;
  }

  .marquee__group[aria-hidden="true"] {
    display: none;
  }
}

/* Trust strip under the showcase: four short, factual reasons to use FrameX */
.trust {
  padding-block: clamp(20px, 3vw, 32px);
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.trust__list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

@media (min-width: 560px) {
  .trust__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 24px;
  }
}

@media (min-width: 1000px) {
  .trust__list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.trust__item {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--taupe);
  font-size: var(--text-sm);
  line-height: 1.4;
}

.trust__item strong {
  display: block;
  color: var(--charcoal);
  font-weight: 700;
}

.frame-card__desc {
  display: -webkit-box;
  overflow: hidden;
  color: var(--taupe);
  font-size: var(--text-xs);
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.frame-card__from {
  margin-top: 4px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: var(--weight-strong);
}

/* ==========================================================================
   Home page below the hero: shopping-site layout
   The page is the soft colour and every section is a white "shelf": a title
   with its "see all" link on the right, then a compact row of things to
   pick. Category circles, three banner tiles, product rows that scroll.
   ========================================================================== */
body[data-page="home"] main {
  padding-bottom: 20px;
  background: var(--surface-soft);
}

.shelf-section {
  padding-block: 8px;
}

.trust + .shelf-section {
  padding-top: 16px;
}

.shelf {
  padding: clamp(16px, 2.4vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
}

.shelf .section-head {
  align-items: center;
  margin-bottom: 16px;
}

.shelf .section-title {
  font-size: var(--text-h2-sm);
  font-weight: 700;
}

.shelf .section-lead {
  margin-top: 2px;
  font-size: var(--text-sm);
}

.shelf .section-more {
  margin-top: 18px;
}

/* Product rows. A phone swipes them sideways (components.css) and has the
   "see all" button in the head. From tablet width up every card is stacked in
   a grid (three per line, four on a laptop, five on a very wide screen) and
   the button sits under the cards. */
.shelf__more {
  display: none;
}

@media (min-width: 640px) {
  .shelf .product-grid--rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-flow: row;
    grid-auto-columns: auto;
    padding-bottom: 0;
    overflow: visible;
    scroll-snap-type: none;
  }

  .shelf--stack .section-head .btn,
  .shelf--stack .rail-arrows {
    display: none;
  }

  .shelf__more {
    display: flex;
    justify-content: center;
    margin-top: 20px;
  }
}

@media (min-width: 1000px) {
  .shelf .product-grid--rail {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1800px) {
  .shelf .product-grid--rail {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* Categories as a mosaic: the first one large, the others as small tiles beside it */
.shelf--cats .collection-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: clamp(104px, 28vw, 150px);
  gap: 10px;
}

.shelf--cats .collection-card {
  min-height: 0;
  padding: 12px 14px;
  border-radius: var(--radius-md);
}

/* Low tiles: show the middle of the picture and keep the dark fade to the bottom part */
.shelf--cats .collection-card img {
  object-position: 50% 45%;
}

.shelf--cats .collection-card::before {
  background: linear-gradient(180deg, rgba(2, 3, 10, 0) 38%, rgba(2, 3, 10, 0.82));
}

.shelf--cats .collection-card__name {
  font-size: var(--text-base);
}

.shelf--cats .collection-card__count {
  margin-top: 4px;
}

/* Phones: the first tile is a wide one on top; an odd one at the end is wide too */
.shelf--cats .collection-card:first-child,
.shelf--cats .collection-card:last-child:nth-child(even) {
  grid-column: span 2;
}

.shelf--cats .collection-card:first-child {
  grid-row: span 2;
}

.shelf--cats .collection-card:first-child .collection-card__name {
  font-size: var(--text-h3);
}

@media (min-width: 900px) {
  .shelf--cats .collection-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
    grid-auto-rows: clamp(120px, 10.5vw, 170px);
    gap: 14px;
  }

  .shelf--cats .collection-card:first-child {
    grid-column: auto;
    grid-row: span 3;
    padding: 22px;
  }

  .shelf--cats .collection-card:first-child .collection-card__name {
    font-size: var(--text-h2-sm);
  }
}

.shelf--cats .category-more {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* Banner tiles */
.promo-tiles {
  display: grid;
  gap: 12px;
}

.promo-tile {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  align-items: center;
  gap: 14px;
  min-height: 190px;
  padding: clamp(16px, 2vw, 22px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--soft-indigo);
  color: var(--ink);
  overflow: hidden;
  transition: box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}

.promo-tile--peach {
  background: var(--soft-peach);
}

.promo-tile--mint {
  background: var(--soft-mint);
}

.promo-tile--lilac {
  background: var(--soft-indigo);
}

@media (min-width: 900px) {
  .promo-tiles--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .promo-tiles--two .promo-tile {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.6fr);
  }
}

.promo-tile__label {
  display: block;
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.promo-tile__title {
  display: block;
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: var(--text-h3);
  line-height: 1.2;
}

.promo-tile__text {
  display: block;
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: var(--text-sm);
}

.promo-tile img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  object-fit: cover;
  box-shadow: 0 14px 28px -16px rgba(5, 8, 22, 0.5);
  transition: transform var(--dur-slow) var(--ease-out);
}

@media (hover: hover) {
  .promo-tile:hover {
    box-shadow: var(--shadow-lift);
    transform: translateY(-2px);
  }

  .promo-tile:hover img {
    transform: scale(1.05) rotate(-1.5deg);
  }
}

@media (min-width: 900px) {
  .promo-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

/* Collection tiles inside a shelf are squares, so the row stays low */
.shelf .promo-band__wall a {
  aspect-ratio: 1;
}

@media (prefers-reduced-motion: reduce) {
  .promo-tile,
  .promo-tile img {
    transition: none;
  }
}

/* The frame guide and the closing panel are white shelves too */
.shelf-section .guide,
.shelf-section .final-cta {
  border: 1px solid var(--line);
  background: var(--white);
}
