/*
Theme Name: Tech News
Theme URI: https://example.com/technews
Author: Tech News Team
Description: A premium newspaper-style WordPress theme for technology news websites. Features breaking news ticker, category-based layouts, and modern responsive design.
Version: 1.0.0
Requires at least: 6.4
Tested up to: 6.8
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: technews
Tags: news, magazine, blog, custom-logo, custom-menu, featured-images, threaded-comments, grid-layout, responsive-layout
*/

/* ==========================================================================
   1. CSS Custom Properties (Design Tokens)
   ========================================================================== */

:root {
  /* Colors */
  --tn-red: #c8102e;
  --tn-red-dark: #a00d24;
  --tn-ink: #121212;
  --tn-muted: #5a5a5a;
  --tn-light-gray: #e8e8e8;
  --tn-soft-bg: #f7f6f3;
  --tn-paper: #ffffff;

  /* Typography */
  --tn-font-serif: 'Lora', Georgia, 'Times New Roman', serif;
  --tn-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Layout */
  --tn-wrap: 1200px;
  --tn-gap: 20px;
  --tn-radius: 4px;

  /* Effects */
  --tn-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  --tn-transition: .25s ease;
}

/* ==========================================================================
   2. Reset / Base Styles
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--tn-font-serif);
  font-size: 18px;
  line-height: 1.65;
  color: var(--tn-ink);
  background: var(--tn-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--tn-font-sans);
  margin-top: 0;
  line-height: 1.2;
}

a {
  color: var(--tn-red);
  text-decoration: none;
  transition: color var(--tn-transition);
}

a:hover,
a:focus {
  color: var(--tn-red-dark);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  margin: 0;
  padding: 0;
}

figure {
  margin: 0;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* ==========================================================================
   3. Layout — .wrap Container
   ========================================================================== */

.wrap {
  max-width: var(--tn-wrap);
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* ==========================================================================
   4. Top Bar
   ========================================================================== */

.topbar {
  background: var(--tn-ink);
  color: #ccc;
  font-family: var(--tn-font-sans);
  font-size: 12px;
  height: 36px;
}

.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.topbar__date {
  white-space: nowrap;
}

.topbar__links {
  display: flex;
  align-items: center;
  gap: 16px;
  list-style: none;
}

.topbar__links a {
  color: #ccc;
  font-size: 12px;
  text-decoration: none;
  transition: color var(--tn-transition);
}

.topbar__links a:hover {
  color: #fff;
}

.topbar__social {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__social a {
  color: #999;
  font-size: 14px;
}

.topbar__social a:hover {
  color: #fff;
}

/* ==========================================================================
   5. Masthead
   ========================================================================== */

.masthead {
  background: var(--tn-paper);
  border-bottom: 3px solid var(--tn-red);
  padding: 20px 0;
}

.masthead .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  margin: 0;
  font-family: var(--tn-font-sans);
  font-size: 36px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -1px;
  line-height: 1;
}

.site-title a {
  color: var(--tn-ink);
  text-decoration: none;
}

.site-title a:hover {
  color: var(--tn-red);
}

.masthead__meta {
  text-align: right;
  font-family: var(--tn-font-sans);
  font-size: 13px;
  color: var(--tn-muted);
}

.masthead__meta .tagline {
  display: block;
  font-style: italic;
  margin-top: 2px;
}

/* ==========================================================================
   6. Primary Navigation
   ========================================================================== */

.nav-primary {
  background: var(--tn-red);
  position: relative;
  z-index: 100;
}

.nav-primary .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 10px;
  line-height: 1;
}

.nav-toggle:hover {
  background: rgba(0, 0, 0, .15);
}

.menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.menu li {
  position: relative;
}

.menu li a {
  display: block;
  color: #fff;
  font-family: var(--tn-font-sans);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 12px 16px;
  text-decoration: none;
  transition: background var(--tn-transition);
}

.menu li a:hover,
.menu li a:focus {
  background: var(--tn-red-dark);
  color: #fff;
}

.menu li.current-menu-item > a,
.menu li.current_page_item > a {
  background: rgba(0, 0, 0, .15);
}

/* Dropdown (sub-menu) */
.menu .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--tn-red-dark);
  min-width: 200px;
  list-style: none;
  padding: 0;
  z-index: 110;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
}

.menu li:hover > .sub-menu {
  display: block;
}

.menu .sub-menu a {
  font-size: 13px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.menu .sub-menu a:hover {
  background: rgba(0, 0, 0, .2);
}

/* Navigation search */
.nav-search {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.nav-search__input {
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .2);
  color: #fff;
  font-family: var(--tn-font-sans);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: var(--tn-radius);
  width: 180px;
  outline: none;
  transition: background var(--tn-transition), width var(--tn-transition);
}

.nav-search__input::placeholder {
  color: rgba(255, 255, 255, .6);
}

.nav-search__input:focus {
  background: rgba(255, 255, 255, .25);
  width: 220px;
}

.nav-search__btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  padding: 6px 10px;
  margin-left: 4px;
}

/* ==========================================================================
   7. Breaking News Ticker
   ========================================================================== */

.breaking {
  background: var(--tn-soft-bg);
  border-bottom: 1px solid var(--tn-light-gray);
  display: flex;
  align-items: center;
  overflow: hidden;
  height: 40px;
  position: relative;
}

.breaking__label {
  background: var(--tn-red);
  color: #fff;
  font-family: var(--tn-font-sans);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
  z-index: 2;
  position: relative;
  flex-shrink: 0;
}

.breaking__label::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 0;
  border-style: solid;
  border-width: 20px 8px 20px 0;
  border-color: transparent transparent transparent var(--tn-red);
}

.breaking__track {
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  mask-image: linear-gradient(to right, transparent 0%, black 3%, black 97%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 3%, black 97%, transparent 100%);
}

.breaking__track:hover {
  animation-play-state: paused;
}

.breaking__track:hover .breaking__items {
  animation-play-state: paused;
}

.breaking__items {
  display: flex;
  white-space: nowrap;
  animation: ticker 30s linear infinite;
}

.breaking__items a {
  display: inline-block;
  padding: 0 24px;
  font-family: var(--tn-font-sans);
  font-size: 13px;
  color: var(--tn-ink);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--tn-transition);
}

.breaking__items a:hover {
  text-decoration: underline;
  color: var(--tn-red);
}

.breaking__items .separator {
  color: var(--tn-light-gray);
  padding: 0 4px;
  user-select: none;
}

@keyframes ticker {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* ==========================================================================
   8. Front Page Hero — .front-lead
   ========================================================================== */

.front-lead {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0;
  margin-top: 30px;
  margin-bottom: 40px;
}

.lead-main {
  padding-right: 25px;
}

/* Lead story (big featured article) */
.lead-story {
  margin-bottom: 25px;
}

.lead-story__thumb {
  position: relative;
  overflow: hidden;
  border-radius: var(--tn-radius);
  margin-bottom: 15px;
}

.lead-story__thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}

.lead-story:hover .lead-story__thumb img {
  transform: scale(1.03);
}

.lead-story__title {
  font-family: var(--tn-font-sans);
  font-size: 28px;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.2;
  margin: 10px 0;
}

.lead-story__title a {
  color: var(--tn-ink);
  text-decoration: none;
}

.lead-story__title a:hover {
  color: var(--tn-red);
}

.lead-story__excerpt {
  font-size: 15px;
  color: var(--tn-muted);
  line-height: 1.55;
  margin-bottom: 10px;
}

.lead-story__meta {
  font-family: var(--tn-font-sans);
  font-size: 12px;
  color: var(--tn-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Lead secondary — 2 smaller cards below the lead */
.lead-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Lead rail — right sidebar with numbered items */
.lead-rail {
  border-left: 1px solid var(--tn-light-gray);
  padding-left: 25px;
}

.lead-rail__title {
  font-family: var(--tn-font-sans);
  font-size: 16px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--tn-ink);
  padding-bottom: 10px;
  margin-bottom: 0;
  margin-top: 0;
}

/* ==========================================================================
   9. Category Badge
   ========================================================================== */

.cat-badge {
  display: inline-block;
  background: var(--tn-red);
  color: #fff;
  font-family: var(--tn-font-sans);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  text-decoration: none;
  border-radius: 2px;
  transition: background var(--tn-transition);
}

.cat-badge:hover {
  background: var(--tn-red-dark);
  color: #fff;
}

/* Alternate badge colors for variety */
.cat-badge--blue    { background: #1a73e8; }
.cat-badge--blue:hover { background: #1558b0; }
.cat-badge--green   { background: #0d7c3f; }
.cat-badge--green:hover { background: #095e2f; }
.cat-badge--orange  { background: #e65100; }
.cat-badge--orange:hover { background: #bf4400; }
.cat-badge--purple  { background: #7b1fa2; }
.cat-badge--purple:hover { background: #5c1680; }

/* ==========================================================================
   10. Card Component
   ========================================================================== */

.card {
  margin-bottom: 5px;
}

.card__thumb {
  overflow: hidden;
  border-radius: var(--tn-radius);
  margin-bottom: 10px;
  position: relative;
}

.card__thumb img {
  width: 100%;
  display: block;
  transition: transform .3s ease;
}

.card:hover .card__thumb img {
  transform: scale(1.05);
}

.card__body {
  padding: 0;
}

.card__title {
  font-family: var(--tn-font-sans);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.25;
  margin: 8px 0;
}

.card__title a {
  color: var(--tn-ink);
  text-decoration: none;
  transition: color var(--tn-transition);
}

.card__title a:hover {
  color: var(--tn-red);
}

.card__excerpt {
  font-size: 14px;
  color: var(--tn-muted);
  line-height: 1.5;
  margin-bottom: 8px;
}

.card__meta {
  font-family: var(--tn-font-sans);
  font-size: 12px;
  color: var(--tn-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.meta-author,
.meta-date,
.meta-read {
  white-space: nowrap;
}

.meta-author a {
  color: var(--tn-muted);
  font-weight: 600;
  text-decoration: none;
}

.meta-author a:hover {
  color: var(--tn-red);
}

.dot {
  display: inline-block;
  width: 3px;
  height: 3px;
  background: var(--tn-muted);
  border-radius: 50%;
  vertical-align: middle;
}

/* Card compact variant */
.card--compact .card__title {
  font-size: 16px;
}

.card--compact .card__excerpt {
  font-size: 13px;
}

/* Card horizontal variant (for sidebar / smaller layouts) */
.card--horizontal {
  display: flex;
  gap: 15px;
  align-items: flex-start;
}

.card--horizontal .card__thumb {
  flex-shrink: 0;
  width: 120px;
  margin-bottom: 0;
}

.card--horizontal .card__body {
  flex: 1;
  min-width: 0;
}

.card--horizontal .card__title {
  font-size: 15px;
  margin-top: 0;
}

/* ==========================================================================
   11. Rail Items (Numbered Sidebar)
   ========================================================================== */

.rail-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--tn-light-gray);
}

.rail-item:last-child {
  border-bottom: none;
}

.rail-num {
  font-family: var(--tn-font-sans);
  font-size: 32px;
  font-weight: 900;
  color: var(--tn-light-gray);
  min-width: 40px;
  line-height: 1;
  flex-shrink: 0;
}

.rail-content {
  flex: 1;
  min-width: 0;
}

.rail-title {
  font-family: var(--tn-font-sans);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 4px;
}

.rail-title a {
  color: var(--tn-ink);
  text-decoration: none;
  transition: color var(--tn-transition);
}

.rail-title a:hover {
  color: var(--tn-red);
}

.rail-meta {
  font-family: var(--tn-font-sans);
  font-size: 12px;
  color: var(--tn-muted);
}

/* ==========================================================================
   12. Section Heads
   ========================================================================== */

.section-head {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--tn-ink);
  padding-bottom: 10px;
  margin-bottom: 25px;
}

.section-head h2 {
  font-family: var(--tn-font-sans);
  font-size: 20px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin: 0;
  line-height: 1;
}

.section-head .more {
  font-family: var(--tn-font-sans);
  font-size: 13px;
  color: var(--tn-red);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--tn-transition);
}

.section-head .more:hover {
  text-decoration: underline;
  color: var(--tn-red-dark);
}

/* ==========================================================================
   13. Category Sections
   ========================================================================== */

.cat-section {
  margin-bottom: 50px;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 25px;
}

/* Featured category grid — first item spans full width or is larger */
.cat-grid--featured {
  grid-template-columns: 1fr 1fr;
}

.cat-grid--featured .card:first-child {
  grid-column: 1 / -1;
}

/* 3-column variant */
.cat-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

/* ==========================================================================
   14. Single Post
   ========================================================================== */

.single-post .entry-header {
  margin-bottom: 30px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.entry-title {
  font-family: var(--tn-font-sans);
  font-size: 36px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 15px;
}

.entry-meta {
  font-family: var(--tn-font-sans);
  font-size: 13px;
  color: var(--tn-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.entry-meta a {
  color: var(--tn-muted);
  font-weight: 600;
}

.entry-meta a:hover {
  color: var(--tn-red);
}

.entry-featured-image {
  margin-bottom: 30px;
  border-radius: var(--tn-radius);
  overflow: hidden;
}

.entry-featured-image img {
  width: 100%;
  display: block;
}

.entry-featured-image figcaption {
  font-family: var(--tn-font-sans);
  font-size: 12px;
  color: var(--tn-muted);
  padding: 8px 0;
  font-style: italic;
}

/* Entry content */
.entry-content {
  font-family: var(--tn-font-serif);
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  font-size: 18px;
  line-height: 1.7;
}

.entry-content p {
  margin-bottom: 1.5em;
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
  font-family: var(--tn-font-sans);
  font-weight: 700;
  margin-top: 2em;
  margin-bottom: 0.75em;
}

.entry-content h2 {
  font-size: 26px;
}

.entry-content h3 {
  font-size: 22px;
}

.entry-content h4 {
  font-size: 18px;
}

.entry-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--tn-radius);
  margin: 1.5em 0;
}

.entry-content blockquote {
  border-left: 3px solid var(--tn-red);
  padding-left: 20px;
  margin-left: 0;
  margin-right: 0;
  font-style: italic;
  color: var(--tn-muted);
}

.entry-content blockquote p:last-child {
  margin-bottom: 0;
}

.entry-content ul,
.entry-content ol {
  padding-left: 1.5em;
  margin-bottom: 1.5em;
}

.entry-content li {
  margin-bottom: 0.5em;
}

.entry-content pre {
  background: var(--tn-ink);
  color: #f0f0f0;
  padding: 20px;
  border-radius: var(--tn-radius);
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.5;
  margin: 1.5em 0;
}

.entry-content code {
  background: var(--tn-soft-bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
}

.entry-content pre code {
  background: none;
  padding: 0;
}

.entry-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-family: var(--tn-font-sans);
  font-size: 15px;
}

.entry-content th,
.entry-content td {
  padding: 10px 14px;
  border: 1px solid var(--tn-light-gray);
  text-align: left;
}

.entry-content th {
  background: var(--tn-soft-bg);
  font-weight: 700;
}

/* Entry tags */
.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 30px auto;
  max-width: 720px;
  align-items: center;
}

.entry-tags__label {
  font-family: var(--tn-font-sans);
  font-size: 13px;
  font-weight: 700;
  color: var(--tn-ink);
  margin-right: 4px;
}

.entry-tags a {
  background: var(--tn-soft-bg);
  padding: 4px 12px;
  font-family: var(--tn-font-sans);
  font-size: 13px;
  color: var(--tn-ink);
  text-decoration: none;
  border-radius: 3px;
  transition: background var(--tn-transition), color var(--tn-transition);
}

.entry-tags a:hover {
  background: var(--tn-red);
  color: #fff;
}

/* Author box */
.author-box {
  display: flex;
  gap: 20px;
  padding: 30px;
  background: var(--tn-soft-bg);
  border-radius: 8px;
  margin: 40px auto;
  max-width: 720px;
  align-items: flex-start;
}

.author-box__avatar {
  flex-shrink: 0;
}

.author-box__avatar img {
  border-radius: 50%;
  width: 80px;
  height: 80px;
  object-fit: cover;
}

.author-box__info {
  flex: 1;
  min-width: 0;
}

.author-box__name {
  font-family: var(--tn-font-sans);
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 5px;
}

.author-box__name a {
  color: var(--tn-ink);
  text-decoration: none;
}

.author-box__name a:hover {
  color: var(--tn-red);
}

.author-box__bio {
  font-size: 14px;
  color: var(--tn-muted);
  line-height: 1.55;
  margin: 0;
}

/* Post navigation (prev / next) */
.post-navigation {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--tn-light-gray);
  border-bottom: 1px solid var(--tn-light-gray);
  padding: 20px 0;
  margin: 40px auto;
  max-width: 720px;
  gap: 20px;
}

.post-navigation .nav-previous,
.post-navigation .nav-next {
  flex: 1;
  min-width: 0;
}

.post-navigation .nav-next {
  text-align: right;
}

.post-navigation .nav-label {
  display: block;
  font-family: var(--tn-font-sans);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--tn-muted);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.post-navigation .nav-title {
  font-family: var(--tn-font-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--tn-ink);
  text-decoration: none;
  transition: color var(--tn-transition);
}

.post-navigation .nav-title:hover {
  color: var(--tn-red);
}

/* Related posts */
.related-posts {
  margin: 50px auto;
  max-width: 720px;
}

.related-posts .cat-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* ==========================================================================
   15. Archive / Search Pages
   ========================================================================== */

.archive-header,
.search-header {
  background: var(--tn-soft-bg);
  padding: 30px;
  margin-bottom: 40px;
  border-radius: var(--tn-radius);
}

.archive-title,
.search-title {
  font-family: var(--tn-font-sans);
  font-weight: 800;
  font-size: 28px;
  margin: 0 0 5px;
}

.archive-description,
.search-description {
  color: var(--tn-muted);
  font-size: 15px;
  margin: 0;
}

.search-result-count {
  font-family: var(--tn-font-sans);
  font-size: 14px;
  color: var(--tn-muted);
  margin-top: 5px;
}

/* ==========================================================================
   16. 404 Page
   ========================================================================== */

.error-404 {
  text-align: center;
  padding: 80px 20px;
}

.error-404 .error-code {
  font-family: var(--tn-font-sans);
  font-size: 120px;
  font-weight: 900;
  color: var(--tn-light-gray);
  line-height: 1;
  margin-bottom: 10px;
}

.error-404 .error-title {
  font-family: var(--tn-font-sans);
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 15px;
}

.error-404 p {
  color: var(--tn-muted);
  max-width: 480px;
  margin: 0 auto 25px;
}

.error-404 .search-form {
  max-width: 400px;
  margin: 0 auto;
  display: flex;
}

.error-404 .search-form .search-field {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--tn-light-gray);
  border-right: none;
  border-radius: var(--tn-radius) 0 0 var(--tn-radius);
  font-size: 15px;
  outline: none;
}

.error-404 .search-form .search-field:focus {
  border-color: var(--tn-red);
}

.error-404 .search-form .search-submit {
  background: var(--tn-red);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 0 var(--tn-radius) var(--tn-radius) 0;
  font-family: var(--tn-font-sans);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--tn-transition);
}

.error-404 .search-form .search-submit:hover {
  background: var(--tn-red-dark);
}

/* ==========================================================================
   17. Comments
   ========================================================================== */

.comments-area {
  max-width: 720px;
  margin: 40px auto;
}

.comments-title {
  font-family: var(--tn-font-sans);
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 25px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--tn-ink);
}

.comment-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.comment {
  padding: 20px 0;
  border-bottom: 1px solid var(--tn-light-gray);
}

.comment:last-child {
  border-bottom: none;
}

.comment-author {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.comment-author img {
  border-radius: 50%;
  margin-right: 10px;
  width: 40px;
  height: 40px;
}

.comment-author .fn {
  font-family: var(--tn-font-sans);
  font-weight: 700;
  font-size: 15px;
  color: var(--tn-ink);
}

.comment-author .fn a {
  color: var(--tn-ink);
  text-decoration: none;
}

.comment-author .fn a:hover {
  color: var(--tn-red);
}

.comment-metadata {
  font-family: var(--tn-font-sans);
  font-size: 12px;
  color: var(--tn-muted);
  margin-bottom: 10px;
}

.comment-metadata a {
  color: var(--tn-muted);
}

.comment-metadata a:hover {
  color: var(--tn-red);
}

.comment-body p {
  font-size: 15px;
  margin: 0 0 10px;
}

.reply a {
  font-family: var(--tn-font-sans);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--tn-red);
  text-decoration: none;
}

.reply a:hover {
  text-decoration: underline;
}

/* Nested (threaded) comments */
.comment .children {
  list-style: none;
  padding-left: 30px;
  margin: 0;
}

/* Comment form */
.comment-respond {
  margin-top: 40px;
}

.comment-reply-title {
  font-family: var(--tn-font-sans);
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 20px;
}

.comment-form label {
  display: block;
  font-family: var(--tn-font-sans);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--tn-ink);
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--tn-light-gray);
  border-radius: var(--tn-radius);
  font-size: 15px;
  outline: none;
  transition: border-color var(--tn-transition);
  margin-bottom: 15px;
}

.comment-form input:focus,
.comment-form textarea:focus {
  border-color: var(--tn-red);
}

.comment-form textarea {
  min-height: 140px;
  resize: vertical;
}

.comment-form .submit {
  background: var(--tn-red);
  color: #fff;
  border: none;
  padding: 12px 30px;
  font-family: var(--tn-font-sans);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-radius: var(--tn-radius);
  cursor: pointer;
  transition: background var(--tn-transition);
}

.comment-form .submit:hover {
  background: var(--tn-red-dark);
}

/* ==========================================================================
   18. Pagination
   ========================================================================== */

.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: 40px 0;
  font-family: var(--tn-font-sans);
}

.page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--tn-light-gray);
  font-size: 14px;
  font-weight: 600;
  color: var(--tn-ink);
  text-decoration: none;
  border-radius: var(--tn-radius);
  transition: background var(--tn-transition), color var(--tn-transition), border-color var(--tn-transition);
}

.page-numbers:hover {
  background: var(--tn-soft-bg);
  border-color: #ccc;
  color: var(--tn-ink);
}

.page-numbers.current {
  background: var(--tn-red);
  color: #fff;
  border-color: var(--tn-red);
}

.page-numbers.dots {
  border: none;
  pointer-events: none;
}

.page-numbers.prev,
.page-numbers.next {
  font-weight: 700;
}

/* ==========================================================================
   19. Footer
   ========================================================================== */

.site-footer {
  background: var(--tn-ink);
  color: #ccc;
  padding: 50px 0 0;
  margin-top: 60px;
}

.footer-widgets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}

.footer-widgets .widget {
  font-size: 14px;
  line-height: 1.6;
}

.footer-widgets .widget-title {
  color: #fff;
  font-family: var(--tn-font-sans);
  font-size: 16px;
  text-transform: uppercase;
  font-weight: 700;
  border-bottom: 2px solid var(--tn-red);
  padding-bottom: 10px;
  margin-bottom: 20px;
  margin-top: 0;
}

.footer-widgets a {
  color: #aaa;
  text-decoration: none;
  transition: color var(--tn-transition);
}

.footer-widgets a:hover {
  color: #fff;
}

.footer-widgets ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-widgets li {
  padding: 6px 0;
  border-bottom: 1px solid #333;
}

.footer-widgets li:last-child {
  border-bottom: none;
}

.footer-widgets p {
  color: #999;
  margin: 0 0 10px;
}

/* Footer social icons */
.footer-social {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #444;
  border-radius: 50%;
  color: #aaa;
  font-size: 16px;
  transition: all var(--tn-transition);
}

.footer-social a:hover {
  background: var(--tn-red);
  border-color: var(--tn-red);
  color: #fff;
}

/* Site info (copyright bar) */
.site-info {
  text-align: center;
  padding: 25px 0;
  margin-top: 40px;
  border-top: 1px solid #333;
  font-family: var(--tn-font-sans);
  font-size: 13px;
  color: #888;
}

.site-info a {
  color: #aaa;
}

.site-info a:hover {
  color: #fff;
}

/* ==========================================================================
   20. Utility Classes
   ========================================================================== */

/* Screen reader text — hidden visually, accessible to assistive technology */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important;
}

.screen-reader-text:focus {
  background: var(--tn-paper);
  border-radius: var(--tn-radius);
  box-shadow: 0 0 2px 2px rgba(0, 0, 0, .6);
  clip: auto !important;
  clip-path: none;
  color: var(--tn-ink);
  display: block;
  font-size: 14px;
  font-weight: 700;
  height: auto;
  left: 5px;
  line-height: normal;
  padding: 15px 23px 14px;
  text-decoration: none;
  top: 5px;
  width: auto;
  z-index: 100000;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--tn-red);
  color: #fff;
  padding: 8px 16px;
  font-family: var(--tn-font-sans);
  font-size: 14px;
  font-weight: 700;
  z-index: 99999;
  text-decoration: none;
  transition: top .2s;
}

.skip-link:focus {
  top: 0;
}

/* Alignment */
.alignleft {
  float: left;
  margin: 0.5em 1.5em 1em 0;
}

.alignright {
  float: right;
  margin: 0.5em 0 1em 1.5em;
}

.aligncenter {
  display: block;
  margin-left: auto;
  margin-right: auto;
  clear: both;
}

/* WordPress captions */
.wp-caption {
  max-width: 100%;
  margin-bottom: 1.5em;
}

.wp-caption img {
  display: block;
  max-width: 100%;
}

.wp-caption-text {
  font-family: var(--tn-font-sans);
  font-size: 12px;
  color: var(--tn-muted);
  padding-top: 8px;
  font-style: italic;
  text-align: center;
}

/* WordPress galleries */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 1.5em;
}

.gallery-item {
  margin: 0;
}

.gallery-item img {
  width: 100%;
  border-radius: var(--tn-radius);
}

/* Clearfix */
.clearfix::after {
  content: '';
  display: table;
  clear: both;
}

/* Sticky post highlight */
.sticky .card {
  border-left: 3px solid var(--tn-red);
  padding-left: 15px;
}

/* ==========================================================================
   21. Sidebar / Widgets (Generic)
   ========================================================================== */

.sidebar {
  font-family: var(--tn-font-sans);
  font-size: 14px;
}

.sidebar .widget {
  margin-bottom: 35px;
}

.sidebar .widget-title {
  font-size: 16px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--tn-ink);
  padding-bottom: 10px;
  margin-bottom: 20px;
  margin-top: 0;
}

.sidebar ul {
  list-style: none;
  padding: 0;
}

.sidebar li {
  padding: 8px 0;
  border-bottom: 1px solid var(--tn-light-gray);
}

.sidebar li:last-child {
  border-bottom: none;
}

.sidebar a {
  color: var(--tn-ink);
  text-decoration: none;
}

.sidebar a:hover {
  color: var(--tn-red);
}

/* Search widget */
.widget_search .search-form {
  display: flex;
}

.widget_search .search-field {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--tn-light-gray);
  border-right: none;
  border-radius: var(--tn-radius) 0 0 var(--tn-radius);
  font-size: 14px;
  outline: none;
}

.widget_search .search-field:focus {
  border-color: var(--tn-red);
}

.widget_search .search-submit {
  background: var(--tn-red);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 0 var(--tn-radius) var(--tn-radius) 0;
  cursor: pointer;
  font-weight: 700;
  transition: background var(--tn-transition);
}

.widget_search .search-submit:hover {
  background: var(--tn-red-dark);
}

/* ==========================================================================
   22. Content Layout (with sidebar)
   ========================================================================== */

.content-area {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  margin-bottom: 50px;
}

.content-area .main-content {
  min-width: 0;
}

/* Full-width variant (no sidebar) */
.content-area--full {
  grid-template-columns: 1fr;
}

/* ==========================================================================
   23. Responsive Breakpoints
   ========================================================================== */

/* ---- Landscape / Small desktop ---- */
@media (max-width: 1140px) {
  :root {
    --tn-gap: 16px;
  }

  .wrap {
    padding-left: 16px;
    padding-right: 16px;
  }

  .cat-grid {
    gap: 20px;
  }

  .lead-main {
    padding-right: 20px;
  }

  .lead-rail {
    padding-left: 20px;
  }

  .content-area {
    gap: 30px;
  }
}

/* ---- Tablet / Portrait ---- */
@media (max-width: 1019px) {
  .front-lead {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .lead-main {
    padding-right: 0;
  }

  .lead-rail {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--tn-light-gray);
    padding-top: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 25px;
  }

  .lead-rail__title {
    grid-column: 1 / -1;
  }

  .cat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .related-posts .cat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .content-area {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 30px;
  }

  .footer-widgets {
    grid-template-columns: repeat(2, 1fr);
  }

  .masthead .wrap {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }

  .masthead__meta {
    text-align: center;
  }

  .entry-title {
    font-size: 30px;
  }
}

/* ---- Mobile / Phone ---- */
@media (max-width: 767px) {
  body {
    font-size: 16px;
  }

  .topbar {
    font-size: 11px;
  }

  .topbar__links {
    gap: 10px;
  }

  .site-title {
    font-size: 26px;
  }

  .masthead {
    padding: 15px 0;
  }

  /* Navigation: hamburger toggle */
  .nav-toggle {
    display: block;
  }

  .nav-primary .wrap {
    flex-wrap: wrap;
  }

  .menu {
    display: none;
    flex-direction: column;
    width: 100%;
    order: 3;
  }

  .nav-toggle[aria-expanded="true"] ~ .menu {
    display: flex;
  }

  .menu li a {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
  }

  .menu .sub-menu {
    position: static;
    box-shadow: none;
    background: rgba(0, 0, 0, .15);
  }

  .nav-search {
    order: 2;
    margin-left: auto;
  }

  .nav-search__input {
    width: 140px;
  }

  .nav-search__input:focus {
    width: 160px;
  }

  /* Breaking ticker */
  .breaking__label {
    font-size: 10px;
    padding: 0 10px;
  }

  .breaking__label::after {
    border-width: 20px 6px 20px 0;
    right: -6px;
  }

  /* Front lead */
  .front-lead {
    margin-top: 20px;
  }

  .lead-story__title {
    font-size: 22px;
  }

  .lead-secondary {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .lead-rail {
    grid-template-columns: 1fr;
  }

  /* Category grid */
  .cat-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .cat-grid--featured {
    grid-template-columns: 1fr;
  }

  .cat-grid--3 {
    grid-template-columns: 1fr;
  }

  .related-posts .cat-grid {
    grid-template-columns: 1fr;
  }

  .cat-section {
    margin-bottom: 35px;
  }

  /* Cards */
  .card__title {
    font-size: 16px;
  }

  .card--compact .card__title {
    font-size: 15px;
  }

  /* Section head */
  .section-head h2 {
    font-size: 17px;
  }

  /* Single post */
  .entry-title {
    font-size: 24px;
  }

  .entry-content {
    font-size: 16px;
  }

  .entry-content h2 {
    font-size: 22px;
  }

  .entry-content h3 {
    font-size: 19px;
  }

  .author-box {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
  }

  .post-navigation {
    flex-direction: column;
    gap: 15px;
  }

  .post-navigation .nav-next {
    text-align: left;
  }

  /* Archive / Search */
  .archive-header,
  .search-header {
    padding: 20px;
  }

  .archive-title,
  .search-title {
    font-size: 22px;
  }

  /* 404 */
  .error-404 {
    padding: 50px 20px;
  }

  .error-404 .error-code {
    font-size: 80px;
  }

  .error-404 .error-title {
    font-size: 22px;
  }

  /* Comments */
  .comment .children {
    padding-left: 15px;
  }

  /* Footer */
  .footer-widgets {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .sidebar {
    grid-template-columns: 1fr;
  }

  .site-footer {
    padding: 35px 0 0;
  }

  .site-info {
    margin-top: 30px;
    padding: 20px 0;
  }

  /* Gallery */
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Pagination */
  .pagination {
    flex-wrap: wrap;
  }
}

/* ---- Very small screens ---- */
@media (max-width: 479px) {
  .site-title {
    font-size: 22px;
  }

  .topbar__links {
    display: none;
  }

  .topbar__social {
    margin-left: auto;
  }

  .lead-story__title {
    font-size: 20px;
  }

  .entry-title {
    font-size: 22px;
  }

  .error-404 .error-code {
    font-size: 60px;
  }

  .gallery {
    grid-template-columns: 1fr;
  }

  .card--horizontal {
    flex-direction: column;
  }

  .card--horizontal .card__thumb {
    width: 100%;
  }

  .breaking {
    height: 36px;
  }

  .breaking__items a {
    font-size: 12px;
    padding: 0 16px;
  }
}

/* ==========================================================================
   24. Print Styles
   ========================================================================== */

@media print {
  .topbar,
  .nav-primary,
  .breaking,
  .site-footer,
  .sidebar,
  .post-navigation,
  .related-posts,
  .comments-area,
  .pagination,
  .nav-toggle {
    display: none !important;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  .wrap {
    max-width: 100%;
    padding: 0;
  }

  .entry-content {
    max-width: 100%;
  }

  .masthead {
    border-bottom: 1px solid #000;
  }

  img {
    max-width: 100% !important;
  }
}
