/* ==========================================================================
   Media Center — premium editorial press hub.
   Built entirely on the existing design tokens (variables.css). No new colours,
   no magic numbers, no inline styles. Mobile-first; scales to 1440px+.
   ========================================================================== */

/* ---- Local tokens (page-scoped rhythm) ---- */
.media {
  --media-gap: clamp(1.5rem, 1rem + 1.4vw, 2.25rem);
  --media-radius: var(--radius-md);
  --cover-ratio: 16 / 9;
}
/* Premium content width — wider than the marketing pages, still centred. */
.media .container { max-width: 1400px; }

/* ---- Page header (compact, perfectly centred editorial band) -------------- */
.media-hero {
  position: relative;
  padding-top: calc(var(--nav-h) + clamp(1.5rem, 1rem + 1.5vw, 2.25rem));
  padding-bottom: clamp(1.25rem, 0.75rem + 1.5vw, 2rem);
  text-align: center;
}
/* Divider between the header and the coverage grid — the same fading hairline
   used for section dividers across the main pages (var(--fade-line)),
   constrained to the content width rather than a flat full-bleed border. */
.media-hero::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin-inline: auto;
  width: min(calc(100% - 2 * var(--gutter)), calc(var(--container-max) - 2 * var(--gutter)));
  height: 1px;
  background: var(--fade-line);
}
.media-hero__eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.media-hero__title {
  font-family: var(--font-display);
  font-weight: var(--fw-medium);
  font-size: clamp(1.9rem, 1.3rem + 2.2vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: var(--tracking-tight);
  margin-top: var(--space-2);
}
.media-hero__sub {
  max-width: 700px;
  margin: var(--space-3) auto 0;
  color: var(--text-secondary);
  font-size: 1.125rem;
  line-height: var(--lh-body);
  text-wrap: pretty;
}
.media-hero__sub a {
  color: var(--color-yellow-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.media-hero__sub a:hover { color: var(--text-primary); }

/* ---- Shared section frame ------------------------------------------------- */
.media-section {
  padding-block: clamp(1.75rem, 1rem + 2vw, 2.75rem);
}
.media-count {
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  margin-bottom: var(--space-5);
}

/* ---- Cover system (shared by hero + cards) -------------------------------- */
.media-cover {
  position: relative;
  aspect-ratio: var(--cover-ratio);
  border-radius: var(--media-radius);
  overflow: hidden;
  background: var(--bg-elevated-2);
}
.media-cover__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.001); /* avoid sub-pixel edge gaps during zoom */
  transition: transform var(--dur-slow) var(--ease-out);
}
/* Branded placeholder cover — shown when an article has no thumbnail.
   A neutral, thin-bordered panel carrying the publication logo + name, at the
   same height as photo covers, so a missing image reads as intentional. */
.media-cover--brand {
  display: grid;
  place-items: center;
  padding: clamp(1rem, 3vw, 1.75rem);
  background: linear-gradient(160deg, var(--color-surface) 0%, var(--bg-elevated-2) 100%);
}
.media-cover__plate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: min(78%, 260px);
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--color-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease-out);
}
.media-cover__plate .media-cover__logo {
  max-height: 52px;
  max-width: 100%;
  width: auto;
  object-fit: contain;
}
.media-cover__pub {
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-tertiary);
  text-align: center;
}


/* ---- Article grid --------------------------------------------------------- */
.media-grid {
  display: grid;
  grid-template-columns: 1fr;            /* mobile: 1 column */
  gap: var(--media-gap);
  align-items: stretch;                   /* equal-height cards per row */
}

.article-card {
  position: relative;                     /* anchor for the stretched card link */
  z-index: 0;                             /* always its own stacking context, so the
                                              stretched-link overlay's layering is scoped
                                              to this card alone, at rest and on hover alike */
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--color-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
  /* Borders over shadows — a quiet resting state, a gentle lift on hover. */
  transition: transform var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}
.article-card:hover,
.article-card:focus-within {
  transform: translateY(-3px);
  border-color: var(--glass-border-strong);
  box-shadow: var(--shadow-md);
}
.article-card__media {
  display: block;
  overflow: hidden;
}
.article-card .media-cover { border-radius: 0; }
.article-card:hover .media-cover__img,
.article-card:focus-within .media-cover__img { transform: scale(1.05); }
/* Logo placeholder lifts gently in step with the photo zoom. */
.article-card:hover .media-cover__plate,
.article-card:focus-within .media-cover__plate { transform: scale(1.03); }

.article-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1 1 auto;
  padding: var(--space-4);
}
/* Publication logo leads the card — credibility before the headline. */
.article-card__head { display: flex; align-items: center; min-height: 28px; }
.article-card__logo {
  height: 28px;                 /* normalised height across all publications — tall enough that
                                    square/icon-shaped marks (Entrepreneur, Fortune India) still
                                    read clearly next to wide wordmarks at the same height */
  width: auto;
  max-width: 160px;
  object-fit: contain;
  object-position: left center;
}
.article-card__logo[src*="fortune-india.png"] { height: 34px; }
.article-card__meta {
  display: flex;
  align-items: center;
  gap: 0.5ch;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}
.article-card__cat { font-weight: var(--fw-semibold); color: var(--text-secondary); }
.article-card__title {
  font-family: var(--font-display);
  font-weight: var(--fw-medium);
  font-size: var(--fs-h4);
  line-height: 1.18;
  letter-spacing: var(--tracking-snug);
  text-wrap: balance;
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-base) var(--ease-out);
}
.article-card:hover .article-card__title,
.article-card:focus-within .article-card__title { text-decoration-color: currentColor; }
.article-card__desc {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: 1.6;
  /* Clamp to 3 lines so every card body stays consistent. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-card__cta {
  position: relative;           /* keep the label/icon above the stretched overlay */
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  align-self: flex-start;
  margin-top: auto;             /* pin the CTA to the bottom of the card */
  padding-top: var(--space-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
}
.article-card__cta:hover { color: var(--color-yellow-deep); }
.article-card__cta .btn__icon { transition: transform var(--dur-base) var(--ease-out); }
.article-card:hover .article-card__cta .btn__icon { transform: translateX(4px); }
/* Stretched link — the CTA covers the whole card, so a click anywhere on the
   tile opens the original publication (in a new tab), with one focusable link.
   z-index:1 is explicit and unambiguous — .article-card and .media-cover__img
   both spin up their own stacking context on hover (via transform), which can
   otherwise push a bare z-index:0 overlay below the photo at the exact moment
   a visitor is hovering it. */
.article-card__link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.article-card__link:focus-visible {
  outline: 2px solid var(--color-yellow-deep);
  outline-offset: 3px;
}

/* ---- Card entrance (staggered fade-up; delay set per-card in JS) ---------- */
.article-card.is-entering {
  animation: media-card-in var(--dur-slow) var(--ease-out) both;
  animation-delay: var(--card-delay, 0ms);
}
@keyframes media-card-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Responsive grid ------------------------------------------------------ */
@media (min-width: 768px) {
  .media-grid { grid-template-columns: repeat(2, 1fr); }   /* tablet: 2 columns */
}
@media (min-width: 1100px) {
  .media-grid { grid-template-columns: repeat(3, 1fr); }   /* desktop: 3 columns */
}

/* ---- Reduced motion ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .media-cover__img,
  .media-cover__plate,
  .article-card { transition: none; }
  .article-card:hover,
  .article-card:focus-within { transform: none; }
  .article-card.is-entering { animation: none; }
}
