/* DaiKredit v8 — compact dark catalog.
   This file intentionally loads after styles.css and only overrides presentation. */

:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f4f7fb;
  --ink-soft: #c3cbd7;
  --muted: #8f99a8;
  --muted-2: #6f7988;
  --bg: #090b0d;
  --paper: #171b20;
  --line: #2a3038;
  --blue: #16aaf2;
  --blue-dark: #087fbd;
  --blue-soft: #102d3e;
  --orange: #ff765f;
  --orange-soft: #39221f;
  --green: #33d06f;
  --green-soft: #153124;
  --yellow-soft: #332d19;
  --yellow-ink: #f4d56b;
  --navy: #11151a;
  --shadow: 0 20px 55px rgba(0, 0, 0, .38);
  --shadow-sm: 0 12px 28px rgba(0, 0, 0, .28);
  --card-bg: #191e24;
  --card-bg-hover: #1d232a;
}

html[data-theme="light"] {
  color-scheme: light;
  --ink: #101b35;
  --ink-soft: #43506b;
  --muted: #74819a;
  --muted-2: #98a2b4;
  --bg: #f6f8fb;
  --paper: #fff;
  --line: #e1e6ef;
  --blue: #1f5cff;
  --blue-dark: #1645cc;
  --blue-soft: #eaf0ff;
  --orange: #f16a4f;
  --orange-soft: #fff0ec;
  --green: #188c70;
  --green-soft: #e8f7f1;
  --yellow-soft: #fff8df;
  --yellow-ink: #896500;
  --navy: #101d3b;
  --shadow: 0 18px 45px rgba(16,31,64,.10);
  --shadow-sm: 0 8px 22px rgba(16,31,64,.08);
  --card-bg: #fff;
  --card-bg-hover: #fff;
}

body {
  background: var(--bg);
  color: var(--ink);
  transition: background-color .2s ease, color .2s ease;
}

/* Header and navigation */
.topline { background: #050607; color: var(--muted); border-bottom: 1px solid var(--line); }
.site-header { background: color-mix(in srgb, var(--bg) 92%, transparent); border-color: var(--line); }
.primary-nav a, .header-contact { color: var(--ink-soft); }
.primary-nav a:hover, .primary-nav a.active { background: #242a31; color: #fff; }
html[data-theme="light"] .primary-nav a:hover,
html[data-theme="light"] .primary-nav a.active { background: var(--blue-soft); color: var(--blue); }

.theme-toggle {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: none;
  font-size: 18px;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--blue); background: var(--blue-soft); }

/* Hero and generic panels */
.hero { background: linear-gradient(130deg, #101419 0%, #151c23 55%, #102a37 100%); border: 1px solid var(--line); }
.page-hero { background: linear-gradient(135deg, #11161b, #151b22); border-color: var(--line); box-shadow: none; }
.page-hero-note, .side-card, .info-tile, .category-card, .article, .prose,
.owner-box, .filter-bar, .notice { background: var(--paper); border-color: var(--line); color: var(--ink-soft); }
.category-card strong, .info-tile h3, .side-card h3, .article h2, .prose h2 { color: var(--ink); }

/* Wider catalog: the cards are the main content. */
.product-layout { grid-template-columns: minmax(0, 1fr); }
.product-layout > .side-card { display: none; }
.catalog-panel { min-width: 0; }
.catalog-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

/* Compact square-like offer cards. Aspect ratio is a preferred minimum;
   cards may grow vertically when legally required text is long. */
.catalog-card {
  position: relative;
  min-width: 0;
  min-height: 390px;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 17px;
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: none;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.catalog-card:hover {
  transform: translateY(-3px);
  border-color: #414b57;
  background: var(--card-bg-hover);
  box-shadow: var(--shadow-sm);
}
html[data-theme="light"] .catalog-card:hover { border-color: #b7c8f3; }

/* Badge is in normal flow, never on top of the CTA. */
.catalog-tags {
  order: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.catalog-card .offer-badge,
.catalog-card .offer-kind {
  position: static;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 25px;
  margin: 0;
  padding: 5px 9px;
  border: 1px solid #39424c;
  border-radius: 999px;
  background: #272d34;
  color: #e8edf3;
  box-shadow: none;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: .015em;
  white-space: normal;
  overflow-wrap: anywhere;
}
.catalog-card .offer-badge { border-color: #22593a; background: #163624; color: #74e99c; }
.catalog-card .offer-badge::before { display: none; }
html[data-theme="light"] .catalog-card .offer-badge { border-color: #cdebdc; background: var(--green-soft); color: var(--green); }
html[data-theme="light"] .catalog-card .offer-kind { border-color: #d4def7; background: var(--blue-soft); color: var(--blue); }

.catalog-brand { order: 1; display: flex; align-items: center; gap: 11px; min-width: 0; }
.catalog-brand > div:last-child { min-width: 0; }
.catalog-brand .offer-logo {
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  border-radius: 12px;
  font-size: 12px;
  box-shadow: none;
}
.catalog-name {
  color: var(--ink);
  font-size: 15px;
  font-weight: 850;
  line-height: 1.22;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}
.catalog-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.32;
  white-space: normal;
  overflow-wrap: anywhere;
}

.catalog-metrics {
  order: 3;
  display: grid;
  gap: 0;
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: transparent;
}
.catalog-metric {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.25fr);
  gap: 9px;
  align-items: start;
  min-width: 0;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.catalog-metric:last-child { border-bottom: 0; }
.catalog-metric span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.catalog-metric .value {
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  text-align: right;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}
.catalog-metric .value.green { color: var(--green); }

.catalog-action { order: 4; margin-top: auto; padding: 0; }
.catalog-action .btn {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--blue);
  color: #041018;
  box-shadow: none;
  font-size: 12px;
  font-weight: 850;
}
.catalog-action .btn:hover { background: #36bfff; transform: none; }
html[data-theme="light"] .catalog-action .btn { color: #fff; }

.offer-legal {
  order: 5;
  display: grid;
  gap: 2px;
  min-width: 0;
  margin: 0;
  padding: 9px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.32;
  overflow-wrap: anywhere;
}
.offer-legal strong { color: var(--ink-soft); font-size: 9.5px; }
.offer-legal .erid { color: var(--muted-2); font-size: 8px; }

/* Required credit warnings stay visible and each has enough area. */
.ad-required-warnings {
  order: 6;
  display: grid;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.ad-required-warning {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 7px 8px;
  border: 1px solid #66551e;
  border-radius: 9px;
  background: #2f2918;
  color: #f2d66e;
  font-size: 8.5px;
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
}
.ad-required-warning + .ad-required-warning { border-color: #224e68; background: #142b39; color: #8ed7ff; }
.ad-required-links { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-size: 8px; line-height: 1.3; }
.ad-required-links a { color: #64c8ff; text-decoration: underline; }
.ad-required-links span { color: var(--ink-soft); }
html[data-theme="light"] .ad-required-warning { border-color: #e4c96a; background: var(--yellow-soft); color: var(--yellow-ink); }
html[data-theme="light"] .ad-required-warning + .ad-required-warning { border-color: #b7caff; background: var(--blue-soft); color: #1a3fa8; }

/* Remaining interface in dark theme */
.filter-bar, .filter-controls select { background: var(--paper); border-color: var(--line); color: var(--ink); }
.disclaimer { background: var(--paper); border-color: var(--line); color: var(--ink-soft); }
footer { background: #080a0c; border-top: 1px solid var(--line); }
.footer-col h3, .footer-brand { color: var(--ink); }
.footer-col a, .footer-brand small, .footer-bottom { color: var(--muted); }
.cookie-banner { background: #13171c; border-top: 1px solid var(--line); }

/* Avoid any text collision globally inside cards. */
.catalog-card, .catalog-card * { min-width: 0; }
.catalog-card p, .catalog-card span, .catalog-card b, .catalog-card strong, .catalog-card small, .catalog-card a {
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .catalog-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .primary-nav { overflow-x: auto; scrollbar-width: none; }
  .primary-nav::-webkit-scrollbar { display: none; }
}

@media (max-width: 640px) {
  .container { width: min(100% - 24px, 1160px); }
  .catalog-list { grid-template-columns: 1fr; gap: 12px; }
  .catalog-card { min-height: 0; aspect-ratio: auto; padding: 15px; }
  .theme-toggle { width: 38px; height: 38px; }
  .topline { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Header must never increase page width on medium screens. */
.header-inner { min-width: 0; }
.primary-nav { min-width: 0; }
@media (max-width: 1120px) {
  .header-inner { gap: 14px; }
  .brand { min-width: 150px; }
  .primary-nav { overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; }
  .header-contact { display: none; }
}
@media (max-width: 820px) {
  .header-inner { min-height: 68px; }
  .brand { min-width: 0; }
  .brand-name small { display: none; }
  .primary-nav { max-width: calc(100vw - 210px); }
}
@media (max-width: 540px) {
  .primary-nav { display: none; }
  .brand { flex: 1; }
}

/* Intrinsic content may make an aspect-ratio item wider than its grid track.
   Keep the square proportion only when three 390px tracks actually fit. */
@media (max-width: 1250px) {
  .catalog-card { aspect-ratio: auto; width: 100%; min-height: 390px; }
}

/* Final specificity guards. */
.catalog-card .catalog-action .btn{white-space:normal;overflow-wrap:anywhere}
.catalog-card .offer-badge,.catalog-card .offer-kind{white-space:normal!important}

/* Legal and registry data must never be clipped. A card stays compact and
   close to square, but may grow vertically when its real text is longer. */
.catalog-card { aspect-ratio: auto; width: 100%; overflow: visible; }

/* v10: clearly distinct light palette. These overrides are deliberately
   explicit because several components use decorative dark backgrounds. */
html[data-theme="light"] body { background: #f6f8fb; color: #101b35; }
html[data-theme="light"] .site-header { background: rgba(255,255,255,.96); border-color: #e1e6ef; }
html[data-theme="light"] .topline { background: #101d3b; color: #cdd6ea; }
html[data-theme="light"] .hero { background: linear-gradient(118deg,#eef3ff,#f8faff 55%,#edf7ff); color: #101b35; border-color: #dce5f4; }
html[data-theme="light"] .hero h1 { color: #101b35; }
html[data-theme="light"] .hero h1 em { color: #1f5cff; }
html[data-theme="light"] .hero-copy { color: #43506b; }
html[data-theme="light"] .micro-note { color: #74819a; }
html[data-theme="light"] .hero-panel { background: #fff; border-color: #e1e6ef; color: #101b35; }
html[data-theme="light"] .hero-panel-title { color: #101b35; }
html[data-theme="light"] .hero-panel-sub { color: #74819a; }
html[data-theme="light"] .page-hero { background: #fff; border-color: #e1e6ef; color: #101b35; }
html[data-theme="light"] .page-hero h1 { color: #101b35; }
html[data-theme="light"] .page-hero-note { background: #f4f7fc; color: #43506b; border-color: #e1e6ef; }
html[data-theme="light"] .catalog-card { background: #fff; border-color: #e1e6ef; }
html[data-theme="light"] .filter-bar,
html[data-theme="light"] .side-card,
html[data-theme="light"] .info-tile,
html[data-theme="light"] .category-card,
html[data-theme="light"] .article,
html[data-theme="light"] .prose,
html[data-theme="light"] .owner-box,
html[data-theme="light"] .notice { background: #fff; color: #43506b; border-color: #e1e6ef; }
html[data-theme="light"] .theme-toggle { background: #fff; color: #101b35; }
html[data-theme="light"] footer { background: #101d3b; }
