/* ================================================================
   Magazine viewer — chrome, toolbar, grid, gallery, gold theme.
   ================================================================ */

/* ---- Viewer shell + gold ambient background ---- */
.yb-viewer{
  position: relative;
  min-height: calc(100vh - 120px);
  padding: 16px 12px 40px;
  overflow-x: hidden;
  background:
    radial-gradient(1200px 600px at 15% 10%, rgba(212,175,55,.08), transparent 55%),
    radial-gradient(1000px 600px at 85% 90%, rgba(138,109,42,.10), transparent 55%),
    var(--yb-bg);
}

/* ---- Toolbar: single centered cluster, wraps cleanly, never clips ---- */
@keyframes slideDown{
  from{ opacity: 0; transform: translateY(-8px); }
  to  { opacity: 1; transform: translateY(0);    }
}
.yb-toolbar{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin: 0 auto 16px;
  width: 100%;
  max-width: 960px;
  box-sizing: border-box;
  border-radius: 16px;
  animation: slideDown .5s cubic-bezier(.2,.8,.2,1) both;
  background: linear-gradient(180deg, rgba(26,23,20,.95), rgba(20,18,16,.95));
  border: 1px solid var(--yb-line);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.yb-btn{
  background: transparent;
  border: 1px solid var(--yb-line);
  color: var(--yb-fg);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: .9rem;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: background .15s ease, border-color .15s ease,
              transform .12s ease, box-shadow .15s ease, color .15s ease;
}
.yb-btn:hover{
  transform: translateY(-1px);
  border-color: var(--yb-accent);
  color: var(--yb-accent-2);
  box-shadow: 0 6px 18px rgba(212,175,55,.18);
}
.yb-btn:active{ transform: translateY(0); }

.yb-btn.primary{
  background: var(--yb-gradient-gold);
  color: #1a1206;
  border-color: var(--yb-accent);
  font-weight: 700;
}
.yb-btn.primary:hover{
  filter: brightness(1.08);
  box-shadow: 0 8px 22px rgba(212,175,55,.35);
}

/* Hide the spacer entirely — toolbar is now a single centered row */
.yb-spacer{ display: none !important; }

.yb-pageinfo{
  color: var(--yb-muted);
  font-variant-numeric: tabular-nums;
  padding: 0 6px;
  white-space: nowrap;
  flex: 0 0 auto;
}

/* ---- Page-number pulse ---- */
@keyframes numPulse{
  0%  { color: var(--yb-accent-2); transform: scale(1.2);
        text-shadow: 0 0 18px rgba(212,175,55,.55); }
  100%{ color: var(--yb-muted); transform: scale(1); text-shadow: none; }
}
.yb-pageinfo.pulse #ybPageNum{ animation: numPulse .5s ease; }

/* ---- Active page — gold glowing shadow ---- */
.yb-page.is-active img{
  box-shadow:
    0 30px 60px rgba(0,0,0,.55),
    0 0 0 1px rgba(212,175,55,.10),
    0 0 120px rgba(212,175,55,.10);
  transition: box-shadow .4s ease;
}

/* ---- Page entrance — soft lift ---- */
@keyframes pageEnter{
  0%  { opacity: 0; transform: translateY(14px) scale(.985); filter: brightness(.85); }
  60% { filter: brightness(1.05); }
  100%{ opacity: 1; transform: translateY(0) scale(1); filter: brightness(1); }
}
.yb-page.is-active.is-incoming{ animation: pageEnter .6s cubic-bezier(.2,.8,.2,1); }

/* ---- Gallery page inside the viewer ---- */
.yb-gallery-page{
  padding: 24px;
  border-radius: var(--yb-radius);
  max-height: calc(100vh - 200px);
  max-height: calc(100dvh - 200px);
  overflow: auto;
  background: linear-gradient(180deg, #14110d 0%, #0f0d0a 100%);
  border: 1px solid var(--yb-line);
  width: 100%;
  box-sizing: border-box;
}
.yb-section-title{
  font-size: 1.6rem;
  margin: 0 0 16px;
  letter-spacing: .02em;
  background: var(--yb-gradient-gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.yb-gallery-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.yb-gallery-grid img{
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
}
.yb-gallery-grid figcaption{
  font-size: .78rem;
  color: var(--yb-muted);
  margin-top: 6px;
}
.yb-gallery-grid figure{
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  border: 1px solid transparent;
  border-radius: 10px;
}
.yb-gallery-grid figure:hover{
  transform: translateY(-4px);
  border-color: var(--yb-accent-3);
  box-shadow: 0 14px 30px rgba(0,0,0,.5), 0 0 30px rgba(212,175,55,.10);
}

/* ---- Grid overlay (gold) ---- */
.yb-grid-overlay{
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: 24px;
  overflow: auto;
  background:
    radial-gradient(900px 500px at 20% 10%, rgba(212,175,55,.08), transparent 60%),
    radial-gradient(900px 500px at 85% 90%, rgba(138,109,42,.10), transparent 60%),
    rgba(11,10,8,.96);
  backdrop-filter: blur(8px);
}
.yb-grid-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  max-width: 1200px;
  margin: 0 auto 20px;
}
.yb-grid-header h2{
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  background: var(--yb-gradient-gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.yb-grid{
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
@keyframes cellIn{
  from{ opacity: 0; transform: translateY(10px) scale(.98); }
  to  { opacity: 1; transform: translateY(0) scale(1);      }
}
.yb-grid .cell{
  position: relative;
  background: #14110d;
  border: 1px solid var(--yb-line);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 3/4;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: cellIn .35s ease both;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.yb-grid .cell:hover{
  transform: translateY(-3px);
  border-color: var(--yb-accent);
  box-shadow: 0 14px 30px rgba(0,0,0,.5), 0 0 40px rgba(212,175,55,.15);
}
.yb-grid .cell img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.yb-grid .cell-labelwrap{ position: relative; }
.yb-grid .cell .label{
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 8px;
  font-size: .75rem;
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.8));
}

/* ---- Navbar gold shimmer ---- */
.yb-navbar{ position: sticky; }
.yb-navbar::after{
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(212,175,55,0) 20%,
    rgba(240,199,94,.7) 50%,
    rgba(212,175,55,0) 80%,
    transparent 100%);
  background-size: 200% 100%;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer{
  0%  { background-position: -200% 0; }
  100%{ background-position:  200% 0; }
}

/* ---- Landing — gold glow pulse ---- */
@keyframes glowPulse{
  0%,100%{ box-shadow: 0 12px 30px rgba(212,175,55,.28); }
  50%    { box-shadow: 0 12px 48px rgba(212,175,55,.55); }
}
.yb-open-btn{
  background: var(--yb-gradient-gold);
  color: #1a1206;
  animation: glowPulse 3s ease-in-out infinite;
}
.yb-open-btn:hover{
  transform: translateY(-2px);
  box-shadow: 0 14px 42px rgba(212,175,55,.55);
  filter: brightness(1.06);
}

/* ---- Landing title — gold text gradient ---- */
.yb-title{
  background: linear-gradient(180deg,#fbf3dd 0%,#d4af37 70%,#8a6d2a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.yb-kicker{ color: var(--yb-accent-2); }

/* ---- Stat cards (admin) — gold accents ---- */
.stat{ border: 1px solid var(--yb-line); background: var(--yb-card); }
.stat .num{
  background: var(--yb-gradient-gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---- Responsive ---- */
@media (max-width: 640px){
  .yb-toolbar{
    border-radius: 14px;
    padding: 8px 10px;
    gap: 6px;
  }
  .yb-btn{
    padding: 7px 11px;
    font-size: .8rem;
  }
  .yb-pageinfo{
    padding: 0 4px;
  }
  .yb-page img{
    max-height: calc(100vh - 200px);
    max-height: calc(100dvh - 200px);
  }
}

/* ---- Reduced motion respect ---- */
@media (prefers-reduced-motion: reduce){
  *{
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}