/*
 * TTFC Former Player Cards — front-end styles.
 * Ported from the original Replit "soccer-cards" app. Everything is scoped to
 * body.ttfc-pc so it is safe even if a stray theme/plugin stylesheet loads.
 */

/* ─── Colour tokens ──────────────────────────────── */
.ttfc-pc {
  --claret:        #660033;
  --claret-dark:   #4a0025;
  --claret-light:  #7a0038;
  --sky:           #87ceeb;
  --sky-dark:      #5bb8e0;
  --sky-pale:      #dff0fb;

  --card-w: 300px;
  --card-h: 460px;
  --card-r: 14px;
}

/* ─── Reset & Base ────────────────────────────────── */
body.ttfc-pc *,
body.ttfc-pc *::before,
body.ttfc-pc *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body.ttfc-pc {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--sky);
  background-image: radial-gradient(circle at 20% 50%, var(--sky-dark) 0%, var(--sky) 60%, #b8dff4 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: #1a1a2e;
  -webkit-font-smoothing: antialiased;
}

body.ttfc-pc img { max-width: 100%; display: block; border: 0; }

body.ttfc-pc button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  text-transform: none;
  line-height: inherit;
  -webkit-appearance: none;
  appearance: none;
}

body.ttfc-pc a { text-decoration: none; }

body.ttfc-pc :focus-visible {
  outline: 3px solid var(--sky-pale);
  outline-offset: 2px;
}

.ttfc-pc .screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ─── Page layout ─────────────────────────────────── */
.ttfc-pc .page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px 56px;
  gap: 40px;
}

.ttfc-pc .page-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 1100px;
}

.ttfc-pc .page-header-crest-link { flex-shrink: 0; }

.ttfc-pc .page-header-crest {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(102,0,51,0.35));
}

/* Balances the crest so the title stays visually centred */
.ttfc-pc .page-header-spacer {
  width: 72px;
  flex-shrink: 0;
}

.ttfc-pc .page-header-text {
  flex: 1;
  text-align: center;
}

.ttfc-pc .page-title {
  font-family: 'Bebas Neue', 'Impact', sans-serif;
  font-weight: 400;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  line-height: 1.1;
  letter-spacing: 0.1em;
  color: var(--claret);
  text-shadow: 0 2px 0 rgba(255,255,255,0.4);
}

.ttfc-pc .page-subtitle {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--claret-dark);
  opacity: 0.75;
  letter-spacing: 0.03em;
}

.ttfc-pc .page-empty {
  font-size: 1rem;
  color: var(--claret);
  text-align: center;
  padding: 40px;
}

.ttfc-pc .cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr));
  gap: 32px;
  width: 100%;
  max-width: 1100px;
  justify-items: center;
}

.ttfc-pc .page-footer {
  font-size: 0.75rem;
  color: var(--claret);
  opacity: 0.5;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
}

.ttfc-pc .page-footer a { color: inherit; }
.ttfc-pc .page-footer a:hover { text-decoration: underline; }

/* ─── Card Container ──────────────────────────────── */
.ttfc-pc .card-container {
  width: var(--card-w);
  height: var(--card-h);
  perspective: 1100px;
}

.ttfc-pc .card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}

.ttfc-pc .card-container.is-flipped .card-inner {
  transform: rotateY(180deg);
}

/* ─── Card Face (shared) ──────────────────────────── */
.ttfc-pc .card-face {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--card-r);
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow:
    0 6px 24px rgba(102,0,51,0.28),
    0 2px 6px rgba(0,0,0,0.2);
  transition: box-shadow 0.25s ease;
}

.ttfc-pc .card-container:hover .card-face {
  box-shadow:
    0 14px 40px rgba(102,0,51,0.38),
    0 4px 12px rgba(0,0,0,0.25);
}

/* Inactive face can't be clicked (mirrors the original pointer-events toggle) */
.ttfc-pc .card-container:not(.is-flipped) .card-back,
.ttfc-pc .card-container.is-flipped .card-front { pointer-events: none; }

/* ─── FRONT ───────────────────────────────────────── */
.ttfc-pc .card-front {
  transform: rotateY(0deg); /* own compositing layer — avoids Chromium skipping image repaints */
  background: var(--claret-dark);
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.ttfc-pc .front-player-img {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: top center;
  display: block;
  z-index: 0;
}

.ttfc-pc .front-player-img--placeholder {
  background: linear-gradient(160deg, var(--claret-light), var(--claret-dark));
}

.ttfc-pc .front-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
  background: linear-gradient(
    to top,
    rgba(102,0,51,0.95) 0%,
    rgba(102,0,51,0.6) 22%,
    rgba(102,0,51,0.05) 55%,
    transparent 75%
  );
}

.ttfc-pc .front-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 14px 14px 16px;
  gap: 8px;
}

.ttfc-pc .front-player-name {
  font-family: 'Bebas Neue', 'Impact', sans-serif;
  font-weight: 400;
  font-size: 1.65rem;
  letter-spacing: 0.07em;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 1px 8px rgba(0,0,0,0.6);
}

.ttfc-pc .front-crest {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
  flex-shrink: 0;
}

.ttfc-pc .front-hint {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  background: rgba(102,0,51,0.45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.15);
}

/* ─── BACK ────────────────────────────────────────── */
.ttfc-pc .card-back {
  transform: rotateY(180deg);
  background: #f7f3f8;
  display: flex;
  flex-direction: column;
}

.ttfc-pc .back-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  flex-shrink: 0;
  background: var(--claret);
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.ttfc-pc .back-thumb {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  object-position: top center;
  border: 2px solid rgba(255,255,255,0.3);
  flex-shrink: 0;
}

.ttfc-pc .back-header-text {
  flex: 1;
  min-width: 0;
}

.ttfc-pc .back-club-label {
  display: block;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 1px;
}

.ttfc-pc .back-player-name {
  display: block;
  font-family: 'Bebas Neue', 'Impact', sans-serif;
  font-weight: 400;
  font-size: 1.2rem;
  letter-spacing: 0.05em;
  color: #ffffff;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ttfc-pc .back-player-meta {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sky);
  margin-top: 2px;
}

.ttfc-pc .back-crest {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.9;
}

/* ─── Accordion scroll area ───────────────────────── */
.ttfc-pc .accordion-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  scrollbar-width: thin;
  scrollbar-color: var(--claret) transparent;
  overscroll-behavior: contain;
}

.ttfc-pc .accordion-scroll::-webkit-scrollbar { width: 3px; }
.ttfc-pc .accordion-scroll::-webkit-scrollbar-track { background: transparent; }
.ttfc-pc .accordion-scroll::-webkit-scrollbar-thumb { background: var(--claret); border-radius: 2px; }

/* ─── Accordion item ──────────────────────────────── */
.ttfc-pc .acc-item {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(102,0,51,0.12);
  background: #ffffff;
  flex-shrink: 0;
}

.ttfc-pc .acc-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px;
  background: var(--claret);
  cursor: pointer;
  text-align: left;
  gap: 6px;
}

.ttfc-pc .acc-trigger:hover { background: var(--claret-light); }
.ttfc-pc .acc-trigger[aria-expanded="true"] { background: var(--claret-dark); }

.ttfc-pc .acc-trigger-label {
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
}

.ttfc-pc .acc-chevron {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.6);
  flex-shrink: 0;
  transition: transform 0.2s ease;
  line-height: 1;
}

.ttfc-pc .acc-trigger[aria-expanded="true"] .acc-chevron { transform: rotate(180deg); }

.ttfc-pc .acc-body[hidden] { display: none; }

/* ─── Accordion content styles ────────────────────── */
.ttfc-pc .acc-rows {
  display: flex;
  flex-direction: column;
  padding: 2px 0 4px;
}

.ttfc-pc .acc-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 11px;
  border-bottom: 1px solid rgba(102,0,51,0.06);
}

.ttfc-pc .acc-row:last-child { border-bottom: none; }

.ttfc-pc .acc-row--wrap {
  flex-wrap: wrap;
  gap: 4px;
}

.ttfc-pc .acc-label {
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.6;
  color: var(--claret);
  letter-spacing: 0.03em;
  flex-shrink: 0;
  min-width: 80px;
}

.ttfc-pc .acc-val {
  font-size: 0.7rem;
  font-weight: 500;
  color: #1a1a2e;
  text-align: right;
  line-height: 1.4;
}

.ttfc-pc .acc-number {
  font-family: 'Bebas Neue', 'Impact', sans-serif;
  font-weight: 400;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--claret);
}

.ttfc-pc .seasons-list {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: flex-end;
  list-style: none;
}

.ttfc-pc .season-badge {
  font-size: 0.57rem;
  font-weight: 700;
  line-height: 1.5;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--sky-pale);
  color: var(--claret-dark);
  letter-spacing: 0.03em;
  border: 1px solid rgba(102,0,51,0.15);
}

.ttfc-pc .other-clubs-list {
  list-style: none;
  padding: 6px 11px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ttfc-pc .other-club-item {
  font-size: 0.69rem;
  line-height: 1.5;
  color: #333;
  padding: 1px 0;
}

.ttfc-pc .other-club-item::before {
  content: "→ ";
  color: var(--claret);
  font-weight: 700;
}

.ttfc-pc .narrative-text {
  font-size: 0.71rem;
  line-height: 1.65;
  color: #333;
  padding: 8px 11px 10px;
}

.ttfc-pc .narrative-text p + p { margin-top: 0.7em; }

.ttfc-pc .acc-empty {
  text-align: center;
  font-style: italic;
  color: var(--claret);
  opacity: 0.7;
  padding-top: 24px;
}

/* ─── Video button ────────────────────────────────── */
.ttfc-pc .back-video-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  background: #87CEEB;
  color: #1a1a2e;
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-top: 1px solid rgba(0,0,0,0.15);
  transition: background 0.2s, opacity 0.2s;
}

.ttfc-pc .back-video-btn:hover {
  background: #6ab8e0;
  color: #1a1a2e;
  opacity: 0.95;
}

.ttfc-pc .back-video-icon {
  font-size: 0.6rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─── Back footer ─────────────────────────────────── */
.ttfc-pc .back-footer {
  flex-shrink: 0;
  width: 100%;
  text-align: center;
  padding: 7px 12px;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--claret);
  background: rgba(102,0,51,0.07);
  border-top: 1px solid rgba(102,0,51,0.12);
  cursor: pointer;
}

.ttfc-pc .back-footer:hover { background: rgba(102,0,51,0.12); }

/* ─── Small screens ───────────────────────────────── */
@media (max-width: 600px) {
  .ttfc-pc .page-wrapper { padding: 28px 16px 40px; gap: 28px; }
  .ttfc-pc .page-header { flex-wrap: wrap; justify-content: center; }
  .ttfc-pc .page-header-spacer { display: none; }
  .ttfc-pc .page-header-text { flex-basis: 100%; }
}

@media (max-width: 360px) {
  .ttfc-pc { --card-w: calc(100vw - 32px); }
}

@media (prefers-reduced-motion: reduce) {
  .ttfc-pc .card-inner,
  .ttfc-pc .acc-chevron { transition: none; }
}

/* Keep the WP admin bar from overlapping on logged-in views */
body.ttfc-pc.admin-bar .page-wrapper { min-height: calc(100vh - 32px); }
