/* ============================================================================
   StrataNova — Field Notes (carousel, tag filter, post pages, galleries)
   Loaded only on the Field Notes listing page and individual post pages.
   Uses the design tokens from styles.css.
   ============================================================================ */

/* ---------- Featured carousel (auto-rotating) ---------- */
.fn-carousel {
  position: relative;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--color-surface);
}
.fn-carousel-viewport {
  position: relative;
  height: clamp(190px, 26vw, 280px);
}
@media (max-width: 640px) {
  .fn-carousel-viewport { height: clamp(180px, 46vw, 240px); }
}
.fn-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-slow) var(--ease-out);
}
.fn-slide.is-active { opacity: 1; visibility: visible; }
.fn-slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.fn-slide-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5,5,5,0.10) 0%, rgba(5,5,5,0.45) 45%, rgba(5,5,5,0.92) 100%);
}
.fn-slide-body {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
@media (min-width: 768px) {
  .fn-slide-body { padding: var(--space-4); max-width: 720px; }
}
.fn-slide-title {
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  font-weight: 600;
  line-height: 1.15;
}
.fn-slide-excerpt {
  color: var(--color-text-secondary);
  font-size: clamp(0.82rem, 1.1vw, 0.95rem);
  max-width: 60ch;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (max-width: 640px) {
  .fn-slide-excerpt { -webkit-line-clamp: 2; }
}
.fn-slide-link {
  margin-top: 4px;
  align-self: flex-start;
}

/* Dot indicators */
.fn-dots {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  display: flex;
  gap: 8px;
  z-index: 2;
}
.fn-dot {
  width: 28px;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.35);
  cursor: pointer;
  transition: background var(--dur-base) var(--ease-out);
}
.fn-dot:hover { background: rgba(255,255,255,0.6); }
.fn-dot.is-active { background: var(--color-accent-strong); }

/* Prev / next arrows (desktop) */
.fn-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(5,5,5,0.55);
  color: #fff;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.fn-arrow:hover { background: var(--color-accent-strong); border-color: var(--color-accent-strong); color: #050505; }
.fn-arrow-prev { left: var(--space-2); }
.fn-arrow-next { right: var(--space-2); }
/* On touch / small screens, hide arrows — users swipe instead */
@media (max-width: 767px) {
  .fn-arrow { display: none; }
}

/* ---------- Tag filter ---------- */
.fn-filter {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  padding: var(--space-2);
  margin-bottom: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fn-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.fn-filter-head .eyebrow { display: block; }
.fn-filter-count { font-family: var(--font-mono); font-size: 12px; color: var(--color-text-tertiary); }
.fn-filter-group { display: flex; flex-wrap: wrap; gap: 5px; align-items: baseline; }
.fn-filter-group-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  min-width: 72px;
}
.fn-chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border-strong);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.fn-chip:hover { color: var(--color-text-primary); border-color: var(--color-text-secondary); }
.fn-chip.is-active {
  background: var(--color-accent-strong);
  color: #050505;
  border-color: var(--color-accent-strong);
}
.fn-filter-clear {
  font-family: var(--font-mono);
  font-size: 12px;
  background: none;
  border: 0;
  color: var(--color-text-secondary);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.fn-filter-clear:hover { color: var(--color-accent-strong); }

/* Tags shown on cards + posts */
.fn-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.fn-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  color: var(--color-text-tertiary);
  white-space: nowrap;
}
.fn-card-tags { margin-top: 4px; }

/* ---------- Post page ---------- */
.fn-post { max-width: 760px; margin-inline: auto; }
.fn-post-back { margin-bottom: var(--space-3); }
.fn-post-header { margin-bottom: var(--space-4); }
.fn-post-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 600;
  line-height: 1.12;
  margin: 8px 0 var(--space-2);
}
.fn-post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-tertiary);
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}
.fn-post-cover {
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
  aspect-ratio: 16 / 9;
}
.fn-post-cover img { width: 100%; height: 100%; object-fit: cover; }
.fn-post-body > * { margin-bottom: var(--space-3); }
.fn-post-body h2 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); font-weight: 600; margin-top: var(--space-4); }
.fn-post-body p { color: var(--color-text-secondary); }
.fn-figure { margin: 0; }
.fn-figure img { width: 100%; border-radius: var(--radius-card); border: 1px solid var(--color-border); }
.fn-figure figcaption,
.fn-gallery-caption {
  font-size: 0.85rem;
  color: var(--color-text-tertiary);
  margin-top: 8px;
}

/* Gallery grid */
.fn-gallery { display: grid; gap: var(--space-2); grid-template-columns: repeat(2, 1fr); }
.fn-gallery.is-single { grid-template-columns: 1fr; }
@media (min-width: 768px) {
  .fn-gallery.cols-3 { grid-template-columns: repeat(3, 1fr); }
}
.fn-gallery-item { margin: 0; }
.fn-gallery-item button {
  display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in;
}
.fn-gallery-item img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--radius-card); border: 1px solid var(--color-border);
}

/* Responsive video embed (16:9) */
.fn-video { margin: 0; }
.fn-video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: #000;
}
.fn-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Lightbox ---------- */
.fn-lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5,5,5,0.92);
  padding: var(--space-4);
}
.fn-lightbox.is-open { display: flex; }
.fn-lightbox img { max-width: 100%; max-height: 86vh; border-radius: var(--radius-card); }
.fn-lightbox-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 48px; height: 48px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: 1.4rem;
  cursor: pointer;
}
.fn-lightbox-close:hover { border-color: var(--color-accent-strong); color: var(--color-accent-strong); }
