/* kyt-entity-registry landing page — minimalist.
 *
 * Token colours + typography for the landing page. */

:root {
  /* Surfaces */
  --background: #f7f7fa;
  --foreground: #232325;
  --card: #ffffff;
  --card-foreground: #232325;

  /* Brand — pink accent */
  --brand: #d64686;
  --brand-soft: #fde9f1;
  --brand-strong: #b83570;
  --brand-foreground: #ffffff;

  /* Semantic */
  --muted: #f3f3f6;
  --muted-foreground: #626368;
  --border: #e9e9ee;
  --ring: #d64686;

  /* Radii */
  --radius: 0.75rem;
  --radius-sm: 0.45rem;
  --radius-md: 0.6rem;

  /* Fonts — loaded from Google Fonts in index.html */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
               Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-heading: 'Manrope', var(--font-sans);

  --shadow-sm: 0 1px 2px rgba(35, 35, 37, 0.04);
  --shadow: 0 4px 16px rgba(35, 35, 37, 0.06),
            0 1px 2px rgba(35, 35, 37, 0.04);
  --shadow-lg: 0 24px 48px rgba(35, 35, 37, 0.08),
               0 2px 4px rgba(35, 35, 37, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #18181c;
    --foreground: #f5f5f7;
    --card: #232328;
    --card-foreground: #f5f5f7;
    --brand: #ec5b9d;
    --brand-soft: #3a1e2d;
    --brand-strong: #f58ec0;
    --muted: #2a2a30;
    --muted-foreground: #9e9ea7;
    --border: #2e2e36;
    --ring: #ec5b9d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.5),
              0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.55),
                 0 2px 4px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  color: var(--foreground);
  background: var(--background);
  line-height: 1.5;
  font-size: 16px;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── i18n visibility ──────────────────────────────────────────────── */
html[lang="en"] [data-lang="ru"],
html[lang="ru"] [data-lang="en"] { display: none !important; }
/* Keep SEO: non-displayed lang copies still live in the DOM. */

/* ── header ───────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--background) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}
.brand-lockup {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.brand-lockup .logo-mark {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.brand-lockup .logo-mark span { color: var(--brand); }
.brand-lockup .brand-sub {
  color: var(--muted-foreground);
  font-size: 12px;
  display: none;
}
@media (min-width: 640px) {
  .brand-lockup .brand-sub { display: inline; }
}
.header-nav {
  display: flex;
  gap: 6px;
  align-items: center;
}
.header-nav a {
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: var(--radius-md);
}
.header-nav a:hover {
  color: var(--foreground);
  text-decoration: none;
  background: var(--muted);
}
.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-family: var(--font-sans);
}
.lang-toggle button {
  padding: 6px 10px;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  min-width: 36px;
}
.lang-toggle button[aria-pressed="true"] {
  background: var(--brand);
  color: var(--brand-foreground);
}
.gh-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  background: var(--foreground);
  color: var(--background);
  white-space: nowrap;
}
.gh-button:hover {
  text-decoration: none;
  opacity: 0.85;
}

/* ── hero ─────────────────────────────────────────────────────────── */
.hero {
  padding: 72px 0 56px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, color-mix(in srgb, var(--brand) 14%, transparent) 0%, transparent 35%),
    radial-gradient(circle at 85% 80%, color-mix(in srgb, var(--brand) 10%, transparent) 0%, transparent 40%);
  z-index: -1;
}
.hero h1 {
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.05;
  max-width: 18ch;
  margin: 0 auto 16px;
}
.hero h1 .accent { color: var(--brand); }
.hero-sub {
  font-size: clamp(15px, 1.5vw, 18px);
  color: var(--muted-foreground);
  max-width: 60ch;
  margin: 0 auto 28px;
}
.hero-ctas {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  transition: transform 80ms, box-shadow 120ms, background 120ms;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary {
  background: var(--brand);
  color: var(--brand-foreground);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 30%, transparent);
}
.btn-primary:hover {
  background: var(--brand-strong);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 40%, transparent);
}
.btn-ghost {
  background: transparent;
  color: var(--foreground);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--muted); }

.hero-stats {
  margin-top: 36px;
  display: flex;
  gap: 40px;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted-foreground);
}
.hero-stat { text-align: center; }
.hero-stat strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

/* ── section ───────────────────────────────────────────────────────── */
section {
  padding: 56px 0;
}
section.band {
  background: var(--card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.section-eyebrow {
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--brand);
  margin-bottom: 8px;
}
.section-title {
  font-size: clamp(24px, 3vw, 36px);
  margin-bottom: 10px;
}
.section-lead {
  color: var(--muted-foreground);
  font-size: 16px;
  max-width: 62ch;
  margin: 0 0 32px;
}

/* ── category tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.tab {
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted-foreground);
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms;
}
.tab:hover {
  color: var(--foreground);
  border-color: var(--muted-foreground);
}
.tab[aria-pressed="true"] {
  background: var(--brand);
  color: var(--brand-foreground);
  border-color: var(--brand);
}
.tab .count {
  margin-left: 5px;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}
.tab-clear {
  color: var(--brand);
  border-style: dashed;
  background: transparent;
}

/* ── quilt controls (search + count) ───────────────────────────────── */
.quilt-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 320px;
  flex: 1;
  min-width: 160px;
}
.search-icon {
  position: absolute;
  left: 12px;
  color: var(--muted-foreground);
  pointer-events: none;
  flex-shrink: 0;
}
.quilt-search {
  width: 100%;
  padding: 8px 14px 8px 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--foreground);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}
.quilt-search::placeholder { color: var(--muted-foreground); }
.quilt-search:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
/* WebKit: hide the native ✕ clear button in search inputs */
.quilt-search::-webkit-search-cancel-button { display: none; }
.search-count {
  font-size: 13px;
  color: var(--muted-foreground);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ── quilt ─────────────────────────────────────────────────────────── */
.quilt-scroll { position: relative; }
.quilt {
  display: grid;
  /* Dense patchwork — 44px tiles / 2px gap reads as a true quilt on
     desktop while still staying tap-friendly on wider mobile. */
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius);
  background: var(--muted);
  border: 1px solid var(--border);
  min-height: 200px;
  transition: opacity 150ms ease;
}
.quilt.quilt-fading {
  opacity: 0;
  pointer-events: none;
}
@media (min-width: 1024px) {
  .quilt {
    /* Tighten further on desktops where the grid has room */
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  }
}
.tile {
  aspect-ratio: 1 / 1;
  background: var(--card);
  border-radius: 3px;
  display: block;
  overflow: hidden;
  position: relative;
  transition: opacity 160ms, transform 140ms, box-shadow 140ms;
  contain: paint;
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px;
  display: block;
}
.tile:hover {
  transform: scale(1.8);
  z-index: 2;
  box-shadow: var(--shadow-lg);
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-radius: var(--radius-sm);
}
/* Hidden tiles disappear during filter, collapsing the grid. */
.tile.tile-hidden {
  display: none;
}
/* Same-brand siblings with an identical logo collapse into one tile with a
 * "+N" badge. While a search / category filter is active they are shown
 * again (and the filter's own .tile-hidden decides which ones). */
.tile.tile-sib { display: none; }
#quilt[data-filter-active] .tile.tile-sib { display: block; }
/* ...but a sibling the filter rejects must stay hidden (the rule above has
 * higher specificity than .tile.tile-hidden, so restate it explicitly). */
#quilt[data-filter-active] .tile.tile-sib.tile-hidden { display: none; }
#quilt[data-filter-active] .tile-grp { display: none; }
.tile-grp {
  position: absolute;
  right: 1px;
  bottom: 1px;
  padding: 0 3px;
  font: 600 9px/14px var(--font-mono, ui-monospace, monospace);
  color: #fff;
  background: var(--brand);
  border-radius: 6px;
  pointer-events: none;
}
/* Tile stagger-in after filter/search recalculation. */
@keyframes tileIn {
  from { opacity: 0; transform: scale(0.82); }
  to   { opacity: 1; transform: scale(1); }
}
.tile.tile-in {
  animation: tileIn 200ms ease-out both;
  animation-delay: calc(var(--tile-i, 0) * 6ms);
}
/* Placeholder tiles are the same bytes for many rows — de-emphasise. */
.tile[data-real="false"] img { opacity: 0.55; }

/* ── hover card ─────────────────────────────────────────────────────── */
.hover-card {
  position: fixed;
  z-index: 50;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px 14px;
  min-width: 240px;
  max-width: 320px;
  font-size: 12px;
  color: var(--foreground);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 120ms, transform 120ms;
}
.hover-card.visible {
  opacity: 1;
  transform: translateY(0);
}
.hover-card .hc-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  word-break: break-word;
}
.hover-card .hc-cat {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: 8px;
}
.hover-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 10px;
  font-variant-numeric: tabular-nums;
}
.hover-card dt { color: var(--muted-foreground); }
.hover-card dd { margin: 0; }
.hc-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}
.hc-pill.real { background: #d1fae5; color: #065f46; }
.hc-pill.placeholder { background: #fee2e2; color: #b91c1c; }
.hc-pill.manual { background: #fef3c7; color: #92400e; }
@media (prefers-color-scheme: dark) {
  .hc-pill.real        { background: #1a3a2a; color: #6ee7a4; }
  .hc-pill.placeholder { background: #3a1f1f; color: #fca5a5; }
  .hc-pill.manual      { background: #3f2e10; color: #fcd34d; }
}

/* ── usage / code blocks ────────────────────────────────────────────── */
.usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.usage-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.usage-card h3 {
  font-size: 17px;
  margin-bottom: 8px;
}
.usage-card p {
  margin: 0 0 12px;
  color: var(--muted-foreground);
  font-size: 14px;
}
pre.code {
  background: #0e0e10;
  color: #f0f0f3;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  margin: 0;
}
pre.code .c-key { color: #ec5b9d; }
pre.code .c-str { color: #a7d998; }
pre.code .c-com { color: #7e7e86; font-style: italic; }

/* ── bulk upload zone ────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px;
  text-align: center;
  background: var(--card);
  transition: all 160ms;
  cursor: pointer;
  user-select: none;
}
.dropzone:hover,
.dropzone.dragging {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.dropzone-icon {
  font-size: 32px;
  margin-bottom: 8px;
  line-height: 1;
}
.dropzone-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  margin: 0 0 4px;
}
.dropzone-sub {
  color: var(--muted-foreground);
  font-size: 13px;
}
.bulk-results {
  margin-top: 20px;
  font-size: 13px;
  display: none;
}
.bulk-results.visible { display: block; }
.bulk-matches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.bulk-match {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--muted);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 12px;
}
.bulk-match .bm-preview {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--card);
  object-fit: contain;
  flex-shrink: 0;
}
.bulk-match .bm-info { min-width: 0; }
.bulk-match .bm-filename {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bulk-match .bm-target {
  color: var(--muted-foreground);
  font-size: 11px;
}
.bulk-match.unmatched {
  background: color-mix(in srgb, var(--brand) 8%, transparent);
  color: var(--brand);
}

/* ── CTA band ───────────────────────────────────────────────────────── */
.cta-band {
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: var(--brand-foreground);
  text-align: center;
  padding: 64px 24px;
  border-radius: var(--radius);
  margin: 0 auto;
  max-width: 1280px;
}
.cta-band h2 {
  color: var(--brand-foreground);
  font-size: clamp(24px, 3vw, 34px);
  margin: 0 0 10px;
}
.cta-band p {
  margin: 0 auto 22px;
  max-width: 54ch;
  opacity: 0.9;
  font-size: 15px;
}
.cta-band .btn-primary {
  background: var(--brand-foreground);
  color: var(--brand);
}
.cta-band .btn-primary:hover { background: #ffe6f0; }

/* ── footer ────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  color: var(--muted-foreground);
  font-size: 13px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}
.footer-inner a {
  color: var(--muted-foreground);
}
.footer-inner a:hover { color: var(--foreground); }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }

/* ── utilities ──────────────────────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.skeleton {
  background: linear-gradient(90deg, var(--muted) 0%, color-mix(in srgb, var(--muted) 70%, var(--card)) 50%, var(--muted) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── back-to-filter sticky button ────────────────────────────────── */
.back-to-filter {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--brand);
  color: var(--brand-foreground);
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: opacity 200ms, transform 200ms;
  line-height: 1;
  white-space: nowrap;
}
.back-to-filter:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  text-decoration: none;
}
.back-to-filter[hidden] { display: none; }

/* ── reduced-motion overrides ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
