/* ==========================================================================
   cards.avhishek.in hero: Abhishek's portrait printed on a credit card,
   laid over a fanned stack that stands for the collection.
   One load moment (the stack fans out) and one pointer response (tilt + sheen).
   ========================================================================== */

.cards-home {
  --ch-gutter: 20px;
  --ch-ease: cubic-bezier(0.2, 0, 0, 1);
}
@media (min-width: 720px) { .cards-home { --ch-gutter: 32px; } }

.ch-hero {
  display: grid;
  gap: 40px;
  width: min(1180px, 100% - 2 * var(--ch-gutter));
  margin-inline: auto;
  padding-block: 28px 72px;
}
/* Below the two-column layout the fanned cards can reach the screen edge. */
@media (max-width: 959px) {
  .ch-hero { overflow-x: clip; }
}

/* ---------- The card stage ---------- */
.ch-stage {
  --cw: clamp(232px, 64vw, 290px);
  --r: calc(var(--cw) * 0.058);
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  gap: 22px;
  margin: 0;
  padding-block: 18px 0;
}
.ch-ambient {
  position: absolute;
  z-index: -1;
  inset: 4% 8% 14%;
  border-radius: 50%;
  background: url("hero/abhishek-card-ambient.webp") center / cover no-repeat;
  filter: blur(56px) saturate(1.35);
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 400ms ease-out;
}
html[data-theme="dark"] .ch-ambient { opacity: 0.38; }
html[data-theme] .ch-ambient.is-swapping { opacity: 0; }

.ch-deck {
  position: relative;
  width: var(--cw);
  aspect-ratio: 54 / 85.6;
}
/* The deck is one button: tap, click or Enter deals the next photo. */
.ch-deck {
  display: block;
  padding: 0;
  border: 0;
  border-radius: var(--r);
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.ch-deck:focus-visible { outline: 2px solid var(--focus); outline-offset: 10px; }

/* Three photo cards. data-pos 0 is the front card; 1 and 2 fan out behind. */
.ch-card {
  position: absolute;
  inset: 0;
  border-radius: var(--r);
  transform-origin: 50% 88%;
  transition-property: rotate, translate, scale, filter, transform;
  transition-duration: 620ms, 620ms, 620ms, 620ms, 500ms;
  transition-timing-function: var(--ch-ease);
}
.ch-card.is-tracking { transition-property: rotate, translate, scale, filter; }
.ch-card[data-pos="0"] { z-index: 3; }
.ch-card[data-pos="1"] {
  z-index: 2;
  rotate: -7deg;
  translate: -11% 1%;
  filter: brightness(0.84) saturate(0.9);
}
.ch-card[data-pos="2"] {
  z-index: 1;
  rotate: 6deg;
  translate: 10% 2%;
  filter: brightness(0.72) saturate(0.85);
}

/* Card face */
.ch-card {
  overflow: hidden;
  background: #1a1d24;
  transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  box-shadow:
    0 1px 1px rgb(0 0 0 / 0.08),
    0 22px 44px -14px rgb(0 0 0 / 0.42),
    0 48px 90px -36px rgb(0 0 0 / 0.38);
}
.ch-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.16);
  pointer-events: none;
}
.ch-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%;
}
.ch-card-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 34% at 50% 0%, rgb(0 0 0 / 0.5) 0%, rgb(0 0 0 / 0.22) 55%, transparent 100%),
    linear-gradient(0deg, rgb(8 10 16 / 0.72) 0%, rgb(8 10 16 / 0.2) 24%, transparent 40%);
}
.ch-card-top {
  position: absolute;
  inset: calc(var(--cw) * 0.07) calc(var(--cw) * 0.07) auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
}
.ch-card-logo {
  display: block;
  width: auto;
  height: calc(var(--cw) * 0.06);
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.55)) drop-shadow(0 0 6px rgb(0 0 0 / 0.45));
}
.ch-contactless {
  width: calc(var(--cw) * 0.08);
  height: calc(var(--cw) * 0.08);
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.55)) drop-shadow(0 0 6px rgb(0 0 0 / 0.45));
}
.ch-chip {
  position: absolute;
  inset-inline-start: 7%;
  top: 15%;
  width: 14%;
  aspect-ratio: 1.3;
  border-radius: 18%;
  background:
    linear-gradient(90deg, transparent 32%, rgb(120 86 30 / 0.55) 32% 35%, transparent 35% 65%, rgb(120 86 30 / 0.55) 65% 68%, transparent 68%),
    linear-gradient(0deg, transparent 46%, rgb(120 86 30 / 0.55) 46% 54%, transparent 54%),
    linear-gradient(135deg, #f4dfa6 0%, #d2a957 55%, #a87c34 100%);
  box-shadow: inset 0 0 0 1px rgb(120 86 30 / 0.45), 0 1px 2px rgb(0 0 0 / 0.3);
}
.ch-card-name {
  position: absolute;
  inset-inline-start: 7%;
  bottom: 6.5%;
  color: #f5f1e8;
  font-family: var(--site-mono, "Geist Mono", ui-monospace, monospace);
  font-size: calc(var(--cw) * 0.054);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgb(0 0 0 / 0.55), 0 -1px 0 rgb(255 255 255 / 0.22);
}
.ch-sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--sx, 30%) var(--sy, 18%), rgb(255 255 255 / 0.32), transparent 48%);
  mix-blend-mode: soft-light;
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 300ms ease-out;
}
.ch-stage.is-tilting .ch-card[data-pos="0"] .ch-sheen { opacity: 1; }

/* Caption: the current photo's place, then the deck position. */
.ch-caption {
  display: grid;
  justify-items: center;
  gap: 8px;
  max-width: 100%;
  margin-top: 8px;
  text-align: center;
}
.ch-place {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
}
.ch-place svg { flex: none; color: var(--muted); }
.ch-place-text { display: inline-block; }
.ch-hint {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.3;
}
.ch-dots { display: inline-flex; gap: 5px; }
.ch-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--line-strong);
  transition-property: width, background-color;
  transition-duration: 300ms;
  transition-timing-function: var(--ch-ease);
}
.ch-dots span.is-active { width: 18px; background: #fc6e20; }

/* ---------- Copy ---------- */
.ch-copy { min-width: 0; }
.ch-title {
  max-width: 11ch;
  margin: 0;
  color: var(--text);
  font-size: clamp(2.625rem, 1.5rem + 4.6vw, 5.25rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-wrap: balance;
}
.ch-title > span { display: block; }
/* Second line takes the gold-card foil: a metallic vertical gradient,
   plus one light band that sweeps across during the load moment. */
.ch-title-foil {
  --foil-top: #ea5a12;     /* 3.2:1 on the light page; brand orange in day mode */
  --foil-bottom: #c2410c;  /* 4.7:1 */
  --foil-band: rgb(255 214 180 / 0.75);
  padding-bottom: 0.06em;  /* room for descenders under background-clip */
  background:
    linear-gradient(100deg, transparent 40%, var(--foil-band) 50%, transparent 60%) 100% 0 / 300% 100% no-repeat,
    linear-gradient(180deg, var(--foil-top) 0%, var(--foil-bottom) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
html[data-theme="dark"] .ch-title-foil {
  --foil-top: #f3d99a;
  --foil-bottom: #b88a3e;
  --foil-band: rgb(255 250 235 / 0.8);
}
@media (forced-colors: active) {
  .ch-title-foil { background: none; color: CanvasText; }
}

.ch-lead {
  max-width: 40ch;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  line-height: 1.5;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}
.ch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}
.ch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding-inline: 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition-property: background-color, border-color, scale;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
  -webkit-tap-highlight-color: transparent;
}
.ch-btn-primary { background: var(--text); color: var(--page); }
.ch-btn-quiet { border-color: var(--line-strong); color: var(--text); }
.ch-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
@media (hover: hover) {
  .ch-btn-primary:hover { background: color-mix(in oklab, var(--text) 86%, var(--page)); }
  .ch-btn-quiet:hover { background: var(--surface); border-color: var(--muted); }
}

.ch-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, max-content));
  column-gap: clamp(20px, 4vw, 44px);
  margin: 40px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.ch-stats div { min-width: 0; }
.ch-stats dt {
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.35;
}
.ch-stats dd {
  margin: 2px 0 0;
  color: var(--text);
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

/* ---------- Wide screens: card left, copy right ---------- */
@media (min-width: 960px) {
  .ch-hero {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    align-items: center;
    gap: clamp(40px, 6vw, 96px);
    min-height: min(860px, calc(100svh - 84px));
    padding-block: 32px 80px;
  }
  .ch-stage { --cw: clamp(300px, 27vw, 372px); padding-block: 24px 0; padding-inline-start: 28px; }
}

/* ---------- Phones ---------- */
@media (max-width: 559px) {
  .ch-hero { gap: 32px; padding-block: 16px 56px; }
  .ch-stage { --cw: min(262px, (100vw - 2 * var(--ch-gutter)) * 0.74); }
  .ch-card { transform-origin: 50% 50%; }
  .ch-card[data-pos="1"] { rotate: -5deg; translate: -10% 1.5%; }
  .ch-card[data-pos="2"] { rotate: 4.5deg; translate: 9.5% 2.5%; }
  .ch-actions .ch-btn { flex: 1 1 100%; }
  .ch-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 12px; }
  .ch-stats dt { font-size: 0.75rem; }
}

/* ---------- Motion: one load moment, one pointer response ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* First load only (cards-hero.js removes .is-intro afterwards). */
  .ch-deck.is-intro .ch-card[data-pos="0"] { animation: ch-rise 700ms var(--ch-ease) both; }
  .ch-deck.is-intro .ch-card[data-pos="1"] { animation: ch-fan 900ms var(--ch-ease) 200ms both; }
  .ch-deck.is-intro .ch-card[data-pos="2"] { animation: ch-fan 900ms var(--ch-ease) 280ms both; }
  .ch-btn:active { scale: 0.96; }
  .ch-title-foil { animation: ch-foil 1400ms ease-out 650ms both; }
}
@keyframes ch-foil {
  from { background-position: 100% 0, 0 0; }
  to   { background-position: 0% 0, 0 0; }
}
@keyframes ch-fan {
  from { rotate: 0deg; translate: 0 0; }
}
@keyframes ch-rise {
  from { opacity: 0; translate: 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .ch-card { transition-property: filter; transition-duration: 200ms; }
}
@media (forced-colors: active) {
  .ch-card { border: 1px solid CanvasText; }
  .ch-dots span.is-active { background: CanvasText; }
}
