/**
 * Miatrys Domain Scholarly — F105 Shared Card Asset (F105-C Slice 2)
 *
 * Implements the F105-B shared card asset/contract (UX v3, Marketing
 * co-reviewed, Architect architecture-gated 2026-07-08) — the `.fi-*`
 * class contract and `--fi-*` token family for the Article/Pillar/Category
 * card system shared across Home, Pillar, Category, and related-research
 * surfaces.
 *
 * SCOPE (F105-C Slice 2 only, per Coordinator kickoff 2026-07-08):
 *   - CSS asset ONLY. Not yet enqueued anywhere (Slice 4).
 *   - Does not touch static-pages.css or its .pe-scholarly-* classes —
 *     those remain live and unchanged until Slice 3 wires the renderer to
 *     emit .fi-card markup in their place.
 *   - No renderer markup changes here (Slice 3). This file styles a
 *     contract; nothing consumes it yet.
 *
 * OWNERSHIP (Architect ruling): this is the plugin-owned shared card asset
 * layer. Theme owns placement/container context only — surfaces opt into
 * these classes rather than the theme defining a parallel card system.
 *
 * NAMESPACE: `.fi-*` classes / `--fi-*` custom properties, per Architect's
 * accepted namespace (F105-B gate §4). If a future slice finds an ACTUAL
 * collision with the live theme, return with evidence rather than
 * changing the namespace preemptively (Architect's own instruction).
 *
 * PALETTE NOTE: F105-B fixes token NAMES, semantic behavior, and
 * qualitative identity ("serious, plain-language, restrained,
 * institutional" — F105-B §1) but does not specify concrete color values.
 * The values below are a first-pass restrained, theme-neutral palette
 * built to satisfy that identity; they are CSS custom properties
 * specifically so a later design pass (Marketing/UX) can retune them
 * without touching any class rule or markup. Flagged as such in the
 * Slice 2 close-out — an implementation default pending review, not a
 * silent design decision.
 *
 * ACCESSIBILITY: trust/status is never color-only anywhere in this file —
 * every --fi-trust-* token pairs with the text label already produced by
 * PE_Scholarly_Card_Trust_Formatter (F105-C Slice 1); no rule here hides
 * or shrinks that text to illegibility in favor of a color-only dot/icon.
 *
 * Browser support: modern browsers (Chrome 111+, Firefox 113+, Safari
 * 16.2+ for color-mix), matching static-pages.css's own stated baseline.
 */

/* ============================================================
   TOKEN CONTRACT (F105-B §7)
   Product-owned, shared. Every visual value below is consumed via var()
   so retuning the palette never requires touching a class rule.
   ============================================================ */
:root {
  /* §7.2 Surface tokens */
  --fi-surface:             #ffffff;
  --fi-surface-subtle:      #f6f7f8;
  --fi-surface-card:        #ffffff;
  --fi-surface-card-hover:  #fafbfc;
  --fi-surface-header:      transparent;

  /* §7.3 Text tokens */
  --fi-text-primary:    #1b1e23;
  --fi-text-secondary:  #464b54;
  --fi-text-muted:      #757b85;
  --fi-text-inverse:    #ffffff;

  /* §7.4 Border and focus tokens */
  --fi-border-subtle:  rgba(20, 24, 30, 0.10);
  --fi-border-strong:  rgba(20, 24, 30, 0.20);
  --fi-focus-ring:     #1a56db;

  /* §7.5 Link tokens */
  --fi-link:        #1a56db;
  --fi-link-hover:  #123fa6;
  --fi-link-muted:  #5b6b85;

  /* §7.6 Card tokens */
  --fi-card-radius:             8px;
  --fi-card-padding:            1.25rem;
  --fi-card-gap:                0.625rem; /* internal gap: title/subtitle/meta stack — see Slice 2 close-out re: card-gap vs grid-gap interpretation */
  --fi-card-border:             1px solid var(--fi-border-subtle);
  --fi-card-shadow:             0 1px 2px rgba(20, 24, 30, 0.04), 0 1px 4px rgba(20, 24, 30, 0.05);
  --fi-card-image-aspect-ratio: 16 / 9;
  --fi-card-min-height:         0;

  /* §7.7 Layout tokens */
  --fi-content-width:  720px;
  --fi-wide-width:     1200px;
  --fi-section-gap:    3rem;
  --fi-grid-gap:       1.5rem;
  --fi-mobile-gap:     1rem;

  /* §7.8 Trust/status tokens — ALWAYS paired with a text label; never the
     sole means of conveying tier (see §17.4 rule near the end of this file). */
  --fi-trust-strong:    #1a7f37;
  --fi-trust-moderate:  #9a6a00;
  --fi-trust-standard:  #57606a;
}

/* ============================================================
   SURFACE / CONTEXT CLASSES (F105-B §6.6)
   Scoping wrappers only. Deliberately minimal — these exist so a surface
   can opt into the shared system and so future slices have a stable hook
   for surface-specific enqueue targeting (F105-C Slice 4), not to impose
   page-level layout decisions here.
   ============================================================ */
.fi-home,
.fi-pillar-page,
.fi-category-archive,
.fi-article-page,
.fi-related-research {
  background: var(--fi-surface);
  color: var(--fi-text-primary);
}

/* ============================================================
   SECTION WRAPPERS (F105-B §6.5, anatomy §10.1)
   The pillar-page category section shell: heading + RSS affordance,
   then a card grid, then a continuation footer.
   ============================================================ */
.fi-section {
  margin-block: var(--fi-section-gap) 0;
}
.fi-section:first-of-type {
  margin-block-start: 0;
}

.fi-section__header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0;
  margin-block-end: 1rem;
  background: var(--fi-surface-header);
}

.fi-section__title {
  margin: 0;
  font-size: 1.375rem;
  line-height: 1.3;
  font-weight: 600;
  color: var(--fi-text-primary);
}
.fi-section__title a {
  color: inherit;
  text-decoration: none;
}
.fi-section__title a:hover {
  text-decoration: underline;
}

/* Pillar intro (lead sentence + category nav) — F105-B §0/§9.1 context.
   Kept deliberately close to the existing pe-scholarly-pillar-intro
   visual language (consistent voice across old and new surfaces during
   the Slice 3 transition), expressed under the new namespace/tokens. */
.fi-section__intro {
  max-width: var(--fi-content-width);
  margin-block: 0 var(--fi-section-gap);
  color: var(--fi-text-secondary);
  line-height: 1.6;
}

.fi-section__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  margin-block-start: 0.5rem;
  line-height: 1.7;
}
.fi-section__nav a {
  color: var(--fi-link);
  text-decoration: underline;
  text-underline-offset: 0.12em;
}
.fi-section__nav a:hover {
  color: var(--fi-link-hover);
}
.fi-section__nav span[aria-hidden="true"] {
  color: var(--fi-text-muted);
}

.fi-section__body {
  /* Houses the .fi-card-grid — no independent styling needed, spacing
     comes from the grid/card tokens themselves. */
}

.fi-section__footer {
  margin-block-start: 1.25rem;
}

/* RSS affordance — F105-B §10.3: visible, muted, ignorable, accessible. */
.fi-section__rss {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-inline-start: 0.6rem;
  font-size: 0.8rem;
  line-height: 1;
  color: var(--fi-link-muted);
  text-decoration: none;
}
.fi-section__rss:hover {
  color: var(--fi-text-primary);
}
.fi-section__rss svg {
  width: 0.75em;
  height: 0.75em;
  fill: currentColor;
}

/* ============================================================
   GRID / LIST WRAPPERS (F105-B §6.4, density §12.2, responsive §18)
   Fluid, auto-fit grid rather than fixed breakpoint column-counts —
   naturally settles near the contract's targets (mobile 1 / tablet 2 /
   desktop 2-3) without brittle magic-number breakpoints, while still
   respecting the explicit mobile single-column requirement below.
   ============================================================ */
.fi-card-grid {
  display: grid;
  max-width: var(--fi-wide-width);
  gap: var(--fi-grid-gap);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.fi-card-grid--article {
  /* Article cards read comfortably a little wider than pillar cards. */
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.fi-card-grid--pillar {
  /* F105-B §9.3: all seven pillar cards share equal structural weight —
     align-items: stretch (grid default) plus each card set to display:flex
     with flex:1 (below) is what makes that equal-height behavior real,
     not just a shared class name. */
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.fi-card-grid--category {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Compact list variant (F105-B §12.3) — linear, denser, for contexts like
   category archives with many items. Cards inside stack vertically;
   .fi-card--compact (below) handles the internal horizontal layout. */
.fi-card-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.fi-card-list > .fi-card {
  border-radius: 0;
  border-inline: none;
}
.fi-card-list > .fi-card + .fi-card {
  border-block-start: none;
}
.fi-card-list > .fi-card:not(:last-child) {
  border-block-end: var(--fi-card-border);
}

/* ============================================================
   CARD ROOT + INTERNALS (F105-B §6.2, §6.3)
   ============================================================ */
.fi-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: var(--fi-card-min-height);
  background: var(--fi-surface-card);
  border: var(--fi-card-border);
  border-radius: var(--fi-card-radius);
  box-shadow: var(--fi-card-shadow);
  overflow: hidden;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.fi-card:hover {
  background: var(--fi-surface-card-hover);
}
/* When a card contains a focused element (e.g. keyboard focus lands on
   the title link), strengthen the card's own border slightly as a
   secondary visual cue alongside the link's own focus-visible outline
   below — an ordinary application of the already-specified stronger
   border token, not a new state or design decision. */
.fi-card:focus-within {
  border-color: var(--fi-border-strong);
}

.fi-card__media {
  display: block;
  width: 100%;
  aspect-ratio: var(--fi-card-image-aspect-ratio);
  overflow: hidden;
  background: var(--fi-surface-subtle);
}

/* .fi-card__image is kept as a class hook for any hand-built <img> this
   codebase ever emits directly; the descendant selector below is the
   PRIMARY targeting mechanism, since wp:post-featured-image (a native WP
   dynamic block) renders its own <img> without a way to place a literal
   class on it from the renderer — discovered while wiring
   pillar-page-renderer.php's actual .fi-card markup (F105-C Slice 3). */
.fi-card__image,
.fi-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fi-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--fi-card-padding);
  gap: var(--fi-card-gap);
}

.fi-card__eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--fi-text-muted);
}

.fi-card__title {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.4;
  font-weight: 600;
  color: var(--fi-text-primary);
  /* §8.4: 2-3 line clamp on dense grids; feature cards may override this
     with a higher/removed clamp at the point they're actually built. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* .fi-card__title-link is kept as a class hook (used directly by the
   compact/feature markup this file already accounts for); the descendant
   selector is the PRIMARY mechanism for wp:post-title's own auto-generated
   <a>, same reasoning as .fi-card__image above. */
.fi-card__title-link,
.fi-card__title a {
  color: inherit;
  text-decoration: none;
}
.fi-card__title-link:hover,
.fi-card__title a:hover {
  text-decoration: underline;
}
/* §17.1: title link is the primary link; if the whole card is ever made
   clickable, this pseudo-element extends its hit target without needing
   a second, competing anchor around the image. */
.fi-card__title-link::after,
.fi-card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
}
.fi-card {
  position: relative;
}
.fi-card__body {
  position: relative;
  z-index: 1;
}

.fi-card__subtitle {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--fi-text-secondary);
}

.fi-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.6rem;
  margin-block-start: auto;
  padding-block-start: 0.5rem;
  font-size: 0.8125rem;
  color: var(--fi-text-muted);
}

.fi-card__meta-item {
  display: inline-flex;
  align-items: center;
}
.fi-card__meta-item + .fi-card__meta-item::before {
  content: "\00b7";
  margin-inline-end: 0.6rem;
  color: var(--fi-text-muted);
}

/* Trust/provenance cue (F105-B §8.7, §16) — visible but not heavy. Text
   ALWAYS present; color is a supplementary accent only (§17.4). */
.fi-card__trust {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8125rem;
  color: var(--fi-text-muted);
}
.fi-card__provenance {
  color: var(--fi-text-muted);
}
.fi-card__signals {
  font-weight: 500;
}
/* Trust tier accent color — supplementary only. The label text itself
   ("Publication Signals: Strong") is what actually conveys the tier;
   this color never substitutes for it. */
[data-fi-trust-tier="strong"]   .fi-card__signals { color: var(--fi-trust-strong); }
[data-fi-trust-tier="moderate"] .fi-card__signals { color: var(--fi-trust-moderate); }
[data-fi-trust-tier="standard"] .fi-card__signals { color: var(--fi-trust-standard); }

.fi-card__actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-block-start: 0.5rem;
}

.fi-card__continuation {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fi-link);
  text-decoration: none;
}
.fi-card__continuation:hover {
  color: var(--fi-link-hover);
  text-decoration: underline;
}

.fi-card__empty-message {
  padding: var(--fi-card-padding);
  color: var(--fi-text-muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* ============================================================
   CARD TYPE VARIANTS (F105-B §8 Article, §9 Pillar, §10 Category anatomy)
   ============================================================ */

/* --- Article card (§8) --- */
.fi-card--article .fi-card__title {
  font-size: 1.0625rem;
}

/* --- Pillar card (§9) --- */
.fi-card--pillar {
  /* §9.3 equal weight: flex:1 on the grid item + shared min-height token
     is what actually keeps 7 pillar cards visually level regardless of
     how much content each currently has. */
  flex: 1;
}
.fi-card--pillar .fi-card__title {
  font-size: 1.125rem;
  -webkit-line-clamp: 2;
}
.fi-card--pillar .fi-card__subtitle {
  /* §9.2: "short description / orientation line" — slightly more
     restrained than an article subtitle, it's orientation copy not a
     usefulness-of-this-specific-item line. */
  color: var(--fi-text-secondary);
}

/* --- Category card / section (§10) --- */
.fi-card--category .fi-card__title {
  font-size: 1rem;
  -webkit-line-clamp: 2;
}

/* ============================================================
   COMPACT / FEATURE / LIST DENSITY VARIANTS (F105-B §12.3, §12.1)
   ============================================================ */

/* Compact — denser horizontal layout for high-item-count contexts
   (e.g. category archives). Media sits beside the body rather than above. */
.fi-card--compact {
  flex-direction: row;
  align-items: flex-start;
  border-radius: 0;
  box-shadow: none;
}
.fi-card--compact .fi-card__media {
  width: 7.5rem;
  aspect-ratio: var(--fi-card-image-aspect-ratio);
  flex-shrink: 0;
}
.fi-card--compact .fi-card__body {
  padding: 0.85rem 1rem;
  gap: 0.3rem;
}
.fi-card--compact .fi-card__title {
  font-size: 0.9375rem;
  -webkit-line-clamp: 2;
}
.fi-card--compact .fi-card__subtitle {
  font-size: 0.875rem;
  -webkit-line-clamp: 2;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
}

/* Feature — more generous display for a single highlighted card
   (F105-B §8.4: "more generous display for feature cards"). */
.fi-card--feature .fi-card__title {
  font-size: 1.375rem;
  -webkit-line-clamp: 4;
}
.fi-card--feature .fi-card__subtitle {
  font-size: 1rem;
}

/* ============================================================
   IMAGE / NO-IMAGE STATES (F105-B §13)
   ============================================================ */
.fi-card--no-image .fi-card__media {
  display: none;
}
/* §13.2: no reserved empty space, no broken-image icon, no loud generic
   fill — the body simply starts at the top of the card. Text-forward,
   per UX's explicit preference over a generic decorative placeholder. */

/* ============================================================
   SUBTITLE / NO-SUBTITLE STATES (F105-B §14)
   ============================================================ */
.fi-card--no-subtitle .fi-card__subtitle {
  display: none;
}
/* §14.2: collapse the region, no visual gap — omitting the element
   entirely (display:none, no reserved min-height) is what actually
   satisfies "do not leave visual gap" rather than hiding it with opacity. */

/* ============================================================
   THIN / EMPTY PILLAR STATES (F105-B §15)
   ============================================================ */
.fi-card--thin {
  /* §15.2: a thin pillar keeps equal card weight, title, description,
     link, consistent spacing — visually IDENTICAL shell to a full
     pillar card. No graying-out, no reduced opacity, no shrinking.
     Deliberately: no rule differs from .fi-card--pillar here. */
}

.fi-card--empty .fi-card__empty-message {
  font-style: normal; /* explicitly not italicized — italics can read as
                         an apologetic/uncertain tone; plain text reads
                         as the intentional, dignified state the contract
                         requires (§15.2 "should not visually apologize"). */
}

/* ============================================================
   HOMEPAGE MODULES (F105-HOME Step 3, 2026-07-09)
   ============================================================ */

/* Lead band — restrained orientation line. Per UX's brief: restrained,
   text-forward, not splashy, not news-urgent, not database-like, not
   sales-like. No search box here unless separately ruled. */
.fi-home-lead {
  max-width: var(--fi-content-width);
  margin-inline: auto;
  padding-block: 2rem;
}
.fi-home-lead__line {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--fi-text-primary);
  margin: 0;
}

/* Section label — e.g. "Recently added research" above primary/secondary.
   Reuses .fi-card__eyebrow's exact typography rather than inventing a
   second label style. */
.fi-home-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--fi-text-muted);
  margin-block-end: 0.75rem;
}

/* Primary + secondary content area. Primary gets a full-width two-column
   layout (image beside body) paired with the existing fi-card--feature
   typography variant; secondary reuses the existing .fi-card-grid
   pattern at standard density — no new grid system introduced. */
.fi-home-primary {
  max-width: var(--fi-wide-width);
  margin-inline: auto;
  margin-block-end: 1.5rem;
}
.fi-home-primary .fi-card {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: var(--fi-card-gap);
}
.fi-home-secondary {
  max-width: var(--fi-wide-width);
  margin-inline: auto;
}

/* Closing band — trust strip + newsletter context. Calm, compact,
   deliberately not louder than the research modules above it (UX §7.4). */
.fi-home-closing {
  max-width: var(--fi-content-width);
  margin-inline: auto;
  padding-block: 2rem;
  border-top: var(--fi-card-border);
  margin-block-start: 2rem;
}
.fi-home-closing__trust {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--fi-text-muted);
  margin: 0 0 1.5rem 0;
}
.fi-home-closing__newsletter-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--fi-text-primary);
  margin: 0 0 0.375rem 0;
}
.fi-home-closing__newsletter-copy {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--fi-text-muted);
  margin: 0;
}

/* Secondary: daily pillar spotlight. Visually subordinate to the primary
   above it, and clearly its own module rather than a continuation of the
   primary's grid — the two are different mechanisms and should not read as
   one list (F105-HOME Step 3R). */
.fi-home-spotlight {
  max-width: var(--fi-wide-width);
  margin-inline: auto;
  margin-block-start: 2rem;
}
.fi-home-subsection-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--fi-text-muted);
  margin-block-end: 0.75rem;
}

/* Across the library: automatic, date-agnostic cross-section. The year is
   corpus CONTEXT, not freshness — set quietly above the card, never styled
   as a badge or a currency claim. */
.fi-home-across {
  max-width: var(--fi-wide-width);
  margin-inline: auto;
  margin-block-start: 3rem;
}
.fi-across__item {
  display: flex;
  flex-direction: column;
}
.fi-across__context {
  font-size: 0.75rem;
  color: var(--fi-text-muted);
  margin: 0 0 0.375rem 0;
}

/* ============================================================
   ACCESSIBILITY (F105-B §17)
   ============================================================ */

/* §17.3: every interactive element gets a visible focus state. */
.fi-card__title-link:focus-visible,
.fi-card__title a:focus-visible,
.fi-card__continuation:focus-visible,
.fi-section__rss:focus-visible,
.fi-section__nav a:focus-visible,
.fi-section__title a:focus-visible {
  outline: 2px solid var(--fi-focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

/* §17.4: trust tier is never color-alone. This rule exists as a guard,
   not a decoration — .fi-card__signals text content is the Marketing-
   approved label ("Publication Signals: Strong") produced by
   PE_Scholarly_Card_Trust_Formatter; color above is supplementary only
   and every rule that sets a trust color leaves the text fully visible
   at normal size and contrast. Nothing in this file conveys tier through
   color, icon, or shape alone. */

/* §17.5: heading order — .fi-section__title is the category/pillar h2;
   .fi-card__title is set as an h3 or lower by the markup (Slice 3's
   concern) so card titles never jump above their owning section. No
   heading-level CSS override lives here; only the markup enforces order. */

/* ============================================================
   RESPONSIVE (F105-B §18)
   ============================================================ */

/* Mobile: single column, comfortable padding, no cramped touch targets. */
@media (max-width: 600px) {
  .fi-card-grid,
  .fi-card-grid--article,
  .fi-card-grid--pillar,
  .fi-card-grid--category {
    grid-template-columns: 1fr;
    gap: var(--fi-mobile-gap);
  }
  .fi-card__body {
    padding: 1rem;
  }
  .fi-card--compact {
    flex-direction: row;
  }
  .fi-card--compact .fi-card__media {
    width: 5.5rem;
  }
  .fi-section__title {
    font-size: 1.1875rem;
  }
}

/* Tablet: 2-column grids explicitly, rather than leaving auto-fit to
   decide, so the contract's stated tablet behavior (§18.2) is guaranteed
   rather than incidental at common tablet widths. */
@media (min-width: 601px) and (max-width: 960px) {
  .fi-card-grid,
  .fi-card-grid--article,
  .fi-card-grid--pillar,
  .fi-card-grid--category {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* §18.4: no horizontal overflow — belt-and-suspenders on top of the
   fluid grid above, since card content (long titles/URLs/meta rows)
   is the most common real-world cause of overflow in practice. */
.fi-card,
.fi-card__media,
.fi-card__image {
  max-width: 100%;
}
.fi-card__title,
.fi-card__subtitle,
.fi-card__meta {
  overflow-wrap: break-word;
  word-break: break-word;
}
