/*
Theme Name: Pex Fusion Theme Lite
Theme URI: https://pexfusion.com
Author: Pex Fusion
Author URI: https://pexfusion.com
Description: Lightweight responsive WordPress theme with left off-canvas navigation.
Version: 1.1.0
Requires at least: 6.6
Tested up to: 6.7
Requires PHP: 7.4
Text Domain: pex-fusion-theme-lite
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: custom-logo, custom-menu, featured-images, translation-ready, accessibility-ready
*/

/* =========================================================
   VARIABLES
   ========================================================= */
:root {
  --pex-primary: #111111;
  --pex-accent: #e63946;
  --pex-header-bg: #ffffff;
  --pex-menu-bg: #111111;
  --pex-menu-text: #ffffff;
  --pex-radius: 6px;
  --pex-mobile-menu-width: 80%;

  /* Header height is a single source of truth. */
  --pex-header-height: 68px;

  /* Logo max height. */
  --pex-logo-height: 44px;

  --pex-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
}

/* =========================================================
   RESET
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--pex-font);
  font-size: 16px;
  line-height: 1.65;
  color: #1a1a1a;
  background: #ffffff;
  overflow-x: hidden;
}

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

a {
  color: var(--pex-accent);
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* =========================================================
   ACCESSIBILITY
   ========================================================= */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  word-wrap: normal !important;
}

.skip-link:focus {
  background: #fff;
  color: #111;
  display: block;
  font-weight: 700;
  left: 6px;
  padding: 10px 16px;
  top: 6px;
  z-index: 100000;
  position: fixed;
  text-decoration: none;
  border-radius: var(--pex-radius);
}

:focus-visible {
  outline: 2px solid var(--pex-accent);
  outline-offset: 2px;
}

/* =========================================================
   HEADER — simple, fixed, auto-height
   ========================================================= */

.pex-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  height: auto;
  min-height: var(--pex-header-height);

  background: var(--pex-header-bg);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  z-index: 900;

  transform: translateY(0);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pex-header.is-sticky {
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.07);
}

/* Only hides when JS explicitly adds .hide AND user scrolled far enough */
.pex-header.hide {
  transform: translateY(-100%);
}

/* Admin bar pushdown */
body.admin-bar .pex-header {
  top: 32px;
}

@media screen and (max-width: 782px) {
  body.admin-bar .pex-header {
    top: 46px;
  }
}

.pex-header__inner {
  max-width: 1200px;
  margin: 0 auto;

  /* Simple, uniform padding — no variables here. */
  padding: 12px 20px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  /* Minimum height matches the CSS variable. Content grows it if needed. */
  min-height: var(--pex-header-height);

  /* Never clip the logo or menu. */
  overflow: visible;
}

/* =========================================================
   LOGO
   ========================================================= */
.pex-branding {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
}

.pex-logo {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}

.pex-logo img,
.custom-logo-link,
.custom-logo-link img,
.custom-logo {
  max-height: var(--pex-logo-height);
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
}

.pex-site-title {
  display: inline-flex;
  align-items: center;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--pex-primary);
  letter-spacing: -0.02em;
  text-decoration: none;
  line-height: 1.2;
}

.pex-site-title:hover {
  text-decoration: none;
}

/* =========================================================
   DESKTOP NAV
   ========================================================= */
.pex-nav {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.pex-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 4px;
  align-items: center;
}

.pex-nav li {
  position: relative;
}

.pex-nav a {
  display: block;
  padding: 10px 14px;
  color: var(--pex-primary);
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.2;
  border-radius: var(--pex-radius);
  transition: background 0.18s ease, color 0.18s ease;
}

.pex-nav a:hover,
.pex-nav .current-menu-item > a,
.pex-nav .current_page_item > a,
.pex-nav .current-menu-ancestor > a {
  background: rgba(0, 0, 0, 0.05);
  color: var(--pex-accent);
  text-decoration: none;
}

/* Submenus */
.pex-nav .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 210px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--pex-radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.10);
  padding: 6px;
  margin: 0;
  list-style: none;
  display: block;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 50;
}

.pex-nav li:hover > .sub-menu,
.pex-nav li:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.pex-nav .sub-menu .sub-menu {
  top: 0;
  left: 100%;
}

.pex-nav .sub-menu a {
  color: #111;
  padding: 9px 12px;
  font-weight: 400;
}

.pex-nav .sub-menu a:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--pex-accent);
}

/* Hamburger */
.pex-hamburger {
  display: none;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 0;
  padding: 0;
  align-items: center;
  justify-content: center;
  border-radius: var(--pex-radius);
  flex-shrink: 0;
}

.pex-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--pex-primary);
  position: relative;
  transition: background 0.2s;
}

.pex-hamburger span::before,
.pex-hamburger span::after {
  content: "";
  position: absolute;
  left: 0;
  width: 22px;
  height: 2px;
  background: var(--pex-primary);
  transition: transform 0.25s ease, top 0.25s ease;
}

.pex-hamburger span::before { top: -7px; }
.pex-hamburger span::after  { top: 7px; }

/* =========================================================
   MOBILE OFF-CANVAS
   ========================================================= */
.pex-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 999;
}

.pex-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

.pex-drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--pex-mobile-menu-width);
  max-width: 360px;
  background: var(--pex-menu-bg);
  color: var(--pex-menu-text);
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 22px 20px 40px;
  display: flex;
  flex-direction: column;
}

.pex-drawer.is-open {
  transform: translateX(0);
}

.pex-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.pex-drawer__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: inherit;
  margin: 0;
  letter-spacing: -0.01em;
}

.pex-drawer__close {
  background: transparent;
  border: 0;
  color: inherit;
  width: 38px;
  height: 38px;
  border-radius: var(--pex-radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  line-height: 1;
}

.pex-drawer__close:hover {
  background: rgba(255, 255, 255, 0.10);
}

.pex-drawer .pex-mobile-menu,
.pex-drawer .pex-mobile-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pex-drawer .pex-mobile-menu a {
  display: block;
  padding: 13px 6px;
  color: var(--pex-menu-text);
  font-size: 1rem;
  font-weight: 500;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.pex-drawer .pex-mobile-menu a:hover,
.pex-drawer .pex-mobile-menu .current-menu-item > a {
  color: var(--pex-accent);
}

.pex-drawer .menu-item-has-children {
  position: relative;
}

.pex-drawer .submenu-toggle {
  position: absolute;
  right: 0;
  top: 0;
  width: 44px;
  height: 46px;
  background: transparent;
  border: 0;
  color: var(--pex-menu-text);
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease;
}

.pex-drawer .submenu-toggle[aria-expanded="true"] {
  transform: rotate(180deg);
}

.pex-drawer .sub-menu {
  display: none;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  margin: 4px 0 8px 6px;
}

.pex-drawer .sub-menu.is-open {
  display: block;
}

.pex-drawer .sub-menu a {
  font-size: 0.95rem;
  padding: 10px 6px;
}

/* =========================================================
   MAIN CONTENT — pushed down by exactly the header height.
   No JS. No variables fighting. One value, one place.
   ========================================================= */
.pex-main {
  padding-top: var(--pex-header-height);
  margin-top: 0;
}

/* If admin bar is visible, add its height on top */
body.admin-bar .pex-main {
  padding-top: calc(var(--pex-header-height) + 32px);
}

@media screen and (max-width: 782px) {
  body.admin-bar .pex-main {
    padding-top: calc(var(--pex-header-height) + 46px);
  }
}

/* =========================================================
   GENERAL LAYOUT
   ========================================================= */
.pex-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

.pex-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 40px;
}

.pex-layout--full {
  grid-template-columns: 1fr;
}

@media (max-width: 900px) {
  .pex-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* =========================================================
   HERO (front page)
   ========================================================= */
.pex-hero {
  padding: 90px 20px;
  text-align: center;
  background: linear-gradient(180deg, #fafafa 0%, #ffffff 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.pex-hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
  color: var(--pex-primary);
}

.pex-hero p {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: #555;
  max-width: 680px;
  margin: 0 auto 28px;
}

.pex-btn {
  display: inline-block;
  padding: 13px 26px;
  background: var(--pex-primary);
  color: #fff;
  border-radius: var(--pex-radius);
  font-weight: 600;
  border: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.pex-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  text-decoration: none;
  color: #fff;
}

.pex-btn--accent {
  background: var(--pex-accent);
}

/* =========================================================
   POST CARDS
   ========================================================= */
.pex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 28px;
}

.pex-card {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--pex-radius);
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  display: flex;
  flex-direction: column;
}

.pex-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.pex-card__thumb {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #f1f1f1;
}

.pex-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.pex-card:hover .pex-card__thumb img {
  transform: scale(1.05);
}

.pex-card__body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.pex-card__meta {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  margin-bottom: 8px;
  font-weight: 600;
}

.pex-card__title {
  margin: 0 0 10px;
  font-size: 1.15rem;
  line-height: 1.35;
}

.pex-card__title a {
  color: var(--pex-primary);
}

.pex-card__title a:hover {
  color: var(--pex-accent);
  text-decoration: none;
}

.pex-card__excerpt {
  color: #555;
  font-size: 0.95rem;
  margin: 0 0 16px;
  flex: 1;
}

.pex-card__more {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--pex-accent);
}

/* =========================================================
   SINGLE / PAGE
   ========================================================= */
.pex-entry {
  max-width: 100%;
}

.pex-entry__header {
  margin-bottom: 26px;
}

.pex-entry__title {
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  color: var(--pex-primary);
}

.pex-entry__meta {
  color: #888;
  font-size: 0.9rem;
}

.pex-entry__thumb {
  margin: 24px 0;
  border-radius: var(--pex-radius);
  overflow: hidden;
}

.pex-entry__content {
  font-size: 1.05rem;
  color: #222;
}

.pex-entry__content h2 {
  font-size: 1.6rem;
  margin: 2em 0 0.6em;
}

.pex-entry__content h3 {
  font-size: 1.3rem;
  margin: 1.6em 0 0.5em;
}

.pex-entry__content p {
  margin: 0 0 1.2em;
}

.pex-entry__content blockquote {
  border-left: 4px solid var(--pex-accent);
  padding: 4px 0 4px 18px;
  margin: 1.6em 0;
  color: #444;
  font-style: italic;
}

.pex-entry__content img {
  border-radius: var(--pex-radius);
  margin: 1em 0;
}

.pex-entry__content pre {
  background: #111;
  color: #eee;
  padding: 18px;
  overflow: auto;
  border-radius: var(--pex-radius);
  font-size: 0.9rem;
}

.pex-entry__content code {
  background: #f2f2f2;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.pex-entry__content pre code {
  background: transparent;
  padding: 0;
}

/* Tags */
.pex-tags {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pex-tags a {
  display: inline-block;
  padding: 5px 12px;
  font-size: 0.82rem;
  background: #f2f2f2;
  color: #333;
  border-radius: 999px;
}

.pex-tags a:hover {
  background: var(--pex-accent);
  color: #fff;
  text-decoration: none;
}

/* Post navigation */
.pex-postnav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 36px 0 0;
}

.pex-postnav a {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--pex-radius);
  color: var(--pex-primary);
  font-weight: 600;
}

.pex-postnav a:hover {
  border-color: var(--pex-accent);
  color: var(--pex-accent);
  text-decoration: none;
}

.pex-postnav .next {
  text-align: right;
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.pex-sidebar .widget {
  margin-bottom: 28px;
  padding: 20px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--pex-radius);
  background: #fff;
}

.pex-sidebar .widget-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--pex-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pex-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pex-sidebar li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.pex-sidebar li:last-child {
  border-bottom: 0;
}

.pex-sidebar a {
  color: #333;
}

.pex-sidebar a:hover {
  color: var(--pex-accent);
}

/* =========================================================
   SEARCH / 404
   ========================================================= */
.pex-search-form {
  display: flex;
  gap: 8px;
  max-width: 520px;
}

.pex-search-form input[type="search"] {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--pex-radius);
  font-size: 1rem;
}

.pex-search-form button {
  padding: 12px 22px;
  background: var(--pex-primary);
  color: #fff;
  border: 0;
  border-radius: var(--pex-radius);
  font-weight: 600;
}

.pex-empty {
  text-align: center;
  padding: 60px 20px;
}

.pex-empty h1 {
  font-size: 4rem;
  margin: 0 0 8px;
  color: var(--pex-accent);
}

.pex-empty p {
  color: #666;
  margin-bottom: 24px;
}

/* =========================================================
   COMMENTS
   ========================================================= */
.pex-comments {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.pex-comments h2,
.pex-comments .comments-title {
  font-size: 1.4rem;
  margin-bottom: 20px;
}

.pex-comments ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pex-comments .comment {
  padding: 18px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.pex-comments .comment-author img {
  border-radius: 50%;
  float: left;
  margin-right: 12px;
}

.pex-comments .comment-meta {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 10px;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--pex-radius);
  font-size: 1rem;
  font-family: inherit;
  margin-bottom: 14px;
}

.comment-form input[type="submit"] {
  padding: 12px 26px;
  background: var(--pex-primary);
  color: #fff;
  border: 0;
  border-radius: var(--pex-radius);
  font-weight: 600;
  cursor: pointer;
}

/* =========================================================
   PAGINATION
   ========================================================= */
.pex-pagination {
  margin-top: 40px;
  text-align: center;
}

.pex-pagination .page-numbers {
  display: inline-block;
  padding: 8px 14px;
  margin: 0 4px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--pex-radius);
  color: #333;
  font-weight: 600;
}

.pex-pagination .page-numbers.current,
.pex-pagination .page-numbers:hover {
  background: var(--pex-primary);
  color: #fff;
  border-color: var(--pex-primary);
  text-decoration: none;
}

/* =========================================================
   FOOTER
   ========================================================= */
.pex-footer {
  background: #0d0d0d;
  color: #bbb;
  padding: 44px 20px 26px;
  margin-top: 60px;
}

.pex-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
}

.pex-footer__widgets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 32px;
  margin-bottom: 30px;
}

.pex-footer .widget-title {
  color: #fff;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.pex-footer a {
  color: #ccc;
}

.pex-footer a:hover {
  color: var(--pex-accent);
}

.pex-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pex-footer li {
  padding: 4px 0;
}

.pex-footer__bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  padding-top: 20px;
  text-align: center;
  font-size: 0.88rem;
  color: #888;
}

.pex-footer__menu ul {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
  .pex-nav {
    display: none;
  }

  .pex-hamburger {
    display: inline-flex;
  }

  .pex-hero {
    padding: 60px 20px;
  }

  .pex-wrap {
    padding: 28px 18px;
  }
}

/* =========================================================
   WORDPRESS CORE CLASSES
   ========================================================= */
.alignleft {
  float: left;
  margin: 0 1.5em 1em 0;
}

.alignright {
  float: right;
  margin: 0 0 1em 1.5em;
}

.aligncenter {
  display: block;
  margin: 1em auto;
}

.wp-caption {
  max-width: 100%;
}

.wp-caption-text {
  font-size: 0.85rem;
  color: #777;
  text-align: center;
  margin-top: 6px;
}

.sticky {
  border-left: 4px solid var(--pex-accent);
  padding-left: 14px;
}

.bypostauthor > .comment-body {
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--pex-radius);
  padding: 14px;
}