/* /css/pages/gallery.css */

/* =========================
   Gallery / Story Detail / Reader
========================= */

:root {
  --fs-public-page-title: clamp(3rem, 6vw, 5rem);
  --fs-public-section-title: clamp(2.25rem, 4.5vw, 4rem);
  --fs-public-card-title: clamp(1.65rem, 2.8vw, 2.6rem);
  --fs-public-body-lg: clamp(1.02rem, 1.55vw, 1.2rem);
  --fs-public-body: 1rem;
  --fs-public-small: 0.82rem;

  --gallery-card-gap: clamp(1.25rem, 2vw, 1.75rem);
  --gallery-card-padding: clamp(1rem, 1.8vw, 1.35rem);
}

/* =========================
   Announcement Strip
   Shared homepage-style voting CTA banner
========================= */

.announcement-strip {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.35rem 1rem;
  background: linear-gradient(90deg, #7454c7, #8b5fd8);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-align: center;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.announcement-strip span,
.announcement-strip #gallery-status-text,
.announcement-strip #story-status-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.announcement-strip a {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.announcement-strip a:hover,
.announcement-strip a:focus-visible {
  color: var(--color-accent-soft);
}

/* =========================
   Gallery Page
========================= */

.gallery-page {
  width: 100%;
  padding-bottom: var(--spacing-2xl);
}

.gallery-hero {
  padding: 3rem 0 2.75rem;
  text-align: center;
  background:
    radial-gradient(circle at top center, rgba(242, 178, 74, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(11, 40, 82, 0.62), rgba(3, 23, 47, 0));
}

.gallery-hero-inner {
  width: min(980px, calc(100% - 2rem));
  margin-inline: auto;
}

.gallery-kicker {
  width: fit-content;
  margin: 0 auto 1rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  background: rgba(126, 97, 191, 0.32);
  border: 1px solid rgba(229, 220, 255, 0.22);
  color: var(--color-accent-soft);
  font-size: var(--fs-public-small);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gallery-hero h1 {
  margin: 0 0 1rem;
  font-family: var(--font-heading);
  font-size: var(--fs-public-page-title);
  line-height: 0.92;
  color: var(--color-accent-soft);
  text-shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
}

.gallery-hero p {
  max-width: 900px;
  margin: 0 auto;
  color: var(--color-text-soft);
  font-size: var(--fs-public-body-lg);
  line-height: 1.55;
}

.gallery-section {
  padding: 2rem 0 4rem;
}

.gallery-toolbar {
  margin-bottom: 1.5rem;
  padding: clamp(1.15rem, 2vw, 1.65rem);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: center;
  background:
    linear-gradient(180deg, rgba(18, 75, 137, 0.72), rgba(9, 37, 77, 0.9));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.gallery-toolbar > div {
  flex: 1 1 520px;
  min-width: 0;
}

.gallery-toolbar h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-heading);
  font-size: var(--fs-public-section-title);
  line-height: 0.95;
  color: var(--color-text);
  letter-spacing: 0.01em;
}

.gallery-toolbar p {
  margin: 0;
  max-width: 760px;
  color: var(--color-text-soft);
  font-size: var(--fs-public-body);
  line-height: 1.55;
}

.gallery-toolbar .btn {
  flex: 0 0 auto;
  margin: 0;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* =========================
   Gallery Grid / Shared Cards
   Max 2 cards per row. Final row centers naturally.
========================= */

.story-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: var(--gallery-card-gap);
}

.story-grid > p,
.story-grid .error {
  width: 100%;
  margin: 0;
  padding: 1.25rem;
  text-align: center;
  background: rgba(7, 31, 64, 0.72);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-soft);
}

.story-grid > *,
.story-card,
.gallery-card {
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(18, 75, 137, 0.78), rgba(7, 31, 64, 0.96));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  color: var(--color-text);
}

.story-grid article,
.story-grid .story-card,
.story-grid .gallery-card {
  flex: 0 1 calc((100% - var(--gallery-card-gap)) / 2);
  max-width: 640px;
  min-width: 360px;
  display: flex;
  flex-direction: column;
}

/* General fallback for any older card image markup */
.story-grid img {
  width: 100%;
  height: auto;
  max-height: 560px;
  display: block;
  object-fit: contain;
  object-position: center;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.story-grid h2,
.story-grid h3,
.story-card h2,
.story-card h3,
.gallery-card h2,
.gallery-card h3 {
  margin: 1rem 1rem 0.45rem;
  font-family: var(--font-heading);
  font-size: var(--fs-public-card-title);
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--color-text);
}

.story-grid p,
.story-card p,
.gallery-card p {
  margin: 0.35rem 1rem;
  color: var(--color-text-soft);
  font-size: var(--fs-public-body);
  line-height: 1.5;
}

.story-grid .btn,
.story-card .btn,
.gallery-card .btn {
  min-height: 44px;
  margin: 1rem;
  width: fit-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.story-grid a:not(.btn) {
  color: inherit;
}

.story-grid .status-badge,
.story-grid .story-status,
.story-grid .tag,
.story-grid .badge {
  width: fit-content;
  margin: 1rem 1rem 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  background: rgba(126, 97, 191, 0.22);
  border: 1px solid rgba(126, 97, 191, 0.34);
  color: #e5dcff;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* =========================
   Gallery Note Panel
========================= */

.gallery-note-panel {
  margin-top: 2rem;
  padding: clamp(1rem, 2vw, 1.5rem);
  background:
    linear-gradient(180deg, rgba(18, 75, 137, 0.72), rgba(9, 37, 77, 0.92));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.gallery-note-panel h2 {
  margin: 0 0 0.6rem;
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1;
  letter-spacing: 0.01em;
}

.gallery-note-panel p {
  max-width: 780px;
  margin: 0;
  color: var(--color-text-soft);
  font-size: var(--fs-public-body);
  line-height: 1.55;
}

/* =========================
   Story Detail Page
========================= */

.concept-page {
  width: 100%;
  padding-bottom: var(--spacing-2xl);
}

.concept-detail-hero {
  padding: 2rem 0 3rem;
  background:
    radial-gradient(circle at top center, rgba(242, 178, 74, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(11, 40, 82, 0.62), rgba(3, 23, 47, 0));
}

.concept-back-row {
  margin-bottom: 1.25rem;
}

.concept-detail-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(320px, 1.15fr);
  gap: 1.35rem;
  align-items: stretch;
  padding: clamp(1rem, 2vw, 1.5rem);
  background:
    linear-gradient(180deg, rgba(18, 75, 137, 0.78), rgba(7, 31, 64, 0.96));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.concept-detail-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.9rem;
  padding: clamp(0.25rem, 1vw, 1rem);
}

.concept-status-pill {
  width: fit-content;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.38rem 0.85rem;
  border-radius: var(--radius-pill);
  background: rgba(126, 97, 191, 0.26);
  border: 1px solid rgba(126, 97, 191, 0.42);
  color: #e5dcff;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.concept-detail-copy .story-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--fs-public-page-title);
  line-height: 0.96;
  letter-spacing: 0.01em;
  color: var(--color-accent-soft);
  text-shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
}

.concept-meta,
.story-meta {
  margin: 0;
  color: var(--color-text-soft);
  font-weight: 700;
}

.concept-description {
  padding-top: 0.35rem;
}

.concept-description p,
.story-content p {
  margin: 0;
  color: var(--color-text-soft);
  font-size: var(--fs-public-body);
  line-height: 1.55;
}

.concept-actions,
.story-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.65rem;
}

.concept-actions .btn,
.story-cta .btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Clean, raw concept image display:
   Keeps the image uncropped, but removes the visible inner frame/background. */
.concept-art-frame {
  min-height: 520px;
  margin: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.concept-art-frame img,
.story-hero-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 680px;
  min-height: 0;
  margin: 0 auto;
  object-fit: contain;
  object-position: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.concept-related {
  padding: 2rem 0 4rem;
}

.concept-related-toolbar {
  margin-bottom: 1.35rem;
}

/* =========================
   Story Detail Gallery Carousel
========================= */

.story-gallery-carousel {
  position: relative;
  flex-direction: column;
  gap: 0.75rem;
}

.story-gallery-stage {
  position: relative;
  width: 100%;
  min-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-gallery-stage .story-hero-img {
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.story-gallery-arrow {
  position: absolute;
  top: 50%;
  z-index: 5;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  border: 1px solid rgba(229, 220, 255, 0.42);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(18, 75, 137, 0.88), rgba(7, 31, 64, 0.96));
  color: #ffffff;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.28),
    0 0 18px rgba(242, 178, 74, 0.1);
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

.story-gallery-arrow:hover,
.story-gallery-arrow:focus-visible {
  background:
    linear-gradient(180deg, rgba(126, 97, 191, 0.94), rgba(7, 31, 64, 0.98));
  border-color: rgba(242, 178, 74, 0.65);
  color: var(--color-accent-soft);
  transform: translateY(-50%) scale(1.05);
  outline: none;
}

.story-gallery-prev {
  left: 0.35rem;
}

.story-gallery-next {
  right: 0.35rem;
}

.story-gallery-caption {
  max-width: 680px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(229, 220, 255, 0.14);
  border-radius: var(--radius-pill);
  background: rgba(7, 31, 64, 0.48);
  color: var(--color-text-soft);
  font-size: 0.94rem;
  line-height: 1.45;
  text-align: center;
}

.story-gallery-counter {
  width: fit-content;
  margin: 0 auto;
  padding: 0.28rem 0.72rem;
  border: 1px solid rgba(242, 178, 74, 0.26);
  border-radius: var(--radius-pill);
  background: rgba(242, 178, 74, 0.1);
  color: var(--color-accent-soft);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

/* =========================
   Reader Page
========================= */

.reader-page {
  width: 100%;
  padding: 2rem 1rem 4rem;
  background:
    radial-gradient(circle at top center, rgba(242, 178, 74, 0.1), transparent 34%),
    linear-gradient(180deg, rgba(11, 40, 82, 0.42), rgba(3, 23, 47, 0));
}

.reader-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.reader-topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1.15rem;
  background:
    linear-gradient(180deg, rgba(18, 75, 137, 0.72), rgba(9, 37, 77, 0.9));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.reader-title-wrap {
  min-width: 0;
  flex: 1 1 340px;
}

.reader-kicker {
  margin: 0 0 0.75rem;
}

.reader-title-wrap h1 {
  margin: 0 0 0.45rem;
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 0.98;
  letter-spacing: 0.01em;
  color: var(--color-accent-soft);
}

.reader-meta {
  margin: 0;
  color: var(--color-text-soft);
  font-size: 0.98rem;
  font-weight: 700;
}

.reader-nav-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.reader-card {
  padding: clamp(0.75rem, 2vw, 1rem);
  background:
    linear-gradient(180deg, rgba(18, 75, 137, 0.78), rgba(7, 31, 64, 0.96));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

/* Reader image cleanup:
   The outer reader-card remains, but the comic page no longer sits inside
   a second light-blue frame. */
.reader-stage {
  min-height: 520px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible;
  border-radius: 0;
  background: transparent;
}

.reader-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 82vh;
  margin: 0 auto;
  object-fit: contain;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.reader-caption {
  min-height: 1.5rem;
  margin: 1rem 0 0;
  color: var(--color-text-soft);
  font-size: 1rem;
  text-align: center;
}

.reader-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.reader-controls .btn,
.reader-nav-links .btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.reader-page-indicator {
  min-width: 120px;
  text-align: center;
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 900;
}

.reader-loading,
.reader-error,
.reader-empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--color-text-soft);
  background: rgba(7, 31, 64, 0.72);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

/* =========================
   Gallery Rendered Story Cards
   Removes inner image frame/background.
========================= */

.story-card-art-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.story-card-art {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
  background: transparent;
}

.story-card-art img {
  width: 100%;
  height: auto;
  max-height: 560px;
  display: block;
  object-fit: contain;
  object-position: center;
  background: transparent;
  border: 0;
}

.story-card-art-empty {
  min-height: 320px;
  display: grid;
  place-items: center;
  color: var(--color-text-soft);
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.story-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--gallery-card-padding);
}

.story-card-body .story-status {
  width: fit-content;
  margin: 0 0 0.85rem;
}

.story-card-body h3 {
  margin: 0 0 0.5rem;
}

.story-card-author {
  margin: 0 0 0.6rem;
  color: var(--color-text);
  font-weight: 800;
}

.story-card-description {
  margin: 0;
  color: var(--color-text-soft);
}

.story-card-votes {
  margin-top: 0.8rem;
  color: var(--color-accent-soft);
  font-weight: 900;
}

.story-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1rem;
}

.story-actions .btn {
  margin: 0;
  min-height: 44px;
}

/* =========================
   Responsive
========================= */

@media (max-width: 1100px) {
  .story-grid article,
  .story-grid .story-card,
  .story-grid .gallery-card {
    flex-basis: calc((100% - var(--gallery-card-gap)) / 2);
    max-width: 560px;
    min-width: 300px;
  }
}

@media (max-width: 1000px) {
  .concept-detail-panel {
    grid-template-columns: 1fr;
  }

  .concept-art-frame,
  .story-gallery-stage {
    min-height: 420px;
  }

  .concept-art-frame img,
  .story-hero-img {
    max-height: 620px;
  }
}

@media (max-width: 720px) {
  .announcement-strip {
    min-height: 30px;
    padding: 0.32rem 0.85rem;
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .reader-page {
    padding: 1.25rem 1rem 3rem;
  }

  .reader-topbar {
    align-items: flex-start;
  }

  .reader-nav-links,
  .reader-controls {
    flex-direction: column;
    width: 100%;
  }

  .reader-nav-links .btn,
  .reader-controls .btn {
    width: 100%;
  }

  .reader-stage {
    min-height: 360px;
  }

  .reader-page-indicator {
    min-width: auto;
  }

  .story-grid article,
  .story-grid .story-card,
  .story-grid .gallery-card {
    flex-basis: 100%;
    max-width: none;
    min-width: 0;
  }

  .story-card-art img,
  .story-grid img {
    max-height: 480px;
  }
}

@media (max-width: 640px) {
  .gallery-hero {
    padding: 2.25rem 0 2.25rem;
  }

  .gallery-hero h1 {
    font-size: clamp(2.6rem, 14vw, 4rem);
  }

  .gallery-section {
    padding-top: 1.5rem;
  }

  .gallery-toolbar {
    text-align: center;
    justify-content: center;
  }

  .gallery-toolbar h2 {
    font-size: clamp(2rem, 11vw, 3.25rem);
  }

  .gallery-toolbar .btn {
    width: 100%;
  }

  .concept-detail-hero {
    padding: 1.5rem 0 2rem;
  }

  .concept-detail-panel {
    padding: 1rem;
  }

  .concept-detail-copy .story-title {
    font-size: clamp(2.5rem, 13vw, 4rem);
  }

  .concept-art-frame,
  .story-gallery-stage {
    min-height: 320px;
  }

  .concept-art-frame img,
  .story-hero-img {
    max-height: 560px;
  }

  .story-gallery-arrow {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    font-size: 1.85rem;
  }

  .story-gallery-prev {
    left: 0;
  }

  .story-gallery-next {
    right: 0;
  }

  .story-gallery-caption {
    width: 100%;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
  }

  .concept-actions,
  .story-cta,
  .story-actions {
    flex-direction: column;
  }

  .concept-actions .btn,
  .story-cta .btn,
  .story-actions .btn {
    width: 100%;
  }

  .story-card-art-empty {
    min-height: 260px;
  }
}