/* Homepage "Stories from home" showcase. Loaded by index.html only.
   Replaces the old visits gallery. The section stays navy in both themes, so it needs no
   [data-theme="dark"] overrides; every colour here is fixed on purpose. */

.story-showcase {
  --ink: #0e1330;
  --ink-lift: #151b3d;
  --hair: rgba(143, 205, 238, .16);
  --gap: clamp(1rem, 2.4vw, 1.75rem);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(4.5rem, 9vw, 7.5rem);
  background-color: var(--ink);
  background-image:
    radial-gradient(52% 46% at 50% 62%, rgba(74, 168, 220, .085), rgba(74, 168, 220, 0) 72%),
    linear-gradient(rgba(8, 11, 30, .56), rgba(8, 11, 30, .56)),
    url("/assets/backgrounds/story-showcase.webp");
  background-size: auto, auto, cover;
  background-position: center, center, center;
  background-repeat: no-repeat;
}

/* A hairline where the lighter trust bar ends, so the two navy bands never read as one. */
.story-showcase::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(143, 205, 238, 0), rgba(143, 205, 238, .42), rgba(143, 205, 238, 0));
  z-index: 1;
}

/* The breath curve, kept to a whisper. */
.story-showcase__curve {
  position: absolute;
  inset: auto 0 11% 0;
  width: 100%;
  height: clamp(70px, 11vw, 140px);
  z-index: -1;
  pointer-events: none;
}
.story-showcase__curve path {
  fill: none;
  stroke: rgba(143, 205, 238, .11);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.story-showcase ::selection { background: rgba(74, 168, 220, .38); color: #fff; }

.story-showcase__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  flex-wrap: wrap;
  margin-bottom: clamp(2rem, 4.5vw, 3.25rem);
}
.story-showcase__intro { max-width: 34rem; }
.story-showcase__intro h2 { margin: 0; color: #fff; text-wrap: balance; }

.story-showcase__tools { display: flex; align-items: center; gap: 1.25rem; }
.story-showcase__all {
  color: var(--sky-300, #8fcdee);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: .01em;
  text-decoration: underline;
  text-decoration-color: rgba(143, 205, 238, .4);
  text-underline-offset: .35em;
  transition: text-decoration-color .25s var(--ease-out);
}
.story-showcase__all:hover { text-decoration-color: currentColor; }
.story-showcase__all:focus-visible { box-shadow: inset 0 -2px 0 var(--sky-300, #8fcdee); text-decoration: none; }

.story-showcase__arrows { display: none; gap: .6rem; }
.story-showcase.is-scrollable .story-showcase__arrows { display: flex; }
.story-showcase__arrow {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .24);
  background: transparent;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color .25s var(--ease-out), border-color .25s var(--ease-out), opacity .25s var(--ease-out);
}
.story-showcase__arrow:hover:not(:disabled) { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .5); }
.story-showcase__arrow:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--sky-300, #8fcdee); }
.story-showcase__arrow:disabled { opacity: .3; cursor: default; }
.story-showcase__arrow svg { width: 18px; height: 18px; }
.story-showcase__arrow--prev svg { transform: rotate(90deg); }
.story-showcase__arrow--next svg { transform: rotate(-90deg); }

/* Track: native scroll-snap. With three stories it simply lays them out; it scrolls once
   there are more than fit, and always on phones. */
.story-showcase__viewport {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: clamp(1.25rem, 5vw, 2.5rem);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin-inline: calc(clamp(1.25rem, 5vw, 2.5rem) * -1);
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
  padding-block: .5rem 1.25rem;
}
.story-showcase__viewport::-webkit-scrollbar { display: none; }
.story-showcase__viewport:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgba(143, 205, 238, .55); border-radius: 6px; }

.story-showcase__track {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 2 * var(--gap)) / 3);
  gap: var(--gap);
}
.story-showcase__slide { scroll-snap-align: start; min-width: 0; }

.story-card {
  display: block;
  color: #fff;
  text-decoration: none;
  transition: opacity .5s var(--ease-out);
}
.story-card:hover, .story-card:focus-visible { text-decoration: none; outline: none; }

/* A thin mat around the print, like a framed photograph on a wall. */
.story-card__frame {
  display: block;
  padding: 9px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .13);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 28px 50px -26px rgba(0, 0, 0, .65), 0 6px 14px -8px rgba(0, 0, 0, .5);
  transition: border-color .4s var(--ease-out), transform .6s var(--ease-out);
}
.story-card__frame picture, .story-card__frame img { display: block; }
.story-card__frame img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 8px;
  background: var(--ink-lift);
}

.story-card__title {
  display: block;
  margin-top: 1.15rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(1.05rem, 1.5vw, 1.2rem);
  line-height: 1.3;
  color: #fff;
  text-wrap: balance;
}
.story-card__cue {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-top: .7rem;
  color: var(--sky-300, #8fcdee);
  font-size: .95rem;
}
.story-card__cue svg { width: 16px; height: 16px; transition: transform .35s var(--ease-out); }

.story-card:hover .story-card__frame { border-color: rgba(143, 205, 238, .45); transform: translateY(-3px); }
.story-card:hover .story-card__cue svg { transform: translateX(4px); }
.story-card:focus-visible .story-card__frame { border-color: transparent; box-shadow: inset 0 0 0 2px var(--sky-300, #8fcdee), 0 28px 50px -26px rgba(0, 0, 0, .65); }

/* Once the track can scroll, the centre-most story is lit and its neighbours step back. */
.story-showcase.is-scrollable .story-card { opacity: .62; }
.story-showcase.is-scrollable .story-card.is-active,
.story-showcase.is-scrollable .story-card:hover,
.story-showcase.is-scrollable .story-card:focus-visible { opacity: 1; }

.story-showcase__note {
  margin: clamp(1.25rem, 3vw, 2rem) 0 0;
  color: rgba(255, 255, 255, .56);
  font-size: .9rem;
}

@media (max-width: 860px) {
  .story-showcase__track { grid-auto-columns: min(78%, 22rem); }
  .story-showcase__tools { width: 100%; justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  .story-card, .story-card__frame, .story-card__cue svg, .story-showcase__arrow, .story-showcase__all { transition: none; }
  .story-card:hover .story-card__frame { transform: none; }
  .story-card:hover .story-card__cue svg { transform: none; }
}
