/*
Theme Name: IFixIt
Theme URI: https://ifixit.org.uk
Author: IFixIt
Description: Custom news/blog-style WordPress theme for ifixit.org.uk. Header navigation is a normal editable WordPress Menu (set it yourself under Appearance → Menus) rather than hardcoded categories. Homepage features the latest Phone Repair post up top, followed by an AJAX "load more" feed of the site's latest posts (auto-loads the first 15, then unlimited on click). Includes sponsor/ad widget areas and AJAX-loaded related posts on single articles.
Version: 1.0
Requires at least: 5.9
Requires PHP: 7.4
Text Domain: ifixit
*/

:root{
  --ifx-blue:#0b6efd;
  --ifx-dark:#0a1a2f;
  --ifx-text:#111318;
  --ifx-muted:#5b6270;
  --ifx-border:#e6e8ec;
  --ifx-bg:#f7f7f8;
  --ifx-white:#ffffff;
}

*{box-sizing:border-box;}
body{
  margin:0;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  color:var(--ifx-text);
  background:var(--ifx-bg);
}
a{color:inherit;text-decoration:none;}
a:hover{text-decoration:underline;}
img{max-width:100%;display:block;}
.container{max-width:1240px;margin:0 auto;padding:0 20px;}

/* ---------- Header ---------- */
.ifx-header{background:var(--ifx-white);border-bottom:1px solid var(--ifx-border);position:sticky;top:0;z-index:50;}
.ifx-header-inner{display:flex;align-items:center;gap:24px;padding:14px 0;}
.ifx-logo{font-size:22px;font-weight:800;color:var(--ifx-blue);white-space:nowrap;}
.ifx-search{flex:1;display:flex;align-items:center;background:var(--ifx-bg);border:1px solid var(--ifx-border);border-radius:24px;padding:8px 16px;max-width:480px;}
.ifx-search input{border:0;background:transparent;outline:0;flex:1;font-size:14px;}
.ifx-search button{border:0;background:var(--ifx-blue);color:#fff;width:32px;height:32px;border-radius:50%;cursor:pointer;}

/* Menu comes from a normal WP Menu (Appearance → Menus) — no categories hardcoded in the theme */
.ifx-nav{display:flex;flex-wrap:wrap;row-gap:8px;gap:22px;padding:12px 0;border-top:1px solid var(--ifx-border);list-style:none;margin:0;}
.ifx-nav li{display:inline;}
.ifx-nav a{font-weight:600;font-size:14px;white-space:nowrap;color:var(--ifx-text);padding:4px 0;}
.ifx-nav a:hover,.ifx-nav .current-menu-item>a,.ifx-nav .current-menu-parent>a,.ifx-nav .current_page_item>a{color:var(--ifx-blue);text-decoration:none;border-bottom:2px solid var(--ifx-blue);}
.ifx-nav-empty{font-size:13px;color:var(--ifx-muted);padding:8px 0;}
@media(max-width:640px){.ifx-nav{gap:14px;}}

/* ---------- Hero (featured: latest Phone Repair post) ---------- */
.ifx-hero{display:grid;grid-template-columns:2fr 1fr;gap:20px;margin:20px 0;}
.ifx-hero-main{background:#fff;border:1px solid var(--ifx-border);border-radius:8px;overflow:hidden;display:grid;grid-template-columns:1.1fr 1fr;}
.ifx-hero-main img{width:100%;height:100%;object-fit:cover;min-height:260px;}
.ifx-hero-main-body{padding:22px;display:flex;flex-direction:column;justify-content:center;}
.ifx-cat-pill{display:inline-block;background:var(--ifx-blue);color:#fff;font-size:11px;font-weight:700;padding:3px 10px;border-radius:12px;text-transform:uppercase;letter-spacing:.04em;margin-bottom:10px;width:fit-content;}
.ifx-hero-main-body h1{font-size:26px;line-height:1.25;margin:0 0 10px;}
.ifx-hero-main-body p{color:var(--ifx-muted);font-size:14px;line-height:1.5;margin:0 0 12px;}
.ifx-byline{font-size:12px;color:var(--ifx-muted);}
.ifx-ad-slot{background:#fff;border:1px dashed #c9cdd6;border-radius:8px;display:flex;align-items:center;justify-content:center;min-height:260px;color:#9aa0ab;font-size:13px;text-align:center;padding:16px;}
.ifx-ad-slot .widget{width:100%;}

/* ---------- Section layout ---------- */
.ifx-section-title{display:flex;align-items:center;gap:8px;font-size:18px;font-weight:800;margin:34px 0 16px;}
.ifx-main-grid{display:grid;grid-template-columns:2.3fr 1fr;gap:24px;align-items:start;}
.ifx-post-list{display:flex;flex-direction:column;gap:0;}
.ifx-post-row{display:flex;gap:16px;padding:18px 0;border-bottom:1px solid var(--ifx-border);}
.ifx-post-row img{width:220px;height:130px;object-fit:cover;border-radius:6px;flex-shrink:0;}
.ifx-post-row-body{flex:1;}
.ifx-post-row-body .ifx-cat-tag{font-size:11px;font-weight:700;color:var(--ifx-blue);text-transform:uppercase;letter-spacing:.03em;}
.ifx-post-row-body h3{font-size:18px;line-height:1.3;margin:6px 0 8px;}
.ifx-post-row-body p{font-size:13.5px;color:var(--ifx-muted);margin:0 0 8px;line-height:1.5;}
.ifx-meta{font-size:12px;color:var(--ifx-muted);}

.ifx-loadmore-wrap{text-align:center;margin:26px 0;}
.ifx-loadmore{background:var(--ifx-blue);color:#fff;border:0;padding:12px 30px;border-radius:24px;font-weight:700;font-size:14px;cursor:pointer;}
.ifx-loadmore:hover{opacity:.9;}
.ifx-loadmore[disabled]{opacity:.5;cursor:default;}
.ifx-loadmore-msg{font-size:13px;color:var(--ifx-muted);margin-top:8px;}

/* ---------- Sidebar ---------- */
.ifx-sidebar > *{margin-bottom:22px;}
.ifx-widget{background:#fff;border:1px solid var(--ifx-border);border-radius:8px;padding:18px;}
.ifx-widget h3{font-size:15px;font-weight:800;margin:0 0 14px;}
.ifx-sidebar-post{display:flex;gap:10px;padding:10px 0;border-bottom:1px solid var(--ifx-border);}
.ifx-sidebar-post:last-child{border-bottom:0;}
.ifx-sidebar-post img{width:70px;height:56px;object-fit:cover;border-radius:5px;flex-shrink:0;}
.ifx-sidebar-post h4{font-size:13px;line-height:1.35;margin:0;}
.ifx-cat-list a{display:block;padding:8px 0;border-bottom:1px solid var(--ifx-border);font-size:13.5px;font-weight:600;}
.ifx-cat-list a:last-child{border-bottom:0;}

/* ---------- Single article ---------- */
.ifx-article-wrap{display:grid;grid-template-columns:2.3fr 1fr;gap:24px;align-items:start;margin:24px 0;}
.ifx-article{background:#fff;border:1px solid var(--ifx-border);border-radius:8px;padding:26px;}
.ifx-article .ifx-cat-pill{margin-bottom:12px;}
.ifx-article h1{font-size:30px;line-height:1.3;margin:0 0 12px;}
.ifx-article .ifx-byline{margin-bottom:18px;padding-bottom:18px;border-bottom:1px solid var(--ifx-border);}
.ifx-article-body{font-size:16px;line-height:1.75;color:#242731;}
.ifx-article-body p{margin:0 0 18px;}
.ifx-article-body img{border-radius:6px;margin:18px 0;}
.ifx-article-thumb{width:100%;height:auto;border-radius:6px;margin-bottom:18px;}

.ifx-related{margin-top:34px;padding-top:24px;border-top:1px solid var(--ifx-border);}
.ifx-related h2{font-size:18px;font-weight:800;margin:0 0 16px;}
.ifx-related-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:16px;}
.ifx-related-item img{width:100%;height:120px;object-fit:cover;border-radius:6px;margin-bottom:8px;}
.ifx-related-item .ifx-cat-tag{font-size:10.5px;font-weight:700;color:var(--ifx-blue);text-transform:uppercase;}
.ifx-related-item h4{font-size:13.5px;line-height:1.35;margin:5px 0 0;}
.ifx-related-loadmore-wrap{text-align:center;margin-top:18px;}

/* ---------- Footer ---------- */
.ifx-footer{background:var(--ifx-dark);color:#c7cbd6;margin-top:50px;padding:40px 0 26px;}
.ifx-footer .container{display:flex;justify-content:space-between;flex-wrap:wrap;gap:20px;}
.ifx-footer a{color:#c7cbd6;}
.ifx-footer-nav{display:flex;gap:16px;flex-wrap:wrap;font-size:13px;list-style:none;margin:0;padding:0;}
.ifx-footer-bottom{text-align:center;font-size:12px;color:#8890a0;margin-top:24px;}

/* ---------- Responsive ---------- */
@media(max-width:900px){
  .ifx-hero{grid-template-columns:1fr;}
  .ifx-hero-main{grid-template-columns:1fr;}
  .ifx-main-grid,.ifx-article-wrap{grid-template-columns:1fr;}
  .ifx-post-row{flex-direction:column;}
  .ifx-post-row img{width:100%;height:180px;}
  .ifx-related-grid{grid-template-columns:1fr;}
}
