/*
 * Theme Name: GeneratePress Seisenlinea
 * Theme URI: https://www.seisenlinea.com/
 * Description: GeneratePress child theme for Seisenlinea
 * Author: Jaime Cosme
 * Author URI: https://www.seisenlinea.com/
 * Template: generatepress
 * Version: 1.0.0
 * License: GPL-2.0+
 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
 */

/* Links */
a {
  color: #e5554e;
  text-decoration: none;
  transition: all 0.1s ease-in-out;
}

a:hover {
  color: #333;
}

/* Typography */
body {
  font-family: Ubuntu, sans-serif;
  font-weight: 300;
  font-size: 18px;
}

/* .main-title included explicitly: GP renders the site title as <h1> only
   on the front page, and as <p class="main-title"> on every other
   template (to avoid a duplicate <h1> alongside the post/page title) -
   without it, the title would silently fall back to body's Ubuntu on
   every non-front-page. */
h1, h2, h3, h4, h5, h6, .main-title {
  font-family: Lato, sans-serif;
}

h1 { font-size: 36px; }
h2 { font-size: 30px; }
h3 { font-size: 24px; }
h4 { font-size: 20px; }
h5 { font-size: 18px; }
h6 { font-size: 16px; }

/* Fixed header */
.site-header {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 9999;
}

/* Push header below admin bar when logged in */
.admin-bar .site-header {
  top: 32px;
}

@media (max-width: 782px) {
  .admin-bar .site-header {
    top: 46px;
  }
}

/* Site title on desktop */
.main-title {
  font-size: 32px;
  font-weight: 400;
}

/* Compensate for fixed header */
.site-content,
.site-inner {
  padding-top: 60px;
}

/* Buttons */
button,
input[type="button"],
input[type="reset"],
input[type="submit"],
.button {
  background-color: #333;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  font-weight: 300;
  padding: 16px 24px;
  text-transform: uppercase;
  white-space: normal;
  width: auto;
}

button:hover,
input:hover[type="button"],
input:hover[type="reset"],
input:hover[type="submit"],
.button:hover {
  background-color: #e5554e;
  color: #fff;
}

.button {
  display: inline-block;
}

/* Entry spacing */
.entry {
  margin-bottom: 40px;
}

.page-content:not(:first-child),
.entry-content:not(:first-child),
.entry-summary:not(:first-child),
.post-image:not(:first-child) {
  margin-top: 1em;
}

/* Responsive tables: hand-coded <table> markup in post_content (e.g.
   problemas-motores-bmw-m47) has no wrapper/class and can overflow the
   viewport on mobile if column content forces a wide min-content width.
   display:block + overflow-x:auto makes the table itself scrollable;
   children (thead/tbody/tr/td/th) keep their table-* display values so
   the table layout algorithm - including colspan/rowspan - is unaffected.
   :not(.tablepress) excludes TablePress-rendered tables, which already
   ship their own opt-in DataTables horizontal-scroll wrapper. */
.entry-content table:not(.tablepress) {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* Post meta */
.avatar {
  border-radius: 50%;
  margin-right: 5px;
}

.entry-meta {
  line-height: 40px;
  margin-bottom: 10px !important;
}

.img-circle {
  border-radius: 50%;
}

/* Sidebar widgets */
.sidebar {
  font-size: 16px;
}

.sidebar li {
  border-bottom: 1px dotted #ddd;
  margin-bottom: 10px;
  padding-bottom: 10px;
}

.sidebar p:last-child,
.sidebar ul > li:last-child {
  margin-bottom: 0;
}

.sidebar .widget {
  background-color: #fff;
  margin-bottom: 40px;
  padding: 40px;
}

.widget li li {
  border: none;
  margin: 0 0 0 30px;
  padding: 0;
}

/* Mobile menu swap */
/* GP generates: .has-inline-mobile-toggle #site-navigation .inside-navigation > *:not(.main-nav) { display:none }
   We beat it by adding a second ID (#site-navigation.toggled vs .has-inline-mobile-toggle #site-navigation) */
#mobile-menu {
  display: none;
}

/* Show mobile menu when toggled — specificity (0,2,3,0) beats GP's (0,1,4,0) */
.has-inline-mobile-toggle #site-navigation.toggled .inside-navigation #mobile-menu {
  display: block;
}

/* Hide primary menu ul when mobile menu is active — our (0,1,2,0) beats GP's (0,0,3,0) */
.main-navigation.toggled #primary-menu > ul {
  display: none;
}

/* Show mobile menu ul — GP hides .main-navigation ul by default */
.main-navigation.toggled #mobile-menu ul {
  display: block;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Fix li float inherited from .main-navigation li — exclude flex items */
.main-navigation.toggled #mobile-menu li:not(.menu-item-has-children) {
  float: none;
  clear: both;
  display: block;
  text-align: left;
}

/* Parent items: side-by-side link + toggle button */
.main-navigation.toggled #mobile-menu li.menu-item-has-children {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  float: none;
  clear: both;
  text-align: left;
}

.main-navigation.toggled #mobile-menu li.menu-item-has-children > a {
  flex: 1;
}

.main-navigation.toggled #mobile-menu a {
  /* line-height:60px used to double as the row's tap-target height, but it
     applies per line - a wrapped (2-line) label got 120px of line-height,
     spacing the two lines far apart. min-height plus a normal line-height
     keeps single-line rows the same height while wrapped text reads
     normally. */
  display: flex;
  align-items: center;
  /* Flexbox drops the plain whitespace text node between the <i> icon and
     the label (e.g. "<i class="fa fa-home"></i> Inicio") that gave them a
     gap under normal block/inline flow - gap replaces it explicitly. */
  gap: 6px;
  min-height: 60px;
  padding: 10px 20px;
  line-height: 1.3;
  color: #fff;
}

.main-navigation.toggled #mobile-menu a:hover {
  color: #e5554e;
}

/* Mobile submenu toggle button */
#mobile-menu .mobile-sub-toggle {
  background: none;
  border: none;
  padding: 0 20px;
  margin: 0;
  cursor: pointer;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60px;
  width: auto;
  flex-shrink: 0;
  text-transform: none;
  font-size: inherit;
  box-shadow: none;
}

#mobile-menu .mobile-sub-toggle svg {
  fill: currentColor;
  transition: transform 0.2s ease;
  display: block;
}

#mobile-menu .mobile-sub-toggle.is-open svg {
  transform: rotate(180deg);
}

/* Override GP's ul ul: position:absolute; left:-99999px; opacity:0; height:0 */
#mobile-menu .sub-menu {
  position: relative !important;
  left: auto !important;
  float: none !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  box-shadow: none !important;
  width: 100% !important;
  flex-basis: 100%;
  height: auto !important;
  max-height: 0;
  overflow: hidden !important;
  transition: max-height 0.25s ease;
  padding-left: 20px;
  box-sizing: border-box;
  background-color: rgb(89, 89, 89);
}

#mobile-menu .sub-menu.is-open {
  max-height: 600px;
}

#mobile-menu .sub-menu li {
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

#mobile-menu .sub-menu li:last-child {
  border-bottom: none;
}

#mobile-menu .sub-menu a {
  /* Same fixed-line-height-as-row-height issue as the top-level items
     above, for submenu entries that wrap to more than one line. */
  display: flex;
  align-items: center;
  min-height: 40px;
  line-height: 1.3 !important;
  padding-top: 4px;
  padding-bottom: 4px;
}

/* Mobile search box */
#mobile-menu .mobile-search {
  padding: 16px 20px 32px;
}

#mobile-menu .mobile-search form {
  display: flex;
  height: 44px;
}

#mobile-menu .mobile-search input[type="search"] {
  flex: 1;
  /* Flex items default to min-width:auto (their intrinsic content size),
     which for a search input is wide enough to overflow this 260px panel
     alongside the button. min-width:0 lets flex:1 actually shrink it. */
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-right: none;
  padding: 0 12px;
  font-size: 16px;
  outline: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

#mobile-menu .mobile-search input[type="search"]::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

#mobile-menu .mobile-search button[type="submit"] {
  background-color: inherit;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-left: none;
  padding: 0 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  width: auto;
  height: auto;
  text-transform: none;
}

#mobile-menu .mobile-search button[type="submit"]:hover {
  color: #e5554e;
  background-color: inherit;
}

#mobile-menu .mobile-search button[type="submit"] svg {
  fill: currentColor;
  display: block;
}

/* Remove gap between main content and sidebar on mobile */
@media (max-width: 768px) {
  .separate-containers .site-main {
    margin-top: 0;
  }

  /* GP's "separate containers" style pads .inside-article 30px on every
     side on mobile. Genesis (production) starts the title flush with the
     top of the content area - drop just the top padding to match, keeping
     the left/right/bottom spacing. */
  .separate-containers .inside-article {
    padding-top: 0;
  }
}

/* Mobile overrides */
@media (max-width: 960px) {
  .site-header {
    height: 54px;
    overflow: hidden;
  }

  /* Compensates the header for the scrollbar-hiding width jump caused by
     body.mobile-menu-open { overflow: hidden } (see mobile-menu.js, which
     sets --mobile-menu-sbw to the real scrollbar width right before adding
     that class - 0 on touch devices with overlay scrollbars). */
  body.mobile-menu-open .site-header {
    width: calc(100% - var(--mobile-menu-sbw, 0px));
  }

  .site-inner {
    padding-top: 60px;
  }

  /* Three-column mobile header: logo | centered site name | hamburger */
  .inside-header {
    height: 100%;
    padding: 0 15px;
    position: relative;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    text-align: left !important;
  }

  /* Logo: left, shrink to icon only */
  .site-branding-container {
    position: static;
    flex: 0 0 auto;
  }

  .site-logo img {
    max-height: 29px;
    width: auto;
    display: block;
  }

  /* Site name: truly centered over the full header width */
  .site-branding-container .site-branding {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    pointer-events: none;
  }

  .site-branding-container .site-branding a {
    pointer-events: auto;
  }

  .main-title {
    font-size: 24px;
    font-weight: 400;
    line-height: 1.2;
    margin: 0;
  }

  /* Nav (hamburger): right side */
  #site-navigation.main-navigation {
    margin-left: 0;
    flex: 0 0 auto;
  }

  /* Reddish button matching production's mobile menu toggle: a 44x44px
     square flush with the top-right corner of the header (production's
     button is position:fixed, top:0, right:0, 44x44, 14px padding - not
     stretched to the header's full height). !important beats GP's own
     generated .menu-toggle rules (background-color/color, and display:block
     - without display:flex actually applying, the icon isn't centered),
     output inline in <head> as customizer CSS.
     GP renders this toggle button twice (a duplicate for another layout
     mode), both matching plain .menu-toggle. Scoped to [data-nav=
     "site-navigation"], the one actually in our mobile header, so the
     other one - normally display:none - isn't forced visible too. */
  .menu-toggle[data-nav="site-navigation"] {
    background-color: #e5554e !important;
    color: #fff !important;
    position: absolute;
    top: 0;
    right: 0;
    width: 44px;
    height: 44px;
    padding: 14px;
    font-size: 16px;
    box-sizing: border-box;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Animated hamburger → X transition */
  .menu-toggle .icon-menu-bars {
    position: relative;
    width: 1em;
    height: 1em;
  }

  .menu-toggle .icon-menu-bars svg {
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  .menu-toggle .icon-menu-bars svg:nth-child(1) {
    opacity: 1;
    transform: rotate(0deg);
  }

  .menu-toggle .icon-menu-bars svg:nth-child(2) {
    display: block !important;
    opacity: 0;
    transform: rotate(-45deg);
  }

  .toggled .menu-toggle .icon-menu-bars svg:nth-child(1) {
    display: block !important;
    opacity: 0;
    transform: rotate(45deg);
  }

  .toggled .menu-toggle .icon-menu-bars svg:nth-child(2) {
    opacity: 1;
    transform: rotate(0deg);
  }

  /* Off-canvas lateral panel, matching production's slide-out mobile menu.
     display:block (overriding the base display:none for this breakpoint)
     so the transform can actually animate - display can't be transitioned.
     !important because GP's own generated rule that normally hides this
     div - .has-inline-mobile-toggle #site-navigation .inside-navigation
     > *:not(.main-nav) { display:none } - has higher specificity (1 ID,
     3 classes) than a bare #mobile-menu (1 ID, 0 classes), regardless of
     source order. Without it, the panel stays display:none until
     .toggled is added, at which point a higher-specificity legacy rule
     further up (2 IDs) shows it - jumping straight from "not rendered" to
     "already at its open transform" in the same frame, with no closed
     frame ever painted to transition from. That's what made the panel
     snap open instantly instead of sliding, while the overlay (never
     display:none) animated normally - looking like the overlay lagged. */
  #mobile-menu {
    display: block !important;
    position: fixed;
    top: 54px;
    right: 0;
    bottom: 0;
    width: 260px;
    max-width: 85vw;
    background: #333;
    color: #fff;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.3);
    z-index: 10000;
  }

  .main-navigation.toggled #mobile-menu {
    transform: translateX(0);
  }

  .admin-bar #mobile-menu {
    top: 100px; /* 46px admin bar + 54px header */
  }

  /* Dimmed backdrop behind the panel; lives at wp_footer (see functions.php)
     so it isn't a descendant of a transformed element.
     z-index must stay BELOW .site-header's (9999): #mobile-menu is nested
     inside .site-header, which is position:fixed + z-index:9999 and so
     forms its own stacking context - #mobile-menu's z-index:10000 only
     applies within that context, it can't escape it. Tying or beating
     9999 here would paint the overlay above the whole header context
     (menu included), even though #mobile-menu's own z-index is higher. */
  #mobile-menu-overlay {
    display: block;
    position: fixed;
    top: 54px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    z-index: 9000;
  }

  .admin-bar #mobile-menu-overlay {
    top: 100px;
  }

  body.mobile-menu-open #mobile-menu-overlay {
    opacity: 1;
    visibility: visible;
  }

  /* Lock page scroll behind the open panel/overlay */
  body.mobile-menu-open {
    overflow: hidden;
  }
}
