@charset "UTF-8";
/*
 * styles.v4.css — Wave A overlay
 * Splash loader, hover-preview, lightbox, recently-viewed,
 * lazy/blur-up for images, polish for view transitions.
 * Loads AFTER styles.v2.css.
 */

:root {
  --v4-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --v4-shadow-pop: 0 36px 90px -30px rgba(0, 0, 0, 0.78);
}

/* ── A7: Splash loader ── */

.v4-splash {
  position: fixed;
  inset: 0;
  z-index: 2147483700;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 540px at 50% 35%, rgba(216, 74, 99, 0.16), transparent 60%),
    radial-gradient(800px 480px at 80% 80%, rgba(200, 151, 63, 0.14), transparent 60%),
    linear-gradient(180deg, #0e0c09, #15120e 50%, #0e0c09);
  transition: opacity 420ms var(--v4-ease), transform 420ms var(--v4-ease);
}
.v4-splash.is-leaving { opacity: 0; pointer-events: none; transform: scale(1.03); }
.v4-splash-inner {
  display: grid;
  gap: 22px;
  place-items: center;
  text-align: center;
  animation: v4SplashIn 540ms var(--v4-ease) both;
}
.v4-splash-logo {
  width: clamp(120px, 22vw, 180px);
  filter: drop-shadow(0 20px 50px rgba(216, 74, 99, 0.32));
  animation: v4SplashPulse 2.6s ease-in-out infinite;
}
.v4-splash-bar {
  width: 220px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 244, 222, 0.08);
  overflow: hidden;
  position: relative;
}
.v4-splash-bar::before {
  content: "";
  position: absolute; inset: 0;
  width: 38%;
  background: linear-gradient(90deg, transparent, #ff6685, #ffc171, transparent);
  animation: v4SplashSlide 1.3s linear infinite;
}
.v4-splash-tag {
  font: 700 0.72rem/1 "Inter", system-ui, sans-serif;
  letter-spacing: 0.18em;
  color: rgba(216, 175, 132, 0.78);
  text-transform: uppercase;
}
@keyframes v4SplashIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes v4SplashPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes v4SplashSlide { from { transform: translateX(-110%); } to { transform: translateX(360%); } }

body.v4-splash-active { overflow: hidden; }

/* ── A38: lazy + blur-up ── */

img.v4-lazy {
  opacity: 0;
  filter: blur(14px);
  transform: scale(1.02);
  transition: opacity 500ms var(--v4-ease), filter 700ms var(--v4-ease), transform 700ms var(--v4-ease);
  background:
    linear-gradient(135deg, #2b211a, #161210);
}
img.v4-lazy.is-loaded {
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
}

/* Same blur-up for background-image based art (.post-art, .cat-art, .detail-art use background-image) */
.v4-bg-lazy {
  filter: blur(14px) saturate(0.95);
  transition: filter 700ms var(--v4-ease);
}
.v4-bg-lazy.is-loaded { filter: blur(0) saturate(1); }

/* ── A4: hover preview ── */
/* The hover layer sits over the existing .post-art and fades a SECOND
 * preview image (detailPreviewUrl) in on hover. Only pointer:fine. */

@media (hover: hover) and (pointer: fine) {
  .post-art .v4-hover-layer {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 420ms var(--v4-ease), transform 600ms var(--v4-ease);
    pointer-events: none;
    z-index: 2;
  }
  .post-card:hover .post-art .v4-hover-layer.is-ready {
    opacity: 1;
    transform: scale(1.02);
  }
}

/* ── A6: Lightbox ── */

.v4-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2147483800;
  display: grid;
  place-items: center;
  background: rgba(8, 6, 4, 0.86);
  backdrop-filter: blur(18px) saturate(115%);
  -webkit-backdrop-filter: blur(18px) saturate(115%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms var(--v4-ease);
}
.v4-lightbox.is-open { opacity: 1; pointer-events: auto; }

.v4-lb-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
}
.v4-lb-stage.is-panning { cursor: grabbing; }
.v4-lb-img {
  position: absolute;
  top: 50%; left: 50%;
  max-width: none;
  max-height: none;
  user-select: none;
  -webkit-user-drag: none;
  transform: translate(-50%, -50%) scale(1);
  transition: transform 200ms var(--v4-ease);
  box-shadow: var(--v4-shadow-pop);
  border-radius: 10px;
  background: #0e0c09;
}
.v4-lb-stage.is-zoomed .v4-lb-img { transition: none; }

.v4-lb-toolbar {
  position: absolute;
  top: 18px; right: 18px;
  display: flex;
  gap: 8px;
  z-index: 3;
}
.v4-lb-toolbar button {
  display: inline-flex;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 244, 222, 0.16);
  background: rgba(20, 17, 14, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text);
  cursor: pointer;
  transition: all 160ms var(--v4-ease);
}
.v4-lb-toolbar button:hover { border-color: rgba(255, 244, 222, 0.34); background: rgba(36, 30, 24, 0.85); transform: scale(1.06); }
.v4-lb-toolbar svg { width: 18px; height: 18px; }

.v4-lb-arrow {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  display: grid;
  width: 52px; height: 52px;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 244, 222, 0.16);
  background: rgba(20, 17, 14, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text);
  cursor: pointer;
  transition: all 160ms var(--v4-ease);
  z-index: 3;
}
.v4-lb-arrow:hover { border-color: rgba(255, 244, 222, 0.34); background: rgba(36, 30, 24, 0.85); transform: translateY(-50%) scale(1.06); }
.v4-lb-arrow.prev { left: 18px; }
.v4-lb-arrow.next { right: 18px; }
.v4-lb-arrow[disabled] { opacity: 0.32; cursor: default; }
.v4-lb-counter {
  position: absolute;
  top: 18px; left: 50%;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 244, 222, 0.12);
  background: rgba(20, 17, 14, 0.7);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  z-index: 3;
}

/* Help hint at the bottom */
.v4-lb-hint {
  position: absolute;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 244, 222, 0.08);
  background: rgba(20, 17, 14, 0.5);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: rgba(200, 185, 161, 0.72);
  z-index: 3;
}

@media (max-width: 620px) {
  .v4-lb-arrow { width: 44px; height: 44px; }
  .v4-lb-hint { display: none; }
}

/* Make detail art clickable: cursor zoom-in */
.detail-art { cursor: zoom-in; }
.detail-art.has-image:hover { filter: brightness(1.04); }

/* ── A10: Recently viewed ── */

.v4-recent-section {
  margin: 28px 0 4px;
  padding-top: 6px;
}
.v4-recent-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.v4-recent-card {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(255, 244, 222, 0.08);
  background: rgba(28, 24, 19, 0.55);
  aspect-ratio: 1 / 1;
  cursor: pointer;
  text-align: left;
  padding: 0;
  transition: transform 280ms var(--v4-ease), border-color 280ms var(--v4-ease);
}
.v4-recent-card:hover {
  transform: translateY(-2px);
  border-color: rgba(200, 151, 63, 0.42);
}
.v4-recent-card .v4-recent-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}
.v4-recent-card .v4-recent-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  align-items: end;
  padding: 8px 10px;
  background: linear-gradient(180deg, transparent 50%, rgba(8, 6, 4, 0.85));
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
}
.v4-recent-card .v4-recent-overlay span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 1120px) {
  .v4-recent-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .v4-recent-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
}

/* ── A5: View Transitions — turn on shared morph for post art ── */
/* Note: this complements the @supports block in styles.v2.css */

@supports (view-transition-name: a) {
  .post-art.is-vt-source { view-transition-name: v4-post-hero; }
  .detail-art.is-vt-target { view-transition-name: v4-post-hero; }
  ::view-transition-old(v4-post-hero),
  ::view-transition-new(v4-post-hero) {
    animation-duration: 520ms;
    animation-timing-function: var(--v4-ease);
    mix-blend-mode: normal;
  }
}

/* Reduce-motion override */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .v4-splash { transition: opacity 0.001ms; }
}
