/*
Theme Name: TechStyle NG
Theme URI: https://techstyleng.com
Author: TechStyle NG
Description: A black and white editorial tech news theme with a full-screen menu, lead story with latest rail, list feed, category sections, author credentials, sources and structured data for E-E-A-T.
Version: 3.0.1
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: techstyleng
Tags: blog, news, two-columns, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready, dark-mode
*/

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --panel: #f4f4f4;
  --ink: #0a0a0a;
  --muted: #404040;
  --line: #e4e4e4;
  --brand: #0a0a0a;
  --brand-ink: #ffffff;
  --accent: #0a0a0a;
  --radius: 2px;
  --shadow: 0 8px 24px rgba(0,0,0,.12);
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Space Grotesk", "Inter", system-ui, sans-serif;
  --max: 1240px;
  --header-total: 69px;
}

:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #0a0a0a;
  --panel: #161616;
  --ink: #f5f5f5;
  --muted: #a3a3a3;
  --line: #2a2a2a;
  --brand: #ffffff;
  --brand-ink: #0a0a0a;
  --accent: #ffffff;
  --shadow: 0 8px 24px rgba(0,0,0,.6);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 17px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
body.menu-open { overflow: hidden; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.015em; font-weight: 700; }

.screen-reader-text { position: absolute !important; clip: rect(1px,1px,1px,1px); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
.skip-link:focus { clip: auto; width: auto; height: auto; background: var(--ink); color: var(--bg); padding: 10px 16px; z-index: 1000; top: 8px; left: 8px; }
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 100; background: var(--surface); border-top: 4px solid var(--ink); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 28px; height: 64px; }
.site-title { font-family: var(--font-head); font-weight: 700; font-size: 1.55rem; margin: 0; letter-spacing: -.03em; }
.site-title a { color: var(--ink); }
.site-title a:hover { text-decoration: none; }
.site-title span { font-weight: 500; }
.custom-logo { max-height: 38px; width: auto; }

.main-nav { align-self: stretch; display: flex; }
.main-nav ul { display: flex; list-style: none; margin: 0; padding: 0; }
.main-nav li { display: flex; }
.main-nav a {
  display: flex; align-items: center; padding: 0 13px; color: var(--ink);
  font-family: var(--font-head); font-weight: 600; font-size: .9rem;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.main-nav a:hover, .main-nav .current-menu-item > a, .main-nav .current-cat > a { border-bottom-color: var(--ink); text-decoration: none; }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; background: transparent;
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); cursor: pointer; font-size: 1rem;
}
.icon-btn:hover { border-color: var(--ink); }
.menu-btn {
  display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px;
  background: var(--ink); color: var(--bg); border: 0; border-radius: var(--radius);
  font: 600 .9rem var(--font-head); cursor: pointer;
}
.menu-btn:hover { opacity: .88; }
.burger, .burger::before, .burger::after { display: block; width: 16px; height: 2px; background: currentColor; }
.burger { position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -5px; }
.burger::after { top: 5px; }
.subscribe-btn {
  font: 600 .88rem var(--font-head); color: var(--ink); border: 1px solid var(--ink);
  padding: 9px 14px; border-radius: var(--radius); white-space: nowrap;
}
.subscribe-btn:hover { background: var(--ink); color: var(--bg); text-decoration: none; }

.search-panel { display: none; border-top: 1px solid var(--line); padding: 14px 0; background: var(--panel); }
.search-panel.open { display: block; }
.search-form { display: flex; gap: 8px; }
.search-form input[type="search"] {
  flex: 1; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: inherit;
}
.btn, .search-form input[type="submit"], .comment-form input[type="submit"] {
  display: inline-block; background: var(--ink); color: var(--bg); border: 0; border-radius: var(--radius);
  padding: 11px 18px; font: 600 .95rem var(--font-head); cursor: pointer;
}
.btn:hover { text-decoration: none; opacity: .88; }

/* ---------- Full-screen menu ---------- */
.mega {
  display: none; position: fixed; left: 0; right: 0; top: var(--header-total); bottom: 0; z-index: 90;
  background: var(--surface); overflow-y: auto; padding: 40px 0 70px;
}
.mega.open { display: block; }
.mega-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 48px; }
.mega-title { font: 700 .75rem var(--font-head); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.mega ul { list-style: none; margin: 0; padding: 0; }
.mega-sections a { display: inline-block; padding: 4px 0; color: var(--ink); font: 700 clamp(1.6rem, 3.2vw, 2.4rem) var(--font-head); letter-spacing: -.02em; }
.mega-sections .sub-menu { padding: 2px 0 8px 18px; }
.mega-sections .sub-menu a { font-size: 1.15rem; font-weight: 600; }
.mega-links a, .mega-social a { display: inline-block; padding: 5px 0; color: var(--ink); font-weight: 500; }

/* ---------- Layout ---------- */
.site-main { padding: 28px 0 56px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; }
.layout.no-sidebar { grid-template-columns: minmax(0, 760px); justify-content: center; }

/* ---------- Labels, meta ---------- */
.cat-label { font: 700 .72rem var(--font-head); letter-spacing: .09em; text-transform: uppercase; color: var(--ink); }
.cat-label:hover { text-decoration: underline; }
.cat-badge {
  display: inline-block; align-self: flex-start; background: var(--ink); color: var(--bg);
  font: 700 .72rem var(--font-head); letter-spacing: .08em; text-transform: uppercase; padding: 4px 9px; border-radius: 2px;
}
.cat-badge:hover { text-decoration: none; opacity: .88; }
.meta { color: var(--muted); font-size: .85rem; display: flex; flex-wrap: wrap; gap: 4px 14px; }

.section-title { border-top: 4px solid var(--ink); padding-top: 10px; font-size: 1.3rem; margin-bottom: 18px; }

/* ---------- Home: lead + latest rail ---------- */
.lead-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 36px; padding-bottom: 32px; border-bottom: 1px solid var(--ink); margin-bottom: 24px; }
.lead-thumb { display: block; aspect-ratio: 16 / 9; background: var(--line); overflow: hidden; }
.lead-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.lead:hover .lead-thumb img { transform: scale(1.02); }
.lead-body { padding-top: 16px; }
.lead-body h2 { font-size: clamp(1.8rem, 3.4vw, 2.7rem); margin: 8px 0 12px; }
.lead-body h2 a { color: var(--ink); }
.lead-body h2 a:hover { text-decoration: underline; }
.lead-body p { color: var(--muted); font-size: 1.08rem; margin: 0 0 12px; }

.lead-list { border-left: 1px solid var(--line); padding-left: 28px; }
.rail-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; border-bottom: 3px solid var(--ink); padding-bottom: 8px; margin: 0 0 4px; }
.lead-list ol { list-style: none; margin: 0; padding: 0; counter-reset: n; }
.lead-list li { counter-increment: n; display: grid; grid-template-columns: 30px 1fr; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.lead-list li:last-child { border-bottom: 0; }
.lead-list li::before { content: counter(n); font: 700 1.5rem/1 var(--font-head); color: var(--muted); opacity: .45; }
.lead-list h3 { font-size: 1.02rem; margin: 3px 0 5px; }
.lead-list h3 a { color: var(--ink); }
.lead-list h3 a:hover { text-decoration: underline; }

/* ---------- Feed (list items) ---------- */
.feed { margin-bottom: 8px; }
.feed-item { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.feed-item:first-child { padding-top: 4px; }
.feed-body h2 { font-size: 1.4rem; margin: 6px 0 8px; }
.feed-body h2 a { color: var(--ink); }
.feed-body h2 a:hover { text-decoration: underline; }
.feed-body p { margin: 0 0 10px; color: var(--muted); }
.feed-thumb { aspect-ratio: 4 / 3; background: var(--line); overflow: hidden; align-self: start; display: block; }
.feed-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.post-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 24px; }
.card { display: flex; flex-direction: column; }
.card-thumb { aspect-ratio: 16 / 10; background: var(--line); overflow: hidden; display: block; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .card-thumb img { transform: scale(1.03); }
.card-body { padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.card-body h2 { font-size: 1.12rem; margin: 0; }
.card-body h2 a { color: var(--ink); }
.card-body h2 a:hover { text-decoration: underline; }
.card-body p { margin: 0; color: var(--muted); font-size: .95rem; }
.card-grid .card-body p { display: none; }

.home-section { margin-top: 44px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; border-top: 4px solid var(--ink); padding-top: 10px; margin-bottom: 20px; }
.section-head h2 { font-size: 1.5rem; margin: 0; }
.section-head a { font-weight: 600; font-size: .9rem; color: var(--ink); }

/* ---------- Sidebar ---------- */
.sidebar .widget { border-top: 4px solid var(--ink); padding-top: 12px; margin-bottom: 32px; }
.widget-title { font: 700 .8rem var(--font-head); text-transform: uppercase; letter-spacing: .12em; margin-bottom: 12px; }
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.widget li:last-child { border-bottom: 0; }
.widget a { color: var(--ink); }
.widget a:hover { text-decoration: underline; }
.newsletter-box { background: var(--panel); padding: 18px !important; }
.newsletter-box p { margin: 0 0 12px; color: var(--muted); font-size: .95rem; }

/* ---------- Single ---------- */
.entry { background: transparent; border: 0; }
.entry-header { padding: 0 0 8px; }
.entry-title { font-size: clamp(2rem, 4.4vw, 3rem); margin: 12px 0 14px; }
.entry-thumb { margin: 22px 0 0; }
.entry-thumb img { width: 100%; max-height: 560px; object-fit: cover; }
.entry-content { padding: 26px 0 16px; font-size: 1.12rem; line-height: 1.75; }
.entry-content > * + * { margin-top: 1.2em; }
.entry-content h2 { margin-top: 1.9em; font-size: 1.7rem; }
.entry-content h3 { margin-top: 1.5em; font-size: 1.3rem; }
.entry-content blockquote { margin-left: 0; padding: 2px 22px; border-left: 4px solid var(--ink); color: var(--muted); font-style: italic; }
.entry-content pre, .entry-content code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.entry-content pre { background: #0a0a0a; color: #f5f5f5; padding: 16px; overflow-x: auto; }
.entry-content :not(pre) > code { background: var(--panel); padding: 2px 6px; }
.entry-content a { text-decoration: underline; text-underline-offset: 3px; }
.entry-footer { padding: 0 0 24px; display: flex; flex-wrap: wrap; gap: 8px; }
.tag-link { background: var(--panel); border: 1px solid var(--line); color: var(--muted); padding: 4px 12px; font-size: .82rem; }
a.tag-link:hover { color: var(--ink); border-color: var(--ink); text-decoration: none; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.post-nav a { display: block; border: 1px solid var(--line); padding: 16px 18px; color: var(--ink); font-weight: 600; }
.post-nav a:hover { border-color: var(--ink); text-decoration: none; }
.post-nav small { display: block; color: var(--muted); font-weight: 500; }
.post-nav .next { text-align: right; }

.archive-header { margin-bottom: 28px; border-top: 4px solid var(--ink); padding-top: 14px; }
.archive-header h1 { font-size: clamp(1.8rem, 3.6vw, 2.4rem); }
.archive-header p { color: var(--muted); margin: 0; }

.pagination { margin-top: 32px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 8px; }
.pagination .page-numbers { padding: 8px 14px; border: 1px solid var(--line); color: var(--ink); }
.pagination .current, .pagination a.page-numbers:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); text-decoration: none; }

/* ---------- Comments ---------- */
.comments-area { margin-top: 32px; border-top: 4px solid var(--ink); padding-top: 16px; }
.comment-list { list-style: none; padding: 0; margin: 0 0 24px; }
.comment-list .children { list-style: none; padding-left: 28px; }
.comment-body { padding: 16px 0; border-bottom: 1px solid var(--line); }
.comment-author img { display: inline-block; border-radius: 50%; margin-right: 10px; vertical-align: middle; }
.comment-form label { display: block; font-weight: 600; margin-bottom: 4px; }
.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 var(--line); background: var(--surface); color: var(--ink); font: inherit; border-radius: var(--radius);
}

/* ---------- Newsletter band + footer ---------- */
.newsletter-band { background: var(--panel); border-top: 1px solid var(--line); padding: 34px 0; }
.newsletter-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.newsletter-inner h2 { font-size: 1.5rem; margin: 0 0 4px; }
.newsletter-inner p { margin: 0; color: var(--muted); }

.site-footer { background: var(--bg); color: var(--ink); padding: 48px 0 24px; border-top: 4px solid var(--ink); }
.site-footer a { color: var(--ink); }
.site-footer a:hover { text-decoration: underline; }
.site-footer .widget-title { color: var(--ink); }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1.2fr 1fr; gap: 32px; margin-bottom: 28px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { padding: 4px 0; }
.footer-note { color: var(--muted); margin: 0 0 .6em; font-size: .92rem; }
.footer-social { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; }
.footer-social a { font-size: .9rem; text-decoration: underline; text-underline-offset: 3px; }
.footer-bottom { border-top: 1px solid var(--line); padding-top: 18px; color: var(--muted); font-size: .88rem; }

.not-found { text-align: center; padding: 60px 0; }
.not-found h1 { font-size: 5rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .main-nav { display: none; }
  .layout { grid-template-columns: 1fr; gap: 36px; }
  .lead-grid { grid-template-columns: 1fr; }
  .lead-list { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 18px; }
  .mega-grid { grid-template-columns: 1fr; gap: 32px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .subscribe-btn { display: none; }
  .header-inner { gap: 12px; }
  .site-title { font-size: 1.35rem; }
  .feed-item { grid-template-columns: minmax(0, 1fr) 110px; gap: 14px; }
  .feed-body h2 { font-size: 1.12rem; }
  .feed-body p { display: none; }
  .post-grid, .card-grid { grid-template-columns: 1fr; }
  .post-nav { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .menu-label { display: none; }
  .menu-btn { padding: 0 12px; }
}

/* ---------- WordPress core ---------- */
.alignleft { float: left; margin: 0 1em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1em; }
.aligncenter { margin-left: auto; margin-right: auto; }
.wp-caption-text, figcaption { color: var(--muted); font-size: .85rem; margin-top: 6px; }
