/* card A — QUIET.
   One hero mark: Omar's own woodcut (the sun-and-moon twins from his book cover), set as a
   seal on the card's top edge. Everything else is light, not ornament: the moon's cool light
   catches the card's left rim, the mind's warm light its right rim, and the same two lights
   run faintly along the hairlines between the links. */

.card {
  --seal: 80px;
  --seal-rise: .6;    /* fraction of the seal that stands above the card's top edge */
  --cool: color-mix(in srgb, var(--moonlight) 90%, transparent);
  --warm: color-mix(in srgb, var(--mind-glow) 86%, transparent);

  padding: var(--card-pad);
  padding-top: calc(var(--seal) * (1 - var(--seal-rise)) + 1.35rem);
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow:
    var(--card-shadow),
    -30px -12px 80px -36px color-mix(in srgb, var(--moonlight) 30%, transparent),
    30px -12px 80px -36px color-mix(in srgb, var(--mind-glow) 38%, transparent);
  color: var(--card-text);
  font-family: var(--font-sans);
  text-align: center;
  -webkit-font-smoothing: antialiased;
}

/* The rim: a 1px edge lit from the two sources, cool down the left, warm down the right,
   settling to the plain token border along the bottom. */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background:
    radial-gradient(60% 90% at 0% 22%, var(--cool), transparent 74%),
    radial-gradient(60% 90% at 100% 22%, var(--warm), transparent 74%),
    linear-gradient(var(--card-border), var(--card-border));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

/* The two lights falling faintly across the card's face. */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(var(--seam-angle),
    color-mix(in srgb, var(--moonlight) 6%, transparent) 0%,
    transparent 38%, transparent 62%,
    color-mix(in srgb, var(--mind-glow) 6%, transparent) 100%);
  pointer-events: none;
}

.card > * { position: relative; z-index: 1; }

/* ---------- the seal ---------- */
.card .card__seal {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 50%;
  width: var(--seal);
  height: var(--seal);
  transform: translate(-50%, calc(var(--seal-rise) * -100%));
  border-radius: 50%;
  overflow: hidden;
  isolation: isolate;
  background: var(--card-bg);
  /* a faint corona: cool where it faces the moon, warm where it faces the mind */
  box-shadow:
    0 10px 24px color-mix(in srgb, var(--night-deep) 55%, transparent),
    -14px -6px 34px -8px color-mix(in srgb, var(--moonlight) 30%, transparent),
    14px -6px 34px -8px color-mix(in srgb, var(--mind-glow) 42%, transparent),
    0 -10px 44px -6px color-mix(in srgb, var(--star) 10%, transparent);
}
.card__seal::after {           /* the seal's rim, lit like the card's */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 1px;
  background: linear-gradient(var(--seam-angle), var(--cool), var(--card-border) 50%, var(--warm));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.card__seal img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* anchored at the crescent (top-right) so its horns clear the rim by >= 2px at 52-80px */
  object-position: 50% 0%;
  transform: scale(1.12);
  transform-origin: 74% 0%;
  /* black lines on white paper -> pale lines on the card's dark */
  filter: invert(1) sepia(.2) brightness(.9);
  mix-blend-mode: screen;
}

/* ---------- type ---------- */
.card__name {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--fs-name);
  letter-spacing: -.02em;
  line-height: 1;
  color: var(--card-text);
}
.card__tagline {
  max-width: 28ch;
  margin: .5rem auto 0;
  font-size: var(--fs-tagline);
  line-height: 1.45;
  color: var(--card-muted);
}

/* ---------- links: rows, not buttons ---------- */
.card__links {
  list-style: none;
  margin: 1.35rem 0 0;
  padding: 0;
  text-align: left;
}
.card__links li { position: relative; }
.card__links li + li::before {   /* hairline between rows, lit cool-left / warm-right */
  content: "";
  position: absolute;
  top: 0; left: .35rem; right: .35rem;
  height: 1px;
  background: linear-gradient(to right,
    transparent 0%,
    color-mix(in srgb, var(--moonlight) 16%, transparent) 18%,
    var(--card-link-border) 50%,
    color-mix(in srgb, var(--mind-glow) 20%, transparent) 82%,
    transparent 100%);
}
.card__links a {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: var(--link-h);
  padding: 0 var(--link-pad-x);
  border-radius: var(--link-radius);
  color: var(--card-text);
  font-size: var(--fs-link);
  font-weight: 500;
  text-decoration: none;
  /* iOS Safari skips :active without a touch listener; its native tap highlight, in the
     hover-fill token, is the press feedback there. It clears on release. */
  -webkit-tap-highlight-color: var(--card-link-bg-hover);
  transition: background-color var(--t-hover) var(--ease-calm);
}
.card__label {                  /* one line, always: a longer label ellipsizes, never wraps */
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card__note {                   /* the book's title, so the seal has a source */
  flex: 0 100 auto;             /* gives way long before the label does */
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--card-muted);
  font-size: var(--fs-link-arrow);
  font-weight: 400;
}
.card__arrow {
  flex: none;
  color: var(--card-muted);
  font-size: var(--fs-link-arrow);
  font-weight: 400;
  transition: transform var(--t-hover) var(--ease-calm), color var(--t-hover) var(--ease-calm);
}
.card__links a:active { background: var(--card-link-bg-hover); }
@media (hover: hover) {         /* a tap must not leave a filled row behind */
  .card__links a:hover { background: var(--card-link-bg-hover); }
  .card__links a:hover .card__arrow { transform: translate(2px, -2px); color: var(--card-text); }
}
.card__links a:focus-visible {
  outline: 2px solid var(--card-focus);
  outline-offset: 2px;
}

/* ---------- glass ----------
   The token glass alone is too thin over the light half for AA text, so a veil of the
   card's own colour thickens toward the light side (where the backdrop is bright). */
.card.card--glass {
  background: var(--card-bg-glass);
  -webkit-backdrop-filter: blur(var(--card-blur)) saturate(1.2);
          backdrop-filter: blur(var(--card-blur)) saturate(1.2);
}
.card.card--glass::after {
  background:
    linear-gradient(var(--seam-angle),
      color-mix(in srgb, var(--moonlight) 6%, transparent) 0%,
      transparent 38%, transparent 62%,
      color-mix(in srgb, var(--mind-glow) 6%, transparent) 100%),
    linear-gradient(var(--seam-angle),
      color-mix(in srgb, var(--card-bg) 10%, transparent) 0%,
      color-mix(in srgb, var(--card-bg) 44%, transparent) 45%,
      color-mix(in srgb, var(--card-bg) 62%, transparent) 100%);
}
.card.card--glass .card__tagline,
.card.card--glass .card__note,
.card.card--glass .card__arrow { color: color-mix(in srgb, var(--card-text) 80%, transparent); }

/* ---------- phone ----------
   The seal must stay out of the top art band (0-29vh), where the mind's raised hand is. */
@media (max-width: 640px) {
  .card { --seal: 60px; --seal-rise: .5; }
  .card__tagline { margin-top: .4rem; }
  .card__links { margin-top: 1.1rem; }
}
@media (max-width: 359px) {
  .card__note { display: none; }
}
@media (max-height: 700px) {
  .card { --seal: 60px; padding-top: calc(var(--seal) * (1 - var(--seal-rise)) + 1rem); }
  .card__links { margin-top: .9rem; }
}
/* Instagram's in-app browser: 390 wide but only ~660-760 tall under its own bars. The 42vh
   budget cannot hold below ~826px, so the seal shrinks and sinks: it adds <= 21px above. */
@media (max-width: 640px) and (max-height: 800px) {
  .card { --seal: 52px; --seal-rise: .4; padding-top: calc(var(--seal) * (1 - var(--seal-rise)) + 1rem); }
  .card__tagline { margin-top: .3rem; }
  .card__links { margin-top: .9rem; }
}
/* <= 760 tall (the common Instagram heights), with tokens.css's 40px rows: a smaller seal that
   rises only 16px, so it clears the traveler; ~304px in all. (Final refiner, 2026-10-28.) */
@media (max-width: 640px) and (max-height: 760px) {
  .card { --seal: 46px; --seal-rise: .35; padding-top: calc(var(--seal) * (1 - var(--seal-rise)) + .8rem); }
  .card__tagline { margin-top: .35rem; }
  .card__links { margin-top: .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .card__links a, .card__arrow { transition: none; }
}
