/* ============================================
   FILM REEL NAVIGATION
   Global cinematic nav — brutalist + editorial
   7 page modules with agent icons (no photos)
   ============================================ */

/* ─── Trigger button (ORBIS orbit glyph, top-right) ─── */
#fr-trigger {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9997;
  width: 56px;
  height: 56px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  mix-blend-mode: difference;
}
#fr-trigger:hover {
  transform: scale(1.1);
}

body.fr-open #fr-trigger {
  opacity: 0;
  pointer-events: none;
}

#fr-trigger .fr-orbit {
  position: relative;
  width: 40px;
  height: 40px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

#fr-trigger .fr-planet {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #ffffff;
  border-radius: 50%;
  top: -4px;
  left: 50%;
  margin-left: -3px;
  animation: fr-orbit-spin 6s linear infinite;
  transform-origin: 3px 22px;
}
@keyframes fr-orbit-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

#fr-trigger .fr-label {
  position: absolute;
  right: calc(100% + 14px);
  top: 50%;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: rgba(255, 255, 255, 0.75);
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  transform: translate(8px, -50%);
}
#fr-trigger:hover .fr-label {
  opacity: 1;
  transform: translate(0, -50%);
}

@media (max-width: 767px) {
  #fr-trigger {
    top: 18px;
    right: 18px;
    width: 48px;
    height: 48px;
  }
  #fr-trigger .fr-orbit { width: 34px; height: 34px; }
  #fr-trigger .fr-planet {
    width: 5px;
    height: 5px;
    top: -3.5px;
    margin-left: -2.5px;
    transform-origin: 2.5px 18.5px;
  }
  #fr-trigger .fr-label { display: none; }
}

/* ============================================
   OVERLAY + MODULES
   ============================================ */

#fr-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(6, 6, 6, 0.97);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  display: flex;
  flex-direction: column;
}
#fr-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

#fr-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(6, 6, 6, 0.85);
  color: #FAFAF9;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 24px;
  line-height: 1;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.3s ease, background 0.2s ease;
  z-index: 10;
  padding: 0;
}
#fr-close:hover {
  border-color: #81FF28;
  color: #81FF28;
  background: rgba(129, 255, 40, 0.08);
  transform: rotate(90deg);
}

#fr-topbar {
  padding: 32px 96px 24px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
#fr-topbar .fr-brand em {
  font-family: 'DM Serif Display', serif;
  font-style: italic;
  color: #81FF28;
  text-transform: none;
  letter-spacing: 0;
  margin: 0 4px;
}
#fr-topbar .fr-count {
  opacity: 0.6;
}

/* Modules container — 7-column horizontal strip on desktop */
.fr-strip {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* Each module — panel lightens on hover, icon glows neon.
   Grid rows lock the vertical position of every label across all 7 panels
   so numbers, names, taglines and paths each sit on a single horizontal line. */
.fr-module {
  position: relative;
  background: #060606;
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  row-gap: 0;
  padding: clamp(28px, 2.6vw, 44px) clamp(18px, 1.8vw, 28px);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  cursor: pointer;
  transition: background 0.35s ease;
}
.fr-module:hover {
  background: rgba(129, 255, 40, 0.04);
}
.fr-module > .fr-num     { grid-row: 1; align-self: start; }
.fr-module > .fr-name    { grid-row: 3; align-self: end; }
.fr-module > .fr-tagline { grid-row: 4; align-self: start; }
.fr-module > .fr-path    { grid-row: 5; align-self: end; }

/* Agent icon — sits center of panel, dim by default, glows neon on hover */
.fr-module-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(72px, 9vw, 140px);
  height: clamp(72px, 9vw, 140px);
  object-fit: contain;
  opacity: 0.28;
  filter: grayscale(0.85) brightness(0.9);
  transition: opacity 0.45s ease, filter 0.45s ease, transform 0.6s ease;
  z-index: 0;
  pointer-events: none;
  user-select: none;
}
.fr-module:hover .fr-module-icon {
  opacity: 1;
  filter: grayscale(0) brightness(1.05)
          drop-shadow(0 0 16px rgba(129, 255, 40, 0.65))
          drop-shadow(0 0 36px rgba(129, 255, 40, 0.35));
  transform: translate(-50%, -50%) scale(1.04);
}

/* Content z-index above icon */
.fr-module > *:not(.fr-module-icon) {
  position: relative;
  z-index: 2;
}

/* Number at top */
.fr-num {
  font-family: 'DM Mono', monospace;
  font-size: clamp(28px, 3.2vw, 46px);
  font-weight: 500;
  letter-spacing: 0.05em;
  line-height: 1;
  color: #81FF28;
  margin-bottom: 0;
  transition: transform 0.3s ease;
  text-shadow: 0 2px 18px rgba(129, 255, 40, 0.25);
}
.fr-module:hover .fr-num {
  transform: translateX(4px);
}

/* Name — grid places it on row 3 so its bottom edge is identical across panels.
   min-height reserves 2 lines, flex align pins text to the bottom of that area. */
.fr-name {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(26px, 3.2vw, 48px);
  font-weight: 400;
  line-height: 1.05;
  color: #FAFAF9;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
  transition: transform 0.4s ease, color 0.3s ease;
  min-height: 2.1em;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.fr-module:hover .fr-name { transform: translateY(-2px); color: #FAFAF9; }

/* Short name only visible on mobile (hidden on desktop) */
.fr-name-short {
  display: none;
}

/* Tagline — fixed reserved height so path lines match across panels */
.fr-tagline {
  font-family: 'DM Serif Display', serif;
  font-style: italic;
  font-size: clamp(12px, 0.95vw, 15px);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.45;
  margin-bottom: 0;
  min-height: 5.8em;
  display: flex;
  align-items: flex-start;
}

.fr-path {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  padding-top: 14px;
  margin-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  transition: color 0.3s ease, border-color 0.3s ease;
  width: 100%;
}
.fr-module:hover .fr-path {
  color: rgba(129, 255, 40, 0.8);
  border-top-color: rgba(129, 255, 40, 0.3);
}

/* Active page indicator */
.fr-module.is-current {
  background: linear-gradient(180deg, #060606 0%, rgba(129, 255, 40, 0.05) 100%);
}
.fr-module.is-current .fr-module-icon {
  opacity: 1;
  filter: grayscale(0) brightness(1.05)
          drop-shadow(0 0 14px rgba(129, 255, 40, 0.55));
}
.fr-module.is-current .fr-num { color: #81FF28; }
.fr-module.is-current .fr-name {
  color: #81FF28;
  font-style: italic;
}
.fr-module.is-current::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #81FF28;
  z-index: 3;
}

/* ============================================
   MOBILE: vertical stack of horizontal bars
   Each panel = full-width horizontal row with icon + name.
   Tap anywhere on the bar = navigate to page.
   ============================================ */
@media (max-width: 767px) {
  #fr-topbar {
    padding: 18px 70px 14px 20px;
    font-size: 9px;
    flex-shrink: 0;
  }
  #fr-close {
    top: 18px;
    right: 18px;
    width: 38px;
    height: 38px;
    font-size: 22px;
  }

  /* Strip becomes a vertical flex stack (not grid) */
  .fr-strip {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    gap: 1px;
    background: rgba(255, 255, 255, 0.08);
    padding: 0;
    margin: 8px 0 20px;
    max-height: none;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* Each panel becomes a horizontal row */
  .fr-module {
    display: flex;
    flex-direction: row;
    align-items: center;
    grid-template-rows: none;
    gap: 18px;
    padding: 18px 24px;
    min-height: 76px;
    background: #060606;
    position: relative;
  }
  .fr-module.is-current {
    background: linear-gradient(90deg, rgba(129,255,40,0.10) 0%, rgba(129,255,40,0.02) 50%, transparent 100%);
  }
  .fr-module.is-current::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    height: auto;
    background: #81FF28;
    z-index: 3;
  }

  /* Icon: left side, static, always visible */
  .fr-module-icon {
    position: static;
    transform: none;
    width: 44px;
    height: 44px;
    opacity: 0.65;
    filter: grayscale(0.45) brightness(1);
    flex-shrink: 0;
    margin: 0;
  }
  .fr-module.is-current .fr-module-icon {
    opacity: 1;
    filter: grayscale(0) brightness(1.05)
            drop-shadow(0 0 10px rgba(129, 255, 40, 0.7));
  }

  /* Hide num / tagline / path / short-name — mobile uses full name only */
  .fr-num { display: none; }
  .fr-tagline { display: none; }
  .fr-path { display: none; }
  .fr-name-short { display: none; }

  /* Full name on the right of the icon */
  .fr-name {
    display: block;
    position: static;
    grid-row: auto;
    align-self: auto;
    margin: 0;
    min-height: auto;
    font-family: 'DM Serif Display', serif;
    font-size: 26px;
    font-weight: 400;
    line-height: 1.1;
    color: #FAFAF9;
    letter-spacing: -0.01em;
    text-align: left;
    flex: 1 1 auto;
  }
  .fr-module.is-current .fr-name {
    color: #81FF28;
    font-style: italic;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  #fr-trigger .fr-planet { animation: none; }
  #fr-overlay, .fr-module, .fr-module-icon,
  .fr-num, .fr-name, .fr-path, #fr-close, #fr-trigger {
    transition-duration: 0.01ms !important;
  }
}

/* Disable body scroll when open */
body.fr-open { overflow: hidden; }
