/* Слой поверх Basecoat (дизайн-система shadcn/ui без React):
   раскладка и специфика приложения. Цвета — только через токены Basecoat. */

body {
  background: var(--color-background);
  color: var(--color-foreground);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; }
.site-footer {
  text-align: left;
  padding: 1.25rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-muted-foreground);
  font-size: 0.875rem;
}
.site-footer a { color: inherit; text-underline-offset: 3px; }
.site-footer a:hover { color: var(--color-foreground); }

main {
  max-width: 80rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
}
main h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.025em; margin: 0 0 1rem; }
main h2 { font-size: 1.125rem; font-weight: 600; margin: 1.75rem 0 0.75rem; }
main h3 { font-size: 1rem; font-weight: 600; margin: 1.25rem 0 0.5rem; }
main p { margin: 0.5rem 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}
.topbar .brand { font-weight: 600; color: var(--color-foreground); text-decoration: none; }
.topbar nav { display: flex; gap: 0.25rem; flex: 1; }
.userbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--color-muted-foreground);
  font-size: 0.875rem;
}

.messages { list-style: none; margin: 1rem auto 0; padding: 0 1.25rem; max-width: 72rem; }
.messages .alert { margin-bottom: 0.5rem; }

.muted { color: var(--color-muted-foreground); font-size: 0.875rem; }
.error { color: var(--color-destructive); font-size: 0.875rem; }

.toolbar { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin: 1rem 0; }
.toolbar form { display: flex; gap: 0.5rem; align-items: center; }

.form-stack { display: flex; flex-direction: column; gap: 1rem; max-width: 26rem; }
.form-stack .actions { display: flex; gap: 0.5rem; align-items: center; }
.field input[type="color"] {
  inline-size: 4rem;
  block-size: 2.25rem;
  padding: 0.2rem;
  border: 1px solid var(--color-input);
  border-radius: var(--radius);
  background: transparent;
}

/* Статусы: те же формы, что у бейджей Basecoat, свои семантические цвета. */
.badge.verified {
  background: oklch(0.55 0.15 150);
  color: oklch(0.99 0 0);
  border-color: transparent;
}
.badge.draft,
.badge.stale {
  background: oklch(0.95 0.06 90);
  color: oklch(0.4 0.09 70);
  border-color: oklch(0.85 0.08 85);
}
html.dark .badge.draft,
html.dark .badge.stale {
  background: oklch(0.3 0.06 85);
  color: oklch(0.9 0.08 90);
  border-color: oklch(0.45 0.07 85);
}

/* Слепок комплекта: сводка строкой, состав и настройки — по клику */
.spec-details ol { margin: 0.5rem 0 0.25rem; padding-left: 1.25rem; }
.spec-details p { margin: 0.25rem 0 0; }

.warning-box {
  border: 1px solid oklch(0.83 0.11 85);
  background: oklch(0.98 0.03 90);
  color: oklch(0.35 0.07 70);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
}
html.dark .warning-box {
  border-color: oklch(0.45 0.09 85);
  background: oklch(0.25 0.04 85);
  color: oklch(0.9 0.07 90);
}

.verse-pair { margin-bottom: 1.25rem; }
.verse-pair .original { white-space: pre-line; font-weight: 500; }
.verse-pair .translation { white-space: pre-line; color: var(--color-muted-foreground); }

.mismatch,
tr.mismatch td { background: color-mix(in oklab, var(--color-destructive) 9%, transparent); }

.style-layout { display: flex; gap: 2rem; align-items: flex-start; flex-wrap: wrap; }
.style-layout > :first-child { flex: 1 1 30rem; min-width: 0; max-width: 44rem; }
.preview-pane { position: sticky; top: 1rem; flex: 0 0 30rem; max-width: 30rem; }
.preview-box {
  width: 480px;
  height: 270px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: oklch(0.14 0 0);
  position: relative;
}
#bg-drag {
  position: absolute;
  inset: 0;
  cursor: grab;
  touch-action: none;
}
#bg-drag:active { cursor: grabbing; }
.preview-box iframe {
  width: 1920px;
  height: 1080px;
  transform: scale(0.25);
  transform-origin: top left;
  border: 0;
}

.bg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.bg-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.bg-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: oklch(0.14 0 0);
}
.bg-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  align-items: flex-start;
}
.item-actions { display: flex; gap: 0.25rem; }
.bg-rename { display: flex; gap: 0.25rem; width: 100%; }
.bg-rename .input { flex: 1; min-width: 0; height: 2rem; font-size: 0.875rem; }

.landing .hero { max-width: 44rem; margin: 2rem auto 3rem; text-align: center; }
.landing .hero h1 { font-size: 2.25rem; margin-bottom: 1rem; }
.landing .lead { font-size: 1.125rem; color: var(--color-muted-foreground); }
.landing .hero .toolbar { justify-content: center; margin-top: 1.5rem; }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
  gap: 1rem;
  max-width: 56rem;
  margin: 0 auto;
}
.card.feature { padding: 1.25rem 1.5rem; }
.card.feature h2 { margin-top: 0; font-size: 1rem; }
.card.feature p { color: var(--color-muted-foreground); font-size: 0.9rem; }
.shot { margin: 0; text-align: center; }
.shot img {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) * 1.5);
  box-shadow: 0 12px 40px -12px oklch(0 0 0 / 0.25);
}
.shot figcaption { margin-top: 0.5rem; }
.shot img { cursor: zoom-in; }
.carousel-nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
#lightbox {
  /* Preflight сбрасывает margin у dialog — центрируем явно */
  position: fixed;
  inset: 0;
  margin: auto;
  width: fit-content;
  height: fit-content;
  border: none;
  padding: 0;
  background: transparent;
  max-width: none;
  max-height: none;
  overflow: visible;
}
#lightbox::backdrop { background: oklch(0 0 0 / 0.8); }
/* Дialog получает фокус при открытии — кольцо фокуса тут ни к чему */
#lightbox:focus,
#lightbox:focus-visible,
#lightbox *:focus,
#lightbox *:focus-visible {
  outline: none;
  box-shadow: none;
}
#lightbox figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
#lightbox img {
  max-width: 92vw;
  max-height: 85vh;
  border-radius: var(--radius);
  cursor: zoom-out;
  display: block;
}
#lightbox figcaption {
  color: oklch(0.95 0 0);
  font-size: 0.9rem;
  text-align: center;
  background: oklch(0 0 0 / 0.55);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
}
.shot-hero { max-width: 56rem; margin: 0 auto 3rem; }
.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 1.5rem;
  max-width: 64rem;
  margin: 3rem auto 1rem;
}
.verse-checkbox {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.2rem 0;
  font-size: 0.875rem;
}
details > summary { cursor: pointer; }

/* Мобильные экраны: таблицы скроллятся внутри себя, предпросмотр — по ширине */
@media (max-width: 48rem) {
  .table {
    display: block;
    overflow-x: auto;
  }
  .preview-pane {
    position: static;
    flex-basis: 100%;
    max-width: 100%;
  }
  .preview-box {
    width: 100% !important;
    aspect-ratio: 16 / 9;
    height: auto;
  }
}
