/* ─────────────────────────────────────────────────────────────
   GDfm Stories — Public CSS
   Mobile-first, then desktop overrides
───────────────────────────────────────────────────────────── */

/* ── Story page wrapper ────────────────────────────────────── */
.gdfms-story-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 60px;
  box-sizing: border-box;
}

/* ── Top bar ───────────────────────────────────────────────── */
.gdfms-top-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 0 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  color: #888;
  line-height: 1.2;
}
.gdfms-bar-sep { opacity: .5; }
.gdfms-bar-date { font-weight: 600; }

/* ── Hero ──────────────────────────────────────────────────── */
.gdfms-hero {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 32px;
}
.gdfms-hero-left { flex: 1; }

.gdfms-headline {
  font-size: clamp(26px, 7vw, 52px);
  font-weight: 900;
  line-height: 1.1;
  margin: 0 0 14px;
  letter-spacing: -.01em;
  word-break: break-word;
}
.gdfms-tagline {
  font-size: 15px;
  line-height: 1.5;
  color: #999;
  margin: 0;
}

/* ── Image card stack ─────────────────────────────────────── */
.gdfms-mosaic {
  position: relative;
  border-radius: 16px;
  min-height: 240px;
  overflow: visible;
}

.gdfms-mosaic-img {
  position: absolute;
  background-size: cover;
  background-position: center;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.13);
  cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease;
}
.gdfms-mosaic-img:hover {
  transform: scale(1.04) !important;
  box-shadow: 0 8px 30px rgba(0,0,0,.22);
  z-index: 10 !important;
}

/* Hero — always largest */
.gdfms-mosaic-img:nth-child(1) {
  width: 54%;
  height: 62%;
  top: 8%;
  left: 5%;
  z-index: 3;
  transform: rotate(-2deg);
}
.gdfms-mosaic-img:nth-child(2) {
  width: 46%;
  height: 54%;
  top: 3%;
  right: 4%;
  z-index: 2;
  transform: rotate(2.5deg);
}
.gdfms-mosaic-img:nth-child(3) {
  width: 48%;
  height: 50%;
  bottom: 4%;
  left: 24%;
  z-index: 4;
  transform: rotate(0.5deg);
}
/* Only show up to 3 cards in the visual stack */
.gdfms-mosaic-img:nth-child(n+4) {
  display: none;
}

/* Single image — center it, no rotation */
.gdfms-mosaic-img:only-child {
  width: 75%;
  height: 78%;
  top: 8%;
  left: 12.5%;
  transform: none;
}

/* Two images — side by side with overlap */
.gdfms-mosaic-img:first-child:nth-last-child(2) {
  width: 56%;
  height: 72%;
  top: 10%;
  left: 4%;
}
.gdfms-mosaic-img:last-child:nth-child(2):nth-last-child(1) {
  width: 48%;
  height: 62%;
  top: 14%;
  right: 4%;
}

.gdfms-mosaic-viewall {
  position: absolute;
  bottom: 10px;
  right: 12px;
  background: rgba(0,0,0,.55);
  color: #fff !important;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none !important;
  z-index: 20;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.gdfms-mosaic-viewall:hover {
  background: rgba(0,0,0,.8);
}

/* ── Body ──────────────────────────────────────────────────── */
.gdfms-body {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* ── Overview / bullets ────────────────────────────────────── */
.gdfms-overview-heading {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.01em;
  margin: 0 0 16px;
  line-height: 1.2;
}
.gdfms-bullets {
  list-style: none;
  margin: 0;
  padding: 0;
}
.gdfms-bullets li {
  position: relative;
  padding: 13px 0 13px 18px;
  border-bottom: 1px solid rgba(128,128,128,.12);
  font-size: 15px;
  line-height: 1.6;
}
.gdfms-bullets li:last-child { border-bottom: none; }
.gdfms-bullets li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 21px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e8534a;
  flex-shrink: 0;
}

/* ── Articles sidebar ──────────────────────────────────────── */
.gdfms-articles-heading {
  font-size: 17px;
  font-weight: 800;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}
.gdfms-count-badge {
  font-size: 13px;
  font-weight: 700;
  color: #e8534a;
}
.gdfms-articles-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.gdfms-article-item {
  display: flex !important;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(128,128,128,.04);
  border: 1px solid rgba(128,128,128,.1);
  border-radius: 12px;
  text-decoration: none !important;
  color: inherit !important;
  transition: background .15s, border-color .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.gdfms-article-item.gdfms-hidden {
  display: none !important;
}
.gdfms-article-item:hover {
  background: rgba(128,128,128,.08);
  border-color: rgba(128,128,128,.18);
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.gdfms-article-favicon {
  display: inline-block !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
  object-fit: cover;
  background: rgba(128,128,128,.08);
}
.gdfms-article-item-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.gdfms-article-pub-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.gdfms-article-pub {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  color: #555 !important;
  line-height: 1.2;
  text-transform: uppercase;
}
.gdfms-article-time {
  font-size: 10px;
  font-weight: 600;
  color: #999 !important;
  white-space: nowrap;
  flex-shrink: 0;
}
.gdfms-article-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: #222 !important;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gdfms-paywall-badge { font-size: 11px; opacity: .7; margin-left: 2px; }
.gdfms-article-paywalled .gdfms-article-title { opacity: .75; }

.gdfms-load-more {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 12px 16px;
  background: rgba(128,128,128,.06);
  border: 1px solid rgba(128,128,128,.15);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.gdfms-load-more:hover {
  background: rgba(128,128,128,.12);
  border-color: rgba(128,128,128,.25);
}
.gdfms-load-more-count {
  font-weight: 400;
  color: #999;
}

/* ── Social / Instagram ────────────────────────────────────── */
.gdfms-social-section {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid rgba(128,128,128,.15);
}
.gdfms-social-heading {
  font-size: 17px;
  font-weight: 800;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}
.gdfms-ig-embeds {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.gdfms-ig-embeds .instagram-media {
  margin: 0 auto !important;
  max-width: 100% !important;
  min-width: 0 !important;
  width: 100% !important;
}



/* ─────────────────────────────────────────────────────────────
   Tablet — 600px+
───────────────────────────────────────────────────────────── */
@media (min-width: 600px) {
  .gdfms-story-page { padding: 0 24px 60px; }

  .gdfms-ig-embeds {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }

  .gdfms-archive-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .gdfms-archive-title { font-size: 28px; }
}

/* ─────────────────────────────────────────────────────────────
   Desktop — 880px+
───────────────────────────────────────────────────────────── */
@media (min-width: 880px) {

  .gdfms-hero {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 40px;
    align-items: start;
    margin-bottom: 48px;
  }

  .gdfms-mosaic {
    min-height: 320px;
  }

  .gdfms-body {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 48px;
    align-items: start;
  }

  .gdfms-archive-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ─────────────────────────────────────────────────────────────
   Wide — 1100px+
───────────────────────────────────────────────────────────── */
@media (min-width: 1100px) {
  .gdfms-hero {
    grid-template-columns: 1fr 440px;
  }
  .gdfms-body {
    grid-template-columns: 1fr 340px;
  }
  .gdfms-archive-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ─────────────────────────────────────────────────────────────
   Dark mode
───────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  .gdfms-headline       { color: #f0f0f0; }
  .gdfms-tagline        { color: #aaa; }
  .gdfms-bullets li     { color: #ddd; }
  .gdfms-article-item {
    background: rgba(255,255,255,.04);
    border-color: rgba(255,255,255,.08);
  }
  .gdfms-article-item:hover {
    background: rgba(255,255,255,.07);
    border-color: rgba(255,255,255,.12);
  }
  .gdfms-article-title  { color: #e0e0e0 !important; }
  .gdfms-article-pub    { color: #999 !important; }
  .gdfms-article-time   { color: #777 !important; }
  .gdfms-load-more {
    background: rgba(255,255,255,.05);
    border-color: rgba(255,255,255,.1);
    color: #ccc;
  }
  .gdfms-load-more:hover {
    background: rgba(255,255,255,.1);
    border-color: rgba(255,255,255,.15);
  }
  .gdfms-overview-heading,
  .gdfms-articles-heading,
  .gdfms-social-heading { color: #f0f0f0; }
  .gdfms-archive-headline { color: #f0f0f0; }
  .gdfms-archive-tagline  { color: #999; }
  .gdfms-archive-card {
    background: rgba(255,255,255,.03);
  }
  .gdfms-article-item:hover { opacity: .65; }
}

/* Astra theme dark mode class override */
.dark-mode .gdfms-headline,
body.dark .gdfms-headline { color: #f0f0f0; }
.dark-mode .gdfms-tagline,
body.dark .gdfms-tagline  { color: #aaa; }

/* ─────────────────────────────────────────────────────────────
   Archive — feed grid
───────────────────────────────────────────────────────────── */

.gdfms-archive {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 12px 48px;
  box-sizing: border-box;
}

.gdfms-archive-title {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 16px;
  line-height: 1.2;
  padding: 0 4px;
}

/* ── Feed grid ─────────────────────────────────────────────── */
.gdfms-feed-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ── Feed card ─────────────────────────────────────────────── */
.gdfms-feed-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  background-size: cover;
  background-position: center;
  background-color: #1a1a2e;
  min-height: 220px;
  -webkit-tap-highlight-color: transparent;
  transition: transform .18s ease, box-shadow .18s ease;
}

.gdfms-feed-card:active {
  transform: scale(.97);
}

/* Gradient overlay — always dark at bottom so text is readable */
.gdfms-feed-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,.02) 0%,
    rgba(0,0,0,.1)  35%,
    rgba(0,0,0,.65) 70%,
    rgba(0,0,0,.85) 100%
  );
  border-radius: 10px;
}

.gdfms-feed-card-body {
  position: relative;
  z-index: 1;
  padding: 12px 12px 14px;
}

.gdfms-feed-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  color: rgba(255,255,255,.7);
  margin-bottom: 6px;
  line-height: 1.2;
}

.gdfms-feed-meta-local {
  background: #e8534a;
  color: #fff;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9px;
  letter-spacing: .06em;
}

.gdfms-feed-card-headline {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  margin: 0 0 5px;
  /* Clamp to 3 lines on small cards */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gdfms-feed-card-tagline {
  font-size: 12px;
  color: rgba(255,255,255,.75);
  line-height: 1.35;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Pagination ─────────────────────────────────────────────── */
.gdfms-archive-pagination {
  margin-top: 24px;
  text-align: center;
}
.gdfms-archive-empty {
  text-align: center;
  color: #888;
  padding: 48px 0;
}

/* ─────────────────────────────────────────────────────────────
   Tablet — 600px+
───────────────────────────────────────────────────────────── */
@media (min-width: 600px) {
  .gdfms-archive { padding: 28px 16px 48px; }
  .gdfms-archive-title { font-size: 26px; }

  .gdfms-feed-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  .gdfms-feed-card { min-height: 260px; }
  .gdfms-feed-card-headline { font-size: 15px; }
}

/* ─────────────────────────────────────────────────────────────
   Desktop — 880px+
───────────────────────────────────────────────────────────── */
@media (min-width: 880px) {
  .gdfms-archive { padding: 32px 20px 60px; }

  .gdfms-feed-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
  }

  .gdfms-feed-card { min-height: 300px; }

  /* First card spans 2 columns and 2 rows — hero card */
  .gdfms-feed-card:first-child {
    grid-column: span 2;
    grid-row: span 2;
    min-height: 610px;
  }
  .gdfms-feed-card:first-child .gdfms-feed-card-headline {
    font-size: 22px;
    -webkit-line-clamp: 4;
    margin-bottom: 8px;
  }
  .gdfms-feed-card:first-child .gdfms-feed-card-tagline {
    font-size: 14px;
    -webkit-line-clamp: 3;
  }
  .gdfms-feed-card:first-child .gdfms-feed-card-meta {
    font-size: 11px;
  }
  .gdfms-feed-card:first-child .gdfms-feed-card-body {
    padding: 20px 20px 22px;
  }

  .gdfms-feed-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
  }

  .gdfms-feed-card-headline { font-size: 14px; }
  .gdfms-feed-card-body { padding: 12px 14px 16px; }

  .gdfms-archive-title { font-size: 30px; margin-bottom: 20px; }
}

/* ─────────────────────────────────────────────────────────────
   Wide — 1100px+
───────────────────────────────────────────────────────────── */
@media (min-width: 1100px) {
  .gdfms-feed-grid { gap: 12px; }
  .gdfms-feed-card { min-height: 320px; }
  .gdfms-feed-card:first-child { min-height: 652px; }
}

/* ─────────────────────────────────────────────────────────────
   Topic tags
───────────────────────────────────────────────────────────── */

/* Tag bar on archive/taxonomy pages */
.gdfms-tag-bar-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 16px;
  /* Bleed edge-to-edge on mobile */
  margin-left: -12px;
  margin-right: -12px;
  padding: 0 12px;
}
.gdfms-tag-bar-wrap::-webkit-scrollbar { display: none; }

.gdfms-tag-bar {
  display: flex;
  gap: 8px;
  white-space: nowrap;
  padding-bottom: 4px;
}

.gdfms-tag {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(128,128,128,.25);
  color: inherit;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
  line-height: 1.2;
}
.gdfms-tag:hover { border-color: rgba(128,128,128,.5); }
.gdfms-tag-active {
  background: #e8534a;
  border-color: #e8534a;
  color: #fff !important;
}

/* Topic tags on single story page */
.gdfms-story-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.gdfms-story-topic-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-decoration: none;
  background: rgba(232,83,74,.15);
  color: #e8534a;
  border: 1px solid rgba(232,83,74,.25);
  line-height: 1.2;
  transition: background .15s;
}
.gdfms-story-topic-tag:hover {
  background: rgba(232,83,74,.25);
  color: #e8534a;
}

/* Topic pills on feed cards */
.gdfms-feed-card-topics {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.gdfms-feed-card-topic {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: rgba(255,255,255,.9);
  background: rgba(232,83,74,.75);
  padding: 2px 7px;
  border-radius: 10px;
  line-height: 1.4;
}

/* Admin topics grid */
@media (min-width: 600px) {
  .gdfms-tag-bar-wrap {
    margin-left: -16px;
    margin-right: -16px;
    padding: 0 16px;
  }
  .gdfms-tag-bar-wrap { margin-bottom: 20px; }
}

/* ── Editor note ───────────────────────────────────────────── */
.gdfms-editor-note {
  margin-bottom: 28px;
  padding: 20px 22px;
  background: rgba(128,128,128,.04);
  border: 1px solid rgba(128,128,128,.1);
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.7;
}
.gdfms-editor-note p:first-child { margin-top: 0; }
.gdfms-editor-note p:last-child { margin-bottom: 0; }
.gdfms-editor-note a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (prefers-color-scheme: dark) {
  .gdfms-editor-note {
    color: #ddd;
    background: rgba(255,255,255,.04);
    border-color: rgba(255,255,255,.08);
  }
}

/* ── Lightbox ─────────────────────────────────────────────── */
.gdfms-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(0,0,0,.92);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  opacity: 0;
  transition: opacity .2s ease;
}
.gdfms-lightbox.gdfms-lb-visible { opacity: 1; }
.gdfms-lightbox img {
  max-width: 92vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  cursor: default;
}
.gdfms-lb-close {
  position: absolute;
  top: 16px;
  right: 20px;
  color: #fff;
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  opacity: .7;
  transition: opacity .15s;
  z-index: 2;
  background: none;
  border: none;
  padding: 8px;
}
.gdfms-lb-close:hover { opacity: 1; }
.gdfms-lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 32px;
  font-weight: 300;
  cursor: pointer;
  opacity: .6;
  transition: opacity .15s;
  z-index: 2;
  background: none;
  border: none;
  padding: 16px;
  line-height: 1;
}
.gdfms-lb-nav:hover { opacity: 1; }
.gdfms-lb-prev { left: 12px; }
.gdfms-lb-next { right: 12px; }
.gdfms-lb-counter {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.7);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
}
