/* ============================================================
   v2 Design — magazine cover + editorial reader
   ============================================================
   ALL rules in this file are scoped to [data-version="v2"]
   so they only apply when the user has the new design active.
   This means v1 stays pixel-identical even with this file loaded.

   Library = magazine issue cover
   Reader  = long-form editorial page

   Index, Yours, Submit, Quiz, Videos all stay v1 in Deploy 2.
   They get redesigned in Deploy 3.

   Cormorant Garamond is loaded via the <link> in index.html,
   alongside the existing Lora/Nunito/Caveat fonts.
   ============================================================ */

/* ============================================================
   v2 LIBRARY — Magazine cover treatment
   ============================================================ */

[data-version="v2"] .topbar {
  border-bottom: 0.5px solid rgba(232, 72, 104, 0.18);
  padding: 16px 22px 12px;
  padding-top: calc(16px + var(--st));
}
[data-version="v2"] .topbar__title {
  font-family: 'Cormorant Garamond', var(--ff-serif), Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 1.45rem;
  color: var(--t1);
  letter-spacing: 0.005em;
}

/* Replace ✨ Featured / 🔥 Latest section heads with hairline-rule small caps */
[data-version="v2"] #view-library .section-head {
  display: none;     /* hide v1 section heads inside library only */
}

/* The new top-of-library "Issue bar" — Volume ii / May 2026 */
[data-version="v2"] #library-scroll {
  padding-top: 4px;
}
[data-version="v2"] .v2-issue-bar {
  padding: 16px 22px 18px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid rgba(232, 72, 104, 0.4);
  margin: 0 22px;
}
[data-version="v2"] .v2-issue-vol {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 17px;
  color: var(--t1);
  font-weight: 500;
}
[data-version="v2"] .v2-issue-date {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}

/* The cover hero (replaces the old .feature-card big card) */
[data-version="v2"] #view-library .feature-card {
  border-radius: 6px;
  margin: 26px 22px 0;
  width: calc(100% - 44px);
  overflow: hidden;
  position: relative;
  background: linear-gradient(165deg, #2e1820 0%, #441830 50%, #1a0a10 100%);
  border: 0;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  aspect-ratio: 4 / 5;
  cursor: pointer;
}
/* Subtle accent glow in upper-left */
[data-version="v2"] #view-library .feature-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 35% 30%, rgba(232, 72, 104, 0.22), transparent 55%);
  z-index: 1;
  pointer-events: none;
}
[data-version="v2"] #view-library .feature-card__img,
[data-version="v2"] #view-library .feature-card__placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  z-index: 0;
  background: transparent;
}
[data-version="v2"] #view-library .feature-card__img {
  object-fit: cover;
  filter: saturate(0.9) contrast(1.05);
}
/* Big watermark emoji behind cover typography when no cover image */
[data-version="v2"] #view-library .feature-card__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 130px;
  opacity: 0.13;
}
/* Cover number badge top-left */
[data-version="v2"] #view-library .feature-card .v2-cover-no {
  position: absolute;
  top: 16px;
  left: 18px;
  z-index: 3;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}
/* Hide v1 "tag" chip inside overlay; we render our own tag */
[data-version="v2"] #view-library .feature-card .feature-card__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 22px;
  background: linear-gradient(180deg, transparent 30%, rgba(13, 5, 8, 0.85) 100%);
  z-index: 2;
}

/* Install banner — refine it for v2 so it doesn't feel out of place
   above the magazine cover. Same placement, quieter chrome. */
[data-version="v2"] .install-banner {
  margin: 14px 22px 4px;
  background: rgba(36, 18, 24, 0.6);
  border: 0.5px solid rgba(232, 72, 104, 0.25);
  border-radius: 8px;
  padding: 12px 14px;
}
[data-version="v2"] .install-banner__text strong {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 0.95rem;
}
[data-version="v2"] .install-banner__action {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  background: var(--rose);
  border-radius: 4px;
  padding: 7px 12px;
}
[data-version="v2"] #view-library .feature-card__tag {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 3;
  display: inline-block;
  padding: 4px 10px;
  background: rgba(13, 5, 8, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(242, 140, 160, 0.4);
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #f28ca0;
  margin: 0;
}
[data-version="v2"] #view-library .feature-card__title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 32px;
  color: #f5e6ea;
  line-height: 1.05;
  margin-bottom: 0;
  font-weight: 500;
}
/* Hide v1 meta line — we put meta below the cover, not on it */
[data-version="v2"] #view-library .feature-card__meta {
  display: none;
}
/* Hide v1 "New" badge — v2 has its own treatment */
[data-version="v2"] #view-library .feature-card .badge-new {
  display: none;
}

/* Pull-quote below the cover (rendered by JS) */
[data-version="v2"] .v2-pull {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 16px;
  line-height: 1.55;
  color: #dcc8cf;
  padding: 4px 0 4px 16px;
  margin: 18px 22px 0 38px;
  border-left: 2px solid var(--rose);
}
[data-version="v2"] .v2-pull-byline {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #b89aa4;
  font-weight: 600;
  margin: 12px 22px 0 54px;
}
[data-version="v2"] .v2-read {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--t1);
  font-weight: 600;
  padding: 0;
  margin: 24px 22px 0 54px;
  cursor: pointer;
  background: transparent;
  border: 0;
  width: auto;
  font-family: var(--ff-body);
}
[data-version="v2"] .v2-read .v2-arrow {
  width: 32px;
  height: 1px;
  background: var(--rose);
  position: relative;
  display: inline-block;
}
[data-version="v2"] .v2-read .v2-arrow::after {
  content: '';
  position: absolute;
  right: 0;
  top: -3px;
  width: 8px;
  height: 8px;
  border-right: 1px solid var(--rose);
  border-top: 1px solid var(--rose);
  transform: rotate(45deg);
}

/* Table of contents header */
[data-version="v2"] .v2-toc-head {
  padding: 36px 22px 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
[data-version="v2"] .v2-toc-label {
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}
[data-version="v2"] .v2-toc-rule {
  height: 1px;
  background: rgba(232, 72, 104, 0.4);
  margin: 0 22px;
}
[data-version="v2"] .v2-toc-list {
  padding: 0 22px;
  margin-bottom: 8px;
}
[data-version="v2"] .v2-toc-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 0.5px solid rgba(232, 72, 104, 0.15);
  align-items: baseline;
  cursor: pointer;
  background: transparent;
  border-left: 0; border-right: 0; border-top: 0;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
}
[data-version="v2"] .v2-toc-item:last-child {
  border-bottom: 0;
}
[data-version="v2"] .v2-toc-item:active {
  background: rgba(232, 72, 104, 0.04);
}
[data-version="v2"] .v2-toc-no {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: #b89aa4;
  font-weight: 600;
}
[data-version="v2"] .v2-toc-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 19px;
  color: var(--t1);
  line-height: 1.2;
  font-weight: 500;
}
[data-version="v2"] .v2-toc-meta {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #b89aa4;
  font-weight: 600;
  white-space: nowrap;
}
[data-version="v2"] .v2-toc-meta.is-new {
  color: #f28ca0;
}

/* Hide all v1 story-row scroll rows when v2 is active —
   we replace them with the TOC list above */
[data-version="v2"] #view-library .story-row {
  display: none;
}

/* ============================================================
   v2 READER — Editorial layout
   ============================================================ */

[data-version="v2"] .reader-bar {
  padding: 14px 16px 12px;
  padding-top: calc(14px + var(--st));
  background: rgba(26, 10, 16, 0.94);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-bottom: 0.5px solid rgba(232, 72, 104, 0.2);
}
[data-version="v2"] .reader-bar__title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 14px;
  color: var(--t1);
  letter-spacing: 0.01em;
}

[data-version="v2"] .reader {
  padding: 0 22px calc(40px + var(--sb));
}
/* Hide v1 hero — v2 uses pure typographic title page */
[data-version="v2"] .reader__hero {
  display: none;
}

/* Issue/edition kicker above title */
[data-version="v2"] .v2-reader-kicker {
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 16px;
}

[data-version="v2"] .reader__title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 36px;
  font-weight: 500;
  line-height: 1.05;
  color: var(--t1);
  margin-bottom: 16px;
  letter-spacing: -0.005em;
  max-width: 12ch;
}

[data-version="v2"] .reader__meta {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #b89aa4;
  font-weight: 600;
  padding-bottom: 22px;
  border-bottom: 0.5px solid rgba(232, 72, 104, 0.2);
  margin-bottom: 28px;
  display: flex;
  gap: 14px;
  align-items: baseline;
}
/* Hide v1 .tag chip in reader meta — we render plain text instead */
[data-version="v2"] .reader__meta .tag {
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #b89aa4;
  font-weight: 600;
}

[data-version="v2"] .reader__body {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 18px;
  line-height: 1.75;
  color: #dcc8cf;
}
[data-version="v2"] .reader__body p {
  margin-bottom: 1.4em;
}
/* The editorial drop cap on the first paragraph */
[data-version="v2"] .reader__body > p:first-of-type::first-letter {
  font-family: 'Cormorant Garamond', Georgia, serif;
  float: left;
  font-size: 4.4em;
  line-height: 0.85;
  font-weight: 500;
  font-style: normal;
  margin: 0.05em 0.1em -0.05em 0;
  color: var(--rose);
}
[data-version="v2"] .reader__body em,
[data-version="v2"] .reader__body .dialogue {
  font-style: italic;
  color: #f28ca0;
}
[data-version="v2"] .reader__body .emphasis {
  color: #f0d89c;
  font-weight: 500;
}
[data-version="v2"] .reader__body .scene-break {
  text-align: center;
  margin: 2.5rem 0;
  color: var(--rose);
  font-size: 14px;
  letter-spacing: 0.6em;
  opacity: 0.6;
}

/* End-of-story sign-off — fleuron + Caveat script */
[data-version="v2"] .reader__end {
  text-align: center;
  margin-top: 56px;
  padding: 24px 22px 60px;
  position: relative;
}
[data-version="v2"] .reader__end::before {
  content: '❦';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg);
  padding: 0 14px;
  color: var(--rose);
  font-size: 14px;
}
[data-version="v2"] .reader__end-icon {
  display: none;
}
[data-version="v2"] .reader__end-text {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 18px;
  color: #dcc8cf;
  padding-top: 24px;
  border-top: 0.5px solid rgba(232, 72, 104, 0.2);
}
[data-version="v2"] .reader__end-sig {
  font-family: var(--ff-script), 'Caveat', cursive;
  font-size: 28px;
  color: #f28ca0;
  margin-top: 8px;
  display: block;
}

/* ============================================================
   v2 BOTTOM NAV — keep existing tabs, just refine the styling
   We do NOT change the tab structure in Deploy 2.
   Stories / Q&A / Yours / Videos / Share all still work.
   ============================================================ */

[data-version="v2"] .bottom-nav {
  background: rgba(26, 10, 16, 0.92);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border-top: 0.5px solid rgba(232, 72, 104, 0.18);
}
[data-version="v2"] .bottom-nav__tab[aria-current="page"]::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: var(--rose);
  border-radius: 0 0 2px 2px;
}
[data-version="v2"] .bottom-nav__tab {
  position: relative;
}
[data-version="v2"] .bottom-nav__label {
  font-size: 9px;
  letter-spacing: 0.18em;
  font-weight: 600;
}
