/* =========================================================
   index.css — styles specific to the main link index page.
   Depends on base.css being loaded first (uses its variables).
   ========================================================= */

:root {
  --space-xs: clamp(6px, 1vw, 10px);
  --space-sm: clamp(12px, 2vw, 18px);
  --space-md: clamp(24px, 4vw, 40px);
  --space-lg: clamp(48px, 8vw, 88px);

  --content-w: clamp(340px, 88vw, 640px);
  --avatar-size: clamp(92px, 18vw, 156px);
}

.page {
  position: relative;
  z-index: 1;
  width: var(--content-w);
  margin: 0 auto;
  padding: var(--space-lg) 0 var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.avatar-wrap {
  position: relative;
  width: var(--avatar-size);
  height: var(--avatar-size);
  margin-bottom: var(--space-md);
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(200, 172, 114, 0.35);
  display: block;
  background: #1a1420;
}

.seal-badge {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: calc(var(--avatar-size) * 0.42);
  height: calc(var(--avatar-size) * 0.42);
  border-radius: 50%;
  background: var(--bg);
  padding: 3px;
}

.seal-badge canvas {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
}

.seal-badge.dragging canvas { cursor: grabbing; }

.seal-hint {
  font-size: 0.68rem;
  color: var(--ink-faint);
  font-style: italic;
  margin: 0 0 var(--space-sm);
}

h1 {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  font-weight: 500;
  font-optical-sizing: auto;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
  line-height: 1.02;
}

.sub {
  font-style: italic;
  font-weight: 400;
  color: var(--ink-dim);
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  margin: 0 0 var(--space-sm);
}

.lede {
  font-size: clamp(0.92rem, 1.4vw, 1.02rem);
  line-height: 1.7;
  color: var(--ink-dim);
  max-width: 44ch;
  margin: 0 0 var(--space-lg);
  font-weight: 400;
}

.lede em {
  color: var(--ink);
  font-style: normal;
}

ol.index {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: item;
  width: 100%;
}

/* Ornamental rule — a thin line with a small sigil mark at its center,
   the same diamond form as the seal's inlay. Echoes the hairline dividers
   used between Realms on arkhelion.my.id. */
.rule {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 12px;
}

.rule .seg {
  flex: 1;
  height: 1px;
  background: var(--line);
  transition: background 0.5s ease;
}

.rule .mark {
  font-size: 0.6rem;
  line-height: 1;
  color: var(--ink-faint);
  transform: rotate(0deg) scale(0.85);
  transition: color 0.5s ease, transform 0.5s ease;
}

li:hover .rule .seg,
a:focus-visible ~ .rule .seg {
  background: var(--accent);
}

li:hover .rule .mark {
  color: var(--accent);
  transform: rotate(90deg) scale(1.1);
}

/* Section divider — marks the donation entries as their own, distinct
   part of the index, rather than just more rows in the same list. */
.section-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: var(--space-md) 0 var(--space-sm);
}

.section-divider .seg {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line) 30%, var(--line) 70%, transparent);
}

.section-divider .section-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-style: italic;
  color: var(--accent);
  opacity: 0.85;
  white-space: nowrap;
}

ol.index li {
  counter-increment: item;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  transition-delay: calc(var(--i, 0) * 70ms);
}

ol.index li.visible {
  opacity: 1;
  transform: translateY(0);
}

ol.index li:nth-child(1) { --i: 0; }
ol.index li:nth-child(2) { --i: 1; }
ol.index li:nth-child(3) { --i: 2; }
ol.index li:nth-child(4) { --i: 3; }
ol.index li:nth-child(5) { --i: 4; }
ol.index li:nth-child(6) { --i: 5; }
ol.index li:nth-child(7) { --i: 6; }

ol.index a {
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 20px);
  padding: clamp(12px, 2.2vw, 18px) 4px;
  text-decoration: none;
  color: var(--ink);
  text-align: left;
  transition: transform 0.3s ease;
}

li:hover a,
a:focus-visible {
  transform: translateX(6px);
}

ol.index a::before {
  content: counter(item, upper-roman);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  color: var(--ink-faint);
  flex-shrink: 0;
  width: 2em;
  align-self: flex-start;
  margin-top: 4px;
  transition: color 0.3s ease;
}

li:hover a::before,
a:focus-visible::before {
  color: var(--accent);
}

ol.index .entry {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

ol.index .label {
  font-size: clamp(1.05rem, 2vw, 1.22rem);
  font-weight: 500;
  position: relative;
  width: fit-content;
}

ol.index .label::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s ease;
}

ol.index a:hover .label::after,
ol.index a:focus-visible .label::after {
  transform: scaleX(1);
}

ol.index a:hover .label,
ol.index a:focus-visible .label {
  color: var(--accent);
}

ol.index .meta {
  font-size: 0.78rem;
  color: var(--ink-faint);
  font-style: italic;
  transition: color 0.3s ease;
}

li:hover .meta {
  color: var(--ink-dim);
}

/* Tarot slot — a small card back on the right of each row.
   Points at asset/tarot/<slug>.jpg; falls back to this placeholder
   pattern until a matching image file exists there. */
ol.index .tarot-card {
  width: clamp(28px, 5.5vw, 38px);
  aspect-ratio: 5 / 8;
  flex-shrink: 0;
  border-radius: 3px;
  border: 1px solid rgba(200, 172, 114, 0.35);
  background:
    repeating-linear-gradient(135deg, #17102a, #17102a 4px, #1d1533 4px, #1d1533 8px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

ol.index .tarot-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

ol.index .tarot-card.has-img .tarot-mark {
  display: none;
}

ol.index .tarot-card .tarot-mark {
  color: var(--accent);
  font-size: 0.62rem;
  opacity: 0.75;
}

li:hover .tarot-card {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

ol.index a:focus-visible {
  outline: 1px solid var(--ink-faint);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  ol.index li {
    opacity: 1;
    transform: none;
    transition: none;
  }
  li:hover a, a:focus-visible { transform: none; }
}

footer {
  margin-top: var(--space-lg);
}

/* QR-code tarot slot — a light backing so the code stays readable at
   thumbnail size, and it doesn't get cropped the way photo art does. */
ol.index .tarot-card.qr-slot {
  background: #f4f1e9;
  cursor: pointer;
}

ol.index .tarot-card.qr-slot .tarot-img {
  object-fit: contain;
  padding: 3px;
  background: #f4f1e9;
}

ol.index .tarot-card.qr-slot .zoom-hint {
  position: absolute;
  bottom: 1px;
  right: 2px;
  font-size: 0.5rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

li:hover .tarot-card.qr-slot .zoom-hint,
.tarot-card.qr-slot:focus-visible .zoom-hint {
  opacity: 0.85;
}

.tarot-card.qr-slot:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

/* Lightbox — opens when a QR tarot-card is clicked, so people can
   actually scan it instead of squinting at a 30px thumbnail. */
.qr-lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 4, 10, 0.86);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 24px;
}

.qr-lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.qr-lightbox .qr-panel {
  background: var(--bg);
  border: 1px solid rgba(200, 172, 114, 0.35);
  border-radius: 8px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(340px, 88vw);
  transform: scale(0.94) translateY(8px);
  transition: transform 0.3s ease;
}

.qr-lightbox.open .qr-panel {
  transform: scale(1) translateY(0);
}

.qr-lightbox img {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 4px;
  background: #f4f1e9;
  padding: 10px;
}

.qr-lightbox .qr-label {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--ink-dim);
  font-style: italic;
  text-align: center;
}

.qr-lightbox .qr-close {
  margin-top: 18px;
  background: none;
  border: 1px solid var(--ink-faint);
  color: var(--ink-dim);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 6px 16px;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.3s ease, color 0.3s ease;
}

.qr-lightbox .qr-close:hover,
.qr-lightbox .qr-close:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .qr-lightbox, .qr-lightbox .qr-panel { transition: none; }
}
