/*
Theme Name: PENMAN Basic
Author: You
Version: 1.1
*/

html { scroll-behavior: smooth; }
body { margin: 0; }
img { max-width: 100%; height: auto; }

/* =========================================================
   MOBILE HEADER MENU (accordion)
   ========================================================= */

/* Mobile-only helpers (desktop uses Tailwind classes) */
@media (max-width: 767px) {
  /* Section container */
  .pm-mob-parent {
    border: 1px solid rgb(226 232 240); /* slate-200 */
    border-radius: 1rem;
    padding: 0.75rem;
    background: #fff;
  }

  .pm-mob-parent + .pm-mob-parent { margin-top: 0.6rem; }

  .pm-mob-parent-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
  }

  /* Parent = section header */
  .pm-mob-parent-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    text-decoration: none;
    line-height: 1.15;
    word-break: break-word;
  }

  .pm-mob-subtoggle {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgb(226 232 240);
    border-radius: 0.75rem;
    padding: 0.35rem;
    background: #fff;
  }

  .pm-mob-subtoggle:focus { outline: 2px solid rgb(59 130 246); outline-offset: 2px; }

  /* Submenu container (collapsed by default; opened via .is-open from theme.js) */
  .pm-mob-sub {
    display: none;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px dashed rgb(226 232 240);
  }

  .pm-mob-sub.is-open { display: block; }

  /* Child links */
  .pm-mob-child-link {
    display: block;
    padding: 0.5rem 0.6rem;
    border-radius: 0.75rem;
    text-decoration: none;
    font-size: 0.875rem;
  }

  .pm-mob-child-link:hover { background: rgb(248 250 252); }
}

/* === LOGO SAFETY === */
.custom-logo,
.custom-logo-link img {
  width: 36px !important;
  height: 36px !important;
  object-fit: cover;
  border-radius: 0.5rem;
}

/* === ENTRY CONTENT FIXES === */
.entry-content > *:first-child { margin-top: 0 !important; }
.entry-content > *:last-child { margin-bottom: 0 !important; }
.entry-content p { margin: 0; }

/* =========================================================
   DESKTOP HEADER MENU
   ========================================================= */

@media (min-width: 768px) {
  header nav ul,
  header nav li {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  header nav > ul#menu-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
  }

  header nav > ul#menu-header > li {
    position: relative;
  }

  header nav > ul#menu-header > li > a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
  }

  header nav > ul#menu-header > li > ul.sub-menu {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 0; /* IMPORTANT: no hover gap */

    width: 380px;
    background: #fff;
    border: 1px solid rgb(226 232 240);
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(0,0,0,.12);
    padding: 12px;

    z-index: 999999;
  }

  header nav > ul#menu-header > li.menu-item-has-children:hover > ul.sub-menu,
  header nav > ul#menu-header > li.menu-item-has-children:focus-within > ul.sub-menu {
    display: block;
  }

  header nav > ul#menu-header > li > ul.sub-menu > li > a {
    display: block;
    padding: 12px;
    border-radius: 12px;
    text-decoration: none;

    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
  }

  header nav > ul#menu-header > li > ul.sub-menu > li > a:hover {
    background: rgb(248 250 252);
  }

  header nav > ul#menu-header > li > ul.sub-menu > li > a .menu-desc {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.3;
    color: rgb(100 116 139);
  }

  header nav > ul#menu-header > li > ul.sub-menu > li.menu-divider-after {
    position: relative;
    padding-bottom: 14px;
    margin-bottom: 6px;
  }

  header nav > ul#menu-header > li > ul.sub-menu > li.menu-divider-after::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 4px;
    height: 1px;
    background: rgb(226 232 240);
  }
}

/* =========================================================
   MOBILE NAV (CUSTOM)
   ========================================================= */

.pm-mob-toggle { line-height: 0; }

.pm-mob-section-title {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgb(100 116 139);
  font-weight: 700;
  margin-bottom: 10px;
}

.pm-mob-divider {
  height: 1px;
  background: rgb(226 232 240);
  margin: 14px 0;
}

.pm-mob-home {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 10px;
  border: none;
  background: transparent;
  text-decoration: none;
  color: rgb(15 23 42);
  font-weight: 700;
}

.pm-mob-home-hint {
  font-size: 12px;
  color: rgb(100 116 139);
  font-weight: 600;
}

.pm-mob-list { list-style: none; padding: 0; margin: 0; }

.pm-mob-item + .pm-mob-item {
  margin-top: 6px;
}

.pm-mob-parent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pm-mob-link {
  display: block;
  width: 100%;
  padding: 10px 8px;
  border-radius: 10px;
  text-decoration: none;
  color: rgb(15 23 42);
  font-weight: 600;
  background: transparent;
  border: none;
}

.pm-mob-item:not(.pm-mob-parent) > .pm-mob-link:hover {
  background: rgba(15, 23, 42, 0.04);
}

.pm-mob-parent .pm-mob-link {
  font-weight: 700;
}

.pm-mob-subtoggle {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgb(15 23 42);
}

.pm-mob-subtoggle:hover {
  background: rgba(15, 23, 42, 0.04);
}

.pm-mob-subtoggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.pm-mob-sub {
  display: none;
  list-style: none;
  margin: 6px 0 0 0;
  padding: 6px 0 0 0;
  border-left: 1px solid rgba(226, 232, 240, 0.7);
}

.pm-mob-sub.is-open {
  display: block;
}

.pm-mob-sub .pm-mob-link {
  background: transparent;
  border: none;
  padding: 10px 10px 10px 14px;
  margin-left: 10px;
  color: rgb(51 65 85);
  font-size: 13px;
  font-weight: 500;
}

.pm-mob-sub .pm-mob-link:hover {
  background: rgb(241 245 249);
  border-radius: 10px;
}

.pm-mob-actions {
  display: flex;
}

.pm-mob-cta {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgb(15 23 42);
  color: white;
  font-weight: 700;
  padding: 12px 14px;
  text-decoration: none;
}

.pm-mob-cta:hover { background: rgb(30 41 59); }
