:root {
  color-scheme: dark;
  --bg: #0b0b0d;
  --surface: #141418;
  --surface-raised: #1b1b20;
  --surface-soft: #21171b;
  --text: #f5f3f4;
  --muted: #aaa4a8;
  --accent: #e65f82;
  --accent-strong: #ff7899;
  --border: #2b292e;
  --border-bright: #464149;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --content: 1320px;
}

*, *::before, *::after { box-sizing: border-box; }

html { overflow-x: hidden; scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
img { display: block; max-width: 100%; }
code { padding: 0.12rem 0.35rem; border-radius: 5px; background: var(--surface-raised); }
pre { overflow-x: auto; padding: 1rem; border-radius: var(--radius); background: var(--surface); }

:focus-visible {
  outline: 3px solid var(--accent-strong);
  outline-offset: 3px;
}

.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;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(11, 11, 13, 0.94);
  backdrop-filter: blur(14px);
}

.header-inner {
  width: min(100%, var(--content));
  min-height: 66px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.logo {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 850;
  letter-spacing: -0.055em;
}

.logo > span:not(.logo-mark) { color: var(--accent-strong); }
.logo-mark { margin-right: 4px; color: var(--accent); font-size: 0.72em; }

.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a { min-height: 44px; padding: 11px 12px; border-radius: 9px; color: var(--muted); font-size: 0.9rem; font-weight: 650; }
.site-nav a:hover { color: var(--text); background: var(--surface); }

.header-search { width: min(310px, 26vw); margin-left: auto; display: flex; }
.header-search input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 44px 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
}
.header-search input::placeholder { color: #777178; }
.header-search button {
  width: 42px;
  height: 42px;
  margin-left: -42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.mobile-menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.content-area { flex: 1; width: min(100%, var(--content)); margin: 0 auto; padding: 36px 24px 72px; }

.product-hero { max-width: 780px; padding: 34px 0 26px; }
.product-hero h1 {
  max-width: 750px;
  margin: 5px 0 12px;
  font-size: clamp(2.15rem, 5vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.055em;
}
.product-hero > p:last-child { max-width: 650px; margin: 0; color: var(--muted); font-size: clamp(1rem, 1.7vw, 1.15rem); }
.eyebrow { margin: 0; color: var(--accent-strong); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }

.featured-category-rail {
  width: 100%;
  margin: 0 0 42px;
  padding: 2px 2px 12px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--border-bright) transparent;
  scroll-snap-type: x proximity;
}

.category-rail-link {
  min-width: 148px;
  min-height: 66px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  scroll-snap-align: start;
}
.category-rail-link:hover { border-color: var(--accent); background: var(--surface-soft); }
.category-rail-link span { font-weight: 750; }
.category-rail-link small { color: var(--muted); }
.category-rail-all { border-color: #633042; }

.card-section, .browse-category-section { margin-bottom: 60px; }
.section-header { margin-bottom: 18px; display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.section-header h2 { margin: 2px 0 0; font-size: clamp(1.35rem, 2vw, 1.75rem); letter-spacing: -0.025em; }
.view-all { min-height: 44px; padding: 10px 0; color: var(--accent-strong); font-size: 0.9rem; font-weight: 750; white-space: nowrap; }
.section-note { color: var(--muted); font-size: 0.85rem; }

.gif-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.gif-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 0 0 transparent;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.gif-card:hover { transform: translateY(-3px); border-color: var(--border-bright); box-shadow: var(--shadow); }
.card-media-frame { position: relative; aspect-ratio: 4 / 5; display: block; overflow: hidden; background: #050506; }
.card-preview-image { width: 100%; height: 100%; object-fit: cover; }
.card-category-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  max-width: calc(100% - 58px);
  padding: 5px 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: rgba(8, 8, 10, 0.78);
  color: #fff;
  font-size: 0.67rem;
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.play-cue {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  padding-left: 2px;
  border-radius: 50%;
  background: rgba(230, 95, 130, 0.92);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.34);
}
.card-copy { min-height: 84px; padding: 13px 14px 14px; display: flex; flex-direction: column; gap: 5px; }
.card-copy strong {
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.35;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.card-copy small { margin-top: auto; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }

.category-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.category-card { min-height: 112px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; justify-content: flex-end; }
.category-card:hover { border-color: var(--accent); background: var(--surface-soft); }
.category-card h3 { margin: 0 0 3px; font-size: 1.05rem; }
.category-count { color: var(--muted); font-size: 0.85rem; }

.about-block { max-width: 820px; margin: 20px 0 0; padding: 30px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.about-block h2 { margin: 5px 0 8px; letter-spacing: -0.025em; }
.about-block > p:last-child { margin: 0; color: var(--muted); }

.page-header { max-width: 800px; margin: 8px 0 30px; }
.page-header h1 { margin: 3px 0 7px; font-size: clamp(2rem, 4vw, 3.3rem); line-height: 1.08; letter-spacing: -0.045em; }
.page-header > p:last-child, .page-stats { margin: 0; color: var(--muted); }

.breadcrumbs { margin: 0 0 18px; display: flex; align-items: center; gap: 9px; overflow: hidden; color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.breadcrumbs a:hover { color: var(--accent-strong); }
.breadcrumbs span:last-child { overflow: hidden; color: var(--text); text-overflow: ellipsis; }
.detail-page { max-width: 920px; }
.media-player { max-height: 76vh; margin-bottom: 22px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #030303; display: flex; justify-content: center; }
.media-image { width: 100%; max-height: 76vh; object-fit: contain; }
.detail-info h1 { max-width: 850px; margin: 0 0 14px; font-size: clamp(1.55rem, 3vw, 2.35rem); line-height: 1.15; letter-spacing: -0.035em; }
.detail-meta, .detail-tags { margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.pill { min-height: 36px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-raised); display: inline-flex; align-items: center; font-size: 0.78rem; font-weight: 700; }
.pill:hover { border-color: var(--accent); }
.pill-sm { min-height: 32px; padding: 5px 10px; color: var(--muted); }
.detail-source, .detail-date, .detail-desc { color: var(--muted); font-size: 0.9rem; }
.detail-source { margin-top: 14px; }
.source-link { color: var(--accent-strong); font-weight: 700; }
.detail-date { margin: 6px 0; }
.detail-desc { max-width: 720px; }
.related-section { margin-top: 54px; padding-top: 30px; border-top: 1px solid var(--border); }
.related-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.source-grid, .tag-grid, .intent-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.source-card, .tag-card, .intent-card, .intent-detail-card { padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.source-card:hover, .tag-card:hover, .intent-card:hover { border-color: var(--accent); }
.source-card h3, .tag-card h3, .intent-card h3 { margin: 0 0 4px; font-size: 1rem; }
.source-cat, .tag-count, .source-card p, .intent-card p { color: var(--muted); font-size: 0.82rem; }
.tag-section, .source-list { margin: 26px 0; }
.tag-section h2, .source-list h2 { font-size: 1.05rem; }
.tag-rail { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip { min-height: 40px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.data-strip { margin: 24px 0; }
.data-strip div, .mini-pill-row { display: flex; flex-wrap: wrap; gap: 7px; }
.data-strip span, .mini-pill-row span, .mini-pill-row a { padding: 5px 9px; border-radius: 999px; background: var(--surface-raised); color: var(--muted); font-size: 0.77rem; }
.intent-list { display: grid; gap: 12px; }
.intent-detail-card { display: grid; grid-template-columns: 1fr auto; gap: 20px; }
.editorial-block, .intent-summary { max-width: 780px; margin: 0 0 26px; color: var(--muted); }

.search-page-form { margin-top: 22px; }
.search-page-form label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 0.85rem; }
.search-page-form > div { display: flex; gap: 8px; }
.search-page-form input { min-width: 0; flex: 1; min-height: 50px; padding: 0 16px; border: 1px solid var(--border-bright); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.search-page-form button { min-width: 104px; min-height: 50px; border: 0; border-radius: var(--radius); background: var(--accent); color: #fff; font-weight: 800; cursor: pointer; }
.search-results-section { min-height: 240px; }

.pagination { margin: 28px 0 10px; padding: 12px 0; display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.pagination-summary { color: var(--muted); font-size: 0.82rem; }
.pagination-links { display: flex; align-items: center; gap: 7px; }
.page-link { min-width: 42px; min-height: 42px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 999px; display: inline-grid; place-items: center; font-size: 0.84rem; }
.page-link.current { border-color: var(--accent); background: var(--accent); }
.page-link.unavailable { color: #686269; }

.policy-content { max-width: 780px; }
.policy-content h2 { margin: 30px 0 8px; }
.policy-content p, .policy-content li { color: var(--muted); }
.empty-state { grid-column: 1 / -1; padding: 42px 0; color: var(--muted); }

.site-footer { margin-top: auto; padding: 28px 24px; border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner { width: min(100%, var(--content)); margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.footer-links a { min-height: 36px; padding: 7px 0; color: var(--muted); font-size: 0.8rem; }
.footer-links a:hover { color: var(--text); }
.footer-copy { max-width: 480px; margin: 0; color: #7f7980; font-size: 0.78rem; text-align: right; }

@media (max-width: 1040px) {
  .gif-grid, .category-grid, .source-grid, .tag-grid, .intent-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .related-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .header-inner { gap: 14px; }
  .site-nav a { padding-inline: 8px; }
}

@media (max-width: 760px) {
  .header-inner { min-height: 60px; padding: 0 16px; }
  .site-nav { position: absolute; top: 100%; left: 0; right: 0; padding: 10px 16px 16px; border-bottom: 1px solid var(--border); background: var(--bg); display: none; flex-direction: column; align-items: stretch; }
  .site-nav.open { display: flex; }
  .site-nav a { width: 100%; }
  .header-search { width: auto; flex: 1; }
  .header-search input { padding-left: 13px; }
  .mobile-menu-btn { display: block; flex: 0 0 auto; }
  .content-area { padding: 24px 16px 56px; }
  .product-hero { padding: 18px 0 20px; }
  .product-hero h1 { font-size: clamp(2.05rem, 10vw, 3.2rem); }
  .featured-category-rail { margin-bottom: 30px; margin-right: -16px; width: calc(100% + 16px); padding-right: 16px; }
  .gif-grid, .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .category-grid, .source-grid, .tag-grid, .intent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-copy { min-height: 78px; padding: 10px; }
  .card-copy strong { font-size: 0.84rem; }
  .section-header { align-items: center; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
  .footer-copy { text-align: left; }
}

@media (max-width: 480px) {
  .gif-grid, .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .logo { font-size: 1.13rem; }
  .logo-mark { display: none; }
  .header-search input { width: 100%; font-size: 0.86rem; }
  .card-media-frame { aspect-ratio: 3 / 4; }
  .card-category-badge { max-width: calc(100% - 20px); }
  .play-cue { width: 30px; height: 30px; }
  .category-grid, .source-grid, .tag-grid, .intent-grid { grid-template-columns: 1fr; }
  .section-header { align-items: flex-start; }
  .search-page-form > div { flex-direction: column; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .intent-detail-card { grid-template-columns: 1fr; }
}

@media (max-width: 340px) {
  .header-search { display: none; }
  .content-area { padding-inline: 10px; }
  .gif-grid, .related-grid { gap: 7px; }
  .card-copy { padding: 8px; }
}

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