/*
Theme Name:  W1Network Pro
Theme URI:   https://w1network.com
Author:      W1Network Team
Author URI:  https://w1network.com
Description: High-performance TikTok-style WordPress theme. Infinite scroll, category feeds, background music player, auto-scroll reader, schema markup, AdSense-ready. Optimised for Core Web Vitals, WCAG 2.1 AA, LiteSpeed/Cloudflare, international SEO (US/UK/CA).
Version:     7.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License:     GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: w1network-pro
Tags:        dark, custom-logo, custom-colors, custom-menu, featured-images, infinite-scroll, responsive-layout, accessibility-ready, schema-markup
*/

/* ==========================================================================
   @layer — Cascade Management (prevents specificity wars, replaces !important)
   ========================================================================== */
@layer reset, tokens, base, layout, components, utilities, overrides;

/* ==========================================================================
   1. DESIGN TOKENS (CSS Custom Properties)
   ========================================================================== */
@layer tokens {

  :root {
    /* Brand */
    --clr-primary:     #ff0050;
    --clr-primary-dim: #cc0040;
    --clr-accent:      #00f2ea;
    --clr-gold:        #ffd500;
    --clr-success:     #00c853;
    --clr-warn:        #ff9100;
    --clr-scroll:      #00b4d8;

    /* Backgrounds */
    --bg-0: #000000;   /* page */
    --bg-1: #0d0d0d;   /* header / footer */
    --bg-2: #1a1a1a;   /* card */
    --bg-3: #242424;   /* hover */
    --bg-4: #2e2e2e;   /* input */

    /* Text */
    --tx-0: #ffffff;
    --tx-1: #c8c8c8;
    --tx-2: #888888;
    --tx-3: #555555;

    /* Borders */
    --bd-1: rgba(255,255,255,0.08);
    --bd-2: rgba(255,255,255,0.14);

    /* Shadows */
    --sh-sm:  0 2px 8px  rgba(0,0,0,0.35);
    --sh-md:  0 4px 20px rgba(0,0,0,0.45);
    --sh-lg:  0 8px 40px rgba(0,0,0,0.55);
    --sh-glow: 0 0 18px rgba(255,0,80,0.45);

    /* Typography */
    --ff-sans:   'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --ff-mono:   'JetBrains Mono', 'Fira Code', monospace;
    --ff-serif:  'Playfair Display', Georgia, serif;

    --fs-xs:  0.6875rem;  /* 11px */
    --fs-sm:  0.75rem;    /* 12px */
    --fs-base:1rem;        /* 16px */
    --fs-md:  1.125rem;   /* 18px */
    --fs-lg:  1.25rem;    /* 20px */
    --fs-xl:  1.5rem;     /* 24px */
    --fs-2xl: clamp(1.5rem, 4vw, 2.25rem);
    --fs-3xl: clamp(2rem, 6vw, 3.5rem);

    --lh-tight:  1.25;
    --lh-normal: 1.6;
    --lh-loose:  1.85;

    /* Spacing (8-point grid) */
    --sp-1: 0.25rem;  /* 4px  */
    --sp-2: 0.5rem;   /* 8px  */
    --sp-3: 0.75rem;  /* 12px */
    --sp-4: 1rem;     /* 16px */
    --sp-5: 1.25rem;  /* 20px */
    --sp-6: 1.5rem;   /* 24px */
    --sp-8: 2rem;     /* 32px */
    --sp-10:2.5rem;   /* 40px */
    --sp-12:3rem;     /* 48px */

    /* Borders */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Motion */
    --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --dur-fast:    120ms;
    --dur-base:    240ms;
    --dur-slow:    400ms;

    /* Layout */
    --max-w:       1440px;
    --max-w-content: 860px;
    --header-h:    60px;

    /* Z-index */
    --z-below:   -1;
    --z-base:     0;
    --z-raise:   10;
    --z-sticky: 100;
    --z-header: 900;
    --z-float:  850;
    --z-modal: 1100;
    --z-toast: 1200;
  }

  /* Light Mode */
  body.light-mode {
    --bg-0: #f8f8f6;
    --bg-1: #ffffff;
    --bg-2: #ffffff;
    --bg-3: #f0f0ef;
    --bg-4: #e8e8e7;
    --tx-0: #0a0a0a;
    --tx-1: #3a3a3a;
    --tx-2: #777777;
    --tx-3: #aaaaaa;
    --bd-1: rgba(0,0,0,0.07);
    --bd-2: rgba(0,0,0,0.12);
    --sh-sm:  0 2px 8px  rgba(0,0,0,0.08);
    --sh-md:  0 4px 20px rgba(0,0,0,0.10);
    --sh-lg:  0 8px 40px rgba(0,0,0,0.14);
  }
}

/* ==========================================================================
   2. RESET
   ========================================================================== */
@layer reset {
  *, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  html {
    font-size: 16px;
    scroll-behavior: smooth;
    color-scheme: dark light;
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-synthesis: none;
    hanging-punctuation: first last;
  }

  img, video, svg, canvas {
    max-width: 100%;
    height: auto;
    display: block;
  }

  input, button, textarea, select {
    font: inherit;
  }

  button, a, [role="button"] {
    touch-action: manipulation;
    cursor: pointer;
  }

  ul, ol { list-style: none; }
  a { text-decoration: none; color: inherit; }

  @media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important; /* Required for reduced-motion override */
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
}

/* ==========================================================================
   3. BASE — Typography & Global
   ========================================================================== */
@layer base {

  body {
    font-family: var(--ff-sans);
    font-size: var(--fs-base);
    line-height: var(--lh-normal);
    background: var(--bg-0);
    color: var(--tx-0);
    overflow-x: hidden;
    padding-top: var(--header-h);
    min-height: 100vh;
  }

  h1, h2, h3, h4, h5, h6 {
    font-family: var(--ff-sans);
    line-height: var(--lh-tight);
    font-weight: 700;
    color: var(--tx-0);
    letter-spacing: -0.02em;
  }

  p { max-width: 70ch; }

  a:focus-visible,
  button:focus-visible,
  input:focus-visible,
  textarea:focus-visible {
    outline: 2px solid var(--clr-primary);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
  }

  ::selection {
    background: rgba(255, 0, 80, 0.3);
    color: var(--tx-0);
  }

  /* Scrollbar */
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: var(--bg-1); }
  ::-webkit-scrollbar-thumb {
    background: var(--bd-2);
    border-radius: var(--radius-full);
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--clr-primary); }
}

/* ==========================================================================
   4. LAYOUT — Containers & Wrappers
   ========================================================================== */
@layer layout {

  .site { display: flex; flex-direction: column; min-height: 100vh; }
  .site-main { flex: 1; }

  .container {
    width: 100%;
    max-width: var(--max-w);
    margin-inline: auto;
    padding-inline: var(--sp-4);
  }

  .content-wrapper {
    max-width: var(--max-w);
    margin-inline: auto;
    padding: var(--sp-6) var(--sp-4);
  }

  @media (min-width: 768px) {
    .content-wrapper { padding: var(--sp-8) var(--sp-6); }
  }

  /* Utility spacing */
  .mt-lg  { margin-top: var(--sp-6); }
  .mt-xl  { margin-top: var(--sp-12); }
  .sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
  }
}

/* ==========================================================================
   5. COMPONENTS
   ========================================================================== */
@layer components {

/* ─── SITE HEADER ─────────────────────────────────────────── */

.site-header {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg-1) 97%, transparent);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--bd-1);
  box-shadow: 0 1px 24px rgba(0,0,0,0.3);
  z-index: var(--z-header);
  display: flex;
  align-items: center;
}

.header-container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

/* Logo */
.site-branding { flex-shrink: 0; }

.site-logo {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #ff0050 0%, #ff6b9d 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  transition: opacity var(--dur-fast) ease;
}
.site-logo:hover { opacity: 0.82; }

.custom-logo-link { display: block; line-height: 0; }
.custom-logo-link img { max-height: 38px; width: auto; }

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}

/* Icon buttons */
.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: var(--radius-full);
  background: var(--bg-3);
  border: 1px solid var(--bd-1);
  color: var(--tx-1);
  transition:
    background var(--dur-fast) ease,
    color var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-spring),
    box-shadow var(--dur-fast) ease;
  flex-shrink: 0;
  line-height: 0;
}

.header-icon-btn:hover {
  background: rgba(255,0,80,0.12);
  border-color: rgba(255,0,80,0.35);
  color: var(--clr-primary);
  transform: scale(1.08);
}

/* Submit button */
.btn-submit-post {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.55rem var(--sp-5);
  height: 36px;
  background: linear-gradient(135deg, #ff0050 0%, #cc0040 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 3px 14px rgba(255,0,80,0.38);
  transition:
    opacity var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-spring),
    box-shadow var(--dur-fast) ease;
}
.btn-submit-post:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 5px 20px rgba(255,0,80,0.5);
}
.btn-submit-post svg { flex-shrink: 0; }

@media (max-width: 479px) {
  .btn-submit-post .btn-text { display: none; }
  .btn-submit-post { padding: 0 var(--sp-3); width: 36px; justify-content: center; }
}

/* User menu */
.user-menu { position: relative; }

.user-avatar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  border: 2px solid var(--clr-primary);
  background: transparent;
  padding: 2px;
  overflow: hidden;
  transition:
    transform var(--dur-fast) var(--ease-spring),
    box-shadow var(--dur-fast) ease;
}
.user-avatar-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 0 3px rgba(255,0,80,0.22);
}
.user-avatar-btn img {
  width: 100%; height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 220px;
  background: var(--bg-2);
  border: 1px solid var(--bd-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--sh-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.97);
  transition:
    opacity var(--dur-base) ease,
    transform var(--dur-base) ease,
    visibility 0s var(--dur-base);
  z-index: var(--z-modal);
  overflow: hidden;
}
.user-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition:
    opacity var(--dur-base) ease,
    transform var(--dur-base) ease,
    visibility 0s;
}

.user-info {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--bd-1);
}
.user-info-name  {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--tx-0);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-info-email {
  display: block;
  font-size: var(--fs-xs);
  color: var(--tx-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.user-menu-links { padding: var(--sp-2); }
.user-menu-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0.6rem var(--sp-3);
  color: var(--tx-1);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.user-menu-link:hover { background: var(--bg-3); color: var(--tx-0); }
.user-menu-link--highlight { color: var(--clr-primary); font-weight: 700; }
.user-menu-link--highlight:hover { background: rgba(255,0,80,0.08); color: var(--clr-primary); }
.user-menu-link--logout { color: #ff5757; }
.user-menu-link--logout:hover { background: rgba(255,77,77,0.08); color: #ff5757; }

/* Header search */
.header-search-wrapper {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: color-mix(in srgb, var(--bg-1) 98%, transparent);
  border-bottom: 1px solid var(--bd-1);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  transform: translateY(-4px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--dur-base) ease,
    transform var(--dur-base) ease,
    visibility 0s var(--dur-base);
  z-index: calc(var(--z-header) - 1);
}
.header-search-wrapper.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition:
    opacity var(--dur-base) ease,
    transform var(--dur-base) ease,
    visibility 0s;
}
.header-search-container {
  max-width: 620px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.header-search-form {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg-3);
  border: 1.5px solid var(--bd-2);
  border-radius: var(--radius-full);
  overflow: hidden;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.header-search-form:focus-within {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(255,0,80,0.15);
}
.header-search-icon {
  padding-left: var(--sp-4);
  color: var(--tx-2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  pointer-events: none;
}
.header-search-input {
  flex: 1;
  padding: 0.6rem var(--sp-4);
  background: transparent;
  border: none;
  color: var(--tx-0);
  font-size: 0.95rem;
}
.header-search-input::placeholder { color: var(--tx-2); }
.header-search-submit, .header-search-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  background: transparent;
  border: none;
  color: var(--tx-2);
  flex-shrink: 0;
  transition: color var(--dur-fast) ease;
}
.header-search-submit:hover, .header-search-close:hover { color: var(--clr-primary); }
.search-shortcut { display: none; }
@media (min-width: 768px) {
  .search-shortcut {
    display: block;
    font-size: var(--fs-xs);
    color: var(--tx-3);
    white-space: nowrap;
  }
  .search-shortcut kbd {
    display: inline-block;
    padding: 1px 5px;
    background: var(--bg-3);
    border: 1px solid var(--bd-2);
    border-radius: 4px;
    font-size: var(--fs-xs);
    color: var(--tx-2);
  }
}

/* Mobile Nav Drawer */
.mobile-nav-panel {
  position: fixed;
  top: 0; right: 0;
  width: 280px; max-width: 88vw;
  height: 100dvh;
  background: var(--bg-1);
  border-left: 1px solid var(--bd-1);
  z-index: calc(var(--z-header) + 100);
  overflow-y: auto;
  transform: translateX(110%);
  visibility: hidden;
  transition:
    transform var(--dur-slow) var(--ease-out),
    visibility 0s var(--dur-slow);
  box-shadow: var(--sh-lg);
}
.mobile-nav-panel.is-open {
  transform: translateX(0);
  visibility: visible;
  transition:
    transform var(--dur-slow) var(--ease-out),
    visibility 0s;
}
.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(3px);
  z-index: calc(var(--z-header) + 90);
}
.mobile-nav-overlay.is-open { display: block; }
.mobile-nav-inner { display: flex; flex-direction: column; min-height: 100%; }
.mobile-nav-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4);
  border-bottom: 1px solid var(--bd-1);
  height: var(--header-h);
}
.mobile-nav-brand {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #ff0050, #ff6b9d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.mobile-nav-close-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-3);
  border: none;
  color: var(--tx-1);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.mobile-nav-close-btn:hover { background: rgba(255,0,80,0.1); color: var(--clr-primary); }

.mobile-search-wrap {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--bd-1);
}
.mobile-search-form {
  display: flex;
  align-items: center;
  background: var(--bg-3);
  border: 1.5px solid var(--bd-1);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.mobile-search-form:focus-within { border-color: var(--clr-primary); }
.mobile-search-icon { padding-left: var(--sp-3); color: var(--tx-2); flex-shrink: 0; display: flex; align-items: center; }
.mobile-search-input {
  flex: 1;
  padding: 0.55rem var(--sp-3);
  background: transparent;
  border: none;
  color: var(--tx-0);
  font-size: 0.875rem;
}
.mobile-search-input::placeholder { color: var(--tx-2); }
.mobile-search-submit {
  padding: 0 var(--sp-3);
  background: transparent;
  border: none;
  color: var(--tx-2);
  display: flex; align-items: center;
  transition: color var(--dur-fast) ease;
}
.mobile-search-submit:hover { color: var(--clr-primary); }

.mobile-user-strip {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--bd-1);
}
.mobile-user-avatar {
  width: 42px; height: 42px;
  border-radius: var(--radius-full);
  border: 2px solid var(--clr-primary);
  object-fit: cover; flex-shrink: 0;
}
.mobile-user-name { display: block; font-weight: 700; font-size: 0.9rem; color: var(--tx-0); }
.mobile-user-role { display: block; font-size: var(--fs-xs); color: var(--tx-2); margin-top: 2px; }

.mobile-nav-actions { display: flex; flex-direction: column; padding: var(--sp-2) 0; flex: 1; }
.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0.8rem var(--sp-4);
  color: var(--tx-1);
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
  min-height: 44px;
}
.mobile-nav-link:hover { background: var(--bg-3); color: var(--tx-0); }
.mobile-nav-link--primary { color: var(--clr-primary); font-weight: 700; }
.mobile-nav-link--primary:hover { background: rgba(255,0,80,0.08); color: var(--clr-primary); }
.mobile-nav-link--logout { color: #ff5757; }
.mobile-nav-link--logout:hover { background: rgba(255,77,77,0.08); color: #ff5757; }

/* ─── SKIP LINK ───────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-4);
  padding: var(--sp-2) var(--sp-4);
  background: var(--clr-primary);
  color: #fff;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 700;
  z-index: calc(var(--z-modal) + 100);
  transition: top var(--dur-fast) ease;
}
.skip-link:focus { top: 0; }

/* ─── CATEGORY TABS ───────────────────────────────────────── */
.category-tabs {
  position: sticky;
  top: var(--header-h);
  z-index: calc(var(--z-header) - 10);
  background: color-mix(in srgb, var(--bg-0) 95%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bd-1);
  margin-bottom: var(--sp-6);
}
.category-tabs-container {
  display: flex;
  gap: var(--sp-1);
  max-width: var(--max-w);
  margin-inline: auto;
  padding: var(--sp-2) var(--sp-4);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.category-tabs-container::-webkit-scrollbar { display: none; }

.category-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.45rem var(--sp-4);
  min-height: 36px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  color: var(--tx-1);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  transition:
    background var(--dur-fast) ease,
    color var(--dur-fast) ease,
    border-color var(--dur-fast) ease;
  cursor: pointer;
}
.category-tab:hover {
  background: var(--bg-3);
  color: var(--tx-0);
}
.category-tab.active {
  background: rgba(255,0,80,0.15);
  border-color: rgba(255,0,80,0.4);
  color: var(--clr-primary);
}

/* ─── CATEGORY SECTION ────────────────────────────────────── */
.category-section {
  margin-bottom: var(--sp-10);
  /* content-visibility defers rendering of off-screen sections */
  content-visibility: auto;
  contain-intrinsic-size: 0 600px;
}
.category-section:first-of-type { content-visibility: visible; }

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--bd-1);
}
.category-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--tx-0);
}
.category-icon {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--clr-primary), #ff6b9d);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 900;
  color: #fff;
}
.category-count {
  font-size: var(--fs-sm);
  color: var(--tx-2);
  font-weight: 400;
}
.view-all-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.4rem var(--sp-4);
  background: var(--bg-3);
  border: 1px solid var(--bd-2);
  border-radius: var(--radius-full);
  color: var(--tx-1);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease;
  min-height: 32px;
}
.view-all-btn:hover {
  background: rgba(255,0,80,0.1);
  border-color: rgba(255,0,80,0.35);
  color: var(--clr-primary);
}

/* ─── POSTS GRID ──────────────────────────────────────────── */
.posts-grid, .tiktok-feed .posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: var(--sp-4);
}

@media (min-width: 640px)  { .posts-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px)  { .posts-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .posts-grid { grid-template-columns: repeat(4, 1fr); } }

/* ─── POST CARD ───────────────────────────────────────────── */
.post-card {
  background: var(--bg-2);
  border: 1px solid var(--bd-1);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition:
    transform var(--dur-base) var(--ease-out),
    box-shadow var(--dur-base) ease,
    border-color var(--dur-base) ease;
  /* Fade-in via JS — start invisible */
  opacity: 0;
  translate: 0 12px;
}
.post-card.fade-in {
  animation: cardReveal var(--dur-slow) var(--ease-out) forwards;
}
@keyframes cardReveal {
  to { opacity: 1; translate: 0 0; }
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-md);
  border-color: var(--bd-2);
}

/* Thumbnail */
.post-thumbnail {
  position: relative;
  width: 100%;
  /* 16:9 aspect ratio - reserves space, eliminates CLS */
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-3);
}
.post-thumbnail img,
.post-thumbnail video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out);
}
.post-card:hover .post-thumbnail img,
.post-card:hover .post-thumbnail video {
  transform: scale(1.04);
}

/* Badge */
.post-badges {
  position: absolute;
  top: var(--sp-2);
  left: var(--sp-2);
  z-index: var(--z-raise);
  display: flex;
  gap: var(--sp-1);
}
.badge {
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.4;
}
.badge.new       { background: linear-gradient(135deg,#00c853,#00953e); color:#fff; }
.badge.trending  { background: linear-gradient(135deg,#ff9100,#e67e00); color:#fff; }
.badge.hot       { background: linear-gradient(135deg,#ff0050,#cc0040); color:#fff; }

/* Post content */
.post-content {
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  flex: 1;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}
.post-category {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--clr-primary);
  transition: opacity var(--dur-fast) ease;
}
.post-category:hover { opacity: 0.8; }
.post-date, .post-views {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-xs);
  color: var(--tx-2);
}

.post-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--tx-0);
}
.post-title a {
  color: inherit;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--dur-fast) ease;
}
.post-title a:hover { color: var(--clr-primary); }

.post-excerpt {
  font-size: var(--fs-sm);
  color: var(--tx-1);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Post actions */
.post-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: auto;
  padding-top: var(--sp-2);
  border-top: 1px solid var(--bd-1);
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  min-height: 32px;
  background: transparent;
  border: 1px solid var(--bd-1);
  border-radius: var(--radius-full);
  color: var(--tx-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition:
    background var(--dur-fast) ease,
    color var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-spring);
  cursor: pointer;
  white-space: nowrap;
}
.action-btn:hover {
  background: var(--bg-3);
  border-color: var(--bd-2);
  color: var(--tx-0);
}
.action-btn:active { transform: scale(0.95); }

.like-btn.liked  { background: rgba(255,0,80,0.12); border-color: rgba(255,0,80,0.35); color: var(--clr-primary); }
.like-btn.liked .icon { fill: var(--clr-primary); stroke: none; }
.bookmark-btn.bookmarked { background: rgba(255,213,0,0.12); border-color: rgba(255,213,0,0.35); color: var(--clr-gold); }
.bookmark-btn.bookmarked .icon { fill: var(--clr-gold); stroke: none; }
.share-btn:hover { background: rgba(0,242,234,0.1); border-color: rgba(0,242,234,0.35); color: var(--clr-accent); }

/* Reactions */
.reaction-buttons {
  display: flex;
  gap: var(--sp-1);
  padding: var(--sp-2);
  background: var(--bg-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--bd-1);
}
.reaction-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  font-size: 1.1rem;
  transition: transform var(--dur-fast) var(--ease-spring), background var(--dur-fast) ease;
  cursor: pointer;
}
.reaction-btn:hover { transform: scale(1.3); background: var(--bg-4); }
.reaction-btn.active { transform: scale(1.2); }

/* ─── LOAD MORE / INFINITE SCROLL ─────────────────────────── */
.load-more-container { text-align: center; margin-top: var(--sp-6); }
.load-more-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.65rem var(--sp-8);
  min-height: 44px;
  background: var(--bg-2);
  border: 1px solid var(--bd-2);
  border-radius: var(--radius-full);
  color: var(--tx-0);
  font-size: 0.875rem;
  font-weight: 700;
  transition:
    background var(--dur-fast) ease,
    color var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-spring),
    box-shadow var(--dur-fast) ease;
  cursor: pointer;
}
.load-more-btn:hover {
  background: rgba(255,0,80,0.12);
  border-color: rgba(255,0,80,0.4);
  color: var(--clr-primary);
  transform: translateY(-2px);
  box-shadow: var(--sh-sm);
}
.load-more-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.load-more-trigger { height: 1px; pointer-events: none; }

.loading-spinner {
  display: flex;
  justify-content: center;
  padding: var(--sp-8) 0;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--bd-2);
  border-top-color: var(--clr-primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── ADSENSE ─────────────────────────────────────────────── */
.ad-container {
  width: 100%;
  overflow: hidden;
  text-align: center;
  border-radius: var(--radius-md);
  margin-block: var(--sp-6);
}
.ad-container::before {
  content: attr(aria-label);
  display: block;
  font-size: var(--fs-xs);
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--sp-2);
}
.ad-container ins {
  display: block;
  width: 100%;
}
.ad-container:empty { display: none; }

/* ─── SINGLE POST ─────────────────────────────────────────── */
.single-post-header { margin-bottom: var(--sp-6); }

.post-breadcrumb { margin-bottom: var(--sp-4); }
.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-sm);
  color: var(--tx-2);
  list-style: none;
}
.breadcrumb-list a:hover { color: var(--clr-primary); }
.breadcrumb-current { color: var(--tx-0); font-weight: 600; }

.single-post-title {
  font-size: var(--fs-2xl);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-4);
  color: var(--tx-0);
}

.single-post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--tx-2);
  margin-bottom: var(--sp-6);
}
.single-post-meta .post-category {
  font-size: var(--fs-sm);
  font-weight: 700;
  padding: 3px 10px;
  background: rgba(255,0,80,0.12);
  border: 1px solid rgba(255,0,80,0.3);
  border-radius: var(--radius-full);
  color: var(--clr-primary);
}
.post-date, .post-views, .post-read-time, .post-author {
  display: flex;
  align-items: center;
  gap: 5px;
}

.single-post-content {
  max-width: var(--max-w-content);
  color: var(--tx-1);
  line-height: var(--lh-loose);
}
.single-post-content h2,
.single-post-content h3,
.single-post-content h4 {
  margin-top: var(--sp-8);
  margin-bottom: var(--sp-4);
  color: var(--tx-0);
}
.single-post-content h2 { font-size: var(--fs-xl); }
.single-post-content h3 { font-size: var(--fs-lg); }
.single-post-content p  { margin-bottom: var(--sp-4); }
.single-post-content ul,
.single-post-content ol {
  padding-left: var(--sp-6);
  margin-bottom: var(--sp-4);
  list-style: revert;
}
.single-post-content li { margin-bottom: var(--sp-2); }
.single-post-content a  { color: var(--clr-primary); }
.single-post-content a:hover { text-decoration: underline; }
.single-post-content blockquote {
  border-left: 3px solid var(--clr-primary);
  padding: var(--sp-4) var(--sp-6);
  margin-block: var(--sp-6);
  background: var(--bg-2);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--tx-1);
}
.single-post-content figure { margin-block: var(--sp-6); }
.single-post-content figcaption {
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--tx-2);
  margin-top: var(--sp-2);
}
.single-post-content img {
  border-radius: var(--radius-md);
  width: 100%;
}
.single-post-content pre,
.single-post-content code {
  font-family: var(--ff-mono);
  font-size: 0.875em;
  background: var(--bg-2);
  border: 1px solid var(--bd-1);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}
.single-post-content pre {
  padding: var(--sp-4);
  overflow-x: auto;
  line-height: 1.6;
}
.single-post-content pre code { background: none; border: none; padding: 0; }
.single-post-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--sp-4);
  font-size: var(--fs-sm);
}
.single-post-content th,
.single-post-content td {
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--bd-1);
  text-align: left;
}
.single-post-content th { background: var(--bg-2); font-weight: 700; }
.single-post-content tr:nth-child(even) td { background: color-mix(in srgb, var(--bg-2) 50%, transparent); }

/* Post tags */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-block: var(--sp-6);
}
.post-tag {
  padding: 4px 12px;
  background: var(--bg-2);
  border: 1px solid var(--bd-1);
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  color: var(--tx-1);
  font-weight: 600;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease;
  min-height: 30px;
  display: inline-flex; align-items: center;
}
.post-tag:hover {
  background: rgba(255,0,80,0.1);
  border-color: rgba(255,0,80,0.35);
  color: var(--clr-primary);
}

/* Post actions card */
.post-actions-card {
  background: var(--bg-2);
  border: 1px solid var(--bd-1);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  margin-block: var(--sp-6);
}

/* Related posts */
.related-posts { margin-top: var(--sp-12); }
.related-posts-header {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-6);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--bd-1);
  color: var(--tx-0);
}

/* Page links (multi-page posts) */
.page-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-block: var(--sp-6);
  font-size: var(--fs-sm);
  font-weight: 700;
}
.page-links a {
  padding: 4px 10px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  color: var(--tx-0);
  transition: background var(--dur-fast) ease;
}
.page-links a:hover { background: var(--clr-primary); color: #fff; }

/* ─── SCROLL TO TOP ────────────────────────────────────────── */
.scroll-to-top {
  position: fixed;
  bottom: var(--sp-6);
  left: var(--sp-5);
  width: 42px; height: 42px;
  border-radius: var(--radius-full);
  background: var(--bg-2);
  border: 1px solid var(--bd-2);
  color: var(--tx-1);
  display: flex; align-items: center; justify-content: center;
  z-index: var(--z-float);
  box-shadow: var(--sh-sm);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity var(--dur-base) ease,
    transform var(--dur-base) var(--ease-out),
    background var(--dur-fast) ease,
    color var(--dur-fast) ease;
  cursor: pointer;
}
.scroll-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.scroll-to-top:hover {
  background: rgba(255,0,80,0.12);
  border-color: rgba(255,0,80,0.35);
  color: var(--clr-primary);
}

/* ─── SHARE MODAL ─────────────────────────────────────────── */
.share-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(6px);
  z-index: var(--z-modal);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: var(--sp-4);
}
.share-modal.active { display: flex; }

@media (min-width: 480px) {
  .share-modal { align-items: center; }
}

.share-content {
  background: var(--bg-2);
  border: 1px solid var(--bd-2);
  border-radius: var(--radius-xl) var(--radius-xl) var(--radius-lg) var(--radius-lg);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  animation: sheetSlideUp var(--dur-slow) var(--ease-out) forwards;
}
@media (min-width: 480px) {
  .share-content {
    border-radius: var(--radius-xl);
    animation: modalPop var(--dur-base) var(--ease-spring) forwards;
  }
}
@keyframes sheetSlideUp {
  from { transform: translateY(60px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes modalPop {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--bd-1);
}
.share-title { font-size: var(--fs-md); font-weight: 700; color: var(--tx-0); }
.share-close {
  width: 34px; height: 34px;
  border-radius: var(--radius-full);
  background: var(--bg-3);
  border: none;
  color: var(--tx-2);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
  cursor: pointer;
}
.share-close:hover { background: rgba(255,0,80,0.1); color: var(--clr-primary); }

.share-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2);
  padding: var(--sp-4);
}
.share-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-2);
  background: var(--bg-3);
  border: 1px solid var(--bd-1);
  border-radius: var(--radius-md);
  color: var(--tx-1);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--dur-fast) ease,
    color var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-spring),
    border-color var(--dur-fast) ease;
  min-height: 70px;
}
.share-option:hover {
  background: var(--bg-4);
  color: var(--tx-0);
  transform: translateY(-2px);
  border-color: var(--bd-2);
}
.share-option .icon { font-size: 1.5rem; }
.share-option.facebook:hover { background: rgba(24,119,242,0.12); border-color: rgba(24,119,242,0.35); color: #1877f2; }
.share-option.twitter:hover  { background: rgba(29,155,240,0.12); border-color: rgba(29,155,240,0.35); color: #1d9bf0; }
.share-option.whatsapp:hover { background: rgba(37,211,102,0.12); border-color: rgba(37,211,102,0.35); color: #25d366; }
.share-option.linkedin:hover { background: rgba(0,119,181,0.12);  border-color: rgba(0,119,181,0.35);  color: #0077b5; }
.share-option.telegram:hover { background: rgba(36,161,222,0.12); border-color: rgba(36,161,222,0.35); color: #24a1de; }

/* ─── ARCHIVE / SEARCH ────────────────────────────────────── */
.archive-header {
  margin-bottom: var(--sp-8);
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid var(--bd-1);
}
.archive-label {
  display: inline-flex;
  padding: 3px 10px;
  background: rgba(255,0,80,0.12);
  border: 1px solid rgba(255,0,80,0.3);
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--clr-primary);
  margin-bottom: var(--sp-4);
}
.archive-title {
  font-size: var(--fs-2xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--tx-0);
  margin-bottom: var(--sp-3);
}
.archive-title .search-term { color: var(--clr-primary); }
.archive-description { font-size: var(--fs-base); color: var(--tx-1); max-width: 70ch; }
.archive-count { font-size: var(--fs-sm); color: var(--tx-2); margin-top: var(--sp-2); }

/* Pagination */
.archive-pagination { margin-top: var(--sp-10); }
.archive-pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2);
}
.archive-pagination .page-numbers {
  display: flex; align-items: center; justify-content: center;
  min-width: 42px; height: 42px;
  padding: 0 var(--sp-3);
  background: var(--bg-2);
  border: 1px solid var(--bd-1);
  border-radius: var(--radius-sm);
  color: var(--tx-1);
  font-size: 0.875rem;
  font-weight: 600;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.archive-pagination .page-numbers:hover { background: var(--bg-3); color: var(--tx-0); }
.archive-pagination .page-numbers.current {
  background: var(--clr-primary);
  border-color: var(--clr-primary);
  color: #fff;
}
.archive-pagination .nav-text { margin-inline: var(--sp-1); }

/* No results */
.no-results { text-align: center; padding: var(--sp-12) var(--sp-4); }
.no-results-message { font-size: var(--fs-lg); color: var(--tx-1); margin-bottom: var(--sp-6); }
.btn-back-home {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.65rem var(--sp-6);
  background: var(--clr-primary);
  color: #fff;
  border-radius: var(--radius-full);
  font-weight: 700;
  transition: opacity var(--dur-fast) ease, transform var(--dur-fast) var(--ease-spring);
  min-height: 44px;
}
.btn-back-home:hover { opacity: 0.88; transform: translateY(-1px); }

/* ─── 404 PAGE ────────────────────────────────────────────── */
.error-404 {
  text-align: center;
  padding: var(--sp-12) var(--sp-4) var(--sp-8);
}
.error-404-content { max-width: 480px; margin-inline: auto; }
.error-404-code {
  font-size: clamp(5rem, 20vw, 9rem);
  font-weight: 900;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, var(--clr-primary), #ff6b9d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.error-404-title { font-size: var(--fs-2xl); font-weight: 800; margin-bottom: var(--sp-3); }
.error-404-message { font-size: var(--fs-base); color: var(--tx-1); margin-bottom: var(--sp-8); }
.error-404-search {
  display: flex;
  gap: var(--sp-2);
  max-width: 360px;
  margin: 0 auto var(--sp-6);
}
.error-404-search-input {
  flex: 1;
  padding: 0.65rem var(--sp-4);
  background: var(--bg-2);
  border: 1px solid var(--bd-2);
  border-radius: var(--radius-full);
  color: var(--tx-0);
  font-size: 0.9rem;
}
.error-404-search-input::placeholder { color: var(--tx-2); }
.error-404-search-btn {
  width: 44px; height: 44px;
  background: var(--clr-primary);
  border: none;
  border-radius: var(--radius-full);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: opacity var(--dur-fast) ease;
}
.error-404-search-btn:hover { opacity: 0.9; }

/* ─── TOAST NOTIFICATION ──────────────────────────────────── */
.toast-notification {
  position: fixed;
  bottom: var(--sp-8);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-2);
  border: 1px solid var(--bd-2);
  border-radius: var(--radius-full);
  padding: var(--sp-3) var(--sp-5);
  color: var(--tx-0);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--sh-md);
  z-index: var(--z-toast);
  opacity: 0;
  transition:
    opacity var(--dur-base) ease,
    transform var(--dur-base) var(--ease-out);
  pointer-events: none;
  white-space: nowrap;
}
.toast-notification.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── COMMENTS (collapsed preview) ───────────────────────── */
.comments-section { margin-top: var(--sp-10); }
.comments-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  background: var(--bg-2);
  border: 1px solid var(--bd-2);
  border-radius: var(--radius-full);
  color: var(--tx-0);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease;
  min-height: 44px;
}
.comments-toggle-btn:hover { background: var(--bg-3); }
.comments-toggle-btn .toggle-chevron {
  transition: transform var(--dur-base) ease;
}
.comments-toggle-btn.is-expanded .toggle-chevron { transform: rotate(180deg); }
.comments-all {
  display: none;
  margin-top: var(--sp-4);
  animation: commentsReveal var(--dur-base) var(--ease-out);
}
.comments-all.is-visible { display: block; }
@keyframes commentsReveal {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── SUBMIT POST FORM ────────────────────────────────────── */
.submit-form-wrapper {
  max-width: 680px;
  margin-inline: auto;
}
.submit-form-header { margin-bottom: var(--sp-8); }
.submit-form-title  { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -0.03em; }

.form-group { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.form-label { font-size: 0.875rem; font-weight: 700; color: var(--tx-0); }
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.7rem var(--sp-4);
  background: var(--bg-2);
  border: 1.5px solid var(--bd-2);
  border-radius: var(--radius-md);
  color: var(--tx-0);
  font-size: var(--fs-base);
  font-family: inherit;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
  min-height: 44px;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(255,0,80,0.15);
  outline: none;
}
.form-textarea { min-height: 220px; resize: vertical; }
.form-hint { font-size: var(--fs-sm); color: var(--tx-2); }
.form-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0.75rem var(--sp-8);
  background: linear-gradient(135deg, #ff0050, #cc0040);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-size: var(--fs-base);
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(255,0,80,0.38);
  transition:
    opacity var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-spring),
    box-shadow var(--dur-fast) ease;
  cursor: pointer;
  min-height: 48px;
}
.form-submit-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(255,0,80,0.5);
}
.form-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.form-alert {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: var(--sp-4);
}
.form-alert-success { background: rgba(0,200,83,0.12); border: 1px solid rgba(0,200,83,0.3); color: var(--clr-success); }
.form-alert-error   { background: rgba(255,0,80,0.1);  border: 1px solid rgba(255,0,80,0.3);  color: var(--clr-primary); }

/* ─── SEARCH RESULTS ──────────────────────────────────────── */
.search-term { color: var(--clr-primary); }
}

/* ==========================================================================
   6. UTILITIES
   ========================================================================== */
@layer utilities {
  .hidden  { display: none; }
  .visible { visibility: visible; }
  .fw-700  { font-weight: 700; }
  .c-primary { color: var(--clr-primary); }
}

/* ==========================================================================
   7. OVERRIDES — Light Mode, Print, High Contrast
   ========================================================================== */
@layer overrides {

  /* Light mode adjustments */
  body.light-mode .site-header {
    background: color-mix(in srgb, #ffffff 97%, transparent);
    border-bottom-color: rgba(0,0,0,0.08);
    box-shadow: 0 1px 12px rgba(0,0,0,0.06);
  }
  body.light-mode .category-tabs {
    background: color-mix(in srgb, var(--bg-0) 95%, transparent);
    border-bottom-color: rgba(0,0,0,0.07);
  }
  body.light-mode .post-card {
    box-shadow: var(--sh-sm);
  }
  body.light-mode .post-card:hover {
    box-shadow: 0 6px 28px rgba(0,0,0,0.12);
  }
  body.light-mode .user-dropdown::before {
    background: var(--bg-2);
    border-top: 1px solid var(--bd-1);
    border-left: 1px solid var(--bd-1);
  }

  /* High contrast */
  @media (forced-colors: active) {
    .site-header, .post-card, .action-btn {
      border: 1px solid ButtonText;
    }
    .clr-primary { color: Highlight; }
  }

  /* Print */
  @media print {
    .site-header,
    .scroll-to-top,
    .share-modal,
    .loading-spinner,
    .category-tabs,
    #w1-music-player,
    #w1-scroll-btn,
    #ar-toolbar {
      display: none !important; /* Print-only: safe to use !important */
    }
    body { background: #fff; color: #000; padding-top: 0; }
    .single-post-content { max-width: 100%; color: #111; }
    a { color: #000; text-decoration: underline; }
    a[href]::after { content: ' (' attr(href) ')'; font-size: 0.8em; color: #555; }
  }
}
