/*
Theme Name: PureAPK Posts Theme
Author: Custom
Version: 1.0.0
Description: App-store style layout for normal WordPress Posts (no Apps CPT). Includes RTL/Urdu auto-font support.
Text Domain: pureapk-posts
*/

:root{
  --bg:#f5f7fb;
  --card:#fff;
  --text:#101828;
  --muted:#667085;
  --line:#e5e7eb;
  --brand:#2563eb;
  --brand2:#1d4ed8;
  --radius:14px;
  --shadow: 0 8px 22px rgba(16,24,40,.06);
  --max: 1180px;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: Inter, "Noto Nastaliq Urdu", "Noto Sans Arabic", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
}
a{color:inherit;text-decoration:none}
img{max-width:100%;height:auto;display:block}

.container{max-width:var(--max); margin:0 auto; padding:14px;}

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.topbar{
  position: sticky; top:0; z-index:50;
  background:#fff;
  border-bottom:1px solid var(--line);
}
.toprow{display:flex; align-items:center; gap:12px; padding:12px 0;}
.logo{font-weight:800; letter-spacing:.3px; display:flex; align-items:center; gap:10px; white-space:nowrap;}
.logo-badge{width:34px;height:34px;border-radius:10px; background: linear-gradient(135deg, var(--brand), #60a5fa); display:inline-block;}
.header-search{flex:1; display:flex; align-items:center; background:#f1f5f9; border:1px solid #e2e8f0; border-radius:999px; padding:10px 12px; min-width:240px;}
.header-search input[type="search"]{width:100%; border:0; outline:0; background:transparent; font-size:14px;}
.nav{display:flex; align-items:center; gap:10px;}
.nav a{padding:8px 10px; border-radius:999px; font-weight:600; font-size:13px; color:var(--muted);}
.nav a.active{background:#eef2ff; color:var(--brand2);}
.burger{width:38px;height:38px;border-radius:12px; border:1px solid var(--line); background:#fff; display:none; align-items:center; justify-content:center; cursor:pointer;}
.burger span{width:18px;height:2px;background:#111; display:block; position:relative;}
.burger span:before,.burger span:after{content:""; position:absolute; left:0; width:18px;height:2px;background:#111;}
.burger span:before{top:-6px;} .burger span:after{top:6px;}

.layout{display:grid; grid-template-columns: 1fr 340px; gap:14px; padding-top:14px;}
.section{padding:12px;}
.section-head{display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px;}
.section-title{display:flex; align-items:center; gap:8px; font-weight:800; font-size:14px;}
.dot{width:22px;height:22px;border-radius:8px; background:#eef2ff; color:var(--brand2); display:flex; align-items:center; justify-content:center; font-weight:800; font-size:12px;}
.viewall{font-size:12px; font-weight:700; color:var(--brand2); background:#eef2ff; padding:7px 10px; border-radius:999px; border:1px solid #e0e7ff; white-space:nowrap;}

.apps-grid{display:grid; grid-template-columns: repeat(5, 1fr); gap:10px;}
.app{border:1px solid var(--line); border-radius:14px; background:#fff; overflow:hidden; transition: transform .08s ease, box-shadow .08s ease;}
.app:hover{ transform: translateY(-2px); box-shadow: 0 14px 30px rgba(16,24,40,.10); }
.app-top{padding:10px 10px 8px; display:flex; gap:10px; align-items:center;}
.icon{width:42px;height:42px;border-radius:12px; background:#f1f5f9; border:1px solid #e2e8f0; overflow:hidden; flex:0 0 42px;}
.icon img{width:100%;height:100%;object-fit:cover;}
.app-name{font-size:12px; font-weight:800; line-height:1.2; margin:0; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;}
.app-meta{font-size:11px; color:var(--muted); margin-top:3px; display:flex; gap:8px; flex-wrap:wrap;}
.pill{border:1px solid var(--line); background:#fff; border-radius:999px; padding:3px 7px; font-weight:700; font-size:10px; color:#475467;}
.app-actions{padding:0 10px 10px; display:flex; justify-content:space-between; align-items:center; gap:8px;}
.btn{flex:1; background:var(--brand); color:#fff; border:0; border-radius:999px; padding:8px 10px; font-size:12px; font-weight:800; cursor:pointer; text-align:center;}
.btn:hover{ background:var(--brand2); }
.mini{font-size:11px; color:var(--muted); white-space:nowrap;}

.two-col{display:grid; grid-template-columns: 1.2fr .8fr; gap:12px;}
.list{display:flex; flex-direction:column; gap:10px;}
.row{display:flex; gap:10px; align-items:center; padding:10px; border:1px solid var(--line); border-radius:14px; background:#fff;}
.row .icon{width:44px;height:44px; border-radius:14px;}
.row h4{margin:0;font-size:12px;font-weight:900; line-height:1.2;}
.row .sub{font-size:11px;color:var(--muted); margin-top:4px;}
.row .right{margin-left:auto; display:flex; align-items:center; gap:10px; white-space:nowrap;}
.dl{display:inline-flex; align-items:center; gap:6px; padding:7px 10px; border-radius:999px; border:1px solid #dbeafe; background:#eff6ff; color:#1d4ed8; font-weight:900; font-size:12px;}

.ad{border:1px dashed #cbd5e1; border-radius:16px; background:#fff; padding:10px; text-align:center; color:var(--muted);}
.ad img{width:100%; border-radius:12px;}
.ad small{display:block; margin-top:6px;}

.side .box{ padding:12px; }
.side .box h3{margin:0 0 10px; font-size:12px; font-weight:900; color:#111; text-transform:uppercase; letter-spacing:.7px; text-align:center;}
.trust{display:flex; justify-content:center; align-items:center; border:1px solid var(--line); border-radius:14px; height:44px; font-weight:900; color:#111; background:#fff;}
.popular .p{display:flex; gap:10px; align-items:flex-start; padding:10px; border:1px solid var(--line); border-radius:14px; background:#fff;}
.popular .p .icon{width:36px;height:36px;border-radius:12px;}
.popular .p .t{font-size:12px;font-weight:900; line-height:1.25;}
.popular .p .m{font-size:11px;color:var(--muted); margin-top:4px;}
.tags{display:flex; flex-wrap:wrap; gap:8px; justify-content:center;}
.tag{border:1px solid #dbeafe; background:#eff6ff; color:#1d4ed8; font-weight:900; font-size:11px; padding:6px 10px; border-radius:999px;}

/* Post page */
.post-wrap{padding:12px;}
.post-wrap h1{margin:0 0 10px; font-size:22px;}
.post-meta{color:var(--muted); font-size:12px; margin-bottom:10px;}
.post-content{line-height:1.8; color:#111;}
.post-content p{margin: 0 0 14px;}
.footer{padding:18px 0; color:var(--muted); font-size:12px; text-align:center;}

/* Urdu / RTL (auto via body class) */
body.pureapk-font-ur{font-family:"Noto Nastaliq Urdu","Noto Sans Arabic",serif;}
body.pureapk-rtl{direction:rtl;}
body.pureapk-rtl .row .right{margin-left:0; margin-right:auto;}

/* Responsive */
@media (max-width: 1100px){ .apps-grid{ grid-template-columns: repeat(4, 1fr);} }
@media (max-width: 920px){
  .layout{ grid-template-columns: 1fr; }
  .side{ order:2; }
  .apps-grid{ grid-template-columns: repeat(3, 1fr); }
  .two-col{ grid-template-columns: 1fr; }
  .burger{ display:flex; }
  .nav{ display:none; }
}
@media (max-width: 520px){
  .apps-grid{ grid-template-columns: repeat(2, 1fr); }
  .search{ min-width: 0; }
}


/* Single post app header (v2) */
.app-hero{ padding:14px; margin-bottom:14px; }
.app-hero-head{ display:flex; gap:14px; align-items:center; margin-bottom:12px; }
.app-hero-icon{ width:78px; height:78px; border-radius:18px; overflow:hidden; background:#f1f5f9; border:1px solid #e2e8f0; flex:0 0 78px;}
.app-hero-icon img{ width:100%; height:100%; object-fit:cover; }
.app-hero-title{ font-size:22px; font-weight:900; line-height:1.2; margin:0; }
.app-hero-sub{ margin-top:6px; color:var(--muted); font-size:12px; }
.app-hero-grid{ display:grid; grid-template-columns: repeat(3, 1fr); gap:10px; margin-top:10px; }
.app-hero-item{ padding:10px; border:1px solid var(--line); border-radius:14px; background:#fff; }
.app-hero-item b{ display:block; margin-bottom:6px; font-size:12px; }
.app-hero-item div{ font-size:12px; color:#111; }
.app-hero-actions{ display:flex; justify-content:center; margin-top:14px; }
.app-hero-actions a{ min-width: 240px; text-align:center; }
@media (max-width: 780px){
  .app-hero-grid{ grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px){
  .app-hero-actions a{ min-width: 100%; }
  .app-hero-head{ align-items:flex-start; }
}


/* Search form fix (v3) */
.header-search form.pureapk-search-form{
  width:100%;
  display:flex;
  align-items:center;
  gap:8px;
}
.header-search form.pureapk-search-form input[type="search"]{
  flex:1;
  min-width:0;
}
.header-search form.pureapk-search-form .pureapk-search-btn{
  border:0;
  background:transparent;
  cursor:pointer;
  font-size:16px;
  line-height:1;
  padding:4px 6px;
}


/* Fix WP body.search class conflict: header search uses .header-search (v4) */


/* Logo fix (v5) */
.logo .custom-logo-link{ display:flex; align-items:center; }
.logo .custom-logo{ max-height:38px; width:auto; height:auto; display:block; }



/* Top menu markup from wp_nav_menu */
.nav .top-menu{ display:flex; gap:10px; margin:0; padding:0; list-style:none; align-items:center; }
.nav .top-menu li{ margin:0; padding:0; }
.nav .top-menu a{
  padding:8px 10px;
  border-radius:999px;
  font-weight:600;
  font-size:13px;
  color:var(--muted);
  display:inline-block;
}
.nav .top-menu a:hover{ background:#f1f5f9; }
.nav .top-menu .current-menu-item > a,
.nav .top-menu .current_page_item > a{
  background:#eef2ff;
  color:var(--brand2);
}

/* Mobile menu (v6) */
.mobile-menu-overlay{
  position:fixed; inset:0;
  background:rgba(0,0,0,.35);
  opacity:0; visibility:hidden;
  transition:opacity .15s ease, visibility .15s ease;
  z-index:60;
}
.mobile-menu{
  position:fixed;
  top:0; right:0;
  height:100%;
  width:320px;
  max-width:86vw;
  background:#fff;
  border-left:1px solid var(--line);
  box-shadow:0 20px 60px rgba(0,0,0,.2);
  transform:translateX(102%);
  transition:transform .18s ease;
  z-index:61;
  display:flex;
  flex-direction:column;
}
.mobile-menu.is-open{ transform:translateX(0); }
.mobile-menu-overlay.is-open{ opacity:1; visibility:visible; }
.mobile-menu-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px;
  border-bottom:1px solid var(--line);
}
.mobile-menu-title{ font-weight:900; }
.mobile-menu-close{
  width:38px; height:38px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#fff;
  cursor:pointer;
}
.mobile-menu-links{ padding:10px 14px 16px; overflow:auto; }
.mobile-menu-links a{
  display:block;
  padding:12px 10px;
  border-radius:12px;
  border:1px solid var(--line);
  margin-bottom:10px;
  font-weight:800;
}
.mobile-menu-links a:hover{ background:#f8fafc; }

.mobile-menu-links .mobile-menu-list{ list-style:none; padding:0; margin:0; }
.mobile-menu-links .mobile-menu-list li{ margin:0; padding:0; }

html.menu-open, html.menu-open body{ overflow:hidden; }



/* Post paragraph color cycling (v8)
   Note: CSS can't reliably color "every 3 lines" because lines change with screen size.
   This cycles colors by PARAGRAPH blocks. */
.post-content p{ color:#111; }
.post-content p:nth-of-type(3n+1){ color:#111; }
.post-content p:nth-of-type(3n+2){ color:#1d4ed8; }
.post-content p:nth-of-type(3n){ color:#16a34a; }
