/* =====================================================================
   FPL Analyzer Articles (FAA)

   Layout follows the Premier League "Fantasy is LIVE" block: one wide lead
   card, a stacked list of secondary items beside it, then a row of cards
   underneath. Retuned to the FPL Analyzer palette rather than the PL purple,
   and mobile-first — below 900px the columns collapse to one and the card row
   becomes a snap-scrolling carousel.
   ===================================================================== */

.faa-wrap { padding-bottom: 32px; }

/* ─── Lead block ─────────────────────────────────────────────────────── */

.faa-lead-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.faa-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
}

.faa-lead {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  text-align: left;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.faa-lead-media {
  position: relative;
  aspect-ratio: 16 / 8.5;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.16), rgba(233, 30, 99, 0.16));
  overflow: hidden;
}

.faa-lead-media img,
.faa-card-media img,
.faa-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.faa-lead-body { padding: 20px 22px 24px; }

.faa-lead-body h2 {
  margin: 0 0 10px;
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  line-height: 1.15;
  font-weight: 800;
  color: #fff;
}

.faa-lead-body p {
  margin: 0 0 14px;
  color: var(--text-secondary, rgba(255, 255, 255, 0.65));
  font-size: 0.92rem;
  line-height: 1.55;
}

/* ─── Secondary list ─────────────────────────────────────────────────── */

.faa-list { display: flex; flex-direction: column; }

.faa-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 14px;
  align-items: start;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease;
}

.faa-item:last-child { border-bottom: 0; }
.faa-item:hover { background: rgba(255, 255, 255, 0.04); }

.faa-item-title {
  margin: 0 0 6px;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
  /* Three lines then ellipsis, so every row keeps the same height. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.faa-item-thumb {
  width: 96px;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  flex: 0 0 auto;
}

/* ─── Tags and bylines ───────────────────────────────────────────────── */

.faa-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pl-cyan, #00d4ff);
}

/* ─── Feed entrance ──────────────────────────────────────────────────────
   The feed had no motion at all: every card appeared in the same frame, which
   reads as a flash rather than as content arriving. A short stagger gives the
   eye an order to follow.

   Kept deliberately small: 200ms per card, 40ms apart, and only the first few
   are delayed — beyond that the last card would wait longer than it took the
   data to load. `both` holds the pre-state so nothing flashes at full opacity
   before its turn. Decorative only; it never gates interaction. */

@keyframes faaCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* Opening a story replaced the feed in a single frame. Growing it slightly
   from the feed's plane bridges the swap. Starts at 0.98, never 0 — nothing
   in the physical world appears out of nothing. */
@keyframes faaReaderIn {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .faa-reader {
    animation: faaReaderIn 220ms cubic-bezier(0.23, 1, 0.32, 1) both;
    transform-origin: top center;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .faa-lead,
  .faa-item {
    animation: faaCardIn 200ms cubic-bezier(0.23, 1, 0.32, 1) both;
  }

  .faa-item:nth-child(1) { animation-delay: 40ms; }
  .faa-item:nth-child(2) { animation-delay: 80ms; }
  .faa-item:nth-child(3) { animation-delay: 120ms; }
  .faa-item:nth-child(4) { animation-delay: 160ms; }
  .faa-item:nth-child(n + 5) { animation-delay: 200ms; }
}

.faa-tag.quiz { color: var(--pl-yellow, #ffd700); }
.faa-tag.poll { color: var(--pl-magenta, #e91e63); }
.faa-tag.news { color: var(--pl-cyan, #00d4ff); }

/* Attribution for gathered stories. Quiet enough not to compete with the
   headline, but always present — the words and the photograph are the
   publisher's, not ours. */
.faa-credit {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--text-muted, rgba(255, 255, 255, 0.45));
}

.faa-credit a {
  color: var(--pl-cyan, #00d4ff);
  text-decoration: none;
}

.faa-credit a:hover { text-decoration: underline; }

.faa-credit-img { opacity: 0.75; }

.faa-reader-media {
  margin: 18px 0 4px;
  border-radius: 14px;
  overflow: hidden;
}

.faa-reader-media img {
  display: block;
  width: 100%;
  height: auto;
}

/* Sends the reader to the publisher for the rest of the story. FAN carries an
   extract and a link, never the whole article. */
.faa-readmore {
  display: inline-block;
  margin-top: 18px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--pl-green, #00ff87);
  text-decoration: none;
}

.faa-readmore:hover { text-decoration: underline; }

/* Credit for a story FAN wrote itself: the facts came from the publisher, the
   words did not. */
.faa-sourceline {
  margin-top: 20px;
  font-size: 0.78rem;
  color: var(--text-muted, rgba(255, 255, 255, 0.45));
}

.faa-sourceline a { color: var(--pl-cyan, #00d4ff); text-decoration: none; }
.faa-sourceline a:hover { text-decoration: underline; }

.faa-byline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.72rem;
  color: var(--text-muted, rgba(255, 255, 255, 0.45));
}

/* ─── Card row ───────────────────────────────────────────────────────── */

.faa-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 30px 0 14px;
}

.faa-row-head h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
}

.faa-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 16px;
}

.faa-card {
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  font: inherit;
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.faa-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 212, 255, 0.35);
}

.faa-card-media {
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.14), rgba(233, 30, 99, 0.14));
  overflow: hidden;
}

.faa-card-body { padding: 13px 14px 16px; }

.faa-card-body h4 {
  margin: 6px 0 8px;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.32;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Shown when a post carries no image of its own. */
.faa-ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  letter-spacing: 0.14em;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.28);
}

/* ─── Reader ─────────────────────────────────────────────────────────── */

.faa-reader { max-width: 760px; margin: 0 auto; padding: 4px 0 40px; }

.faa-reader h1 {
  margin: 12px 0;
  font-size: clamp(1.5rem, 4vw, 2.3rem);
  line-height: 1.18;
  color: #fff;
}

.faa-reader .faa-block-text {
  margin: 0 0 18px;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-secondary, rgba(255, 255, 255, 0.75));
  white-space: pre-wrap;        /* the author's paragraph breaks are meaningful */
  overflow-wrap: anywhere;
}

.faa-reader figure { margin: 0 0 20px; }
.faa-reader figure img { width: 100%; border-radius: 12px; display: block; }

.faa-reader figcaption {
  margin-top: 7px;
  font-size: 0.78rem;
  color: var(--text-muted, rgba(255, 255, 255, 0.45));
  text-align: center;
}

.faa-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary, #ccc);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

/* ─── Composer ───────────────────────────────────────────────────────── */

.faa-composer { display: flex; flex-direction: column; gap: 14px; }

.faa-input,
.faa-textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 16px;              /* 16px stops iOS Safari zooming the page on focus */
  color: var(--text-primary, #fff);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
}

.faa-textarea { min-height: 150px; resize: vertical; line-height: 1.6; }

.faa-input:focus-visible,
.faa-textarea:focus-visible {
  outline: none;
  border-color: var(--pl-cyan, #00d4ff);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.22);
}

.faa-blocks { display: flex; flex-direction: column; gap: 12px; }

.faa-block {
  position: relative;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 12px;
}

.faa-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted, rgba(255, 255, 255, 0.45));
}

.faa-mini-btn {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary, #ccc);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.faa-mini-btn.danger { color: var(--pl-red, #ff4d4d); border-color: rgba(255, 77, 77, 0.35); }

.faa-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.faa-status { min-height: 20px; font-size: 0.82rem; color: var(--text-muted, rgba(255, 255, 255, 0.5)); }
.faa-status.err { color: var(--pl-red, #ff4d4d); }
.faa-status.ok { color: var(--pl-green, #00ff87); }

.faa-blocked-note {
  padding: 14px 16px;
  border: 1px solid rgba(255, 77, 77, 0.35);
  border-radius: 12px;
  background: rgba(255, 77, 77, 0.08);
  color: #ffb3b3;
  font-size: 0.86rem;
  line-height: 1.5;
}

/* ─── Poll / quiz ────────────────────────────────────────────────────── */

.faa-choice {
  position: relative;
  display: block;
  width: 100%;
  min-height: 48px;
  margin-bottom: 9px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

.faa-choice:hover { border-color: rgba(0, 212, 255, 0.4); }
.faa-choice.correct { border-color: var(--pl-green, #00ff87); }
.faa-choice.wrong { border-color: var(--pl-red, #ff4d4d); }
.faa-choice[disabled] { cursor: default; }

/* The result bar sits behind the label, like an X poll. */
.faa-choice-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: rgba(0, 212, 255, 0.18);
  transition: width 0.5s ease;
  z-index: 0;
}

.faa-choice-label,
.faa-choice-pct { position: relative; z-index: 1; }

.faa-choice-pct {
  float: right;
  color: var(--text-secondary, #ccc);
  font-variant-numeric: tabular-nums;
}

.rtl .faa-choice-fill { inset: 0 0 0 auto; }
.rtl .faa-choice-pct { float: left; }

/* ─── Admin block list ───────────────────────────────────────────────── */

.faa-admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.faa-admin-row:last-child { border-bottom: 0; }
.faa-admin-name { font-weight: 700; font-size: 0.88rem; color: #fff; }
.faa-admin-meta { font-size: 0.74rem; color: var(--text-muted, rgba(255, 255, 255, 0.45)); }

.faa-pill {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.faa-pill.blocked { background: rgba(255, 77, 77, 0.16); color: #ff8080; }
.faa-pill.ok { background: rgba(0, 255, 135, 0.13); color: var(--pl-green, #00ff87); }

/* ─── Mobile ─────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .faa-lead-grid { grid-template-columns: 1fr; gap: 14px; }
  .faa-lead-body { padding: 16px 16px 18px; }
  .faa-row-head { margin: 24px 0 12px; }
  .faa-row-head h3 { font-size: 1.12rem; }

  /* A snap carousel reads better than a 2-up grid on a phone, and matches how
     the Premier League page behaves at this width. */
  .faa-cards {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    margin: 0 -16px;
    padding-inline: 16px;
    scrollbar-width: none;
  }
  .faa-cards::-webkit-scrollbar { display: none; }
  .faa-card { flex: 0 0 74%; max-width: 280px; scroll-snap-align: start; }

  .faa-item { grid-template-columns: minmax(0, 1fr) 78px; padding: 12px 14px; min-height: 44px; }
  .faa-item-thumb { width: 78px; }

  .faa-reader { padding-top: 0; }
  .faa-reader .faa-block-text { font-size: 0.97rem; line-height: 1.7; }

  .faa-actions .faa-mini-btn,
  .faa-actions button { min-height: 44px; }

  .faa-admin-row { grid-template-columns: 1fr; gap: 8px; }
}

@media (max-width: 380px) {
  .faa-card { flex-basis: 84%; }
  .faa-lead-body h2 { font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .faa-card, .faa-choice-fill { transition: none; }
  .faa-card:hover { transform: none; }
}
