/*
 * Front-page sections: family band, choosing guide, tamper comparison, slogan.
 * Loaded after components.css so it can build on those primitives.
 */

/* --- Family band ------------------------------------------------------ */

/*
 * The client's «نوارها»: they were explicit that these should sit on the hero
 * background rather than float below it. Pulled up over the hero's lower edge
 * on a translucent surface — the one overlap DESIGN.md rule 18 allows, because
 * it is a specified composition rather than incidental stacking.
 */
.family-band {
  position: relative;
  z-index: 5;
  margin-block-start: clamp(-5rem, -7vw, -3rem);
}

.family-card {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  background-color: rgba(20, 20, 20, 0.72);
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-card);
  text-decoration: none;
  transition: transform var(--dur-base) var(--ease-spring),
              border-color var(--dur-base) var(--ease-out),
              background-color var(--dur-base) var(--ease-out);
}

/*
 * The translucency is progressive enhancement. Without backdrop-filter the card
 * is simply a dark panel, which is a perfectly good card — so the fallback
 * above is opaque enough to carry text on its own rather than relying on blur
 * that may never arrive.
 */
@supports (backdrop-filter: blur(12px)) {
  .family-card {
    background-color: rgba(20, 20, 20, 0.55);
    backdrop-filter: blur(14px) saturate(120%);
  }
}

.family-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-signal);
  background-color: rgba(20, 20, 20, 0.85);
}

.family-card__media {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: var(--color-surface-alt);
}

.family-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.family-card__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.family-card__title {
  font-weight: 700;
  font-size: var(--step-1);
}

.family-card__text {
  color: var(--color-ink-soft);
  font-size: var(--step--1);
  line-height: 1.6;
  /* Two lines on the band; the full description lives in the section below. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Choosing guide --------------------------------------------------- */

/*
 * Rows, not cards. The content is if-then, and three equal cards would both
 * break DESIGN.md rule 15 and misrepresent the shape of the information.
 */
.guide {
  padding: 0;
  margin: var(--space-4) 0 0;
  list-style: none;
  border-block-start: 1px solid var(--color-line);
}

.guide__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  padding-block: var(--space-3);
  border-block-end: 1px solid var(--color-line);
}

.guide__goal {
  flex: 1 1 20rem;
  font-size: var(--step-1);
  max-width: none;
}

.guide__answer {
  flex: 0 0 auto;
  padding: 0.35rem 1rem;
  border: 1px solid var(--color-signal);
  border-radius: var(--radius-pill);
  color: var(--color-signal);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}

.guide__answer:hover {
  background-color: var(--color-signal);
  color: var(--color-void);
}

/* --- Tamper comparison ------------------------------------------------ */

.compare {
  position: relative;
  margin-block-start: var(--space-3);
  border-radius: var(--radius-card);
  overflow: hidden;
  background-color: var(--color-surface-alt);
  /* Set inline and updated by JS. Also the no-JS resting state. */
  --compare-position: 50%;
}

.compare__pair {
  position: relative;
  margin: 0;
  aspect-ratio: 3 / 2;
}

.compare__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/*
 * The "before" image is clipped rather than resized, so both frames stay in
 * register. Anything that scaled one side would break the illusion that this is
 * one object changing rather than two photographs.
 *
 * inset-inline-end works out to the correct side under either direction.
 */
.compare__img--before {
  clip-path: inset(0 0 0 var(--compare-position));
}

[dir='rtl'] .compare__img--before {
  clip-path: inset(0 var(--compare-position) 0 0);
}

.compare__divider {
  position: absolute;
  inset-block: 0;
  inset-inline-start: var(--compare-position);
  width: 2px;
  background-color: var(--color-signal);
  transform: translateX(-1px);
  pointer-events: none;
  z-index: 3;
}

.compare__caption {
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 2;
  padding: var(--space-2);
  background: linear-gradient(to top, rgba(13, 13, 13, 0.9), transparent);
  color: var(--color-ink);
  font-size: var(--step--1);
}

/*
 * A real range input, restyled. It keeps keyboard operation, screen-reader
 * announcement and touch dragging for free — all of which a custom div handle
 * would have had to reimplement, usually badly.
 */
.compare__range {
  position: absolute;
  inset-block: 0;
  inset-inline: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  appearance: none;
  cursor: ew-resize;
}

.compare__range::-webkit-slider-thumb {
  appearance: none;
  width: 44px;                 /* full touch target, not a hairline */
  height: 44px;
  border-radius: 50%;
  background-color: var(--color-signal);
  border: 3px solid var(--color-void);
  cursor: ew-resize;
}

.compare__range::-moz-range-thumb {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--color-signal);
  border: 3px solid var(--color-void);
  cursor: ew-resize;
}

.compare__range::-moz-range-track {
  background: transparent;
}

.compare__range:focus-visible {
  outline: 2px solid var(--color-signal);
  outline-offset: -4px;
}

/* --- Slogan ----------------------------------------------------------- */

.slogan {
  padding-block: var(--section-gap);
  border-block: 1px solid var(--color-line);
}

.slogan__text {
  margin: 0;
  max-width: 28ch;
  font-size: var(--step-2);
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--color-ink);
}

/* --- Article card ----------------------------------------------------- */

.card__meta {
  margin: var(--space-2) 0 0;
  color: var(--color-ink-faint);
  font-size: var(--step--1);
}
