/* ============================================
   NARRATIVE FRAMES EXPLORER
   css/page-narrative-frames-explorer.css
   ============================================ */

/* ---- Layout: Dual-mode (Grid + Detail) ---- */

.nfe-page { min-height: 100vh; }

/* Grid mode: standard flow */
.nfe-page[data-mode="grid"] .nfe-detail { display: none; }
.nfe-page[data-mode="grid"] .nfe-grid-view { display: block; }

/* Detail mode: sidebar + main */
.nfe-page[data-mode="detail"] .nfe-grid-view { display: none; }
.nfe-page[data-mode="detail"] .nfe-detail { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 53px); }

/* ---- Sticky Top Bar ---- */

.nfe-topbar {
  background: var(--color-grey-light, #F5F5F3);
  border-bottom: 1px solid var(--grey-200, #E0E0E0);
  padding: 0.75rem var(--site-gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nfe-topbar__left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nfe-topbar__back {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: var(--font-weight-medium);
  color: var(--color-blue);
  text-decoration: none;
  white-space: nowrap;
}
.nfe-topbar__back:hover { text-decoration: underline; }

.nfe-topbar__title {
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.3vw, 1.2rem);
  font-weight: var(--font-weight-bold);
  color: var(--color-black);
  letter-spacing: -0.01em;
}

.nfe-topbar__right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nfe-topbar__credit {
  font-size: 0.78rem;
  color: var(--grey-500, #999);
}

/* ---- Hero Strip ---- */

.nfe-hero {
  background: var(--color-blue);
  color: var(--color-white);
  padding: clamp(2.5rem, 5vw, 4rem) var(--site-gutter);
  position: relative;
  overflow: hidden;
}

.nfe-hero::after {
  content: '';
  position: absolute;
  top: -60%;
  right: -10%;
  width: 50vw;
  height: 200%;
  background: radial-gradient(ellipse, rgba(245, 197, 24, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.nfe-hero__inner {
  max-width: var(--site-max-width);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.nfe-hero__eyebrow {
  font-size: clamp(0.78rem, 0.95vw, 0.88rem);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 0.75rem;
}

.nfe-hero__title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.5vw, 3rem);
  font-weight: var(--font-weight-bold);
  line-height: 1.1;
  max-width: 700px;
  margin-bottom: 1rem;
}

.nfe-hero__dot {
  display: inline-block;
  width: 0.35em;
  height: 0.35em;
  background: var(--color-yellow);
  border-radius: 50%;
  vertical-align: baseline;
  margin-left: 0.02em;
}

.nfe-hero__subtitle {
  font-size: clamp(0.92rem, 1.1vw, 1.02rem);
  line-height: 1.6;
  max-width: 560px;
  opacity: 0.85;
  margin-bottom: 1.5rem;
}

.nfe-hero__stats {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
}

.nfe-hero__stat { display: flex; flex-direction: column; gap: 0.15rem; }

.nfe-hero__stat-value {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.5vw, 2.2rem);
  font-weight: var(--font-weight-bold);
  color: var(--color-yellow);
}

.nfe-hero__stat-label {
  font-size: 0.78rem;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---- "Surprise Me" Button ---- */

.nfe-surprise__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.85em 2em;
  background: var(--color-yellow);
  color: var(--color-black);
  border: none;
  border-radius: 50px;
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 1.1vw, 1.05rem);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}

.nfe-surprise__btn:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 32px rgba(245, 197, 24, 0.4);
}

.nfe-surprise__btn:active { transform: scale(0.97); }

.nfe-surprise__btn svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.nfe-surprise__btn:hover svg { transform: rotate(180deg); }

/* Idle pulse animation */
@keyframes surprisePulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(245, 197, 24, 0.2); }
  50% { box-shadow: 0 4px 24px rgba(245, 197, 24, 0.45); }
}

.nfe-surprise__btn--idle {
  animation: surprisePulse 3s ease-in-out infinite;
}

/* Shimmer effect on pills during Surprise Me */
@keyframes pillShimmer {
  0% { filter: brightness(1); transform: scale(1); }
  50% { filter: brightness(1.3); transform: scale(1.05); }
  100% { filter: brightness(1); transform: scale(1); }
}

.nfe-pill--shimmer {
  animation: pillShimmer 0.4s ease-in-out;
}

/* Winner glow */
@keyframes pillWinner {
  0% { box-shadow: 0 0 0 0 rgba(245, 197, 24, 0.6); transform: scale(1); }
  50% { box-shadow: 0 0 0 12px rgba(245, 197, 24, 0); transform: scale(1.15); }
  100% { box-shadow: 0 0 0 0 rgba(245, 197, 24, 0); transform: scale(1.15); }
}

.nfe-pill--winner {
  animation: pillWinner 0.6s ease-out forwards;
  z-index: 10;
  position: relative;
}

/* ---- Pill Grid (Grid Mode) ---- */

.nfe-grid-view {
  background: var(--color-white);
}

.nfe-grid-wrap {
  max-width: var(--site-max-width);
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3.5rem) var(--site-gutter);
}

.nfe-grid-wrap__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
  flex-wrap: wrap;
}

.nfe-grid-wrap__title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.2vw, 1.8rem);
  font-weight: var(--font-weight-bold);
  color: var(--color-black);
  margin-bottom: 0.3rem;
}

.nfe-grid-wrap__subtitle {
  font-size: clamp(0.88rem, 1vw, 0.95rem);
  color: var(--grey-700, #666);
  line-height: 1.5;
  max-width: 500px;
}

/* 4-column pill grid matching original layout image */
.nfe-grid-columns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1rem, 2vw, 2rem);
  align-items: start;
}

.nfe-grid-columns__col {
  display: flex;
  flex-direction: column;
  gap: clamp(0.4rem, 0.8vw, 0.6rem);
}

@media (max-width: 1024px) {
  .nfe-grid-columns { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .nfe-grid-columns { grid-template-columns: 1fr; }
}

.nfe-cluster {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
}

.nfe-cluster .nfe-pill--sub {
  margin-left: 0.4rem;
}

/* Pill base — uses PNG images */
.nfe-pill {
  display: inline-block;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.2s ease,
              filter 0.2s ease;
  border: none;
  background: none;
  padding: 0;
  line-height: 0;
  border-radius: 50px;
}

.nfe-pill img {
  height: clamp(28px, 3.2vw, 36px);
  width: auto;
  display: block;
  pointer-events: none;
}

.nfe-pill--sub img {
  height: clamp(24px, 2.8vw, 32px);
}

.nfe-pill:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  filter: brightness(1.05);
}

.nfe-pill:active { transform: scale(0.97); }

/* ---- Sidebar (Detail Mode) ---- */

.nfe-sidebar {
  background: var(--color-white);
  border-right: 1px solid var(--grey-200, #E0E0E0);
  padding: 1rem 0.75rem;
  overflow-y: auto;
  position: sticky;
  top: 53px;
  height: calc(100vh - 53px);
  display: flex;
  flex-direction: column;
}

.nfe-sidebar__back {
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.8rem;
  font-weight: var(--font-weight-medium);
  color: var(--color-blue);
  text-decoration: none;
  padding: 0.5rem 0.5rem;
  margin-bottom: 0.75rem;
  border-radius: 6px;
  transition: background 0.15s ease;
}
.nfe-sidebar__back:hover { background: var(--grey-100, #F0F0F0); }

.nfe-sidebar__pills {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nfe-sidebar__cluster {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}

.nfe-sidebar__cluster-subs {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding-left: 0.6rem;
}

.nfe-sidebar .nfe-pill img {
  height: 22px;
}

.nfe-sidebar .nfe-pill--sub img {
  height: 19px;
}

.nfe-sidebar .nfe-pill.is-active {
  outline: 2px solid var(--color-blue);
  outline-offset: 2px;
  border-radius: 50px;
}

.nfe-sidebar__surprise {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--grey-200, #E0E0E0);
  flex-shrink: 0;
}

.nfe-sidebar__surprise-btn {
  width: 100%;
  padding: 0.5em 0.8em;
  background: var(--color-yellow);
  color: var(--color-black);
  border: none;
  border-radius: 50px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  transition: transform 0.2s ease;
}
.nfe-sidebar__surprise-btn:hover { transform: scale(1.03); }
.nfe-sidebar__surprise-btn svg { width: 14px; height: 14px; }

/* ---- Main Content (Detail Mode) ---- */

.nfe-main {
  background: var(--color-grey-light, #F5F5F3);
  overflow-y: auto;
}

.nfe-main__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(1.5rem, 3vw, 2.5rem);
}

/* Multi-column content grid */
.nfe-content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1rem, 2vw, 1.5rem);
  align-items: start;
}

.nfe-content-grid__col {
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 2vw, 1.5rem);
}

/* Full-width sections (header, case study) sit above the grid */
.nfe-section--full {
  grid-column: 1 / -1;
}

/* Within columns, strategic uses single-column stacking */
.nfe-content-grid .nfe-strategic {
  grid-template-columns: 1fr;
}

/* Frame Header */
.nfe-frame-header {
  border-radius: var(--radius-card, 1.2rem);
  padding: clamp(1.5rem, 3vw, 2.5rem);
  color: var(--color-white);
  position: relative;
  overflow: hidden;
  margin-bottom: clamp(1.5rem, 2.5vw, 2rem);
}

.nfe-frame-header::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.06));
  pointer-events: none;
}

.nfe-frame-header__pill {
  margin-bottom: 0.75rem;
}

.nfe-frame-header__pill img {
  height: clamp(32px, 4vw, 42px);
  width: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.nfe-frame-header__definition {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.5vw, 1.3rem);
  font-weight: var(--font-weight-medium);
  line-height: 1.45;
  max-width: 640px;
  opacity: 0.95;
  position: relative;
  z-index: 1;
}

/* ---- Content Sections ---- */

.nfe-section {
  margin-bottom: clamp(1.5rem, 2.5vw, 2rem);
  background: var(--color-white);
  border-radius: var(--radius-card, 1.2rem);
  padding: clamp(1.25rem, 2.5vw, 2rem);
}

.nfe-section__label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--grey-500, #999);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.nfe-section__label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--grey-200, #E0E0E0);
}

.nfe-section__content {
  font-size: clamp(0.88rem, 1vw, 0.95rem);
  line-height: 1.7;
  color: var(--color-grey-dark, #3A3A4A);
}

.nfe-section__content strong {
  color: var(--color-black);
  font-weight: var(--font-weight-semibold);
}

/* Case Study */
.nfe-case-study {
  border-radius: 0.8rem;
  overflow: hidden;
  border: 1px solid var(--grey-200, #E0E0E0);
}

.nfe-case-study img {
  width: 100%;
  display: block;
}

/* Examples */
.nfe-examples {
  display: grid;
  gap: 0.5rem;
}

.nfe-example {
  padding: 0.75rem 1rem;
  background: var(--color-grey-light, #F5F5F3);
  border-radius: 0.6rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--color-grey-dark, #3A3A4A);
  border-left: 3px solid var(--grey-200, #E0E0E0);
  font-style: italic;
}

.nfe-example mark {
  background: rgba(20, 54, 188, 0.08);
  color: var(--color-blue);
  font-weight: var(--font-weight-semibold);
  font-style: normal;
  padding: 0 0.15em;
  border-radius: 2px;
}

/* Non-Examples */
.nfe-non-example {
  padding: 0.6rem 0.85rem;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 0.5rem;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--grey-700, #666);
  border-left: 3px solid var(--grey-200, #E0E0E0);
  margin-top: 0.4rem;
}

.nfe-non-example:first-child { margin-top: 0; }

.nfe-non-example__marker {
  color: var(--grey-500, #999);
  font-weight: bold;
  margin-right: 0.3em;
}

/* Strategic Implications */
.nfe-strategic {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.nfe-strategic__col h4 {
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.nfe-strategic__col--useful h4 { color: #2E7D32; }
.nfe-strategic__col--less h4 { color: #C13B2A; }

.nfe-strategic__col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nfe-strategic__col li {
  font-size: 0.84rem;
  line-height: 1.5;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  color: var(--color-grey-dark, #3A3A4A);
}

.nfe-strategic__col--useful li {
  background: rgba(46, 125, 50, 0.05);
  border-left: 3px solid rgba(46, 125, 50, 0.25);
}

.nfe-strategic__col--less li {
  background: rgba(193, 59, 42, 0.05);
  border-left: 3px solid rgba(193, 59, 42, 0.25);
}

/* Related Frames */
.nfe-relations {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.nfe-relation-pill {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  line-height: 0;
  border-radius: 50px;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.nfe-relation-pill img {
  height: 24px;
  width: auto;
}

.nfe-relation-pill:hover {
  transform: scale(1.08);
  filter: brightness(1.05);
}

/* Identification Criteria */
.nfe-criteria {
  background: var(--color-grey-light, #F5F5F3);
  border-radius: 0.8rem;
  border: 1px solid var(--grey-200, #E0E0E0);
  padding: 1rem 1.25rem;
}

.nfe-criteria ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nfe-criteria li {
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--color-grey-dark, #3A3A4A);
  padding-left: 1.4em;
  position: relative;
}

.nfe-criteria li::before {
  content: '?';
  position: absolute;
  left: 0;
  font-weight: bold;
  color: var(--color-blue);
  font-size: 0.95em;
}

/* Prev/Next Navigation */
.nfe-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: clamp(1.5rem, 2.5vw, 2rem);
  padding-top: clamp(1rem, 2vw, 1.5rem);
  border-top: 1px solid var(--grey-200, #E0E0E0);
}

.nfe-nav__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.5em 1.1em;
  border: 1px solid var(--grey-200, #E0E0E0);
  border-radius: 8px;
  background: var(--color-white);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: var(--font-weight-semibold);
  color: var(--color-grey-dark, #3A3A4A);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.nfe-nav__btn:hover {
  border-color: var(--color-blue);
  color: var(--color-blue);
  background: rgba(20, 54, 188, 0.03);
}

/* ---- Section Reveal Animation ---- */

@keyframes sectionReveal {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.nfe-section {
  opacity: 0;
  animation: sectionReveal 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Stagger: full-width sections first, then left column, then right column */
.nfe-section--full { animation-delay: 0s; }
.nfe-content-grid__col:first-child .nfe-section:nth-child(1) { animation-delay: 0.05s; }
.nfe-content-grid__col:first-child .nfe-section:nth-child(2) { animation-delay: 0.1s; }
.nfe-content-grid__col:first-child .nfe-section:nth-child(3) { animation-delay: 0.15s; }
.nfe-content-grid__col:last-child .nfe-section:nth-child(1) { animation-delay: 0.08s; }
.nfe-content-grid__col:last-child .nfe-section:nth-child(2) { animation-delay: 0.13s; }
.nfe-content-grid__col:last-child .nfe-section:nth-child(3) { animation-delay: 0.18s; }

.nfe-frame-header {
  opacity: 0;
  animation: sectionReveal 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ---- Grid → Detail Transition ---- */

@keyframes gridFadeOut {
  to { opacity: 0; transform: translateY(-8px); }
}

@keyframes detailFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.nfe-grid-view--exiting {
  animation: gridFadeOut 0.25s ease forwards;
}

.nfe-detail--entering {
  animation: detailFadeIn 0.3s ease 0.1s forwards;
  opacity: 0;
}

/* ---- Responsive ---- */

@media (max-width: 1024px) {
  .nfe-page[data-mode="detail"] .nfe-detail {
    grid-template-columns: 1fr;
  }

  .nfe-sidebar {
    position: fixed;
    left: -280px;
    top: 53px;
    width: 260px;
    height: calc(100vh - 53px);
    z-index: 200;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }

  .nfe-sidebar.is-open {
    left: 0;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.12);
  }

  .nfe-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: 53px;
    background: rgba(0, 0, 0, 0.3);
    z-index: 199;
  }

  .nfe-sidebar-backdrop.is-open { display: block; }

  .nfe-sidebar-toggle {
    display: inline-flex;
  }
}

@media (min-width: 1025px) {
  .nfe-sidebar-toggle { display: none; }
  .nfe-sidebar-backdrop { display: none !important; }
}

@media (max-width: 900px) {
  .nfe-content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nfe-strategic { grid-template-columns: 1fr; }
  .nfe-hero__stats { gap: 1.5rem; }
  .nfe-frame-header { border-radius: 0.8rem; }
  .nfe-section { border-radius: 0.8rem; }
  .nfe-main__inner { padding: 1rem; }
}

/* ---- Frame Colours (used as header backgrounds) ---- */

:root {
  --frame-war: #C13B2A;
  --frame-game: #D4763A;
  --frame-journey: #2E7D32;
  --frame-animal: #8B4513;
  --frame-machine: #455A64;
  --frame-healthcare: #1565C0;
  --frame-body: #AD1457;
  --frame-natural-world: #33691E;
  --frame-substance: #4E342E;
  --frame-object: #37474F;
  --frame-building: #5D4037;
  --frame-transaction: #1B5E20;
  --frame-inauthentic: #616161;
  --frame-food: #E65100;
  --frame-mythical: #4A148C;
  --frame-view: #0277BD;
  --frame-performance: #6A1B9A;
  --frame-policing: #283593;
  --frame-legal-order: #1A237E;
  --frame-power: #424242;
  --frame-relationships: #880E4F;
  --frame-time: #C62828;
  --frame-spatial: #00695C;
}
