/* ============================================================
   Купеческий дом — child of Cassiopeia (Joomla 5)
   Дизайн-язык Taiga UI (taiga-family/taiga-ui): Manrope,
   navy-текст, серый фон, мягкие тени, скруглённые карточки.
   Тёплый оранжевый (#ff7043) — акцент из палитры Taiga.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Marck+Script&display=swap');

:root {
  /* акценты (токены Taiga) */
  --kd-accent:         #ff7043;   /* --tui-background-accent-2 */
  --kd-accent-hover:   #ff8a5f;
  --kd-accent-pressed: #e7716a;
  --kd-blue:           #526ed3;   /* --tui-background-accent-1 */
  --kd-blue-hover:     #6c86e2;

  /* текст (Taiga --tui-text-*) */
  --kd-ink:       #1b1f3b;
  --kd-ink-soft:  rgba(27, 31, 59, 0.65);
  --kd-ink-faint: rgba(27, 31, 59, 0.40);

  /* поверхности (Taiga --tui-background-*) */
  --kd-paper: #f6f6f6;
  --kd-card:  #ffffff;
  --kd-dark:  #1b1f3b;
  --kd-line:  rgba(0, 0, 0, 0.10);

  /* скругления (Taiga --tui-radius-*) */
  --kd-r-s:  0.5rem;    /* 8  */
  --kd-r-m:  0.625rem;  /* 10 */
  --kd-r-l:  1rem;      /* 16 */
  --kd-r-xl: 1.5rem;    /* 24 */

  /* тени (Taiga --tui-shadow-*) */
  --kd-shadow:       0 0.25rem 1.25rem rgba(0, 0, 0, 0.10);
  --kd-shadow-hover: 0 1rem 2.5rem rgba(0, 0, 0, 0.14);
  --kd-shadow-md:    0 0.375rem 2rem rgba(0, 0, 0, 0.12);

  --kd-dur: 0.3s;

  /* переопределяем токены Cassiopeia */
  --cassiopeia-color-primary: #1b1f3b;
  --cassiopeia-color-link: #4c66c3;
  --cassiopeia-color-hover: #ff7043;
}

html { scroll-behavior: smooth; }

body.site {
  font-family: 'Manrope', system-ui, sans-serif;
  color: var(--kd-ink);
  background: var(--kd-paper);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .page-header h1 {
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 800;
  color: var(--kd-ink);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

a { color: #4c66c3; text-decoration: none; transition: color var(--kd-dur) ease; }
a:hover, a:focus { color: var(--kd-accent); }

/* ---------- Верхняя тёмная полоса с цитатой ---------- */
.container-topbar {
  background: var(--kd-dark);
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  text-align: center;
  padding: .6rem 1rem;
  letter-spacing: .01em;
}
.container-topbar p { margin: 0; }
.container-topbar .mod-custom { max-width: 900px; margin: 0 auto; }

/* ---------- Шапка ---------- */
.container-header {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(12px);
  box-shadow: inset 0 -1px 0 var(--kd-line);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding-inline: max(1.2rem, calc((100% - 1320px) / 2));
}
.container-header .container-topbar {
  flex: 1 1 100%;
  margin-inline: 0;
  box-shadow: 0 0 0 100vmax var(--kd-dark);
  clip-path: inset(0 -100vmax);
}
.container-header > .grid-child {
  padding-block: .5rem;
  flex: 0 1 auto;
  width: auto;
  margin-inline: 0;
}
.container-header .container-nav { flex: 0 1 auto; margin-left: auto; margin-right: 0; width: auto; }
.container-header .navbar { padding: 0; }

.navbar-brand { display: flex; align-items: center; }
.navbar-brand a,
.navbar-brand .site-title {
  font-family: 'Marck Script', cursive;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  color: var(--kd-ink) !important;
  line-height: 1.1;
  text-decoration: none;
  transition: color var(--kd-dur) ease;
}
.navbar-brand a:hover { color: var(--kd-accent) !important; }
.site-description { display: none; }

/* ---------- Главное меню ---------- */
.container-nav { align-self: center; }
.mod-menu { gap: .1rem; }
.mod-menu > li > a,
.mod-menu > li > .nav-link,
.mod-menu .nav-link {
  font-family: 'Manrope', sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .005em;
  color: var(--kd-ink) !important;
  padding: .8rem .7rem !important;
  border-radius: var(--kd-r-m);
  position: relative;
  transition: background var(--kd-dur) ease, color var(--kd-dur) ease;
}
.mod-menu > li > a:hover { background: rgba(255, 112, 67, 0.10); color: var(--kd-accent-pressed) !important; }
.mod-menu > li.active > a { color: var(--kd-accent-pressed) !important; }
.mod-menu > li.active > a::after {
  content: "";
  position: absolute;
  left: .7rem; right: .7rem; bottom: .35rem;
  height: 2px;
  border-radius: 2px;
  background: var(--kd-accent);
}

/* выпадающее подменю */
.mod-menu ul.mm-collapse, .mod-menu .dropdown-menu, .mod-menu ul ul {
  border: 0;
  border-radius: var(--kd-r-l);
  box-shadow: var(--kd-shadow-md);
  background: #fff;
  padding: .4rem;
  min-width: 240px;
}
.mod-menu ul ul a {
  font-weight: 500;
  font-size: 14px;
  color: var(--kd-ink-soft) !important;
  padding: .55rem .8rem !important;
  border-radius: var(--kd-r-s);
}
.mod-menu ul ul a:hover { color: var(--kd-accent-pressed) !important; background: rgba(255, 112, 67, 0.08); }

/* ---------- Hero-баннер ---------- */
.container-banner { margin: 0; }
.kd-hero {
  position: relative;
  overflow: hidden;
  border-radius: 0;
  animation: kdFade .8s ease both;
}
.kd-hero img {
  width: 100%;
  height: clamp(260px, 46vw, 520px);
  object-fit: cover;
  display: block;
  transform: scale(1.02);
  animation: kdZoom 16s ease-out both;
}
.kd-hero-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 4rem 1.5rem 1.8rem;
  background: linear-gradient(180deg, transparent, rgba(27, 31, 59, .72));
  color: #fff;
  text-align: center;
}
.kd-hero-caption .kd-hero-title {
  font-family: 'Marck Script', cursive;
  font-size: clamp(1.7rem, 3.6vw, 2.6rem);
  text-shadow: 0 2px 16px rgba(0, 0, 0, .4);
  margin: 0;
}
.kd-hero-caption .kd-hero-sub {
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  font-weight: 500;
  opacity: .95;
  margin: .35rem 0 0;
  letter-spacing: .02em;
}
@keyframes kdFade { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes kdZoom { from { transform: scale(1.1); } to { transform: scale(1.02); } }

/* ---------- Контент ---------- */
.site-grid { gap: 2rem; padding-block: 2.4rem; }
.container-component {
  background: var(--kd-card);
  border: 1px solid var(--kd-line);
  border-radius: var(--kd-r-l);
  padding: clamp(1.4rem, 3vw, 2.8rem);
  box-shadow: var(--kd-shadow);
  animation: kdFade .6s ease both;
}
.container-component .page-header h1,
.container-component .article-header h1,
.item-page h1 {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  margin-bottom: 1.1rem;
  position: relative;
  padding-bottom: .85rem;
}
.container-component h1::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 68px; height: 4px;
  background: var(--kd-accent);
  border-radius: 4px;
}
.item-page img, .blog img, .com-content-category-blog img {
  border-radius: var(--kd-r-l);
  max-width: 100%;
  height: auto;
}

/* изображение статьи: отступ от текста + баланс ширины */
figure.item-image {
  margin: .35rem 0 1.3rem;
}
figure.item-image.left, figure.item-image.float-start {
  float: left;
  max-width: min(46%, 430px);
  margin-right: 1.9rem;
}
figure.item-image.right, figure.item-image.float-end {
  float: right;
  max-width: min(46%, 430px);
  margin-left: 1.9rem;
}
figure.item-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--kd-r-l);
}
figure.item-image .caption, figure.item-image figcaption {
  font-size: 12.5px;
  color: var(--kd-ink-faint);
  text-align: center;
  padding: .55rem .3rem 0;
  line-height: 1.35;
}
/* на узких экранах — картинка во всю ширину, текст под ней */
@media (max-width: 640px) {
  figure.item-image.left, figure.item-image.right,
  figure.item-image.float-start, figure.item-image.float-end {
    float: none;
    max-width: 100%;
    margin: 0 0 1.3rem;
  }
}

.article-info, .article-info.muted { display: none; }

/* блог категории */
.blog .blog-item, .com-content-category-blog .blog-item {
  border-bottom: 1px solid var(--kd-line);
  padding-bottom: 1.8rem;
  margin-bottom: 1.8rem;
}
.blog .blog-item:last-child { border-bottom: 0; }
.blog-item .item-title a { color: var(--kd-ink); font-weight: 700; }
.blog-item .item-title a:hover { color: var(--kd-accent); }

/* кнопки — стиль Taiga (rounded rect, bold, мягкая тень) */
.readmore .btn, .com-content-category-blog .btn, .btn-primary {
  background: var(--kd-accent);
  border: 0;
  color: #fff;
  border-radius: var(--kd-r-m);
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 14px;
  padding: .6rem 1.3rem;
  box-shadow: 0 .25rem .9rem rgba(255, 112, 67, .35);
  transition: all var(--kd-dur) ease;
}
.readmore .btn:hover, .com-content-category-blog .btn:hover, .btn-primary:hover {
  background: var(--kd-accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 .5rem 1.25rem rgba(255, 112, 67, .42);
}

/* ---------- Сайдбар ---------- */
.container-sidebar-right { padding-top: 0; }
.container-sidebar-right .card, .container-sidebar-right .moduletable {
  border: 1px solid var(--kd-line);
  border-radius: var(--kd-r-l);
  background: var(--kd-card);
  box-shadow: var(--kd-shadow);
  margin-bottom: 1.6rem;
  overflow: hidden;
  transition: box-shadow var(--kd-dur) ease, transform var(--kd-dur) ease;
}
.container-sidebar-right .card:hover, .container-sidebar-right .moduletable:hover {
  box-shadow: var(--kd-shadow-hover);
}
.container-sidebar-right .card-body { padding: 1.3rem 1.4rem 1.1rem; }
.container-sidebar-right h3, .container-sidebar-right .card-header {
  font-family: 'Manrope', sans-serif;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--kd-ink);
  background: transparent;
  border: 0;
  padding: 1.3rem 1.4rem 0;
  margin: 0;
  position: relative;
}
.container-sidebar-right h3::after {
  content: "";
  display: block;
  width: 36px; height: 4px;
  background: var(--kd-accent);
  border-radius: 4px;
  margin-top: .55rem;
}

/* список «Интересно» */
.kd-newslist { display: flex; flex-direction: column; }
.kd-newsitem {
  display: flex;
  gap: .9rem;
  align-items: center;
  padding: .85rem 0;
  border-bottom: 1px solid var(--kd-line);
  color: var(--kd-ink);
  transition: transform var(--kd-dur) ease;
}
.kd-newsitem:last-child { border-bottom: 0; }
.kd-newsitem:hover { transform: translateX(3px); }
.kd-newsthumb {
  flex: 0 0 64px;
  width: 64px; height: 64px;
  border-radius: var(--kd-r-m);
  background-size: cover;
  background-position: center;
  box-shadow: var(--kd-shadow);
  transition: transform var(--kd-dur) ease;
}
.kd-newsitem:hover .kd-newsthumb { transform: scale(1.05); }
.kd-newstitle {
  display: block;
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.3;
}
.kd-newsitem:hover .kd-newstitle { color: var(--kd-accent); }
.kd-newsdate {
  display: block;
  font-size: 12.5px;
  color: var(--kd-ink-faint);
  margin-top: .2rem;
}

/* тёмный блок «Рекомендуем» */
.kd-dark-card {
  background: var(--kd-dark) !important;
  border-color: var(--kd-dark) !important;
}
.kd-dark-card h3, .kd-dark-card .card-header { color: #fff; }
.kd-dark-card h3::after { background: var(--kd-accent); }
.kd-dark-card a {
  display: block;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  font-size: 14.5px;
  padding: .7rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: all var(--kd-dur) ease;
}
.kd-dark-card a:last-child { border-bottom: 0; }
.kd-dark-card a:hover { color: var(--kd-accent); padding-left: .4rem; }

/* ---------- Футер ---------- */
.container-footer {
  background: var(--kd-dark);
  color: rgba(255, 255, 255, 0.6);
  margin-top: 2.6rem;
  padding: 2.4rem 1rem;
  font-size: 14px;
}
.container-footer a { color: rgba(255, 255, 255, 0.85); }
.container-footer a:hover { color: var(--kd-accent); }
.container-footer .kd-footer-logo {
  font-family: 'Marck Script', cursive;
  font-size: 1.8rem;
  color: #fff;
  display: block;
  margin-bottom: .4rem;
}

/* back to top */
.back-to-top-link {
  background: var(--kd-accent) !important;
  border-radius: 50%;
  border: 0;
  color: #fff !important;
  box-shadow: 0 .5rem 1.25rem rgba(255, 112, 67, .45);
}

/* ---------- Мобильная адаптация ---------- */
@media (max-width: 767.98px) {
  .container-header { position: static; }
  .container-topbar { display: none; }
  .container-header .navbar { padding: 0; }
  .container-header .container-nav { flex: 1 1 100%; margin-left: 0; }
  .container-header > .grid-child { width: 100%; text-align: center; }
  .navbar-brand { justify-content: center; }
  .mod-menu {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center;
    gap: .35rem;
    padding: .1rem 0 .7rem;
    list-style: none;
    margin: 0;
    width: 100%;
  }
  .mod-menu > li { position: relative; }
  ul.mod-menu.mod-menu_dropdown-metismenu li,
  .mod-menu li {
    display: inline-flex !important;
    width: auto !important;
    max-width: max-content !important;
    flex: 0 0 auto !important;
  }
  .mod-menu > li > a {
    display: inline-block;
    background: #ebebeb;
    border-radius: 999px;
    padding: .4rem .85rem !important;
    font-size: 13px !important;
  }
  .mod-menu > li.active > a { background: var(--kd-accent); color: #fff !important; }
  .mod-menu > li.active > a::after { display: none; }
  .mod-menu .mm-toggler { display: none; }
  /* подпункты — плоскими «пилюлями» рядом с остальными */
  .mod-menu li.parent { display: contents; }
  .mod-menu li.parent > a { background: #ebebeb; }
  .mod-menu ul.mm-collapse {
    display: contents !important;
    height: auto !important;
  }
  .mod-menu ul.mm-collapse li { display: inline-block; }
  .mod-menu ul.mm-collapse a {
    display: inline-block;
    background: #faf7f3;
    border: 1px dashed var(--kd-line);
    border-radius: 999px;
    padding: .4rem .85rem !important;
    font-size: 13px !important;
    color: var(--kd-ink-soft) !important;
  }
  .kd-hero img { height: 220px; }
  .site-grid { padding-block: 1.2rem; gap: 1.2rem; }
}
