/**
 * Eappi Child Theme Custom CSS
 */

/* Base responsive improvements */
html,
body {
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
}

/* Ensure proper responsive behavior */
#bg-wrapper,
#wrapper,
#main,
#content,
#content.full {
  width: 100%;
  max-width: 1000px;
  box-sizing: border-box;
}

/* Hardcoded header styling - override all CMS settings */
#header {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 20px !important;
  height: auto !important;
  position: relative;
  max-width: var(--content-max-width, 1000px);
  margin: 0 auto;
  width: 100% !important;
  box-sizing: border-box;
  background: var(--white, #fff) !important;
  border-bottom: 1px solid var(--lightgrey, #eee);
}

#logo {
  position: static !important;
  flex: 0 0 auto;
  max-width: 300px !important;
  height: auto !important;
}

#logo img {
  max-width: 100% !important;
  max-height: 60px !important;
  width: auto !important;
  height: auto !important;
  display: block !important;
}

.header-right {
  display: flex !important;
  align-items: center;
  gap: 20px;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Limit logo width on mobile */
@media only screen and (max-width: 767px) {
  #logo {
    max-width: 50%;
  }

  #logo img {
    max-width: 100%;
    height: auto;
  }
}

#header .menu {
  position: static !important;
  display: flex;
  align-items: center;
}

#header-search {
  position: static !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center;
  visibility: visible !important;
  opacity: 1 !important;
  width: 32px !important;
  height: 32px !important;
}

/* SVG Search Icon - force visibility */
#header-search a.search-icon {
  background: none !important;
  position: relative;
  width: 32px !important;
  height: 32px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  visibility: visible !important;
  opacity: 1 !important;
  text-indent: 0 !important;
}

#header-search a.search-icon svg {
  width: 20px;
  height: 20px;
  /* fill: #333; */
  transition: fill 0.2s ease;
}

#header-search a.search-icon:hover svg {
  /* fill: var(--primary, #d71a06); */
}

/* Hide RSS button */
#header-social {
  display: none !important;
}

/* Search overlay styling */
#pop_out_search {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1002;
  display: none !important;
  align-items: center;
  justify-content: center;
}

#pop_out_search.active {
  display: flex !important;
}

#pop_out_search form {
  background: white;
  padding: 40px;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
}

#pop_out_search input[type="search"] {
  width: 100%;
  padding: 15px;
  font-size: 18px;
  border: 2px solid #ddd;
  border-radius: 4px;
}

/* Desktop Navigation */
.desktop-menu {
  display: flex !important;
  align-items: center;
}

.desktop-menu #menu {
  display: flex !important;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 30px;
}

.desktop-menu #menu li {
  display: flex;
  align-items: center;
}

.desktop-menu #menu a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  padding: 10px 0;
  transition: color 0.2s ease;
}

.desktop-menu #menu a:hover {
  color: #d71a06;
}

@media only screen and (max-width: 1024px) {
  .desktop-menu {
    display: none !important;
  }
}

/* Mobile menu toggle button - force visibility */
.mobile-menu-toggle {
  cursor: pointer;
  z-index: 1001 !important;
  background: transparent !important;
  border: none !important;
  /* padding: 8px !important; */
  margin: 0 !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 32px !important;
  height: 32px !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  position: relative !important;
}

/* Force hamburger to show on mobile/tablet */
@media only screen and (max-width: 1024px) {
  .mobile-menu-toggle {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

/* Hide hamburger on desktop */
@media only screen and (min-width: 1025px) {
  .mobile-menu-toggle {
    display: none !important;
  }
}

.mobile-menu-toggle {
  color: #333;
}
.mobile-menu-toggle span {
  display: block !important;
  width: 20px !important;
  height: 2px !important;
  background: black !important;
  margin: 3px 0 !important;
  transition: all 0.3s ease;
  border-radius: 1px;
}

/* When active, animate to an X and hide the middle bar */
.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5.5px, 5.5px) !important;
  background-color: #ccc !important;
}
.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0 !important;
}
.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5.5px, -5.5px) !important;
  background-color: #ccc !important;
}

.header-right:has(.mobile-menu-toggle.active) #header-search a.search-icon svg {
  stroke: #ccc !important;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.mobile-menu-overlay.active {
  display: flex !important;
}

.mobile-menu-content {
  text-align: center;
}

.mobile-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-nav li {
  margin: 20px 0;
}

.mobile-nav a {
  color: white;
  font-size: 24px;
  text-decoration: none;
  display: block;
  padding: 10px;
}

.mobile-nav a:hover {
  color: #ccc;
}

/* Force mobile elements visibility */
@media only screen and (max-width: 1024px) {
  .header-right {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 9999 !important;
  }

  .mobile-menu-toggle {
    visibility: visible !important;
    opacity: 1 !important;
    display: flex !important;
    position: relative !important;
    z-index: 9999 !important;
    background: transparent !important;
    border: none !important;
    width: 32px !important;
    height: 32px !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    cursor: pointer !important;
  }

  .mobile-menu-toggle span {
    display: block !important;
    width: 20px !important;
    height: 2px !important;
    background: currentColor !important;
    margin: 3px 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  #header-search {
    visibility: visible !important;
    opacity: 1 !important;
    display: flex !important;
    position: relative !important;
    z-index: 9999 !important;
    width: 32px !important;
    height: 32px !important;
  }

  #header-search a.search-icon {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 32px !important;
    height: 32px !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #header-search a.search-icon svg {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 20px !important;
    height: 20px !important;
    /* fill: #333 !important; */
  }
}

/* Mobile styles */
@media only screen and (max-width: 1024px) {
  #header {
    padding: 15px 20px;
    justify-content: space-between;
    align-items: center;
    position: relative;
    flex-wrap: nowrap; /* keep logo + icons in one row */
  }

  #logo {
    flex: 0 0 50%;
    max-width: 50%; /* logo uses at most half of viewport width */
  }

  #logo img {
    max-height: 40px;
    width: 100%;
    height: auto;
  }

  .header-right {
    display: flex !important;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
  }

  /* Hide desktop navigation on mobile */
  #header .menu {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    z-index: 9999;
    padding: 80px 20px 20px 20px;
    overflow-y: auto;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
  }

  #header .menu.active {
    display: flex !important;
  }

  #header .menu li {
    width: 100%;
    text-align: center;
    margin: 10px 0;
  }

  #header .menu li a {
    display: block;
    padding: 15px 20px;
    font-size: 18px;
    font-weight: 500;
    color: var(--black, #333);
    text-decoration: none;
    border-bottom: 1px solid var(--lightgrey, #eee);
  }

  /* Force hamburger and search to display */
  .mobile-menu-toggle {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    order: 2;
  }

  .mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    margin: 3px 0;
    transition: all 0.3s ease;
    transform-origin: center;
  }

  #header-search {
    display: flex !important;
    order: 1;
    margin-left: 0;
    margin-right: 10px;
  }

  #header-search a.search-icon {
    width: 28px !important;
    height: 28px !important;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #header-search a.search-icon svg {
    width: 22px;
    height: 22px;
  }
}

/* Extra small viewports: make logo smaller so icons always have space */
@media only screen and (max-width: 400px) {
  #header {
    padding: 12px 14px;
  }

  #logo {
    flex: 1 1 40%;
    max-width: 40%;
  }

  #logo img {
    max-height: 32px;
  }

  .header-right {
    gap: 8px;
  }
}

/* Smooth transitions for responsive elements */
#bg-wrapper,
#wrapper,
#main,
#content,
#sidebar,
.item,
img {
  transition: width 0.3s ease, max-width 0.3s ease;
}

/* Simple responsive layout for blog articles */
#main {
  width: 100%;
  max-width: var(--content-max-width, 1000px);
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
  display: block;
  overflow: hidden;
}

/* Ensure all containers have same max-width and centering */
#bg-wrapper,
#wrapper,
.filter-container {
  max-width: var(--content-max-width, 1000px);
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

/* Item styles for equal height cards */
.item {
  display: flex;
  flex-direction: column;
  background: var(--white, #fff);
  border: 1px solid var(--lightgrey, #eee);
  border-radius: 5px;
  overflow: hidden;
  box-sizing: border-box;
  width: 100% !important; /* Override hardcoded widths */
  max-width: 100% !important;
}

/* Desktop column layouts using float */
.item {
  float: left;
  box-sizing: border-box;
  margin: 0 15px 30px 0;
  display: block;
}

/* Column 1 - Full width */
#main.column1 .item,
.item.column1 {
  width: 100% !important;
  margin-right: 0;
}

/* Column 2 - Two columns */
#main.column2 .item,
.item.column2 {
  width: calc(50% - 7.5px) !important;
}

#main.column2 .item:nth-child(2n),
.item.column2:nth-child(2n) {
  margin-right: 0;
}

/* Column 3 - Three columns */
#main.column3 .item,
.item.column3 {
  width: calc(33.333% - 10px) !important;
}

#main.column3 .item:nth-child(3n),
.item.column3:nth-child(3n) {
  margin-right: 0;
}

/* Column 4 - Four columns */
#main.column4 .item,
.item.column4 {
  width: calc(25% - 11.25px) !important;
}

#main.column4 .item:nth-child(4n),
.item.column4:nth-child(4n) {
  margin-right: 0;
}

/* Default 2-column layout */
#main:not(.column1):not(.column2):not(.column3):not(.column4) .item {
  width: calc(50% - 7.5px) !important;
}

#main:not(.column1):not(.column2):not(.column3):not(.column4) .item:nth-child(2n) {
  margin-right: 0;
}

/* Clear floats */
#main:after {
  content: "";
  display: table;
  clear: both;
}

/* Image container with placeholder */
.item .item-thumb {
  width: 100%;
  height: 200px;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.item .item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item .item-thumb:empty:before {
  content: "";
  width: 60px;
  height: 60px;
  background: #ccc;
  border-radius: 50%;
}

/* Content area */
.item .item-content {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.item .item-content h2 {
  margin: 0 0 15px 0;
  font-size: 18px;
  line-height: 1.3;
}

.item .item-content .excerpt {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--grey, #666);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

/* Media queries for responsive design */
@media only screen and (max-width: 1024px) {
  /* Styles for tablets in landscape mode and smaller devices */
  #bg-wrapper {
    width: 100%;
    padding: 0;
  }

  #wrapper {
    width: 100%;
    padding: 0;
  }

  #main {
    padding: 0 15px;
  }

  /* Tablet responsive - reduce columns */
  #main.column3 .item,
  .item.column3,
  #main.column4 .item,
  .item.column4 {
    width: calc(50% - 7.5px) !important;
  }

  #main.column3 .item:nth-child(2n),
  .item.column3:nth-child(2n),
  #main.column4 .item:nth-child(2n),
  .item.column4:nth-child(2n) {
    margin-right: 0;
  }

  #main.column3 .item:nth-child(3n),
  .item.column3:nth-child(3n),
  #main.column4 .item:nth-child(4n),
  .item.column4:nth-child(4n) {
    margin-right: 15px;
  }
}

@media only screen and (max-width: 768px) {
  /* Styles for tablets in portrait mode and smaller devices */
  #content {
    width: 100%;
    margin: 0;
    float: none;
  }

  #sidebar {
    width: 100%;
    float: none;
    margin: 30px 0 0 0;
  }

  /* Mobile - single column stacking */
  .item,
  #main.column1 .item,
  #main.column2 .item,
  #main.column3 .item,
  #main.column4 .item,
  #main:not(.column1):not(.column2):not(.column3):not(.column4) .item {
    width: 100% !important;
    margin-right: 0 !important;
    float: none !important;
    display: block;
  }

  /* Ensure consistent spacing on mobile */
  #main {
    padding: 0 15px;
  }

  /* Improve header layout */
  #header {
    height: auto;
    padding-bottom: 20px;
  }

  #logo {
    position: relative;
    text-align: center;
    float: none;
    margin: 20px auto;
  }
}

@media only screen and (max-width: 480px) {
  /* Styles for smartphones */
  .post-pagination a.pagination {
    width: 100%;
    float: none;
    margin-bottom: 10px;
    box-sizing: border-box;
  }

  .post .post-title h1 {
    font-size: 24px;
  }

  /* Fix comment layout */
  .comment-content {
    width: 100%;
  }
}

/** SUCHE */

.search-results .item.archive {
  border-bottom: 1px solid var(--lightgrey, #eee);
}
.search-results .item.archive .item-descrip {
  padding: var(--spacing-4, 1rem);
}
.search-results .item.archive .item-descrip :is(h2, h3, h4) {
  font-weight: 500;
}
.search-results .item.archive .item-descrip .item-footer {
  display: none;
}

#searchform input#s {
  display: inline-block;
  width: 100%;
  border: none;
  outline: none;
  box-shadow: none;
  font-size: 16px !important;
}

div:has(> input#s) {
  position: relative;
}

#searchsubmit {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: auto;
  height: 100%;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

.post-entry blockquote {
  font-size: var(--text-lg, 24px);
  font-style: normal !important;
  font-weight: 500 !important;
  letter-spacing: 0.02em !important;
  line-height: 1.5 !important;
}

.post-title h1 {
  font-weight: 500 !important;
}

.post-entry a {
  color: var(--black, #000);
  text-decoration: underline;
  text-decoration-color: var(--primary, #d71a06);
  text-underline-offset: 3px;
}
.post-entry figure {
  margin-block: 1rem !important;
}

/* POST ENTRY AREA */

h1,
.post.full .post-entry h1 {
  font-weight: 500 !important;
  font-size: clamp(26px, 8vw, 38px) !important;
}

.post.full .post-entry h2 {
  font-weight: 500 !important;
  font-size: clamp(24px, 7.5vw, 34px) !important;
}

.post.full .post-entry h3 {
  font-weight: 500 !important;
  font-size: clamp(20px, 7vw, 32px) !important;
}

.post.full .post-entry h4 {
  font-weight: 500 !important;
  font-size: clamp(18px, 6vw, 28px) !important;
}

.post.full .post-entry h5 {
  font-weight: 500 !important;
  font-size: clamp(16px, 5vw, 24px) !important;
}

.post.full .post-entry h6 {
  font-weight: 500 !important;
  font-size: clamp(14px, 4vw, 20px) !important;
}

.post.full .post-entry :is(p, li, ol, ul, code, pre, pre code, code pre, table, th, td, span, button, a) {
  font-weight: 500 !important;
  font-size: clamp(18px, 2.5vw, 20px) !important;
  line-height: 1.5;
}

footer {
  margin-bottom: 90px;
  padding-inline: 20px;
}

ul.footer-secondary-menu {
  display: flex !important;
  gap: 1rem;
  & > * {
    flex: 1 1 auto;
  }
}

@media (max-width: 768px) {
  ul.footer-secondary-menu,
  footer,
  #footer {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
  }
}
