/**
 * Tattoo Listings v2.0 - Page Layout
 * @description Breadcrumbs, hero, style strip, toolbar, masonry grid, load more, SEO text
 * @version 1.0.0
 * @date 2026-02-26
 */

/* ================================================================
   RESET & BASE
   ================================================================ */
.tattoo-listings {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background var(--transition-normal), color var(--transition-normal);
}

/* Noise grain overlay */
.tattoo-listings::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ================================================================
   STYLE ICONS STRIP (Instagram Stories style, sticky, glassmorphism)
   ================================================================ */
.style-strip {
  padding: 0.75rem 0;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: background var(--transition-normal);
}

.style-strip-scroll {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0.15rem;
  -webkit-overflow-scrolling: touch;
}

.style-strip-scroll::-webkit-scrollbar {
  display: none;
}

.style-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  min-width: 58px;
  cursor: pointer;
  transition: all var(--transition-normal);
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  padding: 0;
}

.style-icon:hover {
  transform: translateY(-2px);
}

.style-icon.active .style-icon-ring {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-dim);
}

.style-icon-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border);
  transition: all var(--transition-normal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.style-icon:hover .style-icon-ring {
  border-color: var(--border-hover);
}

/* : full-cover photo icons + legible labels. */
.style-icon-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background-size: cover;
  background-position: center;
}

/* Drop the dim card background behind photo icons so the image renders
   edge-to-edge instead of sitting on a muted disc. */
img.style-icon-img {
  background: transparent;
}

.style-icon-name {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-2);
  text-align: center;
  letter-spacing: 0.02em;
}

.style-icon.active .style-icon-name {
  color: var(--gold);
}

@media (min-width: 768px) {
  .style-icon-ring {
    width: 72px;
    height: 72px;
  }
  .style-icon-name {
    font-size: 0.875rem; /* 14px */
  }
  .style-strip-scroll {
    gap: 1rem;
  }
}

/* Style icon gradients (for icons without images) */
.si-all { background: var(--gold); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: var(--font-weight-black); color: var(--color-black); }
.si-japanese { background: linear-gradient(135deg, #c62828, #1a1a2e); }
.si-realism { background: linear-gradient(135deg, #00838f, #0a1a2e); }
.si-blackwork { background: linear-gradient(135deg, #37474f, var(--color-bg)); }
.si-minimalism { background: linear-gradient(135deg, #2e7d32, #0a1a0a); }
.si-traditional { background: linear-gradient(135deg, #1565c0, #0a0a2a); }
.si-lettering { background: linear-gradient(135deg, #f57c00, #1a0a0a); }
.si-geometric { background: linear-gradient(135deg, #5e35b1, #1a0a2a); }
.si-fineline { background: linear-gradient(135deg, #00897b, #0a1a1a); }
.si-tribal { background: linear-gradient(135deg, #d84315, #1a0a0a); }
.si-chicano { background: linear-gradient(135deg, #6a1b9a, #0a0a2a); }
.si-ornamental { background: linear-gradient(135deg, #795548, #1a1a0a); }
.si-watercolor { background: linear-gradient(135deg, #e65100, #2d132c); }
.si-dotwork { background: linear-gradient(135deg, #795548, #1a0a0a); }
.si-neotraditional { background: linear-gradient(135deg, #1565c0, #0a0a2a); }

/* ================================================================
   TOOLBAR (Filters button + Sort + Results count)
   ================================================================ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.toolbar-filter-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.4rem 0.85rem;
  min-height: 44px; /* DSv2 §G.2 #12 — touch target */
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
  background: none;
  color: inherit;
  cursor: pointer;
}

.toolbar-filter-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.toolbar-filter-btn svg {
  width: 14px;
  height: 14px;
}

.toolbar-sort {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.04em;
  padding: 0.35rem 0.6rem;
  min-height: 44px; /* DSv2 §G.2 #12 — touch target */
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-2);
  cursor: pointer;
  transition: border-color var(--transition-normal);
}

.toolbar-sort:hover {
  border-color: var(--border-hover);
}

.toolbar-sort:focus {
  outline: none;
  border-color: var(--gold);
}

.toolbar-results {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-2);
  margin-left: auto;
}

.toolbar-results strong {
  font-family: var(--font-mono);
  color: var(--text);
  font-weight: var(--font-weight-bold);
}

/* ================================================================
   APPLIED FILTERS BAR (dismissible chips)
   ================================================================ */
.applied-filters {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.applied-filters:empty {
  display: none;
}

.applied-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: var(--gold-dim);
  color: var(--gold);
  transition: all var(--transition-normal);
}

.applied-chip:hover {
  background: rgba(232, 197, 71, 0.25);
}

.applied-chip button {
  font-size: 0.6rem;
  opacity: 0.7;
  transition: opacity var(--transition-normal);
  line-height: 1;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

.applied-chip button:hover {
  opacity: 1;
}

.applied-clear {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-bold);
  color: var(--text-3);
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--transition-normal);
}

.applied-clear:hover {
  color: var(--gold);
}

/* ================================================================
   MAIN LAYOUT: Single column (no sidebar)
   ================================================================ */
.main-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 1rem 0 3rem;
}

/* ================================================================
   MASONRY GRID
   ================================================================ */
/* : density driven by --cols custom property (JS-controlled),
   falling back to media-query defaults when JS is disabled.
   Layout = CSS Grid (not multi-column): grid never re-balances existing
   items when new cards are appended during infinite scroll, so already
   rendered tiles stay put. Cards are uniform 3:4 (overlay is absolute,
   no text adds height — see card.css), so equal-column rows look clean.
   Vertical rhythm stays on .masonry-item margin-bottom → row-gap: 0. */
.masonry-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  column-gap: 6px;
  row-gap: 0;
  transition: opacity 0.2s;
}

.masonry-grid.loading {
  opacity: 0.4;
  pointer-events: none;
}

@media (min-width: 480px) {
  .masonry-grid { column-gap: 8px; }
}

@media (min-width: 640px) {
  .masonry-grid { grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); column-gap: 10px; }
}

@media (min-width: 1024px) {
  .masonry-grid { grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); column-gap: 12px; }
}

@media (min-width: 1280px) {
  .masonry-grid { grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); column-gap: 12px; }
}

/* ================================================================
   INFINITE SCROLL SENTINEL
   ================================================================ */
.scroll-sentinel {
  padding: 2rem 0;
  display: flex;
  justify-content: center;
}

.scroll-spinner {
  display: none;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.scroll-spinner .spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.scroll-meta {
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-3);
  padding: 0.5rem 0 2rem;
}

/* ================================================================
   RELATED STYLES (Cross-linking)
   ================================================================ */
.related-styles {
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
}

.related-styles-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: var(--font-weight-normal);
  margin-bottom: 0.75rem;
  color: var(--text);
}

.related-styles-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.related-style-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-2);
  text-decoration: none;
  transition: all var(--transition-normal);
}

.related-style-pill:hover {
  border-color: var(--gold);
  color: var(--gold);
  transform: translateY(-1px);
}

.related-style-name {
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.02em;
}

.related-style-count {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-3);
  opacity: 0.7;
}

/* ================================================================
   SEO TEXT BLOCK (bottom)
   ================================================================ */
.seo-bottom {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

.seo-bottom .container {
  max-width: 760px;
}

.seo-bottom h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: var(--font-weight-normal);
  margin-bottom: 0.75rem;
}

.seo-bottom p {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 0.75rem;
  max-width: 760px;
}

/* ================================================================
   NO RESULTS
   ================================================================ */
.tattoo-no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-3);
  font-size: var(--text-lg);
}

/* ================================================================
   SCROLLBAR (subtle)
   ================================================================ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* ================================================================
   INK-DEV-141 VISUAL POLISH
   Toolbar layout + NL search + density slider + style-strip fallback
   ================================================================ */

/* --- Toolbar: NL search container (flex, grows to fill) --- */
.toolbar-nl-search {
  display: flex;
  align-items: center;
  flex: 1 1 160px;
  min-width: 0;
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  transition: border-color var(--transition-normal);
}

.toolbar-nl-search:focus-within {
  border-color: var(--gold);
  outline: none;
}

.nl-search-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-left: 0.6rem;
  color: var(--text-3);
  pointer-events: none;
}

.tattoo-nl-search {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text);
  padding: 0.4rem 0.5rem;
  outline: none;
}

.tattoo-nl-search::placeholder {
  color: var(--text-3);
}

.nl-search-clear {
  flex-shrink: 0;
  margin-right: 0.4rem;
  padding: 0.2rem 0.4rem;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-3);
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.nl-search-clear:hover {
  color: var(--text);
}

/* --- Toolbar: Density control --- */
.toolbar-density {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  cursor: pointer;
  padding: 0 0.2rem;
}

.density-label-text {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-3);
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.density-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-3);
}

.density-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 72px;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--border);
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
}

.density-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  border: 2px solid var(--bg-card);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition-fast);
}

.density-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  border: 2px solid var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.density-slider:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.density-value {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-2);
  min-width: 1ch;
  text-align: center;
}

/* --- Style strip: unknown/fallback circle with initial letter --- */
.si-unknown {
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-bg-card) 100%);
}

/* Initial-letter pseudo-element for any style-icon-img with data-style-initial.
   .style-icon-ring is already display: flex + center aligned (line 244), so
   the ::before centres automatically inside the 64/72 px ring. */
.style-icon-ring .style-icon-img[data-style-initial] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.style-icon-ring .style-icon-img[data-style-initial]::before {
  content: attr(data-style-initial);
  font-family: var(--font-ui);
  font-size: 1.375rem;
  font-weight: var(--font-weight-black);
  color: var(--text-2);
  letter-spacing: 0;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* --- Toolbar: responsive order (mobile two-row, desktop single-row) --- */
@media (max-width: 767px) {
  .toolbar {
    display: grid;
    grid-template-columns: auto auto 1fr;
    grid-template-areas:
      "filter sort density"
      "search search search";
    gap: 0.5rem;
    align-items: center;
  }
  .toolbar-filter-btn { grid-area: filter; }
  .toolbar-sort       { grid-area: sort; }
  .toolbar-density    { grid-area: density; justify-self: end; }
  .toolbar-nl-search {
    grid-area: search;
    flex: 1 1 auto;
  }
  .density-label-text {
    display: none;
  }
  .density-slider {
    width: 56px;
  }

  /* DSv2 §G.2 #11 — overflow fade hint for horizontal style strip */
  .style-strip-scroll {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  }
  .style-strip-scroll.is-expanded {
    -webkit-mask-image: none;
            mask-image: none;
  }
}

@media (min-width: 768px) {
  .toolbar {
    flex-wrap: nowrap;
  }
  .toolbar-filter-btn { order: 1; }
  .toolbar-sort       { order: 2; }
  .toolbar-nl-search {
    order: 3;
    flex: 1 1 auto;
  }
  .toolbar-density    { order: 4; }
}
