@charset "UTF-8";
/*
 * styles.v2.css — Amy's Girls visual refresh (Wave 1)
 * Loads AFTER styles.css. Overrides selectively. Safe to remove (restores old look).
 *
 * Direction: warm glassmorphism. Keeps the existing brand palette
 * (deep ink #12100d, rose #d84a63, gold #c8973f, teal #35a47c)
 * but adds depth via translucent panels, soft glow accents, refined typography.
 */

/* ── Inter from Google Fonts (loaded via index.html <link>; we just declare fallback) ── */

:root {
  /* Refined surface tokens layered over the existing palette */
  --v2-bg-0: #0e0c09;
  --v2-bg-1: #15120e;
  --v2-bg-2: #1c1813;
  --v2-glass: rgba(28, 24, 19, 0.55);
  --v2-glass-strong: rgba(34, 29, 23, 0.78);
  --v2-glass-soft: rgba(255, 244, 222, 0.04);
  --v2-line-1: rgba(255, 244, 222, 0.08);
  --v2-line-2: rgba(255, 244, 222, 0.14);
  --v2-line-hot: rgba(216, 74, 99, 0.42);
  --v2-line-gold: rgba(200, 151, 63, 0.42);

  /* Accents */
  --v2-rose: #d84a63;
  --v2-rose-hot: #ff6685;
  --v2-gold: #d8a04a;
  --v2-gold-hot: #ffc171;
  --v2-teal: #35a47c;
  --v2-teal-hot: #4ec79b;

  /* Glow halos for hover/focus states */
  --v2-glow-rose: 0 0 0 1px rgba(216, 74, 99, 0.32), 0 18px 48px -18px rgba(216, 74, 99, 0.55);
  --v2-glow-gold: 0 0 0 1px rgba(200, 151, 63, 0.34), 0 18px 48px -18px rgba(200, 151, 63, 0.5);
  --v2-glow-teal: 0 0 0 1px rgba(53, 164, 124, 0.32), 0 18px 48px -18px rgba(53, 164, 124, 0.5);

  /* Radii system */
  --v2-r-xs: 6px;
  --v2-r-sm: 10px;
  --v2-r-md: 14px;
  --v2-r-lg: 20px;
  --v2-r-xl: 28px;

  /* Soft shadow scale (warm, not pure black) */
  --v2-shadow-1: 0 1px 0 rgba(255, 244, 222, 0.04) inset, 0 8px 22px -10px rgba(0, 0, 0, 0.55);
  --v2-shadow-2: 0 1px 0 rgba(255, 244, 222, 0.05) inset, 0 22px 48px -22px rgba(0, 0, 0, 0.65);
  --v2-shadow-3: 0 1px 0 rgba(255, 244, 222, 0.06) inset, 0 38px 88px -28px rgba(0, 0, 0, 0.75);

  /* Motion */
  --v2-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --v2-fast: 160ms;
  --v2-med: 280ms;
}

/* ── Typography ── */

html { font-feature-settings: "ss01", "cv11", "cv02"; }

body {
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "ss01", "cv11", "cv02";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(1100px 600px at 12% -10%, rgba(216, 74, 99, 0.18), transparent 60%),
    radial-gradient(900px 520px at 92% 6%, rgba(200, 151, 63, 0.14), transparent 60%),
    radial-gradient(1400px 900px at 50% 110%, rgba(53, 164, 124, 0.10), transparent 60%),
    linear-gradient(180deg, var(--v2-bg-0), var(--v2-bg-1) 40%, var(--v2-bg-0));
  background-attachment: fixed;
}

/* Calm the giant H1 — was clamp(2rem, 5vw, 4.4rem) */
h1 { font-size: clamp(1.85rem, 3.5vw, 3rem); line-height: 1.05; letter-spacing: -0.015em; }
h2 { font-size: clamp(1.4rem, 2.2vw, 1.9rem); line-height: 1.15; letter-spacing: -0.01em; font-weight: 800; }
h3 { font-size: 1.02rem; letter-spacing: -0.005em; font-weight: 700; }

.eyebrow, .side-title, .result-count {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: rgba(216, 175, 132, 0.78); /* warm gold-ish muted, more legible */
}

/* Improve muted text contrast for AA */
:root { --muted: #c8b9a1; }

/* ── Focus ring for keyboard users (global) ── */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--v2-gold-hot);
  outline-offset: 2px;
  border-radius: var(--v2-r-sm);
}

/* ── App shell & sidebar (glass) ── */

.app-shell { grid-template-columns: 280px minmax(0, 1fr); }

.sidebar {
  border-right: 1px solid var(--v2-line-1);
  background:
    linear-gradient(180deg, rgba(18, 16, 13, 0.65), rgba(14, 12, 9, 0.78)),
    radial-gradient(380px 220px at 50% -40px, rgba(216, 74, 99, 0.18), transparent 70%);
  backdrop-filter: blur(22px) saturate(120%);
  -webkit-backdrop-filter: blur(22px) saturate(120%);
  padding: 20px 18px;
}

.brand {
  margin-bottom: 22px;
  padding: 0;
  border: 0;
  background: none;
}
.brand-image {
  border-radius: 0;
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.38));
}

.nav-list { gap: 4px; }

.nav-item, .ghost, .secondary, .primary, .segment-btn, .mobile-menu,
.modal-close, .tag-chip, .hash, .like, .dislike {
  border-radius: var(--v2-r-sm);
  border: 1px solid var(--v2-line-1);
  background: var(--v2-glass-soft);
  transition: transform var(--v2-fast) var(--v2-ease),
              border-color var(--v2-fast) var(--v2-ease),
              background var(--v2-fast) var(--v2-ease),
              color var(--v2-fast) var(--v2-ease),
              box-shadow var(--v2-fast) var(--v2-ease);
}

.nav-item {
  position: relative;
  padding: 0 14px;
  font-weight: 600;
}

.nav-item::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  width: 3px;
  height: 0;
  background: linear-gradient(180deg, var(--v2-rose), var(--v2-gold));
  border-radius: 2px;
  transform: translateY(-50%);
  transition: height var(--v2-med) var(--v2-ease);
}
.nav-item:hover { border-color: var(--v2-line-2); background: rgba(255, 244, 222, 0.06); }
.nav-item.active {
  border-color: var(--v2-line-hot);
  background: linear-gradient(90deg, rgba(216, 74, 99, 0.18), rgba(216, 74, 99, 0.04));
  color: #fff;
}
.nav-item.active::before { height: 60%; }

.admin-link, .admin-quick {
  border-color: var(--v2-line-gold);
  color: #ffe1a7;
  background: linear-gradient(180deg, rgba(200, 151, 63, 0.16), rgba(200, 151, 63, 0.06));
}

/* ── Topbar (sticky glass bar) ── */

.main { padding: 22px clamp(16px, 3vw, 38px) 56px; }

.topbar {
  padding: 14px 16px;
  margin: 0 0 18px;
  border-radius: var(--v2-r-lg);
  border: 1px solid var(--v2-line-1);
  background: var(--v2-glass);
  backdrop-filter: blur(20px) saturate(125%);
  -webkit-backdrop-filter: blur(20px) saturate(125%);
  box-shadow: var(--v2-shadow-2);
}

.search-wrap input {
  border-radius: var(--v2-r-md);
  background: rgba(14, 12, 9, 0.55);
  border-color: var(--v2-line-1);
  padding-left: 42px;
  font-weight: 500;
}
.search-wrap input::placeholder { color: rgba(200, 185, 161, 0.62); }
.search-wrap input:focus {
  border-color: var(--v2-line-gold);
  box-shadow: var(--v2-glow-gold);
  background: rgba(14, 12, 9, 0.78);
}
.search-icon { color: var(--v2-gold-hot); font-weight: 700; }

/* ── Buttons ── */

.primary {
  background: linear-gradient(180deg, var(--v2-rose), #b73a52);
  border: 1px solid rgba(255, 102, 133, 0.32);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.005em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 14px 30px -14px rgba(216, 74, 99, 0.7);
}
.primary:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, var(--v2-rose-hot), #c8455f);
  box-shadow: var(--v2-glow-rose);
}
.primary:active { transform: translateY(0); }

.secondary, .ghost {
  background: rgba(255, 244, 222, 0.06);
  font-weight: 600;
}
.secondary:hover, .ghost:hover {
  border-color: var(--v2-line-2);
  background: rgba(255, 244, 222, 0.1);
}

/* ── Section heads ── */

.section-head { margin: 32px 0 18px; }
.section-head h2 { line-height: 1.1; }
.post-head { margin-top: 36px; }

/* ── Category grid (glass cards) ── */

.category-grid, .post-grid { gap: 16px; }

.category-card, .post-card {
  border: 1px solid var(--v2-line-1);
  border-radius: var(--v2-r-md);
  background: var(--v2-glass);
  backdrop-filter: blur(14px) saturate(115%);
  -webkit-backdrop-filter: blur(14px) saturate(115%);
  box-shadow: var(--v2-shadow-1);
  transition: transform var(--v2-med) var(--v2-ease),
              border-color var(--v2-med) var(--v2-ease),
              box-shadow var(--v2-med) var(--v2-ease);
  overflow: hidden;
}

.category-card:hover, .post-card:hover {
  transform: translateY(-2px);
  border-color: var(--v2-line-2);
  box-shadow: var(--v2-shadow-2);
}

.category-card:hover { border-color: var(--v2-line-gold); }
.post-card:hover { border-color: var(--v2-line-hot); }

/* Cleaner cat/post art — hide the decorative ::before/::after blobs
   in favor of a flat gradient with a soft inner light. The original
   blobs read as a render glitch when no image is set. */
.cat-art:not(.has-image), .post-art:not(.has-image) {
  background:
    radial-gradient(140% 90% at 50% -10%, rgba(216, 74, 99, 0.28), transparent 50%),
    radial-gradient(120% 90% at 20% 110%, rgba(200, 151, 63, 0.18), transparent 55%),
    linear-gradient(145deg, #2b211a, #161210);
}
.cat-art:not(.has-image)::before, .cat-art:not(.has-image)::after,
.post-art:not(.has-image)::before, .post-art:not(.has-image)::after,
.detail-art:not(.has-image)::before, .detail-art:not(.has-image)::after { display: none; }

.cat-art, .post-art { aspect-ratio: 4 / 3; height: auto; }
.post-art { height: auto; }

/* Hover lift on the post art */
.art-link {
  position: relative;
  overflow: hidden;
}
.art-link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(8, 6, 4, 0.7));
  opacity: 0.85;
  transition: opacity var(--v2-fast) var(--v2-ease);
  pointer-events: none;
}
.post-card:hover .art-link::after { opacity: 0.6; }
.art-link img, .art-link {
  transition: transform 480ms var(--v2-ease);
}
.post-card:hover .art-link img { transform: scale(1.04); }

/* Card body */
.category-body, .post-body { padding: 16px; }
.post-body { gap: 6px; }
.category-card h3, .post-card h3 {
  font-size: 1.04rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.005em;
  /* limit to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.category-card p { font-size: 0.88rem; line-height: 1.5; color: var(--muted); min-height: 0; }

/* Topline pills cleaner */
.post-topline { gap: 6px; margin-bottom: 8px; }
.pill, .status {
  border-radius: 999px;
  padding: 0 10px;
  min-height: 22px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: rgba(255, 244, 222, 0.07);
  border: 1px solid var(--v2-line-1);
  color: rgba(246, 239, 226, 0.86);
  text-transform: uppercase;
}
.pill[data-kind="new"]     { color: #d6ffe9; background: rgba(53, 164, 124, 0.18); border-color: rgba(78, 199, 155, 0.36); }
.pill[data-kind="hot"]     { color: #ffd9e0; background: rgba(216, 74, 99, 0.18); border-color: rgba(255, 102, 133, 0.36); }
.pill[data-kind="rare"]    { color: #ffe5b3; background: rgba(200, 151, 63, 0.18); border-color: rgba(255, 193, 113, 0.36); }
.pill[data-kind="cw"]      { color: #ffcc9c; background: rgba(255, 178, 92, 0.16); border-color: rgba(255, 178, 92, 0.36); }

.post-rating { font-size: 0.82rem; color: rgba(200, 185, 161, 0.84); }

/* Hide the duplicate "View post" CTA inside the post card — clicking the art opens it.
   We keep it in the DOM (for screen-reader users without art images) but visually move it
   to be a quieter link-style affordance. */
.post-actions {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed var(--v2-line-1);
}
.post-card .post-actions .primary {
  background: transparent;
  color: var(--v2-gold-hot);
  border: 1px solid var(--v2-line-1);
  box-shadow: none;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.post-card .post-actions .primary:hover {
  background: rgba(200, 151, 63, 0.12);
  border-color: var(--v2-line-gold);
  color: #ffd99c;
  transform: none;
}

/* ── Favorite star — softer, less prominent ── */
.favorite-star {
  width: 36px; height: 36px; min-height: 36px;
  border-radius: 12px;
  background: rgba(8, 6, 4, 0.55);
  border: 1px solid var(--v2-line-1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px -10px rgba(0, 0, 0, 0.7);
}
.favorite-star:hover { border-color: var(--v2-line-gold); }
.favorite-star.active { color: var(--v2-gold-hot); background: rgba(200, 151, 63, 0.22); border-color: var(--v2-line-gold); }

/* ── Tag chips ── */

.tag-chip, .hash {
  min-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(200, 185, 161, 0.92);
  background: var(--v2-glass-soft);
}
.tag-chip span { color: rgba(200, 185, 161, 0.55); font-size: 0.7rem; }
.tag-chip:hover { background: rgba(255, 244, 222, 0.08); border-color: var(--v2-line-2); }
.tag-chip.active {
  color: #fff;
  background: linear-gradient(180deg, rgba(216, 74, 99, 0.32), rgba(216, 74, 99, 0.16));
  border-color: var(--v2-line-hot);
  box-shadow: var(--v2-glow-rose);
}

/* ── Pagination ── */
.page-btn { border-radius: var(--v2-r-sm); }
.page-btn.active { background: linear-gradient(180deg, rgba(216, 74, 99, 0.28), rgba(216, 74, 99, 0.1)); border-color: var(--v2-line-hot); color: #fff; }

/* ── Modals ── */

.modal-panel {
  border-radius: var(--v2-r-lg);
  border: 1px solid var(--v2-line-1);
  background:
    linear-gradient(180deg, rgba(34, 29, 23, 0.92), rgba(20, 17, 14, 0.96));
  backdrop-filter: blur(24px) saturate(130%);
  -webkit-backdrop-filter: blur(24px) saturate(130%);
  box-shadow: var(--v2-shadow-3);
  padding: 28px;
}
.modal::backdrop {
  background:
    radial-gradient(800px 500px at 50% 10%, rgba(216, 74, 99, 0.18), transparent 60%),
    rgba(8, 6, 4, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.modal input, .admin-form input, .admin-form select, .admin-form textarea, .chat-form input {
  border-radius: var(--v2-r-md);
  background: rgba(14, 12, 9, 0.6);
  border-color: var(--v2-line-1);
}
.modal input:focus, .admin-form input:focus, .admin-form select:focus, .admin-form textarea:focus, .chat-form input:focus {
  border-color: var(--v2-line-gold);
  box-shadow: var(--v2-glow-gold);
}

/* Decrypt box for passwords */
.decrypt-box {
  border-radius: var(--v2-r-md);
  background: linear-gradient(180deg, rgba(8, 6, 4, 0.92), rgba(14, 12, 9, 0.9));
  border: 1px solid var(--v2-line-gold);
  box-shadow: 0 0 0 4px rgba(200, 151, 63, 0.06), 0 18px 40px -18px rgba(200, 151, 63, 0.5);
}

/* ── Trade & footer ── */
.trade-card, .trade-form, .ucp-card, .trade-empty,
.detail-media, .detail-body, .best-layout section, .chat-panel, .admin-form, .detail-section {
  border-radius: var(--v2-r-md);
  background: var(--v2-glass);
  backdrop-filter: blur(14px) saturate(115%);
  -webkit-backdrop-filter: blur(14px) saturate(115%);
  border: 1px solid var(--v2-line-1);
  box-shadow: var(--v2-shadow-1);
}

.site-footer { color: rgba(200, 185, 161, 0.84); padding-top: 26px; }

/* ── Mobile sidebar drawer (overlay + better animation) ── */

.app-shell .sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(8, 6, 4, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--v2-med) var(--v2-ease);
}
body.menu-open .sidebar-overlay { opacity: 1; pointer-events: auto; }

@media (max-width: 840px) {
  .sidebar {
    z-index: 30;
    box-shadow: 28px 0 80px rgba(0, 0, 0, 0.55);
    border-right: 1px solid var(--v2-line-2);
  }
  .topbar { padding: 12px 14px; }
  .mobile-menu { padding: 0; width: 42px; min-width: 42px; }
}

/* ── Skeleton loaders ── */

@keyframes v2Shimmer {
  0%   { background-position: -480px 0; }
  100% { background-position: 480px 0; }
}

.v2-skeleton {
  position: relative;
  border-radius: var(--v2-r-md);
  border: 1px solid var(--v2-line-1);
  background:
    linear-gradient(90deg, rgba(255, 244, 222, 0) 0%, rgba(255, 244, 222, 0.07) 50%, rgba(255, 244, 222, 0) 100%),
    rgba(28, 24, 19, 0.55);
  background-size: 480px 100%, 100% 100%;
  background-repeat: no-repeat, no-repeat;
  background-position: -480px 0, 0 0;
  animation: v2Shimmer 1.4s linear infinite;
  overflow: hidden;
}
@media (prefers-reduced-motion: reduce) {
  .v2-skeleton { animation: none; }
}

.v2-skeleton.card-skel { height: 280px; }
.v2-skeleton.card-skel.cat { height: 220px; }
.v2-skeleton.line { height: 12px; border-radius: 6px; margin-top: 8px; }
.v2-skeleton.line.short { width: 40%; }
.v2-skeleton.line.med { width: 70%; }

/* ── Toast stack ── */

.v2-toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 2147483600;
  display: grid;
  gap: 10px;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 28px));
}

.v2-toast {
  pointer-events: auto;
  padding: 12px 14px;
  border-radius: var(--v2-r-md);
  border: 1px solid var(--v2-line-2);
  background: var(--v2-glass-strong);
  backdrop-filter: blur(16px) saturate(125%);
  -webkit-backdrop-filter: blur(16px) saturate(125%);
  color: var(--text);
  box-shadow: var(--v2-shadow-2);
  font-size: 0.9rem;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  animation: v2ToastIn 280ms var(--v2-ease) both;
}
.v2-toast.is-leaving { animation: v2ToastOut 220ms var(--v2-ease) forwards; }
.v2-toast .v2-toast-ico {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}
.v2-toast.v2-success .v2-toast-ico { background: rgba(78, 199, 155, 0.22); color: #c9f4dc; }
.v2-toast.v2-error   .v2-toast-ico { background: rgba(255, 102, 133, 0.22); color: #ffd0d8; }
.v2-toast.v2-info    .v2-toast-ico { background: rgba(200, 151, 63, 0.22); color: #ffe1a7; }
.v2-toast button.v2-toast-x {
  border: 0; background: transparent; color: var(--muted);
  width: 22px; height: 22px; padding: 0; cursor: pointer;
  border-radius: 6px;
}
.v2-toast button.v2-toast-x:hover { color: var(--text); background: rgba(255, 244, 222, 0.08); }

@keyframes v2ToastIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes v2ToastOut {
  from { opacity: 1; transform: translateY(0)    scale(1); }
  to   { opacity: 0; transform: translateY(-6px) scale(0.98); }
}

/* ── Empty states ── */

.v2-empty {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 12px;
  padding: 48px 24px;
  border-radius: var(--v2-r-md);
  border: 1px dashed var(--v2-line-1);
  background: rgba(255, 244, 222, 0.025);
}
.v2-empty .v2-empty-art {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(160deg, rgba(216, 74, 99, 0.22), rgba(200, 151, 63, 0.14));
  border: 1px solid var(--v2-line-2);
  color: var(--v2-gold-hot);
  font-size: 1.8rem;
  font-weight: 800;
}
.v2-empty h3 { margin: 0; font-size: 1.05rem; }
.v2-empty p  { margin: 0; color: var(--muted); max-width: 38ch; line-height: 1.55; }

/* ── Tiny "NEW" / "HOT" badges absolute over the art ── */

.v2-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(8, 6, 4, 0.7);
  border: 1px solid var(--v2-line-2);
  color: #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.v2-badge.v2-new { color: #d6ffe9; border-color: rgba(78, 199, 155, 0.4); }
.v2-badge.v2-hot { color: #ffd0d8; border-color: rgba(255, 102, 133, 0.4); }
.v2-badge.v2-hot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--v2-rose-hot); box-shadow: 0 0 0 4px rgba(216, 74, 99, 0.18); }

/* ── Misc polish ── */

.chip-row { padding-bottom: 12px; }
.chip-row::-webkit-scrollbar-thumb { background: rgba(200, 151, 63, 0.32); }

.message {
  border-radius: var(--v2-r-md);
  border: 1px solid var(--v2-line-1);
  background: rgba(255, 244, 222, 0.05);
}
.message.me { background: linear-gradient(180deg, rgba(53, 164, 124, 0.22), rgba(53, 164, 124, 0.08)); border-color: rgba(78, 199, 155, 0.32); }

/* Light tweak for the back button on detail view */
.back-button { border-radius: var(--v2-r-sm); }

/* ──────────────────────────────────────────────────────────────────────
 * v3 — Motion & polish layer
 * Page transitions, staggered card reveal, micro-interactions,
 * lucide nav icons, share button, detail-page skeletons, progress bar.
 * Inspired by Vercel/Linear/Stripe motion language: short, soft,
 * never bouncy; opacity + 6–10px Y, never rotate or scale jumps.
 * ────────────────────────────────────────────────────────────────────── */

:root {
  --v3-ease-out: cubic-bezier(0.22, 1, 0.36, 1);          /* "spring-ish" but cheap */
  --v3-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --v3-dur-fast: 180ms;
  --v3-dur-base: 320ms;
  --v3-dur-slow: 520ms;
}

/* ── View routing transitions (used when JS swaps .active-view) ── */

.view {
  /* default: hidden, set up for animation when activated */
  opacity: 0;
  transform: translateY(8px);
  filter: blur(0);
  transition: none;
}
.view.active-view {
  animation: v3ViewIn var(--v3-dur-base) var(--v3-ease-out) both;
}

@keyframes v3ViewIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* When the user leaves a view (we add this class via JS just before swap) */
.view.is-leaving {
  animation: v3ViewOut 180ms var(--v3-ease-in-out) forwards;
}
@keyframes v3ViewOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-6px); }
}

/* ── Staggered card reveal ── */
/* Cards get an inline CSS variable --v3-i = index from JS, so we
 * stagger their entry. nth-child fallback also covers default cases. */

.post-grid > *, .category-grid > *, .rank-list > *, .related-grid > *, .trade-grid > * {
  animation: v3CardIn 460ms var(--v3-ease-out) both;
  animation-delay: calc(var(--v3-i, 0) * 35ms);
}

@keyframes v3CardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* nth-child fallback when JS hasn't assigned --v3-i (e.g., re-renders) */
.post-grid > *:nth-child(1)  { --v3-i: 0; }
.post-grid > *:nth-child(2)  { --v3-i: 1; }
.post-grid > *:nth-child(3)  { --v3-i: 2; }
.post-grid > *:nth-child(4)  { --v3-i: 3; }
.post-grid > *:nth-child(5)  { --v3-i: 4; }
.post-grid > *:nth-child(6)  { --v3-i: 5; }
.post-grid > *:nth-child(7)  { --v3-i: 6; }
.post-grid > *:nth-child(8)  { --v3-i: 7; }
.post-grid > *:nth-child(9)  { --v3-i: 8; }
.post-grid > *:nth-child(10) { --v3-i: 9; }
.post-grid > *:nth-child(n+11) { --v3-i: 10; }
.category-grid > *:nth-child(1) { --v3-i: 0; }
.category-grid > *:nth-child(2) { --v3-i: 1; }
.category-grid > *:nth-child(3) { --v3-i: 2; }
.category-grid > *:nth-child(4) { --v3-i: 3; }

/* ── Native View Transitions API (Chrome 111+, Safari 18+) ──
 * If supported, JS will call document.startViewTransition() on route swap.
 * This gives a crossfade between the two view states, and we can name
 * the post art so it morphs into the detail hero. */

@supports (view-transition-name: a) {
  ::view-transition-old(root), ::view-transition-new(root) {
    animation-duration: var(--v3-dur-base);
    animation-timing-function: var(--v3-ease-out);
  }
  ::view-transition-old(root) {
    animation-name: v3VTOut;
  }
  ::view-transition-new(root) {
    animation-name: v3VTIn;
  }
  @keyframes v3VTOut { to { opacity: 0; transform: translateY(-6px); } }
  @keyframes v3VTIn  { from { opacity: 0; transform: translateY(8px); } }

  /* Shared element morph for the active post art */
  .post-art.is-vt-source {
    view-transition-name: v3-post-hero;
  }
  .detail-art.is-vt-target {
    view-transition-name: v3-post-hero;
  }
  ::view-transition-old(v3-post-hero),
  ::view-transition-new(v3-post-hero) {
    animation-duration: 520ms;
    animation-timing-function: var(--v3-ease-out);
    mix-blend-mode: normal;
  }
}

/* ── Page progress bar (top, indeterminate) ── */

.v3-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: rgba(255, 244, 222, 0.06);
  z-index: 2147483500;
  overflow: hidden;
  opacity: 0;
  transition: opacity 240ms var(--v3-ease-out);
  pointer-events: none;
}
.v3-progress.is-active { opacity: 1; }
.v3-progress::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 28%;
  background: linear-gradient(90deg, transparent, var(--v2-rose-hot), var(--v2-gold-hot), transparent);
  animation: v3Progress 1.1s linear infinite;
}
@keyframes v3Progress {
  from { transform: translateX(-30%); }
  to   { transform: translateX(360%); }
}

/* ── Lucide nav icons ── */

.nav-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  text-align: left;
}
.nav-item .v3-icon {
  width: 18px; height: 18px;
  color: rgba(200, 185, 161, 0.78);
  transition: color var(--v3-dur-fast) var(--v3-ease-out), transform var(--v3-dur-fast) var(--v3-ease-out);
}
.nav-item:hover .v3-icon { color: var(--v2-gold-hot); }
.nav-item.active .v3-icon { color: var(--v2-rose-hot); }

/* For nav items WITHOUT injected icon (legacy), keep them centered */
.nav-item:not(.has-v3-icon) {
  grid-template-columns: 1fr;
  gap: 0;
}

/* ── Skeleton for post detail page ── */

.v3-detail-skel {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 18px;
  align-items: start;
  animation: v3ViewIn var(--v3-dur-base) var(--v3-ease-out) both;
}
.v3-detail-skel .v3-skel-art {
  height: clamp(280px, 36vw, 460px);
  border-radius: var(--v2-r-md);
}
.v3-detail-skel .v3-skel-body {
  display: grid;
  gap: 10px;
  padding: 20px;
  border-radius: var(--v2-r-md);
  background: var(--v2-glass);
  border: 1px solid var(--v2-line-1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.v3-detail-skel .v3-skel-line { height: 14px; border-radius: 7px; }
.v3-skel-art, .v3-skel-line {
  background:
    linear-gradient(90deg, rgba(255, 244, 222, 0) 0%, rgba(255, 244, 222, 0.07) 50%, rgba(255, 244, 222, 0) 100%),
    rgba(28, 24, 19, 0.55);
  background-size: 480px 100%, 100% 100%;
  background-repeat: no-repeat, no-repeat;
  background-position: -480px 0, 0 0;
  animation: v2Shimmer 1.4s linear infinite;
}
.v3-skel-line.w90 { width: 90%; }
.v3-skel-line.w70 { width: 70%; }
.v3-skel-line.w50 { width: 50%; }
.v3-skel-line.w40 { width: 40%; }
.v3-skel-line.w30 { width: 30%; }

@media (max-width: 840px) {
  .v3-detail-skel { grid-template-columns: 1fr; }
}

/* ── Share button on post detail ── */

.v3-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  padding: 0 16px;
  border-radius: var(--v2-r-md);
  border: 1px solid var(--v2-line-1);
  color: var(--text);
  background: rgba(255, 244, 222, 0.06);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--v3-dur-fast) var(--v3-ease-out);
}
.v3-share-btn:hover {
  border-color: var(--v2-line-gold);
  background: rgba(200, 151, 63, 0.12);
  color: #ffd99c;
  transform: translateY(-1px);
}
.v3-share-btn svg { width: 16px; height: 16px; }

/* ── Reveal on scroll (for sections like trade, footer) ── */

.v3-reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 540ms var(--v3-ease-out), transform 540ms var(--v3-ease-out);
}
.v3-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Search dropdown (autocomplete) ── */

.search-wrap { position: relative; }
.v3-search-dd {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0; right: 0;
  border-radius: var(--v2-r-md);
  border: 1px solid var(--v2-line-2);
  background:
    linear-gradient(180deg, rgba(34, 29, 23, 0.95), rgba(20, 17, 14, 0.98));
  backdrop-filter: blur(20px) saturate(125%);
  -webkit-backdrop-filter: blur(20px) saturate(125%);
  box-shadow: var(--v2-shadow-2);
  padding: 6px;
  display: none;
  max-height: 320px;
  overflow: auto;
  animation: v3ViewIn 180ms var(--v3-ease-out) both;
}
.v3-search-dd.is-open { display: grid; gap: 2px; }
.v3-search-dd .v3-dd-group {
  display: grid;
  gap: 2px;
  padding: 8px 4px 4px;
}
.v3-search-dd .v3-dd-label {
  padding: 2px 8px 4px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(200, 185, 161, 0.62);
}
.v3-search-dd .v3-dd-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--v3-dur-fast) var(--v3-ease-out);
}
.v3-search-dd .v3-dd-item:hover,
.v3-search-dd .v3-dd-item.is-active {
  background: rgba(200, 151, 63, 0.14);
  color: #ffe5b3;
}
.v3-search-dd .v3-dd-item .v3-dd-meta {
  color: rgba(200, 185, 161, 0.55);
  font-size: 0.74rem;
  font-weight: 700;
}

/* ── Hover micro-interactions on existing buttons ── */

.primary, .secondary, .ghost, .nav-item, .tag-chip, .page-btn {
  will-change: transform;
}

/* Subtle "press" feedback on click */
.primary:active, .secondary:active, .ghost:active, .nav-item:active, .tag-chip:active, .page-btn:active {
  transform: translateY(0) scale(0.985);
}

/* ── Loading state for buttons (data-loading="1") ── */

.primary[data-loading="1"], .secondary[data-loading="1"] {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.primary[data-loading="1"]::after, .secondary[data-loading="1"]::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 16px; height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-top-color: #fff;
  animation: v3Spin 0.7s linear infinite;
}
@keyframes v3Spin { to { transform: rotate(360deg); } }

/* ── Smooth scroll override for our route changes ── */
html { scroll-behavior: smooth; }

/* ── Body initial fade-in on first load ── */
body { animation: v3BodyIn 480ms var(--v3-ease-out) both; }
@keyframes v3BodyIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Reduce motion preference ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .view { opacity: 1; transform: none; }
}
