/*
Theme Name: Trending NZ News
Theme URI: https://trendingnz.co.nz/
Author: Trending NZ
Description: Lightweight, fast news theme for Trending NZ. No page builder, no frameworks.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: trendingnz
*/

:root {
  --ink: #111111;
  --ink-2: #3d3d3d;
  --muted: #6b6b6b;
  --line: #e6e6e6;
  --bg: #ffffff;
  --bg-soft: #f5f5f3;
  --accent: #d0021b;
  --accent-ink: #ffffff;
  --radius: 6px;
  --wrap: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--font); }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); }
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 99; background: #fff; padding: 8px 12px; clip: auto; width: auto; height: auto; }

/* ---------- Header ---------- */
.topbar { background: var(--ink); color: #fff; font-size: 13px; }
.topbar .wrap { display: flex; justify-content: space-between; align-items: center; height: 34px; gap: 12px; }
.topbar a { color: #fff; opacity: .85; }
.topbar a:hover { opacity: 1; color: #fff; }
.topbar .social { display: flex; gap: 14px; }

.site-header { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 50; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 52px; width: auto; }
.brand-word { font-weight: 900; font-size: 24px; letter-spacing: -.02em; text-transform: uppercase; }
.brand-word b { background: var(--accent); color: #fff; padding: 0 6px; margin-left: 4px; border-radius: 3px; }
.header-search input { border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 14px; width: 200px; background: var(--bg-soft); }

.catnav { border-bottom: 3px solid var(--ink); background: #fff; }
.catnav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.catnav ul::-webkit-scrollbar { display: none; }
.catnav a { display: block; padding: 11px 12px; font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .03em; }
.catnav .current a, .catnav a:hover { color: var(--accent); }

/* ---------- Common bits ---------- */
.kicker { display: inline-block; color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.meta { color: var(--muted); font-size: 13px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; border-top: 3px solid var(--ink); padding-top: 10px; margin: 36px 0 16px; }
.section-head h2 { font-size: 20px; text-transform: uppercase; letter-spacing: .02em; margin: 0; }
.section-head a { font-size: 13px; font-weight: 700; color: var(--accent); }
/* Whole picture always visible: image is "contained", spare space filled with a blurred copy. */
.thumb { position: relative; overflow: hidden; border-radius: var(--radius); background: #1b1b1b; aspect-ratio: 16 / 9; isolation: isolate; }
.thumb-bg { position: absolute; inset: -24px; background-size: cover; background-position: center; filter: blur(20px) brightness(.8) saturate(1.1); transform: scale(1.08); z-index: -1; }
.thumb img { position: relative; width: 100%; height: 100%; object-fit: contain; transition: transform .3s; }
a:hover .thumb img { transform: scale(1.02); }
.thumb-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a1a1a, #3a3a3a); color: #fff; font-weight: 900; font-size: 22px; letter-spacing: -.02em; }
.thumb-fallback b { background: var(--accent); padding: 0 6px; margin-left: 4px; border-radius: 3px; }

/* ---------- Cards ---------- */
.card { display: block; }
.card h3 { font-size: 18px; margin: 10px 0 6px; }
.card .excerpt { color: var(--ink-2); font-size: 15px; margin: 0 0 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.grid { display: grid; gap: 24px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.list-item { display: grid; grid-template-columns: 1fr 120px; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list-item h3 { font-size: 17px; margin: 0 0 4px; }
.list-item .thumb { aspect-ratio: 4 / 3; }
.list-item .thumb-fallback, .lead-side .thumb-fallback, .grid-4 .thumb-fallback { font-size: 14px; }
.list-item .thumb-fallback b { padding: 0 4px; }

/* ---------- Home ---------- */
.lead { display: grid; grid-template-columns: 2fr 1fr; gap: 28px; margin-top: 24px; align-items: start; }
.lead-main .thumb { aspect-ratio: 16 / 10; }
.lead-side-title { font-size: 16px; text-transform: uppercase; letter-spacing: .03em; border-top: 3px solid var(--ink); padding-top: 10px; margin: 0 0 4px; }
.side-item { display: grid; grid-template-columns: 112px 1fr; gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.side-item:last-child { border-bottom: 0; }
.side-item .thumb { aspect-ratio: 1 / 1; }
.side-item .thumb-fallback { font-size: 12px; }
.side-item .kicker { margin-bottom: 2px; font-size: 11px; }
.side-item h3 { font-size: 16px; margin: 0 0 4px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lead-main h2 { font-family: var(--serif); font-size: 36px; margin: 14px 0 8px; }
.lead-main .excerpt { font-size: 18px; color: var(--ink-2); }
.lead-side .card h3 { font-size: 17px; }
.lead-side .card + .card { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.latest-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 36px; }
.sidebar-box { background: var(--bg-soft); border-radius: var(--radius); padding: 18px; margin-bottom: 24px; }
.sidebar-box h2 { font-size: 16px; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 10px; }
.ranked { list-style: none; counter-reset: r; margin: 0; padding: 0; }
.ranked li { counter-increment: r; display: grid; grid-template-columns: 30px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 15px; line-height: 1.35; }
.ranked li:last-child { border-bottom: 0; }
.ranked li::before { content: counter(r); color: var(--accent); font-size: 22px; font-weight: 900; line-height: 1; }
.fb-cta { background: #1877f2; color: #fff; border-radius: var(--radius); padding: 18px; }
.fb-cta p { margin: 0 0 12px; font-size: 15px; }
.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 14px; padding: 10px 16px; border-radius: 999px; }
.btn:hover { color: #fff; filter: brightness(1.08); }
.btn-light { background: #fff; color: #1877f2; }
.btn-light:hover { color: #1877f2; }
.more { text-align: center; margin: 28px 0 8px; }

/* ---------- Article ---------- */
.article { max-width: 760px; margin: 28px auto 0; }
.article h1 { font-family: var(--serif); font-size: 40px; margin: 6px 0 12px; }
.article .standfirst { font-size: 20px; color: var(--ink-2); margin: 0 0 14px; line-height: 1.5; }
.byline { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0; margin-bottom: 20px; }
.byline strong { color: var(--ink); }
.share { display: flex; gap: 8px; margin-left: auto; }
.share a { font-size: 13px; font-weight: 700; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); }
.share a.fb { background: #1877f2; border-color: #1877f2; color: #fff; }
.share a.wa { background: #25d366; border-color: #25d366; color: #fff; }
.entry { font-size: 19px; line-height: 1.7; }
.entry p { margin: 0 0 1.1em; }
.entry h2 { font-size: 26px; margin: 1.6em 0 .5em; }
.entry h3 { font-size: 21px; margin: 1.4em 0 .5em; }
.entry h1 { font-size: 28px; }
.entry a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.entry ul, .entry ol { padding-left: 1.3em; margin: 0 0 1.1em; }
.entry li { margin-bottom: .35em; }
.entry figure { margin: 0 0 1.4em; }
.entry figure img, .entry-hero img { border-radius: var(--radius); width: auto; max-width: 100%; max-height: 80vh; height: auto; margin: 0 auto; }
.entry-hero { margin: 0 0 1.4em; }
.entry figcaption { font-size: 14px; color: var(--muted); margin-top: 6px; }
.entry blockquote { border-left: 4px solid var(--accent); margin: 1.4em 0; padding: 4px 0 4px 18px; font-family: var(--serif); font-size: 21px; color: var(--ink-2); }
.entry hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.entry iframe, .entry video { max-width: 100%; }
.tnz-sources { background: var(--bg-soft); border-left: 4px solid var(--ink); border-radius: var(--radius); padding: 14px 18px; font-size: 15px; line-height: 1.55; }
.tnz-sources p { margin: 0 0 .5em; }
.tnz-sources p:last-child { margin: 0; }
.tnz-toc { background: var(--bg-soft); border-radius: var(--radius); padding: 14px 18px; margin: 0 0 1.4em; font-size: 16px; }
.tnz-toc p { margin: 0 0 6px; }
.tnz-toc ul { margin: 0; padding-left: 1.1em; }
.tnz-toc a { color: var(--ink); text-decoration: none; }
.tnz-toc a:hover { color: var(--accent); }
.entry h2[id] { scroll-margin-top: 80px; }
.tnz-related { font-weight: 700; }
.tags { margin: 24px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags a { background: var(--bg-soft); font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 999px; }
.related { max-width: var(--wrap); }
.ad-slot { margin: 24px auto; text-align: center; min-height: 100px; }

/* ---------- Archive, search, pages ---------- */
.archive-head { margin: 28px 0 8px; border-bottom: 3px solid var(--ink); padding-bottom: 12px; }
.archive-head h1 { font-size: 34px; margin: 0; }
.archive-head p { margin: 6px 0 0; color: var(--muted); }
.pagination { display: flex; justify-content: center; gap: 6px; margin: 32px 0; flex-wrap: wrap; }
.pagination .page-numbers { padding: 8px 13px; border: 1px solid var(--line); border-radius: var(--radius); font-weight: 700; font-size: 14px; }
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }
.page-content { max-width: 760px; margin: 28px auto; }
.page-content h1 { font-family: var(--serif); font-size: 38px; }
.searchform { display: flex; gap: 8px; margin: 16px 0; }
.searchform input[type=search] { flex: 1; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; font: inherit; }
.searchform button { border: 0; background: var(--ink); color: #fff; font-weight: 800; padding: 0 18px; border-radius: var(--radius); cursor: pointer; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #d6d6d6; margin-top: 56px; padding: 40px 0 24px; font-size: 15px; }
.site-footer a { color: #fff; }
.site-footer a:hover { color: #ff6b7d; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.site-footer h2 { color: #fff; font-size: 15px; text-transform: uppercase; letter-spacing: .05em; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 8px; }
.footer-brand .brand-word { color: #fff; }
.copyright { border-top: 1px solid #333; margin-top: 28px; padding-top: 18px; font-size: 13px; color: #9a9a9a; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .lead, .latest-layout { grid-template-columns: 1fr; }
  .lead-side { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
  .lead-side-title { grid-column: 1 / -1; }
  .side-item:last-child { border-bottom: 1px solid var(--line); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .topbar .tagline { display: none; }
  .header-search { display: none; }
  .site-header .wrap { height: 56px; }
  .brand img { height: 44px; }
  .grid-3, .grid-4, .lead-side { grid-template-columns: 1fr; }
  .side-item { grid-template-columns: 96px 1fr; }
  .lead-main h2 { font-size: 27px; }
  .article h1 { font-size: 29px; }
  .article .standfirst { font-size: 18px; }
  .entry { font-size: 18px; }
  .entry h2 { font-size: 22px; }
  .share { margin-left: 0; width: 100%; }
  .list-item { grid-template-columns: 1fr 96px; }
  .footer-grid { grid-template-columns: 1fr; }
}
