/* PAPAYA Stylist — visual system, papaya.ua aesthetic
   White paper, thin black lines, generous whitespace, uppercase nav. */

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: #FFFFFF;
  font-family: 'Archivo', ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
html { scrollbar-gutter: stable; }
body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

:root {
  --ink: #0A0A0A;
  --paper: #FFFFFF;
  --hush: #F4F4F4;
  --line: #E6E6E6;
  --rule: #0A0A0A;
  --soft: rgba(10,10,10,.55);
  --whisper: rgba(10,10,10,.32);
  --tile-a: #F2F2F2;
  --tile-b: #E2E2E2;
  --tile-c: #0A0A0A;
}
.invert {
  --ink: #FFFFFF;
  --paper: #0A0A0A;
  --hush: #141414;
  --line: #1F1F1F;
  --rule: #FFFFFF;
  --soft: rgba(255,255,255,.6);
  --whisper: rgba(255,255,255,.3);
  --tile-a: #171717;
  --tile-b: #262626;
  --tile-c: #FFFFFF;
}
body { background: var(--paper); color: var(--ink); }
.root {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  display: flex; flex-direction: column;
}

/* WORDMARK */
.wordmark {
  font-family: 'Archivo Black', ui-sans-serif, sans-serif;
  font-weight: 900;
  font-size: calc(80px * var(--wm-size, 1));
  line-height: .85;
  letter-spacing: .06em;
  color: var(--ink);
  text-transform: uppercase;
  transform: scaleY(1.08);
  transform-origin: left top;
  display: inline-block;
  white-space: nowrap;
}

/* TOP CHROME */
.top {
  display: grid;
  align-items: center;
  padding: 28px 56px 22px;
  border-bottom: 1px solid var(--line);
  gap: 32px;
  background: var(--paper);
}
.top.hero {
  grid-template-columns: 1fr;
  padding: 36px 56px 28px;
  align-items: start;
  border-bottom: none;
}
.top.compact {
  grid-template-columns: auto 1fr auto;
  padding: 18px 40px;
  position: sticky; top: 0; z-index: 6;
  background: var(--paper);
}
.top.compact .brand .wordmark { font-size: 30px; transform: scaleY(1.05); }
.top.compact .brand-sub { display: none; }

.brand { display: flex; flex-direction: column; gap: 10px; }
.brand-btn {
  appearance: none; background: transparent; border: none; padding: 0; cursor: pointer;
  color: var(--ink); text-align: left;
  transition: opacity 120ms;
  display: block; text-decoration: none;
}
.brand-btn:hover { opacity: .7; }
.brand-btn:active { opacity: .5; }
.brand-sub {
  font-family: 'Archivo', sans-serif;
  font-weight: 500;
  font-size: 11px; letter-spacing: .32em;
  color: var(--soft);
  text-transform: uppercase;
}
.top-right { display: flex; align-items: center; gap: 28px; justify-content: flex-end; }
.top-mid { display: flex; justify-content: center; }
.top.compact .top-mid { max-width: 560px; width: 100%; margin: 0 auto; }
.top-mid-desktop { display: block; width: 100%; }
.top-mid-mobile { display: none; align-items: center; gap: 8px; width: 100%; }

.ic-btn {
  appearance: none; cursor: pointer;
  background: transparent; color: var(--ink);
  border: 1px solid var(--line);
  width: 42px; height: 42px;
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.ic-btn:hover { border-color: var(--ink); }
.ic-btn.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.top-mid-mobile-chip {
  flex: 1; min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  display: flex; align-items: center;
  padding: 0 14px;
  font-family: 'Archivo', sans-serif; font-weight: 500;
  font-size: 13px; letter-spacing: .12em;
  text-transform: uppercase;
  overflow: hidden; white-space: nowrap;
  cursor: pointer;
}
.top-mid-mobile-chip .chipcode {
  font-family: 'Archivo Black', sans-serif; font-weight: 900;
  font-size: 14px; letter-spacing: .06em;
  color: var(--ink);
}
.top-mid-mobile-chip .chipplaceholder { color: var(--whisper); font-weight: 500; }

.top-back {
  appearance: none; background: transparent; cursor: pointer;
  border: none; color: var(--ink);
  font-family: 'Archivo', sans-serif; font-weight: 500;
  font-size: 11px; letter-spacing: .28em;
  text-transform: uppercase;
  padding: 8px 0;
  text-decoration: none;
}
.top-back:hover { opacity: .55; }

/* HERO (empty) STATE */
.hero-main {
  flex: 1 0 auto;
  display: flex; flex-direction: column;
  padding: 56px 88px 36px;
  gap: 48px;
  position: relative;
  min-height: calc(100vh - 200px);
}
.hero-block { display: flex; flex-direction: column; gap: 28px; max-width: 1100px; }
.hero-suggest { display: flex; flex-direction: column; gap: 14px; }
.hero-suggest-lbl,
.hero-tags-hd > span:first-child {
  font-family: 'Archivo', sans-serif;
  font-weight: 500;
  font-size: 11px; letter-spacing: .32em;
  color: var(--soft);
  text-transform: uppercase;
}
.hero-suggest-row { display: flex; gap: 12px; flex-wrap: wrap; }
.suggest-pill {
  appearance: none; background: transparent; cursor: pointer;
  border: 1px solid var(--line); color: var(--ink);
  padding: 14px 20px;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  min-width: 200px;
  text-align: left;
  text-decoration: none;
  transition: border-color 120ms, background 120ms, color 120ms;
}
.suggest-pill:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.pill-code { font-family: 'Archivo', sans-serif; font-weight: 600; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; }
.pill-name { font-size: 13px; letter-spacing: .02em; opacity: .65; text-transform: lowercase; }
.suggest-pill:hover .pill-name { opacity: .85; }

.hero-tags { display: flex; flex-direction: column; gap: 18px; }
.hero-tags-hd { display: flex; align-items: center; gap: 18px; }
.hero-tags-rule { flex: 1; height: 1px; background: var(--line); }

.hero-foot {
  margin-top: auto;
  display: flex; justify-content: space-between;
  font-family: 'Archivo', sans-serif;
  font-weight: 500;
  font-size: 11px; letter-spacing: .28em;
  color: var(--whisper);
  text-transform: uppercase;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

/* SEARCH BAR */
.search { width: 100%; }
.search-row { display: flex; align-items: center; gap: 16px; }
.search.hero .search-row { height: 104px; border: 1px solid var(--ink); background: var(--paper); padding: 0 26px; }
.search.compact .search-row { height: 52px; border: 1px solid var(--ink); background: var(--paper); padding: 0 18px; }
.search-ic { color: var(--ink); opacity: .55; flex-shrink: 0; }
.search.hero .search-ic { width: 26px; height: 26px; }
.search-input {
  flex: 1;
  appearance: none;
  border: none; outline: none; background: transparent;
  color: var(--ink);
  font-family: 'Archivo Black', sans-serif;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.search.hero .search-input { font-size: 38px; }
.search.compact .search-input { font-size: 18px; letter-spacing: .06em; }
.search-input::placeholder { color: var(--ink); opacity: .16; }

.search-clear, .search-tag, .search-scan {
  appearance: none; background: transparent; border: none; color: var(--ink);
  cursor: pointer; padding: 6px;
  display: flex; align-items: center; gap: 8px;
  text-decoration: none;
}
.search-clear:hover, .search-tag:hover, .search-scan:hover { opacity: .6; }
.search-sep { width: 1px; height: 50%; background: var(--line); }
.search-tag {
  font-family: 'Archivo', sans-serif; font-weight: 500;
  font-size: 11px; letter-spacing: .24em;
  padding: 8px 12px;
  text-transform: uppercase;
}
.search-tag.on { background: var(--ink); color: var(--paper); }

/* TAG RAIL / CHIPS */
.tagrail { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  appearance: none; background: transparent; cursor: pointer;
  border: 1px solid var(--line); color: var(--ink);
  font-family: 'Archivo', sans-serif; font-weight: 500;
  font-size: 11px; letter-spacing: .22em;
  padding: 11px 16px;
  display: inline-flex; align-items: baseline; gap: 10px;
  text-transform: uppercase;
  text-decoration: none;
  transition: border-color 120ms, background 120ms, color 120ms;
}
.chip:hover { border-color: var(--ink); }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip-n { font-family: 'Archivo', sans-serif; font-size: 10px; opacity: .5; letter-spacing: .06em; }

/* RESULTS HEADER */
.results { display: flex; flex-direction: column; }
.results-hd {
  padding: 28px 40px 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px; align-items: end;
  border-bottom: 1px solid var(--line);
}
.kicker {
  font-family: 'Archivo', sans-serif; font-weight: 500;
  font-size: 11px; letter-spacing: .32em;
  color: var(--soft);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.results-title {
  margin: 0;
  font-family: 'Archivo Black', sans-serif; font-weight: 900;
  font-size: 52px; letter-spacing: .01em; line-height: .95;
  text-transform: uppercase;
  color: var(--ink);
}
.results-sub {
  margin-top: 10px;
  font-family: 'Archivo', sans-serif; font-weight: 500;
  font-size: 11px; letter-spacing: .22em;
  color: var(--soft);
  text-transform: uppercase;
}
.results-sub b { color: var(--ink); font-weight: 600; }
.results-hd-r {
  display: flex; gap: 18px; align-items: center;
  font-family: 'Archivo', sans-serif; font-weight: 500;
  font-size: 11px; letter-spacing: .22em;
  color: var(--soft);
  text-transform: uppercase;
}
.legend { display: inline-flex; align-items: center; gap: 8px; }
.legend-dot { width: 7px; height: 7px; border: 1px solid var(--ink); display: inline-block; }
.legend-dot.video { background: var(--ink); }
.results-tagbar { padding: 18px 40px; border-bottom: 1px solid var(--line); background: var(--paper); }

/* GRID */
.grid-wrap { padding: 22px 40px 40px; }
.grid.layout-masonry { column-gap: 18px; column-count: 4; }
.grid.layout-masonry .cell { break-inside: avoid; margin-bottom: 18px; }

/* TILES */
.tile {
  appearance: none; padding: 0; background: transparent; border: none;
  width: 100%; cursor: pointer;
  display: block;
  position: relative;
  color: var(--ink);
  text-decoration: none;
  text-align: left;
}
.tile-art {
  width: 100%;
  aspect-ratio: 1 / var(--h, 1.8);
  overflow: hidden;
  background: var(--hush);
  transition: opacity 120ms ease;
}
.tile-art img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.modal-frame img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.tile:hover .tile-art { opacity: .85; }
.tile-badge {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--paper); color: var(--ink);
  font-family: 'Archivo', sans-serif; font-weight: 600;
  font-size: 9px; letter-spacing: .22em;
  padding: 5px 8px;
  text-transform: uppercase;
}
.tile-cap {
  margin-top: 8px;
  font-family: 'Archivo', sans-serif; font-weight: 500;
  font-size: 10px; letter-spacing: .22em;
  color: var(--soft);
  text-transform: uppercase;
}

/* Empty result */
.empty {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  padding: 80px 0; gap: 20px;
}
.empty-bar { width: 48px; height: 1px; background: var(--ink); }
.empty-text {
  font-family: 'Archivo', sans-serif; font-weight: 500;
  font-size: 13px; letter-spacing: .22em;
  color: var(--soft);
  text-transform: uppercase;
}

/* MODAL */
.modal {
  position: fixed; inset: 0; z-index: 1000;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--paper);
  animation: modal-in 200ms ease-out;
}
@keyframes modal-in { from { opacity: 0; } to { opacity: 1; } }

.modal-bg { position: absolute; inset: 0; z-index: 0; }
.modal-top {
  position: relative; z-index: 2;
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px 40px;
  border-bottom: 1px solid var(--line);
}
.modal-meta {
  display: inline-flex; align-items: baseline; gap: 12px;
  font-family: 'Archivo', sans-serif; font-weight: 500;
  font-size: 12px; letter-spacing: .22em;
  color: var(--ink);
  text-transform: uppercase;
}
.modal-code { font-weight: 600; }
.modal-dot { opacity: .4; }
.modal-no { color: var(--soft); }
.modal-x {
  appearance: none; background: transparent; border: 1px solid var(--ink); color: var(--ink);
  width: 42px; height: 42px; cursor: pointer;
  display: grid; place-items: center;
  transition: background 120ms, color 120ms;
}
.modal-x:hover { background: var(--ink); color: var(--paper); }

.modal-x-fab {
  display: none;
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: 12px;
  z-index: 1200;
  appearance: none; cursor: pointer;
  width: 48px; height: 48px;
  border: none; border-radius: 50%;
  background: rgba(255,255,255,.92);
  color: #0a0a0a;
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  backdrop-filter: blur(12px) saturate(160%);
  box-shadow: 0 4px 16px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.06);
  place-items: center;
}
.modal-x-fab svg { display: block; }

.modal-stage {
  position: relative; z-index: 1;
  display: grid; place-items: center;
  padding: 32px;
  min-height: 0;
  height: calc(100vh - 180px);
}
.modal-frame {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  height: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: var(--hush);
  animation: frame-in 240ms ease-out;
}
@keyframes frame-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.modal-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--paper); mix-blend-mode: difference; pointer-events: none;
}

.nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 3;
  appearance: none; background: var(--paper); border: 1px solid var(--ink); color: var(--ink);
  width: 54px; height: 54px; cursor: pointer;
  display: grid; place-items: center;
  transition: background 120ms, color 120ms;
}
.nav:hover { background: var(--ink); color: var(--paper); }
.nav-l { left: 28px; } .nav-r { right: 28px; }

.modal-bottom {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px; align-items: center;
  padding: 18px 40px;
  border-top: 1px solid var(--line);
}
.modal-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.modal-tag {
  font-family: 'Archivo', sans-serif; font-weight: 500;
  font-size: 11px; letter-spacing: .22em;
  padding: 7px 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  text-transform: uppercase;
}
.modal-thumbs { display: flex; gap: 6px; }
.thumb {
  width: 32px; height: 3px;
  background: var(--whisper);
  border: none; padding: 0; cursor: pointer;
  transition: background 120ms;
}
.thumb.on { background: var(--ink); }

/* RESPONSIVE */
@media (max-width: 1100px) {
  .top.hero { padding: 28px 32px 24px; }
  .top.compact { padding: 14px 24px; }
  .hero-main { padding: 40px 32px 28px; gap: 36px; }
  .grid-wrap { padding: 18px 24px 36px; }
  .results-hd { padding: 24px 24px 18px; }
  .results-tagbar { padding: 14px 24px; }
  .modal-top, .modal-bottom { padding: 18px 24px; }
  .search.hero .search-input { font-size: 30px; }
  .results-title { font-size: 42px; }
  .grid.layout-masonry { column-count: 3; }
}
@media (max-width: 720px) {
  .top.hero { padding: 24px 18px 16px; grid-template-columns: 1fr; gap: 18px; border-bottom: none; }
  .top.compact { padding: 10px 14px; grid-template-columns: auto 1fr; gap: 12px; }
  .top-right { display: none; }
  .hero-main { padding: 20px 18px 24px; gap: 32px; min-height: 0; }
  .brand { gap: 6px; }
  .brand-sub { font-size: 10px; letter-spacing: .28em; }

  .grid-wrap { padding: 14px 12px 32px; }
  .results-hd { padding: 16px 14px 12px; grid-template-columns: 1fr; gap: 8px; }
  .results-hd-r { display: none; }
  .results-tagbar { padding: 10px 14px; }

  .top-mid-desktop { display: none; }
  .top-mid-mobile { display: flex; }

  .modal { grid-template-rows: auto 1fr auto; height: 100vh; height: 100dvh; background: var(--paper); }
  .modal-top {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 14px);
    left: 14px;
    right: auto;
    z-index: 1100;
    padding: 0;
    border: none;
    background: transparent;
    display: block;
  }
  .modal-top .modal-x { display: none; }
  .modal-meta {
    display: inline-flex;
    background: rgba(255,255,255,.92);
    color: #0a0a0a;
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    backdrop-filter: blur(12px) saturate(160%);
    box-shadow: 0 4px 14px rgba(0,0,0,.14), 0 0 0 1px rgba(0,0,0,.06);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 11px; letter-spacing: .16em;
    gap: 8px;
  }
  .modal-x-fab { display: grid; }
  .modal-bottom {
    padding: 14px 14px calc(env(safe-area-inset-bottom, 0px) + 14px);
    border-top: 1px solid var(--line);
    background: var(--paper);
    grid-template-columns: 1fr;
    z-index: 1100;
  }
  .modal-thumbs { display: none; }
  .nav-l { left: 8px; } .nav-r { right: 8px; }
  .nav {
    width: 44px; height: 44px;
    background: rgba(255,255,255,.92);
    color: #0a0a0a;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(0,0,0,.14), 0 0 0 1px rgba(0,0,0,.06);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    backdrop-filter: blur(12px) saturate(160%);
  }
  .modal-stage { padding: 0; height: auto; min-height: 0; }
  .modal-frame { width: 100%; height: 100%; max-height: 100%; aspect-ratio: auto; border: none; }
  .modal-tags { gap: 6px; }
  .modal-tag { font-size: 10px; padding: 6px 10px; letter-spacing: .16em; }

  .search.hero .search-row { height: 56px; padding: 0 14px; }
  .search.hero .search-input { font-size: 18px; }
  .search.hero .search-ic { width: 20px; height: 20px; }
  .search.compact .search-row { height: 46px; padding: 0 12px; }
  .search.compact .search-input { font-size: 16px; }
  .search-tag span { display: none; }
  .search-tag { padding: 8px; }
  .search-scan { display: none; }

  .results-title { font-size: 30px; }
  .wordmark { font-size: calc(48px * var(--wm-size, 1)); }
  .top.compact .brand .wordmark { font-size: 22px; }

  .grid.layout-masonry { column-count: 2; column-gap: 8px; }
  .grid.layout-masonry .cell { margin-bottom: 8px; }

  .suggest-pill { min-width: 0; flex: 1 1 calc(50% - 6px); padding: 12px 14px; }
  .hero-suggest-row { gap: 8px; }
  .hero-foot { flex-direction: column; gap: 8px; padding-top: 18px; font-size: 9px; letter-spacing: .2em; }
  .chip { padding: 9px 12px; font-size: 10.5px; }
  .hero-tags-hd > span:first-child { font-size: 10px; letter-spacing: .24em; }
}
@media (max-width: 380px) {
  .top.hero { padding: 18px 14px 12px; }
  .hero-main { padding: 18px 14px 22px; gap: 24px; }
  .wordmark { font-size: calc(42px * var(--wm-size, 1)); }
  .search.hero .search-input { font-size: 16px; }
  .grid.layout-masonry { column-count: 1; }
  .suggest-pill { flex: 1 1 100%; }
}
