/*
Theme Name: Hairs Heaven Mobile Ads
Theme URI: https://www.hairsheaven.com/
Author: OpenAI
Description: Responsive hair-blog theme with hardened mobile/desktop overflow protection, dynamic category navigation, configurable Adsterra placements and mobile post navigation.
Version: 1.2.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: hairs-heaven-mobile-ads
*/

:root {
  --hh-bg: #fff;
  --hh-text: #202124;
  --hh-muted: #6b7280;
  --hh-border: #e8e8e8;
  --hh-soft: #f7f7f7;
  --hh-content: 1240px;
  --hh-radius: 8px;
}

html { width: 100%; max-width: 100%; overflow-x: clip; }
body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  background: var(--hh-bg);
  color: var(--hh-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.72;
  -webkit-text-size-adjust: 100%;
}
*, *::before, *::after { box-sizing: border-box; min-width: 0; }

img, picture, video, canvas, svg, iframe, embed, object { max-width: 100%; }
img { height: auto; }
iframe, video { width: 100%; }
pre, code { max-width: 100%; overflow-x: auto; }
table { width: 100%; max-width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
input, select, textarea, button { max-width: 100%; font: inherit; }

.hh-wrap {
  width: calc(100% - 40px);
  max-width: var(--hh-content);
  margin-left: auto;
  margin-right: auto;
}

.site-header { background: #fff; border-bottom: 1px solid var(--hh-border); }
.hh-header-inner {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}
.site-branding { flex: 0 0 auto; max-width: min(320px, 42vw); }
.site-title { margin: 0; font-size: clamp(25px, 3vw, 34px); line-height: 1.1; font-weight: 700; }
.site-title a { color: #111; text-decoration: none; }
.custom-logo-link { display: inline-flex; align-items: center; max-width: 100%; }
.custom-logo { display: block; max-height: 64px; max-width: 100%; width: auto; object-fit: contain; }

.primary-nav { flex: 1 1 auto; }
.primary-nav ul { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px 20px; margin: 0; padding: 0; list-style: none; }
.primary-nav li { margin: 0; }
.primary-nav a { color: #252525; text-decoration: none; font-size: 14px; line-height: 1.35; font-weight: 650; overflow-wrap: anywhere; }
.primary-nav a:hover { text-decoration: underline; }

.hh-mobile-menu { display: none; flex: 0 0 auto; }
.hh-mobile-menu summary { cursor: pointer; list-style: none; font-weight: 700; padding: 9px 12px; border: 1px solid var(--hh-border); border-radius: 7px; background: #fff; }
.hh-mobile-menu summary::-webkit-details-marker { display: none; }
.hh-mobile-menu .menu, .hh-mobile-menu > ul { list-style: none; margin: 10px 0 0; padding: 12px; border: 1px solid var(--hh-border); border-radius: 8px; background: #fff; }
.hh-mobile-menu li + li { margin-top: 7px; }
.hh-mobile-menu a { color: #222; text-decoration: none; font-weight: 600; overflow-wrap: anywhere; }

/* Always uses the site's real WordPress categories, so menu assignment cannot break it. */
.hh-category-bar { width: 100%; border-bottom: 1px solid var(--hh-border); background: #fff; overflow: hidden; }
.hh-category-scroll { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px 10px; padding: 11px 0; }
.hh-category-scroll a { display: inline-flex; align-items: center; min-height: 34px; padding: 6px 11px; border: 1px solid var(--hh-border); border-radius: 999px; color: #262626; background: #fff; text-decoration: none; font-size: 13px; font-weight: 650; line-height: 1.25; }
.hh-category-scroll a:hover { background: var(--hh-soft); }

.site-main { padding: 42px 0 60px; }
.page-title, .archive-title { margin: 0 0 28px; font-size: clamp(30px, 4vw, 44px); line-height: 1.15; overflow-wrap: anywhere; }

.hh-post-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 30px 24px; width: 100%; }
.hh-card { width: 100%; min-width: 0; }
.hh-card-thumb { display: block; width: 100%; aspect-ratio: 4 / 5; overflow: hidden; border-radius: var(--hh-radius); background: var(--hh-soft); margin-bottom: 14px; }
.hh-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hh-card-category { margin: 0 0 6px; color: var(--hh-muted); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.hh-card-category a { color: inherit; text-decoration: none; }
.hh-card-title { margin: 0; font-size: 21px; line-height: 1.34; overflow-wrap: anywhere; }
.hh-card-title a { color: #171717; text-decoration: none; }
.hh-card-title a:hover { text-decoration: underline; }
.hh-card-date { margin-top: 8px; color: var(--hh-muted); font-size: 13px; }

.hh-pagination { margin-top: 42px; overflow: hidden; }
.hh-pagination .nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
.hh-pagination .page-numbers { display: inline-flex; min-width: 38px; min-height: 38px; align-items: center; justify-content: center; border: 1px solid var(--hh-border); border-radius: 6px; color: #222; text-decoration: none; padding: 5px 10px; }
.hh-pagination .current { background: #111; color: #fff; border-color: #111; }

.hh-single-wrap { display: grid; grid-template-columns: minmax(0, 820px) minmax(240px, 320px); justify-content: space-between; align-items: start; gap: 54px; width: 100%; }
.hh-article { width: 100%; min-width: 0; }
.hh-single-category { margin-bottom: 8px; font-size: 13px; font-weight: 700; color: var(--hh-muted); }
.hh-single-category a { color: inherit; text-decoration: none; }
.entry-title { margin: 0 0 10px; font-size: clamp(32px, 5vw, 48px); line-height: 1.14; overflow-wrap: anywhere; word-break: normal; }
.entry-meta { color: var(--hh-muted); font-size: 14px; margin-bottom: 26px; overflow-wrap: anywhere; }
.hh-single-featured { margin: 0 0 28px; width: 100%; }
.hh-single-featured img { display: block; width: 100%; height: auto; border-radius: 6px; }
.entry-content { width: 100%; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.entry-content > * { max-width: 100%; }
.entry-content h2 { font-size: clamp(27px, 3.5vw, 36px); line-height: 1.25; margin-top: 45px; overflow-wrap: anywhere; }
.entry-content h3 { font-size: clamp(22px, 3vw, 28px); line-height: 1.3; margin-top: 34px; overflow-wrap: anywhere; }
.entry-content p { margin: 0 0 1.25em; }
.entry-content figure { margin: 30px 0; width: 100%; max-width: 100%; }
.entry-content img { display: block; max-width: 100%; height: auto; border-radius: 6px; }
.entry-content .alignwide, .entry-content .alignfull { width: 100% !important; max-width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; }
.entry-content .wp-block-image, .entry-content .wp-block-gallery, .entry-content .wp-block-video, .entry-content .wp-block-embed, .entry-content .wp-block-group, .entry-content .wp-block-cover { width: 100%; max-width: 100%; overflow: hidden; }
.entry-content .wp-block-columns { width: 100%; max-width: 100%; }
.entry-content a { overflow-wrap: anywhere; }
.entry-content [style*="width"] { max-width: 100% !important; }

.hh-sidebar { width: 100%; min-width: 0; }
.hh-widget { border-top: 2px solid #111; padding-top: 16px; margin-bottom: 34px; }
.hh-widget-title { margin: 0 0 14px; font-size: 20px; }
.hh-widget ul { margin: 0; padding-left: 19px; }
.hh-widget li + li { margin-top: 8px; }
.hh-widget a { color: #222; text-decoration: none; overflow-wrap: anywhere; }
.hh-widget a:hover { text-decoration: underline; }
.hh-sidebar-ad { margin-top: 0; }

/* Ad wrappers intentionally constrain fixed-size network code instead of allowing it to widen the page. */
.hh-ad-shell { display: block; width: 100%; max-width: 100%; overflow: hidden; clear: both; margin: 18px auto; text-align: center; }
.hh-ad { display: block; width: 100%; max-width: 100%; min-width: 0 !important; overflow: hidden !important; text-align: center; margin: 0 auto; position: relative; z-index: 1; line-height: 1; }
.hh-ad-label { font-size: 10px; line-height: 1; color: #999; margin-bottom: 6px; letter-spacing: .08em; text-transform: uppercase; }
.hh-ad > *, .hh-ad iframe, .hh-ad img, .hh-ad ins, .hh-ad object, .hh-ad embed { max-width: 100% !important; }
.hh-ad iframe { display: inline-block !important; border: 0; overflow: hidden; }
.hh-ad img { height: auto !important; }
.hh-ad ins { margin-left: auto !important; margin-right: auto !important; }
.hh-header-ad-wrap { overflow: hidden; }
.hh-header-ad { margin-top: 2px; }
.hh-intro-ad { margin-top: 4px; }
.hh-after-image-ad { margin-top: 4px; }

.hh-mobile-post-nav { display: none; }

.site-footer { border-top: 1px solid var(--hh-border); padding: 42px 0 24px; background: #fff; }
.hh-footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 34px; }
.hh-footer-title { margin: 0 0 8px; font-size: 24px; }
.site-footer h3 { margin-top: 0; font-size: 18px; }
.site-footer ul { margin: 0; padding-left: 18px; }
.site-footer a { color: #222; text-decoration: none; overflow-wrap: anywhere; }
.site-footer a:hover { text-decoration: underline; }
.hh-copyright { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--hh-border); color: var(--hh-muted); font-size: 14px; }

@media (max-width: 1100px) {
  .hh-wrap { width: calc(100% - 32px); }
  .hh-post-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hh-single-wrap { grid-template-columns: minmax(0, 1fr) 260px; gap: 34px; }
  .primary-nav ul { gap: 6px 13px; }
  .primary-nav a { font-size: 13px; }
}

@media (max-width: 860px) {
  .hh-header-inner { min-height: 72px; gap: 14px; }
  .primary-nav { display: none; }
  .hh-mobile-menu { display: block; position: relative; z-index: 100; }
  .hh-mobile-menu[open] { width: min(300px, calc(100vw - 28px)); }
  .hh-mobile-menu .menu { position: absolute; right: 0; width: min(300px, calc(100vw - 28px)); max-height: min(70vh, 540px); overflow-y: auto; box-shadow: 0 12px 30px rgba(0,0,0,.10); }
  .hh-category-scroll { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: none; padding: 9px 0; }
  .hh-category-scroll::-webkit-scrollbar { display: none; }
  .hh-category-scroll a { flex: 0 0 auto; white-space: nowrap; }
  .hh-post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 25px 16px; }
  .hh-single-wrap { display: block; }
  .hh-sidebar { margin-top: 48px; }
  .hh-sidebar .hh-ad-shell { display: none; }
  .hh-footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  html, body { overflow-x: hidden; }
  body { font-size: 16px; line-height: 1.68; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .hh-wrap { width: calc(100% - 24px); max-width: calc(100vw - 24px); }
  .site-main { padding-top: 28px; padding-bottom: 42px; }
  .site-branding { max-width: calc(100vw - 112px); }
  .site-title { font-size: 25px; }
  .custom-logo { max-height: 50px; }
  .hh-post-grid { grid-template-columns: 1fr; gap: 30px; }
  .hh-card-title { font-size: 22px; }
  .entry-title { font-size: clamp(30px, 9vw, 36px); }
  .entry-content h2 { font-size: clamp(25px, 7.5vw, 29px); }
  .entry-content h3 { font-size: clamp(21px, 6.5vw, 24px); }
  .entry-content ul, .entry-content ol { padding-left: 22px; }
  .entry-content .wp-block-columns { display: block; }
  .entry-content .wp-block-column { width: 100% !important; flex-basis: 100% !important; }
  .hh-footer-grid { grid-template-columns: 1fr; }

  .hh-ad-shell { width: 100%; max-width: 100%; margin: 16px auto 20px; overflow: hidden !important; }
  .hh-ad { width: 100% !important; max-width: 100% !important; min-width: 0 !important; overflow: hidden !important; }
  .hh-ad > div, .hh-ad > span, .hh-ad iframe, .hh-ad ins, .hh-ad object, .hh-ad embed { max-width: 100% !important; }

  .hh-mobile-post-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9998;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 8px max(10px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-right));
    background: rgba(255,255,255,.98);
    border-top: 1px solid var(--hh-border);
    box-shadow: 0 -5px 18px rgba(0,0,0,.08);
  }
  .hh-mobile-post-nav a { min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: #111; color: #fff; text-decoration: none; font-size: 14px; line-height: 1; }
  .hh-mobile-post-nav a span { font-size: 19px; line-height: 1; }
  .hh-post-nav-empty { display: block; }
}
