/* ============================================================
   Section Fronts Edition — CSS
   Three bold magazine-style section dividers with article grids
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --masthead-h: 48px;
  --toc-w: 180px;
  --accent-franchise: #4a90d9;
  --accent-studio:    #888888;
  --accent-composer:  #c0394b;
  --bg-franchise:     #0f1a2e;
  --bg-studio:        #1a1a1a;
  --bg-composer:      #1e0a0f;
  --grid-gap: 20px;
  --card-radius: 6px;
  --font-sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background: #0a0a0a;
  color: #e8e8e8;
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  /* Offset for fixed masthead */
  padding-top: var(--masthead-h);
}

/* ---------- Masthead ---------- */
.sf-masthead {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--masthead-h);
  background: #080808;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 1000;
}

.sf-masthead__wordmark {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-variant: small-caps;
  color: #ffffff;
  text-decoration: none;
  opacity: 0.9;
}

.sf-masthead__wordmark:hover {
  opacity: 1;
}

/* ---------- Layout wrapper ---------- */
.sf-layout {
  display: flex;
  min-height: calc(100vh - var(--masthead-h));
}

/* ---------- Fixed TOC sidebar (desktop) ---------- */
.sf-toc {
  position: fixed;
  top: var(--masthead-h);
  left: 0;
  width: var(--toc-w);
  height: calc(100vh - var(--masthead-h));
  background: #080808;
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 16px;
  z-index: 900;
  gap: 10px;
}

.sf-toc__label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  margin-bottom: 12px;
  padding-left: 4px;
}

.sf-toc__pill {
  display: block;
  padding: 8px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sf-toc__pill:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.06);
}

.sf-toc__pill.is-active {
  color: #fff;
  border-color: currentColor;
  background: rgba(255,255,255,0.08);
}

.sf-toc__pill--franchise.is-active { color: var(--accent-franchise); border-color: var(--accent-franchise); }
.sf-toc__pill--studio.is-active    { color: var(--accent-studio);    border-color: var(--accent-studio); }
.sf-toc__pill--composer.is-active  { color: var(--accent-composer);  border-color: var(--accent-composer); }

/* ---------- Main content ---------- */
.sf-main {
  margin-left: var(--toc-w);
  flex: 1;
  min-width: 0;
}

/* ---------- Section Front Panel ---------- */
.sf-section {
  position: relative;
  height: 70vh;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 48px 60px;
}

/* Left accent bar */
.sf-section::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 12px;
  height: 0;           /* Animated to 100% */
  background: currentColor;
  transition: none;
}

/* Ghost text backdrop */
.sf-section__ghost {
  position: absolute;
  bottom: -0.1em;
  left: 40px;
  font-size: clamp(80px, 10vw, 160px);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #ffffff;
  opacity: 0;          /* Animated in */
  white-space: nowrap;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  will-change: transform, opacity;
}

/* Content layer */
.sf-section__content {
  position: relative;
  z-index: 2;
  max-width: 700px;
}

.sf-section__label {
  font-size: clamp(20px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0;          /* Animated in */
  transform: translateX(-30px);
  display: block;
  margin-bottom: 16px;
}

.sf-section__count {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  margin-bottom: 20px;
  display: block;
}

.sf-section__intro {
  font-size: 16px;
  color: rgba(255,255,255,0.65);
  font-style: italic;
  font-family: var(--font-serif);
  line-height: 1.6;
  opacity: 0;          /* Animated with label */
}

/* Section-specific colours */
.sf-section--franchise {
  background: var(--bg-franchise);
  color: var(--accent-franchise);
}
.sf-section--studio {
  background: var(--bg-studio);
  color: var(--accent-studio);
}
.sf-section--composer {
  background: var(--bg-composer);
  color: var(--accent-composer);
}

/* ---------- Article Grid ---------- */
.sf-grid {
  background: #0e0e0e;
  padding: 40px 48px;
  border-top: 1px solid rgba(255,255,255,0.04);
}

.sf-grid__inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--grid-gap);
}

/* ---------- Article Card ---------- */
.sf-card {
  background: #141414;
  border-radius: var(--card-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  position: relative;
  border: 1px solid rgba(255,255,255,0.06);
  opacity: 0;          /* Animated in */
  transform: translateY(40px);
  will-change: transform, opacity;
}

/* Card image area */
.sf-card__image-wrap {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
  flex-shrink: 0;
}

.sf-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.sf-card:hover .sf-card__image {
  transform: scale(1.04);
}

/* Gradient overlay */
.sf-card__gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, var(--card-bg, #141414) 100%);
  pointer-events: none;
}

/* Primary colour tint overlay */
.sf-card__tint {
  position: absolute;
  inset: 0;
  background: var(--card-primary, transparent);
  opacity: 0.15;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* Year badge */
.sf-card__year {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.7);
  color: rgba(255,255,255,0.8);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.15);
}

/* Card body */
.sf-card__body {
  padding: 14px 16px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sf-card__name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: #f0f0f0;
  transition: transform 0.2s ease;
}

.sf-card__tagline {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  line-height: 1.4;
  font-style: italic;
  font-family: var(--font-serif);
}

.sf-card__highlights {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}

.sf-card__highlights li {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  line-height: 1.4;
  padding-left: 12px;
  position: relative;
}

.sf-card__highlights li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: rgba(255,255,255,0.3);
}

/* Card footer */
.sf-card__footer {
  padding: 10px 16px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.sf-card__page-link {
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  text-decoration: none;
  transition: color 0.15s;
}

.sf-card__page-link:hover {
  color: rgba(255,255,255,0.7);
}

.sf-card__page-sep {
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  margin: 0 1px;
}

/* ---------- Footer ---------- */
.sf-footer {
  background: #080808;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 24px 48px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.sf-footer a {
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.15s;
}

.sf-footer a:hover {
  color: rgba(255,255,255,0.7);
}

.sf-footer__sep {
  color: rgba(255,255,255,0.15);
  font-size: 12px;
}

/* ---------- Loading / Error states ---------- */
.sf-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  font-size: 14px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sf-error {
  padding: 40px 48px;
  color: rgba(255,80,80,0.7);
  font-size: 13px;
}

/* ---------- Mobile sticky TOC ---------- */
.sf-toc-mobile {
  display: none;
  position: sticky;
  top: var(--masthead-h);
  background: #080808;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 8px 16px;
  z-index: 800;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
}

.sf-toc-mobile .sf-toc__pill {
  font-size: 10px;
  padding: 5px 10px;
  flex-shrink: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .sf-grid__inner {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sf-toc {
    display: none;
  }

  .sf-toc-mobile {
    display: flex;
  }

  .sf-main {
    margin-left: 0;
  }

  .sf-section {
    padding: 36px 24px;
    height: auto;
    min-height: 55vh;
  }

  .sf-section__ghost {
    left: 16px;
  }

  .sf-grid {
    padding: 28px 16px;
  }

  .sf-grid__inner {
    grid-template-columns: 1fr;
  }

  .sf-footer {
    padding: 20px 16px;
  }
}

/* ---------- prefers-reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  /* Reveal all animated elements immediately */
  .sf-section::before {
    height: 100% !important;
  }

  .sf-section__ghost {
    opacity: 0.08 !important;
    transform: none !important;
  }

  .sf-section__label,
  .sf-section__intro {
    opacity: 1 !important;
    transform: none !important;
  }

  .sf-card {
    opacity: 1 !important;
    transform: none !important;
  }

  .sf-card__image {
    transition: none;
  }

  html {
    scroll-behavior: auto;
  }

  /* CSS-only :target highlighting for TOC */
  .sf-toc__pill--franchise:target,
  .sf-toc__pill--studio:target,
  .sf-toc__pill--composer:target {
    color: #fff;
  }
}
