/* Sample works: the home band, and /samples/<book_id> (templates/samples/).

   Every colour is a --gk2-* token, so a shop's theme (theme-koala.css) re-points
   this sheet with nothing written here. Every horizontal position is LOGICAL
   (inline-start / inline-end), so the Persian shop mirrors it by its own `dir`;
   the arrows and chevrons are the only things turned by hand, because an SVG
   path has a direction of its own. */

/* --- the card: the page out, the photos in, as prints on it ---------------- */

.sample-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--gk2-ink);
  text-decoration: none;
}

.sample-card__page {
  position: relative;
  display: block;
  aspect-ratio: var(--page-aspect, 2 / 1);
  border-radius: 10px;
  background: var(--gk2-paper-2);
  box-shadow: var(--gk2-ledge);
  transition: transform 260ms var(--gk2-ease), box-shadow 260ms var(--gk2-ease);
}

.sample-card__page > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* The photographs, as small prints dropped on the page's inline-start corner. */
.sample-card__prints {
  position: absolute;
  inset-block-end: -6px;
  inset-inline-start: -6px;
  display: flex;
  pointer-events: none;
}

.sample-card__prints img {
  width: clamp(36px, 20%, 58px);
  aspect-ratio: 1;
  object-fit: cover;
  border: 3px solid var(--gk2-white);
  border-radius: 4px;
  box-shadow: 0 6px 14px -6px rgb(var(--gk2-ink-rgb) / 0.55);
  transform: rotate(var(--tilt, -6deg));
}

.sample-card__prints img + img { margin-inline-start: -12px; }

.sample-card__title {
  padding-inline: 2px;
  margin-block-start: 8px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sample-card:hover .sample-card__page,
.sample-card:focus-visible .sample-card__page {
  transform: translateY(-4px);
  box-shadow: var(--gk2-float);
}

.sample-card:focus-visible { outline: none; }
.sample-card:focus-visible .sample-card__page {
  outline: 3px solid var(--gk2-glow);
  outline-offset: 3px;
}

.sample-card.is-current .sample-card__page {
  outline: 3px solid var(--gk2-glow);
  outline-offset: 3px;
}

/* --- the home band: a row that scrolls, one card and a bit showing on a phone */

.samples-row,
.samples-strip {
  display: grid;
  grid-auto-flow: column;
  gap: 22px;
  margin: 0;
  padding: 6px 4px 22px;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.samples-row { grid-auto-columns: minmax(250px, 320px); }
.samples-strip { grid-auto-columns: minmax(170px, 210px); gap: 18px; }

.samples-row > li,
.samples-strip > li { scroll-snap-align: start; padding-block-end: 8px; }

/* --- the large view -------------------------------------------------------- */

.samples-page { padding-block: clamp(28px, 5vw, 56px) 64px; }

.samples-page__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-block-end: 22px;
}

.samples-page__head h1 { margin: 0; }
.samples-page__count { margin: 0; color: var(--gk2-ink-soft); }

.sample-flow {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) auto auto auto minmax(0, 2.1fr);
  align-items: center;
  gap: clamp(8px, 1.4vw, 18px);
  padding: clamp(16px, 2.6vw, 30px);
  border-radius: 22px;
  background: var(--gk2-paper-2);
}

.sample-flow__in {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.sample-flow__group { display: flex; flex-direction: column; gap: 8px; margin: 0; }

.sample-flow__label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--gk2-ink-soft);
}

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

.sample-photo {
  flex: 0 1 calc((100% - 20px) / 3);
  max-width: 120px;
  min-width: 64px;
  margin: 0;
  padding: 5px 5px 4px;
  background: var(--gk2-white);
  border-radius: 5px;
  box-shadow: 0 8px 18px -10px rgb(var(--gk2-ink-rgb) / 0.55);
  transform: rotate(var(--tilt, -4deg));
}

.sample-photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 3px;
}

.sample-photo figcaption {
  padding-block-start: 4px;
  font-size: 0.78rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sample-flow__template img {
  display: block;
  width: 100%;
  aspect-ratio: var(--page-aspect, 2 / 1);
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--gk2-ledge);
}

.sample-flow__arrow {
  display: grid;
  place-items: center;
  color: var(--gk2-ink-soft);
}

.sample-flow__arrow svg,
.samples-nav__step svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The one thing with a direction of its own: an SVG path. */
[dir="rtl"] .sample-flow__arrow svg,
[dir="rtl"] .samples-nav__step svg { transform: scaleX(-1); }

.sample-flow__engine {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  max-width: 110px;
}

/* The same mark as the masthead and the favicon, from the same variable. */
.sample-flow__mark {
  position: relative;
  display: block;
  width: clamp(56px, 6vw, 72px);
  height: clamp(56px, 6vw, 72px);
  border-radius: 32%;
  background: var(--brand-mark, url("../images/logo-gooki.svg")) center / 100% 100% no-repeat;
  box-shadow: var(--gk2-float);
}

@media (prefers-reduced-motion: no-preference) {
  .sample-flow__mark::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    animation: sample-pulse 2.8s var(--gk2-ease) infinite;
  }
}

@keyframes sample-pulse {
  0% { box-shadow: 0 0 0 0 rgb(var(--gk2-sun-rgb) / 0.55); }
  70%, 100% { box-shadow: 0 0 0 14px rgb(var(--gk2-sun-rgb) / 0); }
}

.sample-flow__brand { font-weight: 700; }
.sample-flow__does { font-size: 0.8rem; color: var(--gk2-ink-soft); line-height: 1.3; }

.sample-flow__out {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  min-width: 0;
}

.sample-flow__out img {
  display: block;
  width: 100%;
  aspect-ratio: var(--page-aspect, 2 / 1);
  object-fit: cover;
  border-radius: 10px;
  box-shadow: var(--gk2-float);
}

.sample-flow__out figcaption {
  font-size: 0.82rem;
  color: var(--gk2-ink-soft);
}

/* --- back / forward and the book ------------------------------------------ */

.samples-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  margin-block: 26px 34px;
}

.samples-nav__step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--gk2-line);
  border-radius: 999px;
  background: var(--gk2-white);
  color: var(--gk2-ink);
  font-weight: 600;
  text-decoration: none;
  transition: border-color 200ms var(--gk2-ease), transform 200ms var(--gk2-ease);
}

.samples-nav__step:hover { border-color: var(--gk2-ink-soft); }
.samples-nav__step--next svg { transform: scaleX(-1); }
[dir="rtl"] .samples-nav__step--next svg { transform: none; }

.samples-nav__book {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 12px;
  text-align: center;
}

.samples-nav__book > span { color: var(--gk2-ink-soft); }
.samples-nav__book > a:not(.btn) { font-weight: 700; color: var(--gk2-ink); }

.samples-strip__title { font-size: 1.15rem; margin-block: 0 12px; }

.samples-page__note {
  margin-block-start: 18px;
  font-size: 0.85rem;
  color: var(--gk2-ink-soft);
}

/* --- narrow screens: the flow stacks, and the arrows point down ------------ */

@media (max-width: 820px) {
  .sample-flow {
    grid-template-columns: minmax(0, 1fr);
    justify-items: stretch;
  }
  .sample-flow__arrow svg,
  [dir="rtl"] .sample-flow__arrow svg { transform: rotate(90deg); }
  .sample-flow__arrow { height: 36px; }
  .sample-flow__engine { justify-self: center; max-width: none; }
  .sample-flow__in { flex-direction: row; align-items: flex-end; }
  .sample-flow__in > * { flex: 1 1 0; min-width: 0; }

  .samples-nav {
    grid-template-columns: 1fr 1fr;
  }
  .samples-nav__book { grid-column: 1 / -1; grid-row: 1; }
  .samples-nav__step--prev { justify-self: start; }
  .samples-nav__step--next { justify-self: end; }
}

@media (max-width: 520px) {
  .sample-flow__in { flex-direction: column; align-items: stretch; }
}
