/* Component styles — tokens & header in theme.css */

:root {
  --font-large: 600 34px/44px var(--font);
  --font-title: 600 24px/32px var(--font);
  --font-headline: 600 20px/24px var(--font);
  --font-label: 600 16px/24px var(--font);
  --font-body: 400 16px/24px var(--font);
  --font-body-sm: 500 14px/20px var(--font);
  --font-caption: 400 12px/16px var(--font);
  --black: var(--bg-primary);
  --dark: var(--card-bg);
  --grey: var(--control-tertiary-hover);
  --light-grey: var(--text-muted);
  --bg-grey: var(--text-secondary);
  --white: var(--text-primary);
  --gold: var(--accent-negative);
  --blue: var(--accent);
  --purple: #6b3cff;
  --green: #009a00;
  --screen-ratio: 178 / 386;
  --radius-phone: 14% / 7%;
}

.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  display: none;
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-soft);
  z-index: 30;
}

.suggestions.is-open { display: block; }

.suggestion {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.suggestion:hover { background: var(--control-tertiary); }

.suggestion img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--card-bg-hover);
}

.btn {
  border: 0;
  border-radius: var(--radius-control);
  background: var(--control-tertiary);
  color: var(--text-primary);
  padding: 10px 16px;
  min-height: 44px;
  font: var(--font-body-sm);
  box-shadow: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn:hover, .btn.is-active { background: var(--control-tertiary-hover); transform: none; }
.btn--primary { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { border: 1px solid var(--border-subtle); background: transparent; }

.apps-page {
  display: grid;
  gap: 16px;
}

.catalog-section {
  display: grid;
  gap: 16px;
}

.catalog-section__title {
  margin: 0;
  font: var(--font-title-sm);
  color: var(--ink);
}

.catalog-platform-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 14px;
}

.catalog-platform-hint .btn--sm {
  padding: 6px 12px;
  font-size: 13px;
}

.apps-count {
  display: none;
}

.apps-grid,
.company-grid,
.figma-cards {
  display: grid;
  gap: 24px 16px;
  grid-template-columns: minmax(0, 1fr);
}

.figma-cards {
  gap: 40px 16px;
}

@media (min-width: 640px) {
  .figma-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .figma-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .figma-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1440px) {
  .figma-cards {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 40px 16px;
  }
}

@media (min-width: 900px) {
  .apps-grid:not(.figma-cards),
  .company-grid:not(.figma-cards) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .apps-grid:not(.figma-cards),
  .company-grid:not(.figma-cards) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.gallery-card,
.app-card,
.company-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  perspective: 900px;
}

.gallery-card__link,
.app-card__link,
.company-card .app-card__link {
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.gallery-card__preview,
.app-card__preview {
  position: relative;
  aspect-ratio: 448 / 570;
  overflow: hidden;
  border-radius: var(--radius-card-lg);
  background: var(--bg-lower);
  transform-style: preserve-3d;
  transform: perspective(900px) rotateX(0deg) rotateY(0deg);
}

.gallery-card__carousel {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.gallery-card__carousel::-webkit-scrollbar {
  display: none;
}

.gallery-card__track {
  display: flex;
  height: 100%;
  min-width: min-content;
}

.gallery-card__slide {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.gallery-card__carousel {
  cursor: grab;
  touch-action: pan-x;
}

.gallery-card__carousel.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.phone-mockup {
  position: absolute;
  inset: 7.5% 25%;
  display: flex;
  align-items: stretch;
  justify-content: center;
  border-radius: var(--radius-phone);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  pointer-events: none;
  overflow: hidden;
}

.phone-mockup__screen {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: calc(var(--radius-phone) - 2px);
  background: #0a0a0a;
}

.phone-mockup__screen img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.gallery-card__phone,
.app-card__phone {
  display: none;
}

.gallery-card__badge,
.app-card__badge {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 6px;
  border-radius: var(--radius-badge);
  background: var(--accent);
  color: var(--accent-text);
  font: 500 14px/20px var(--font);
  white-space: nowrap;
}

.gallery-card__badge--new,
.app-card__badge--new {
  background: var(--accent-red);
}

.gallery-card__dots,
.app-card__dots {
  display: none;
}

.gallery-card__meta,
.app-card__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
}

.gallery-card__logo,
.app-card__logo,
.company-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--accent-red);
  color: #fff;
  font: 600 20px/1 var(--font);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.gallery-card__logo:not(.is-fallback) {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .gallery-card__logo:not(.is-fallback) {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

[data-theme="light"] .gallery-card__logo:not(.is-fallback) {
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.gallery-card__logo.is-fallback {
  background: var(--accent-red);
}

.gallery-card__logo.is-fallback .gallery-card__logo-fallback,
.gallery-card__logo:not(:has(img)) .gallery-card__logo-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.gallery-card__logo-fallback {
  display: none;
  font: 600 20px/1 var(--font);
}

.gallery-card__logo img,
.app-card__logo img,
.company-icon__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 7px;
  box-sizing: border-box;
}

.company-icon__img--local {
  object-fit: cover;
  padding: 0;
}

.gallery-card__info,
.app-card__info {
  min-width: 0;
  flex: 1;
}

.gallery-card__title,
.app-card__title,
.company-title h3 {
  margin: 0;
  overflow: hidden;
  color: var(--text-primary);
  font: 500 16px/24px var(--font);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-card__desc,
.app-card__desc,
.company-title p {
  margin: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font: 500 12px/16px var(--font-display);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-card__desc--products {
  display: flex;
  align-items: baseline;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
}

.gallery-card__desc-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

.gallery-card__more {
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
  flex: 0 0 auto;
  margin-left: 4px;
}

.app-card__header,
.app-card__screens,
.company-body,
.company-preview {
  display: none;
}

.card-tags {
  display: none;
}

.home-hero,
.home-toolbar,
.collection-head,
.stats,
.filter-panel,
.hero,
.policy-card {
  display: none;
}

.hero:not(.home-hero) {
  display: block;
  margin-bottom: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.hero:not(.home-hero)::before,
.hero:not(.home-hero)::after {
  display: none;
}

.hero:not(.home-hero) h1 {
  margin: 0 0 8px;
  font: var(--font-large);
  color: var(--white);
  letter-spacing: -0.03em;
}

.hero:not(.home-hero) p {
  margin: 0;
  color: var(--light-grey);
}

.hero__eyebrow {
  display: none;
}

.hero:not(.home-hero) .hero__eyebrow {
  display: inline-flex;
  align-items: center;
  margin: 0 0 12px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 225, 0, 0.14);
  color: var(--accent-pro);
  font: 600 12px/16px var(--font);
  letter-spacing: 0.02em;
}

.hero--group .hero__row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.hero--group .hero__brand .gallery-card__logo,
.hero--group .hero__brand .app-card__logo {
  display: block;
  width: 72px;
  height: 72px;
}

.hero--group .hero__brand img {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: contain;
  padding: 10px;
  box-sizing: border-box;
}

.hero--group .hero__brand img.company-icon__img--local {
  object-fit: cover;
  padding: 0;
}

.hero--group .hero__brand .gallery-card__logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  font-size: 28px;
  font-weight: 600;
}

.hero--group .hero__body {
  flex: 1;
  min-width: 200px;
}

.hero--group .hero__body h1 {
  margin: 0 0 6px;
}

.panel {
  border: 0;
  border-radius: 20px;
  background: var(--dark);
  box-shadow: none;
}

.platform-tabs,
.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.platform-tab,
.category-tab {
  border: 1px solid var(--grey);
  border-radius: 999px;
  background: transparent;
  color: var(--light-grey);
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
}

.platform-tab.is-active,
.category-tab.is-active {
  border-color: var(--bg-grey);
  background: var(--bg-grey);
  color: var(--black);
}

.layout {
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
}

.sidebar {
  top: 120px;
}

.tree-node {
  border-radius: 12px;
  background: var(--black);
  color: var(--bg-grey);
}

.tree-node:hover,
.tree-node.is-active {
  background: var(--grey);
}

.tree-heading {
  color: var(--light-grey);
}

.screen-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.screen-grid--web {
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
}

.screen-frame {
  border: 1px solid var(--light-grey);
  border-radius: var(--radius-phone);
  background: var(--black);
  box-shadow: none;
}

.screen-card img {
  height: 320px;
}

.media-badge,
.step-badge {
  background: rgba(5, 5, 5, 0.72);
  color: var(--white);
}

.step-badge {
  background: rgba(244, 244, 246, 0.88);
  color: var(--black);
}

.screen-actions--overlay {
  background: transparent;
  border-color: transparent;
}

.animation-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.animation-card {
  background: var(--dark);
}

.animation-strip {
  background: var(--black);
  border-bottom: 1px solid var(--grey);
}

.animation-strip img {
  border-color: var(--grey);
  background: var(--black);
}

.admin-grid {
  grid-template-columns: 320px minmax(0, 1fr);
}

.admin-card {
  background: var(--dark);
}

.admin-card input,
.admin-card textarea,
.dialog input,
.dialog textarea {
  border-color: var(--grey);
  background: var(--black);
  color: var(--white);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 48px 24px;
  border-radius: 20px;
  background: var(--dark);
  color: var(--light-grey);
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 8px;
  color: var(--white);
  font: var(--font-title);
}

.dialog,
.preview-dialog {
  border: 1px solid var(--grey);
  background: var(--dark);
  color: var(--white);
}

.dialog::backdrop,
.preview-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.preview-dialog {
  background: var(--dark);
}

.preview-dialog img {
  background: var(--black);
}

@media (max-width: 900px) {
  .topbar,
  .layout,
  .admin-grid,
  .stats,
  .platform-tabs {
    grid-template-columns: 1fr;
  }

  .layout {
    display: grid;
  }

  .sidebar {
    position: static;
  }
}
