/* MAIN THEME STYLES - THAIPTV NEWS v1.3.8 CLEAN NON-OVERLAPPING CAPTION FIX */

/* 1. MAIN HEADER & BRANDING */
.t-header-main {
  background: #ffffff;
  padding: 16px 0;
  border-bottom: 1px solid var(--t-border);
}
.t-header-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.t-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.t-logo-box {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  font-family: var(--t-font-heading);
  font-weight: 900;
  font-size: 24px;
  padding: 6px 14px;
  border-radius: 6px;
  border-left: 4px solid var(--t-accent);
  box-shadow: var(--t-shadow-sm);
}
.t-logo-text {
  display: flex;
  flex-direction: column;
}
.t-logo-title {
  font-family: var(--t-font-logo);
  font-size: 24px;
  font-weight: 700;
  color: var(--t-primary);
  line-height: 1.1;
  letter-spacing: -0.5px;
  white-space: nowrap;
}
.t-logo-sub {
  font-family: var(--t-font-body);
  font-size: 12px;
  color: var(--t-text-muted);
  font-weight: 400;
  white-space: nowrap;
}

/* 2. NAVIGATION MENU */
.t-nav-bar {
  background: #1e293b;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.t-nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  position: relative;
}

.t-menu, .menu-primary-container, ul.menu, div.t-menu > ul {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--t-font-menu);
  font-weight: 500; /* Medium (500) */
}

.t-menu li, ul.menu li, .menu-item {
  display: inline-block;
  white-space: nowrap;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
}

.t-menu a, ul.menu a, .menu-item a, .t-menu > li > a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 12px;
  color: #f1f5f9;
  font-family: var(--t-font-menu);
  font-weight: 500; /* Medium (500) */
  font-size: 14px;
  white-space: nowrap;
  word-break: keep-all;
  transition: all 0.2s ease;
  border-bottom: 3px solid transparent;
  text-decoration: none;
}

.t-menu a:hover, ul.menu a:hover, .menu-item.current-menu-item > a, .t-menu li.current-menu-item > a {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-bottom-color: var(--t-accent);
}

.t-nav-badge, a.t-nav-badge {
  display: inline-block !important;
  width: auto !important;
  max-width: max-content !important;
  align-self: flex-start !important;
  font-size: 11px !important;
  padding: 3px 10px !important;
  border-radius: 4px !important;
  font-weight: 600 !important;
  color: #ffffff !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
  margin-bottom: 4px !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
}

.t-nav-badge:hover, a.t-nav-badge:hover {
  color: #ffffff !important;
  opacity: 0.9 !important;
  transform: translateY(-1px);
}

.t-badge-war { background: var(--t-accent) !important; }
.t-badge-world { background: var(--t-accent-blue) !important; }
.t-badge-tech { background: var(--t-accent-teal) !important; }
.t-badge-thai { background: var(--t-accent-gold) !important; }
.t-badge-gold { background: var(--t-accent-gold) !important; }

/* HEADER SEARCH FORM */
.t-nav-search {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}
.t-search-form {
  display: flex;
  align-items: center;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 20px;
  padding: 2px 10px;
  transition: border-color 0.2s ease;
}
.t-search-form:focus-within {
  border-color: var(--t-accent-blue);
}
.t-search-input {
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: var(--t-font-body);
  font-size: 13px;
  padding: 4px 6px;
  outline: none;
  width: 120px;
  transition: width 0.3s ease;
}
.t-search-input:focus {
  width: 160px;
}
.t-search-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 13px;
}
.t-search-btn:hover {
  color: #ffffff;
}

/* MOBILE NAVIGATION MENU & TOGGLE */
.t-mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: #ffffff;
  font-family: var(--t-font-menu);
  font-weight: 500;
  font-size: 16px;
  cursor: pointer;
  padding: 10px;
}

@media (max-width: 992px) {
  .t-menu, .menu-primary-container, ul.menu {
    display: none;
  }
  .t-menu.t-menu-active {
    display: flex !important;
    flex-direction: column !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    background-color: #1e293b !important;
    padding: 10px 20px !important;
    z-index: 9999 !important;
    box-shadow: 0 10px 15px rgba(0,0,0,0.3) !important;
    border-top: 1px solid #334155 !important;
  }
  .t-menu.t-menu-active li {
    width: 100% !important;
  }
  .t-menu.t-menu-active a {
    width: 100% !important;
    padding: 10px 0 !important;
    border-bottom: 1px solid #334155 !important;
  }
  .t-mobile-toggle {
    display: block !important;
  }
}

/* 3. BREAKING NEWS TICKER BAR */
.t-subnav-ticker {
  background-color: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.t-ticker-container {
  display: flex;
  align-items: center;
  gap: 12px;
}
.t-date-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #475569;
  font-weight: 600;
  font-size: 13px;
  font-family: var(--t-font-body);
  white-space: nowrap;
  flex-shrink: 0;
}
.t-ticker-divider {
  color: #cbd5e1;
  font-size: 14px;
  flex-shrink: 0;
}
.t-ticker-badge {
  background: var(--t-accent);
  color: #ffffff;
  padding: 3px 10px;
  font-weight: 700;
  font-size: 12px;
  font-family: var(--t-font-logo);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.t-ticker-content {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--t-font-body);
  font-weight: 400;
  font-size: 14px;
}
.t-ticker-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.t-ticker-content li {
  display: inline-block;
  color: #334155;
}
.t-ticker-content li a {
  color: #0f172a;
  font-weight: 500;
  text-decoration: none;
}
.t-ticker-content li a:hover {
  color: var(--t-accent-blue);
}

/* 4. HERO SECTION */
.t-hero-section {
  margin-top: 25px;
}
.t-hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}
@media (max-width: 860px) {
  .t-hero-grid {
    grid-template-columns: 1fr;
  }
}

.t-hero-lead {
  position: relative;
  border-radius: var(--t-radius);
  overflow: hidden;
  height: 450px;
  box-shadow: var(--t-shadow-md);
}
.t-hero-lead img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.t-hero-lead:hover img {
  transform: scale(1.04);
}
.t-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.4) 50%, rgba(0,0,0,0) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 24px;
  color: #ffffff;
}

.t-hero-cat-wrap {
  position: relative;
  z-index: 2;
}

.t-full-card-link {
  color: #ffffff !important;
  text-decoration: none !important;
}
.t-full-card-link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: pointer;
}

.t-hero-title {
  font-family: var(--t-font-heading);
  font-weight: 600; /* SemiBold (600) */
  font-size: 22px;
  color: #ffffff;
  margin-top: 4px;
  margin-bottom: 10px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.t-hero-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--t-font-caption);
  font-weight: 400; /* Regular (400) */
  font-size: 13px;
  color: #cbd5e1;
  position: relative;
  z-index: 1;
}

.t-hero-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 480px) {
  .t-hero-side {
    grid-template-columns: 1fr;
  }
}
.t-hero-sub {
  position: relative;
  border-radius: var(--t-radius);
  overflow: hidden;
  height: 218px;
  box-shadow: var(--t-shadow-sm);
}
.t-hero-sub img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.t-hero-sub:hover img {
  transform: scale(1.05);
}
.t-hero-sub-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(15,23,42,0.9) 0%, rgba(15,23,42,0.2) 60%, transparent 100%);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
}
.t-hero-sub-title {
  font-family: var(--t-font-heading);
  font-weight: 600; /* SemiBold (600) */
  font-size: 14px;
  color: #ffffff;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* MOBILE SPECIFIC HEIGHT & LAYOUT REFINEMENTS (<600px) */
@media (max-width: 600px) {
  .t-hero-lead {
    height: 320px;
  }
  .t-hero-sub {
    height: 180px;
  }
  .t-hero-title {
    font-size: 18px;
  }
  .t-single-title {
    font-size: 20px;
  }
  .t-ticker-container {
    flex-wrap: wrap;
  }
}

/* 5. NEWSPAPER PRO CATEGORY BLOCK STYLES */
.t-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 10px;
  margin-bottom: 20px;
  position: relative;
}
.t-block-title {
  font-family: var(--t-font-heading);
  font-weight: 600; /* SemiBold (600) */
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
.t-block-title::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 0;
  width: 60px;
  height: 3px;
  background: var(--t-accent);
}
.t-block-title.title-blue::after { background: var(--t-accent-blue); }
.t-block-title.title-teal::after { background: var(--t-accent-teal); }
.t-block-title.title-gold::after { background: var(--t-accent-gold); }
.t-block-title.title-purple::after { background: var(--t-accent-purple); }

.t-block-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 768px) {
  .t-block-split {
    grid-template-columns: 1fr;
  }
}

.t-vertical-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #ffffff;
  padding: 16px;
  border-radius: var(--t-radius);
  border: 1px solid var(--t-border);
  box-shadow: var(--t-shadow-sm);
}
.t-list-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--t-border);
}
.t-list-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}
.t-list-thumb {
  width: 90px;
  height: 65px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: #e2e8f0;
}
.t-list-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.t-list-item:hover .t-list-thumb img {
  transform: scale(1.08);
}
.t-list-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.t-list-title {
  font-family: var(--t-font-heading);
  font-weight: 600; /* SemiBold (600) */
  font-size: 14px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.t-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 768px) {
  .t-grid-3 {
    grid-template-columns: 1fr;
  }
}

.t-card-news {
  background: #ffffff;
  border-radius: var(--t-radius);
  overflow: hidden;
  box-shadow: var(--t-shadow-sm);
  border: 1px solid var(--t-border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}
.t-card-news:hover {
  transform: translateY(-3px);
  box-shadow: var(--t-shadow-md);
}
.t-card-thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #e2e8f0;
}
.t-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.t-card-news:hover .t-card-thumb img {
  transform: scale(1.05);
}
.t-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}
.t-card-cat {
  font-family: var(--t-font-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--t-accent-blue);
  margin-bottom: 6px;
}
.t-card-title {
  font-family: var(--t-font-heading);
  font-weight: 600; /* SemiBold (600) */
  font-size: 16px;
  line-height: 1.4;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.t-card-meta {
  font-family: var(--t-font-caption);
  font-weight: 400; /* Regular (400) */
  font-size: 12px;
  color: var(--t-text-muted);
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 6. SIDEBAR & WIDGETS */
.t-sidebar {
  display: flex;
  flex-direction: column;
  gap: 30px;
  font-family: var(--t-font-widget);
  font-weight: 400; /* Regular (400) */
}
.t-widget {
  background: #ffffff;
  border-radius: var(--t-radius);
  padding: 20px;
  border: 1px solid var(--t-border);
  box-shadow: var(--t-shadow-sm);
  font-family: var(--t-font-widget);
  font-weight: 400; /* Regular (400) */
}
.t-widget-title {
  font-family: var(--t-font-heading);
  font-weight: 600; /* SemiBold (600) */
  font-size: 18px;
  padding-bottom: 10px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--t-border);
  position: relative;
}
.t-widget-title::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 40px;
  height: 2px;
  background: var(--t-accent);
}

.t-trending-list, .t-category-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.t-trending-item, .t-catpost-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.t-trending-num {
  font-family: var(--t-font-logo);
  font-size: 24px;
  font-weight: 700;
  color: #cbd5e1;
  line-height: 1;
  min-width: 24px;
}
.t-trending-item:nth-child(1) .t-trending-num { color: var(--t-accent); }
.t-trending-item:nth-child(2) .t-trending-num { color: var(--t-accent-gold); }
.t-trending-item:nth-child(3) .t-trending-num { color: var(--t-accent-blue); }

.t-catpost-thumb {
  width: 75px;
  height: 55px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: #e2e8f0;
}
.t-catpost-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.t-trending-info, .t-catpost-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.t-trending-title, .t-catpost-title {
  font-family: var(--t-font-heading);
  font-weight: 600; /* SemiBold (600) */
  font-size: 14px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 7. SINGLE ARTICLE PAGE & CLEAN NON-OVERLAPPING CAPTION FIX */
.t-single-article {
  background: #ffffff;
  border-radius: var(--t-radius);
  padding: 30px;
  border: 1px solid var(--t-border);
  box-shadow: var(--t-shadow-sm);
}
@media (max-width: 600px) {
  .t-single-article { padding: 18px; }
}

.t-single-header {
  margin-bottom: 24px;
}
.t-single-title {
  font-family: var(--t-font-heading);
  font-weight: 600; /* SemiBold (600) */
  font-size: 28px;
  line-height: 1.35;
  margin-bottom: 16px;
  color: var(--t-primary);
}
.t-single-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--t-font-caption);
  font-weight: 400; /* Regular (400) */
  font-size: 13px;
  color: var(--t-text-muted);
  border-bottom: 1px solid var(--t-border);
  padding-bottom: 16px;
}

.t-single-featured-image {
  margin-bottom: 25px;
  border-radius: var(--t-radius);
  overflow: hidden;
}

.t-single-content {
  font-family: var(--t-font-body);
  font-weight: 400; /* Regular (400) */
  font-size: 18px;
  line-height: 1.8;
  color: #1e293b;
}
.t-single-content p {
  margin-bottom: 20px;
}

/* CLEAN NON-OVERLAPPING CAPTION ALIGNMENT FOR GUTENBERG & ALL IMAGE WRAPPERS */
.t-single-content figure,
.t-single-content .wp-block-image,
.t-single-content .wp-caption {
  margin: 24px 0 20px 0 !important;
  padding: 0 !important;
  text-align: center;
}

.t-single-content figure img,
.t-single-content .wp-block-image img,
.t-single-content .wp-caption img,
.t-single-content img {
  display: block !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-top: 16px !important;
  margin-bottom: 6px !important; /* CRISP 6PX SPACING BELOW IMAGE - NO OVERLAP */
  padding-bottom: 0 !important;
  border-radius: var(--t-radius);
}

.t-single-content figcaption,
.t-single-content .wp-element-caption,
.t-single-content .wp-caption-text {
  font-family: var(--t-font-caption) !important;
  font-weight: 400 !important; /* Regular (400) */
  font-size: 13px !important;
  color: var(--t-text-muted) !important;
  text-align: center !important;
  margin-top: 0 !important; /* 0 MARGIN TOP - RELIES ON 6PX MARGIN-BOTTOM OF IMAGE */
  margin-bottom: 16px !important;
  padding-top: 0 !important;
  line-height: 1.4 !important;
}

/* KEYWORD / TAG BADGES DISPLAY */
.t-post-tags {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px dashed var(--t-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.t-tag-label {
  font-family: var(--t-font-heading);
  font-size: 13px;
  font-weight: 600;
  color: var(--t-text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.t-tag-pill {
  display: inline-block;
  background: #f1f5f9;
  color: #334155;
  font-family: var(--t-font-body);
  font-size: 13px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 15px;
  border: 1px solid #cbd5e1;
  transition: all 0.2s ease;
}
.t-tag-pill:hover {
  background: var(--t-accent-blue);
  color: #ffffff;
  border-color: var(--t-accent-blue);
}

/* SOURCE REFERENCE BLOCK */
.source-ref {
  font-family: var(--t-font-caption) !important;
  font-weight: 400 !important; /* Regular (400) */
  font-size: 0.9em !important;
  color: #64748b !important;
  margin-top: 30px !important;
  border-top: 1px solid #e2e8f0 !important;
  padding-top: 14px !important;
}
.source-ref a {
  color: var(--t-accent-blue) !important;
  font-weight: 600 !important;
  text-decoration: none !important;
}

/* FOOTER & LINKS */
.t-footer {
  background: #0f172a;
  color: #94a3b8;
  padding-top: 50px;
  padding-bottom: 20px;
  margin-top: 50px;
  border-top: 4px solid var(--t-accent);
  font-family: var(--t-font-widget);
  font-weight: 400; /* Regular (400) */
}
.t-footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
@media (max-width: 768px) {
  .t-footer-grid { grid-template-columns: 1fr; }
}
.t-footer-title {
  font-family: var(--t-font-heading);
  font-weight: 600;
  color: #ffffff;
  font-size: 16px;
  margin-bottom: 16px;
}
.t-footer-links {
  list-style: none;
}
.t-footer-links li {
  margin-bottom: 8px;
}
.t-footer-links a:hover {
  color: #ffffff;
}
.t-footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid #1e293b;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.t-footer-nav-links {
  display: flex;
  gap: 20px;
  font-size: 14px;
}
.t-footer-nav-links a {
  color: #cbd5e1;
}
.t-footer-nav-links a:hover {
  color: #38bdf8;
}
