/* Grundfarben und Typografie-Einstellungen */
:root {
  --cassiopeia-color-primary: #03003d;
  --cassiopeia-color-link: #0000ff;
  --cassiopeia-color-hover: #353D6B;
  --body-font-size: 1.2rem;
  --body-line-height: 1.5;
  --body-color: #383838;
  --body-bg: #efefef;
}

/* Hintergrund für Header und Footer */
.header,
.footer {
  background: linear-gradient(90deg, rgb(20, 30, 60) 50%, rgb(0, 70, 95) 100%);
}

/* Layout Grundraster und Inhaltsbreite */
.container-header .grid-child,
.container-header .container-nav,
.container-component {
  max-width: 1030px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* Header Navigation links bündig zum Logo */
.container-header .mod-menu.mod-list.nav {
  margin-left: 0;
  padding-left: 0;
}

.container-header .mod-menu.mod-list.nav > li:first-child {
  margin-left: 0;
}

/* Abstand zwischen Header und Inhalt entfernen */
.site-grid,
main,
.container-component {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Erster Inhaltsblock ohne oberen Abstand */
.blog-featured,
.blog-items,
.blog-item,
.item-content,
.com-content-article {
  margin-top: 0 !important;
}

/* Typografische Hierarchie für Inhalte */
.container-component h1 {
  font-size: 2.1rem;
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: 1.5rem;
}

.container-component h2 {
  font-size: 1.8rem;
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 1rem;
}

.container-component h3 {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0.9rem;
}

.container-component h4 {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 0.7rem;
}

.container-component p {
  font-size: 1.2rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

/* Infoblock unter Buchcover */
.container-component .meta-block p {
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}

/* Vertikaler Abstand ohne manuelle Umbrüche */
.container-component h1,
.container-component h2,
.container-component h3,
.container-component h4,
.container-component p {
  margin-top: 0;
}

.container-component p + h2,
.container-component p + h3,
.container-component p + h4 {
  margin-top: 1.6rem;
}

.container-component h2 + p,
.container-component h3 + p,
.container-component h4 + p {
  margin-top: 0.5rem;
}

.container-component h2 + h3,
.container-component h3 + h4 {
  margin-top: 0.8rem;
}

/* Artikel als weiße Karte */
.blog-item,
.item-content,
.com-content-article,
.com-content-article .article-body {
  background: #ffffff;
  padding: 3.5rem;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.08);
  border-top-left-radius: 0;
  border-top-right-radius: 0;

  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

/* Standardbilder im Inhalt */
.item-content img {
  display: block;
  width: 100%;
  max-width: 900px;
  margin: 1.25rem auto 1.5rem;
  border-radius: 8px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

/* Titelbild stärker betonen */
.item-content img:first-of-type {
  margin-top: 0;
  margin-bottom: 2rem;
}

/* Links im Inhaltsbereich */
.container-component a {
  text-decoration: none;
  font-weight: 400;
  transition: color 0.1s ease;
}

.container-component a:hover {
  color: var(--cassiopeia-color-hover);
}

/* Header Navigation Desktop */
.container-header .mod-menu > li {
  margin: 0 0.9rem;
}

.container-header .mod-menu > li > a {
  font-size: 1.05rem;
  font-weight: 600;
  opacity: 0.9;
  padding: 0.75rem 0;
  text-decoration: none;
}

.container-header .mod-menu > li > a:hover {
  opacity: 1;
}

/* Aktiver Menüpunkt Desktop */
.container-header .mod-menu > .active > a {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 3px;
}

/* Back-to-top Button */
#back-top {
  background: #ffffff;
  text-decoration: none;
  border: 1.5px solid #403678;
  box-shadow: none;
  width: 45px;
  height: 45px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#back-top:not(.visible) {
  opacity: 0;
  pointer-events: none;
}

#back-top.visible {
  opacity: 1;
  pointer-events: auto;
}

#back-top.visible:hover,
#back-top.visible:active {
  background: #ffffff;
  border-color: #03003d;
  box-shadow: none;
}

#back-top:focus {
  outline: none;
}

#back-top:focus-visible {
  border-color: #03003d;
  box-shadow: 0 0 0 3px rgba(64, 54, 120, 0.25);
}

#back-top .icon-arrow-up {
  color: #403678;
}

/* Mobile Anpassungen */
@media (max-width: 992px) {

  /* Header Padding auf Mobile */
  .container-header .grid-child,
  .container-header .container-nav {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Inhalt fast volle Breite */
  .container-component {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }

  /* Karten auf Mobile kompakter */
  .blog-item,
  .item-content,
  .com-content-article,
  .com-content-article .article-body {
    padding: 1rem;
    border-radius: 10px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    overflow: visible;
    box-shadow: none;
  }

  /* Mobile Navigation horizontal */
  .container-header .container-nav .mod-menu {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 2.5rem;
    padding: 0;
    margin: 0;
    list-style: none;
    justify-content: flex-start;
    align-items: center;
  }

  .container-header .container-nav .mod-menu > li {
    margin: 0;
    padding: 0;
  }

  .container-header .container-nav .mod-menu > li > a {
    display: inline-block;
    padding: 0.6rem 0;
    font-size: 1.05rem;
    font-weight: 500;
    white-space: nowrap;

    text-decoration: none !important;
    -webkit-text-decoration: none !important;
    text-decoration-line: none !important;

    -webkit-tap-highlight-color: transparent;
    outline: none;
    box-shadow: none;

    position: relative;
    transition: color 0.1s ease;
  }

  /* Farbiger Unterstrich wie Desktop */
  .container-header .container-nav .mod-menu > li > a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 5px;
    height: 2.5px;
    background: #434B63;
    border-radius: 1px;
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.1s ease, opacity 0.1s ease;
  }

  /* Hover / Tap / Fokus: Unterstrich sichtbar */
  .container-header .container-nav .mod-menu > li > a:hover::after,
  .container-header .container-nav .mod-menu > li > a:active::after,
  .container-header .container-nav .mod-menu > li > a:focus::after,
  .container-header .container-nav .mod-menu > li > a:focus-visible::after {
    opacity: 1;
    transform: scaleX(1);
  }

  /* Aktiver Menüpunkt dauerhaft unterstrichen, nicht fetter */
  .container-header .container-nav .mod-menu > li.active > a,
  .container-header .container-nav .mod-menu > li.current > a,
  .container-header .mod-menu > .active > a {
    font-weight: 500;
    text-decoration: none;
  }

  .container-header .container-nav .mod-menu > li.active > a::after,
  .container-header .container-nav .mod-menu > li.current > a::after {
    opacity: 1;
    transform: scaleX(1);
  }

  /* Tabellen auf Mobile stapeln */
  .container-component table {
    width: 100% !important;
    border-collapse: collapse !important;
    table-layout: auto !important;
    display: block !important;
    float: none !important;
    position: static !important;
    overflow: visible !important;
    margin: 0 0 0.5rem 0 !important;
    padding: 0 !important;
    height: auto !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .container-component table thead {
    display: none !important;
  }

  .container-component table tbody,
  .container-component table tr,
  .container-component table td,
  .container-component table th {
    display: block !important;
    width: 100% !important;
    float: none !important;
    clear: both !important;
    position: static !important;
    height: auto !important;
    overflow: visible !important;
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
  }

  .container-component table tr {
    margin: 0 !important;
    padding: 0 !important;
  }

  .container-component table td,
  .container-component table th {
    padding: 0.25rem 0 !important;
    white-space: normal !important;
    line-height: 1.4 !important;
  }

  .container-component table td + td {
    border: 0 !important;
    margin: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  .container-component table::after {
    content: "";
    display: block;
    clear: both;
  }
}

/* Bilder erst auf sehr kleinen Displays auf volle Breite setzen */
@media (max-width: 700px) {
  .container-component img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 0 1rem 0;
  }

  /* Grundtext etwas ruhiger */
  .container-component p {
    font-size: 1.05rem;
    line-height: 1.5;
  }

    /* Listen an Fließtext anpassen */
  .container-component li {
    font-size: 1.05rem;
    line-height: 1.5;
    margin-bottom: 0.4rem;
  }

  .container-component ul,
  .container-component ol {
    padding-left: 1.2rem;
  }

  .container-component li::marker {
    font-size: 0.9em;
  }

  /* H1 */
  .container-component h1 {
    font-size: 1.4rem;
    line-height: 1.3;
    margin-bottom: 1rem;
  }

  /* H2 */
  .container-component h2 {
    font-size: 1.2rem;
    line-height: 1.2;
    margin-bottom: 0.7rem;
  }

  /* H3 */
  .container-component h3 {
    font-size: 1.1rem;
    line-height: 1.25;
    margin-bottom: 0.6rem;
  }

  /* H4 */
  .container-component h4 {
    font-size: 1.05rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
  }

  /* Nur Startseite: Link Cards */
  body.home .container-component p > a:only-child,
  body.frontpage .container-component p > a:only-child,
  body.com_content.view-featured .container-component p > a:only-child {
    display: block;
    padding: 0.8rem 0.9rem;
    margin: 0.6rem 0;
    background: #ffffff;
    border: 1.5px solid rgba(3,0,61,0.25); /* vorher Hover */
    border-radius: 10px;
    color: var(--cassiopeia-color-primary);
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  }

  body.home .container-component p > a:only-child:hover,
  body.home .container-component p > a:only-child:focus-visible,
  body.frontpage .container-component p > a:only-child:hover,
  body.frontpage .container-component p > a:only-child:focus-visible,
  body.com_content.view-featured .container-component p > a:only-child:hover,
  body.com_content.view-featured .container-component p > a:only-child:focus-visible {
    border-color: #403678; /* vorher Normal */
    color: var(--cassiopeia-color-hover);
  }
}
