/* NRK — спільні стилі (каталог, деталь, бібліотека, новини, герой) */

/* ── Теми: змінні для Tailwind (js/nrk-tailwind-config.js) + перемикач ── */
:root {
  --nrk-page: #fafafa;
  --nrk-surface: #ffffff;
  --nrk-ink: #0a0a0a;
  --nrk-heading: #0a0a0a;
  --nrk-headingAlt: #404040;
  --nrk-accent: #ff2d00;
  --nrk-accentHover: #cc2400;
  --nrk-border-soft: #a3a3a3;
  --nrk-card-shadow: 4px 4px 0 0 #0a0a0a;
  --nrk-header-border-w: 2px;
  --nrk-radius: 0;
  --nrk-radius-sm: 0;
  --nrk-filter-active-bg: #0a0a0a;
  --nrk-filter-active-border: #0a0a0a;
}

html[data-nrk-theme="simple"] {
  --nrk-page: #f3f4f6;
  --nrk-surface: #ffffff;
  --nrk-ink: #111827;
  --nrk-heading: #111827;
  --nrk-headingAlt: #6b7280;
  --nrk-accent: #ff2d00;
  --nrk-accentHover: #cc2400;
  --nrk-border-soft: #d1d5db;
  --nrk-card-shadow: 0 4px 14px rgba(17, 24, 39, 0.08);
  --nrk-header-border-w: 1px;
  --nrk-radius: 12px;
  --nrk-radius-sm: 8px;
  --nrk-filter-active-bg: #ff2d00;
  --nrk-filter-active-border: #cc2400;
}

/* Тема: одне слово; лише дві вертикальні лінії зліва/справа — без «квадрата» й outline при hover */
.nrk-theme-word {
  box-sizing: border-box;
  border: none;
  border-left: 1px solid var(--nrk-ink);
  border-right: 1px solid var(--nrk-ink);
  background: transparent;
  color: var(--nrk-ink);
  cursor: pointer;
}
html[data-nrk-theme="simple"] .nrk-theme-word {
  font-family: "Source Sans 3", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.02em;
  border-left-color: #d1d5db;
  border-right-color: #d1d5db;
}
html[data-nrk-theme="simple"] .nrk-theme-word:hover {
  background: rgba(17, 24, 39, 0.04);
}

/* Хедер / футер */
.nrk-site-header {
  border-bottom-style: solid;
  border-bottom-width: var(--nrk-header-border-w);
  border-bottom-color: var(--nrk-ink);
  transition: border-width 0.15s ease, box-shadow 0.15s ease;
}
html[data-nrk-theme="simple"] .nrk-mobile-nav {
  border-top-width: 1px !important;
  border-top-color: #e5e7eb !important;
}
/* Мобільне меню: кнопка теми по центру */
.nrk-mobile-nav .nrk-theme-word {
  min-width: 7rem;
}
html[data-nrk-theme="simple"] #detail-related button.group {
  border-radius: var(--nrk-radius) !important;
  border-width: 1px !important;
  border-color: #e5e7eb !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
}
html[data-nrk-theme="simple"] #detail-related button.group:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1) !important;
}
html[data-nrk-theme="simple"] .detail-thumb-btn {
  border-radius: var(--nrk-radius-sm) !important;
  border-width: 1px !important;
  border-color: #e5e7eb !important;
}
html[data-nrk-theme="simple"] .nrk-site-header {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  font-family: "Source Sans 3", ui-sans-serif, system-ui, sans-serif;
}
html[data-nrk-theme="simple"] .nrk-header-search-wrap {
  border-radius: var(--nrk-radius-sm);
  border-color: #e5e7eb !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
html[data-nrk-theme="simple"] .nrk-header-search-wrap button {
  border-color: rgba(0, 0, 0, 0.08) !important;
}
html[data-nrk-theme="simple"] .nrk-logo-mark {
  border-radius: var(--nrk-radius-sm);
  background: #1f2937 !important;
  border-color: #1f2937 !important;
}
html[data-nrk-theme="simple"] footer.nrk-site-footer {
  background: #1f2937 !important;
  border-top-color: #374151 !important;
}

/* Картки каталогу */
html[data-nrk-theme="simple"] .catalog-card {
  border-radius: var(--nrk-radius) !important;
  border-width: 1px !important;
  border-color: #e5e7eb !important;
  box-shadow: var(--nrk-card-shadow) !important;
}
html[data-nrk-theme="simple"] .catalog-card:hover,
html[data-nrk-theme="simple"] .catalog-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.12) !important;
}
html[data-nrk-theme="simple"] .catalog-card:focus-visible {
  outline: 2px solid var(--nrk-accent);
  outline-offset: 2px;
}

/* Активні фільтри — червоний акцент (як у брут-темі) */
html[data-nrk-theme="simple"] button.filter-btn.border-black.bg-black,
html[data-nrk-theme="simple"] button.bloc-filter-btn.border-black.bg-black,
html[data-nrk-theme="simple"] button.detail-filter-btn.border-black.bg-black,
html[data-nrk-theme="simple"] button.detail-bloc-btn.border-black.bg-black {
  background-color: var(--nrk-filter-active-bg) !important;
  border-color: var(--nrk-filter-active-border) !important;
  color: #fff !important;
}
html[data-nrk-theme="simple"] button.filter-btn.border-black.bg-white,
html[data-nrk-theme="simple"] button.bloc-filter-btn.border-black.bg-white,
html[data-nrk-theme="simple"] button.detail-filter-btn.border-black.bg-white,
html[data-nrk-theme="simple"] button.detail-bloc-btn.border-black.bg-white {
  border-radius: var(--nrk-radius-sm);
  border-color: #e5e7eb !important;
}

/* Вкладки деталі */
html[data-nrk-theme="simple"] #detail-page .tab-btn.border-black.bg-black {
  background-color: var(--nrk-filter-active-bg) !important;
  border-color: var(--nrk-filter-active-border) !important;
}
html[data-nrk-theme="simple"] #detail-page .tab-btn.border-black.bg-white {
  border-radius: var(--nrk-radius-sm);
  border-color: #e5e7eb !important;
}

/* Герой */
html[data-nrk-theme="simple"] .hero-brutal {
  opacity: 0.04;
  background-size: 32px 32px;
}
html[data-nrk-theme="simple"] .hero-text-col {
  text-shadow: none;
}

/* Новини / бібліотека / ШПС картки */
html[data-nrk-theme="simple"] .news-item {
  border-radius: var(--nrk-radius);
  border-width: 1px !important;
  border-color: #e5e7eb !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
html[data-nrk-theme="simple"] .news-item:hover,
html[data-nrk-theme="simple"] .news-item:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08) !important;
}
html[data-nrk-theme="simple"] .news-tag-filter {
  border-radius: var(--nrk-radius-sm) !important;
}
html[data-nrk-theme="simple"] .library-book-card {
  border-radius: var(--nrk-radius) !important;
  border-width: 1px !important;
  border-color: #e5e7eb !important;
  box-shadow: var(--nrk-card-shadow) !important;
}
html[data-nrk-theme="simple"] .library-book-card:hover,
html[data-nrk-theme="simple"] .library-book-card:focus-within {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.1) !important;
}
html[data-nrk-theme="simple"] .shps-pick {
  border-radius: var(--nrk-radius-sm) !important;
  border-width: 1px !important;
  border-color: #e5e7eb !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
html[data-nrk-theme="simple"] .shps-pick:hover,
html[data-nrk-theme="simple"] .shps-pick:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08) !important;
}

/* nrk-card utility */
html[data-nrk-theme="simple"] .nrk-card {
  border-radius: var(--nrk-radius);
  border-width: 1px;
  border-color: #e5e7eb;
  box-shadow: var(--nrk-card-shadow);
}

.spec-key {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 600;
  color: #0a0a0a;
  text-transform: uppercase;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
}

/* ── Brutal card system (уніфікація карток між сторінками) ── */
.nrk-card {
  border: 2px solid #0a0a0a;
  background: #ffffff;
}
.nrk-card-hover {
  transition: box-shadow 0.12s ease, transform 0.12s ease;
}
.nrk-card-hover:hover,
.nrk-card-hover:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 0 #0a0a0a;
}
.nrk-card-hover:focus-visible {
  outline: 2px solid #ff2d00;
  outline-offset: 2px;
}
.tab-panel {
  font-family: "Source Sans 3", ui-sans-serif, system-ui, sans-serif;
}
.cat-badge {
  border-radius: 0;
  background: #0a0a0a;
  padding: 0.2rem 0.45rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  border: 2px solid #0a0a0a;
}
.catalog-card {
  transition: box-shadow 0.12s ease, transform 0.12s ease;
}
.catalog-card:hover,
.catalog-card:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 0 #0a0a0a;
}
.catalog-card:focus-visible {
  outline: 2px solid #ff2d00;
  outline-offset: 2px;
}
.detail-thumbs-strip {
  scrollbar-width: thin;
  scrollbar-color: #0a0a0a #fafafa;
}
.detail-thumbs-strip::-webkit-scrollbar {
  height: 8px;
}
.detail-thumbs-strip::-webkit-scrollbar-thumb {
  background: #0a0a0a;
  border-radius: 0;
}
#catalog-section {
  scroll-margin-top: 64px;
}
.catalog-filter-strip {
  scrollbar-width: thin;
  scrollbar-color: #0a0a0a #fafafa;
}
.catalog-filter-strip::-webkit-scrollbar {
  height: 5px;
}
.catalog-filter-strip::-webkit-scrollbar-thumb {
  background: #0a0a0a;
  border-radius: 0;
}
.hero-brutal {
  background-image: linear-gradient(#0a0a0a 1px, transparent 1px),
    linear-gradient(90deg, #0a0a0a 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.08;
}
.hero-text-col {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
#news-section,
#library-section {
  scroll-margin-top: 64px;
}
.library-book-card {
  min-width: 0;
  border: 2px solid #0a0a0a;
  background: #ffffff;
  padding: 0;
  transition: box-shadow 0.12s ease, transform 0.12s ease;
}
.library-book-card:hover,
.library-book-card:focus-within {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 0 #0a0a0a;
}
.library-book-card:focus-visible {
  outline: 2px solid #ff2d00;
  outline-offset: 2px;
}

/* Обкладинка бібліотеки 3:4 (як книга / брошура) — стилі в shared, не в Tailwind-JS */
.nrk-library-cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  /* Fallback for browsers/devices with unstable aspect-ratio support */
  min-height: 180px;
  overflow: hidden;
  border: 2px solid #0a0a0a;
  background-color: #fafafa;
  box-shadow: inset 4px 0 0 rgba(0, 0, 0, 0.18), inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.nrk-library-cover-img {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.nrk-library-cover-img.nrk-library-cover-img--contain {
  object-fit: contain;
}
.nrk-library-cover-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  border-top: 2px solid #0a0a0a;
  background-color: #0a0a0a;
  color: #fff;
  padding: 0.5rem 0.5rem;
  height: 2.6rem;
  overflow: hidden;
}
.nrk-library-cover-cap p {
  margin: 0;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  max-height: 1.8rem;
  white-space: normal;
  text-overflow: clip;
  word-break: break-word;
  overflow: hidden;
}
@media (min-width: 640px) {
  .nrk-library-cover-cap p {
    font-size: 11px;
  }
}
.nrk-library-meta {
  margin-top: 0.5rem;
  font-family: "Source Sans 3", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.75rem;
  line-height: 1.375;
  color: #404040;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.nrk-library-card-link {
  display: block;
  text-align: left;
  text-decoration: none;
  color: inherit;
}
.nrk-library-card-link:focus {
  outline: none;
}
.nrk-library-card-link:focus-visible {
  outline: 2px solid #ff2d00;
  outline-offset: 2px;
}
.nrk-library-card-box {
  text-align: left;
}
.nrk-library-card-box--muted {
  opacity: 0.7;
}
.nrk-library-no-url {
  margin-top: 0.25rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #404040;
}
.news-feed-sidebar::-webkit-scrollbar {
  width: 8px;
}
.news-feed-sidebar::-webkit-scrollbar-thumb {
  background: #0a0a0a;
  border-radius: 0;
}
.news-feed-sidebar {
  scrollbar-width: thin;
  scrollbar-color: #0a0a0a #fafafa;
}

/* Уніфікація hover для ленти новин (кнопки-рядки) */
.news-item {
  transition: box-shadow 0.12s ease, transform 0.12s ease, background-color 0.12s ease;
  border-color: #0a0a0a;
}
.news-item:hover,
.news-item:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 0 #0a0a0a;
}

/* Уніфікація інтерактиву для ШПС пікерів */
.shps-pick {
  transition: box-shadow 0.12s ease, transform 0.12s ease, background-color 0.12s ease;
}
.shps-pick:hover,
.shps-pick:focus-visible {
  transform: none;
  box-shadow: none;
}
.shps-pick:focus-visible {
  outline: 2px solid #ff2d00;
  outline-offset: 2px;
}
.news-feed-page::-webkit-scrollbar {
  width: 8px;
}
.news-feed-page::-webkit-scrollbar-thumb {
  background: #0a0a0a;
  border-radius: 0;
}
.news-feed-page {
  scrollbar-width: thin;
  scrollbar-color: #0a0a0a #fafafa;
}

/* Сторінка новин: обгортка стрічки (max-width задається в розмітці) */
.news-feed-layout {
  scroll-margin-top: 72px;
}

/* Фільтр-кнопки у чорному hero (новини, бібліотека, каталог) */
.hero-filter-btn {
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.15);
  transition: color 0.15s ease, background-color 0.15s ease;
}
.hero-filter-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.hero-filter-btn[aria-pressed="true"] {
  background: #fff;
  color: #0a0a0a;
}
html[data-nrk-theme="simple"] .hero-filter-btn[aria-pressed="true"] {
  background: var(--nrk-accent);
  color: #fff;
}

/* Плоский рядок стрічки (джерело → заголовок → дата) */
.news-feed-layout .news-line-item {
  border: none;
  border-bottom: 2px solid rgba(10, 10, 10, 0.10);
  border-left: 4px solid transparent;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.news-feed-layout .news-line-item:last-child {
  border-bottom: none;
}
.news-feed-layout .news-line-item:hover,
.news-feed-layout .news-line-item:focus-visible {
  transform: none;
  box-shadow: none;
  background-color: rgba(10, 10, 10, 0.04);
  border-left-color: var(--nrk-accent);
}
html[data-nrk-theme="simple"] .news-feed-layout #news-feed.news-feed-page {
  border-radius: var(--nrk-radius);
  border-width: 1px;
  border-color: #e5e7eb;
  border-top-width: 6px;
  border-top-color: var(--nrk-accent);
  box-shadow: var(--nrk-card-shadow);
}
html[data-nrk-theme="simple"] .news-feed-layout .news-line-item {
  border-bottom-color: rgba(17, 24, 39, 0.08);
}
html[data-nrk-theme="simple"] .news-feed-layout .news-line-item:hover,
html[data-nrk-theme="simple"] .news-feed-layout .news-line-item:focus-visible {
  background-color: rgba(17, 24, 39, 0.04);
  border-left-color: var(--nrk-accent);
}
html[data-nrk-theme="simple"] .news-line-avatar {
  border-radius: var(--nrk-radius-sm) !important;
}
html[data-nrk-theme="simple"] .news-feed-disclaimer {
  border-radius: var(--nrk-radius-sm);
  border-color: #e5e7eb !important;
  background: rgba(17, 24, 39, 0.02) !important;
}

/* Loading spinner */
.nrk-spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 3px solid #a3a3a3;
  border-top-color: #0a0a0a;
  border-radius: 50%;
  animation: nrk-spin 0.6s linear infinite;
}
@keyframes nrk-spin {
  to { transform: rotate(360deg); }
}
