/* DTN Theme Extra — Animations, Utilities, Enhancements */

/* ── Page load fade ── */
body { animation: dtn-pagein .3s ease; }
@keyframes dtn-pagein { from { opacity: 0; } to { opacity: 1; } }

/* ── Card entrance animation ── */
.dtn-card, .dtn-video-card, .dtn-company-card {
  animation: dtn-cardin .4s ease both;
}
@keyframes dtn-cardin {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dtn-news-grid .dtn-card:nth-child(1) { animation-delay: .04s; }
.dtn-news-grid .dtn-card:nth-child(2) { animation-delay: .08s; }
.dtn-news-grid .dtn-card:nth-child(3) { animation-delay: .12s; }
.dtn-news-grid .dtn-card:nth-child(4) { animation-delay: .16s; }
.dtn-news-grid .dtn-card:nth-child(n+5) { animation-delay: .2s; }

/* ── Sticky nav shadow elevation ── */
#dtn-nav.scrolled {
  box-shadow: 0 4px 32px rgba(0,0,0,.55);
}

/* ── Breaking news badge pulse ── */
.dtn-ticker__label { animation: dtn-pulse 2s infinite; }
@keyframes dtn-pulse { 0%,100%{opacity:1} 50%{opacity:.55} }

/* ── Lazy-load image fade ── */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity .38s ease;
}
img[loading="lazy"].loaded { opacity: 1; }

/* ── Trending item hover ── */
.dtn-trending-item { transition: background .14s, padding-left .14s; }
.dtn-trending-item:hover { padding-left: 18px !important; }

/* ── Mega menu active underline ── */
.dtn-nav-item.current-menu-parent > .dtn-nav-link { border-bottom-color: var(--dtn-red); color: #fff; }

/* ── Hero slide transition ── */
.dtn-hero-swipe { will-change: transform; }

/* ── Video modal ── */
#dtn-video-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 9999;
  display: none;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
#dtn-video-modal.open { display: flex; }
.dtn-video-modal-inner {
  position: relative;
  width: 92%;
  max-width: 960px;
  animation: dtn-modalin .22s ease;
}
@keyframes dtn-modalin {
  from { opacity: 0; transform: scale(.94); }
  to   { opacity: 1; transform: scale(1); }
}
.dtn-video-modal-close {
  position: absolute;
  top: -42px; right: 0;
  background: none; border: none;
  color: rgba(255,255,255,.7);
  font-size: 32px; cursor: pointer;
  line-height: 1; transition: color .15s;
}
.dtn-video-modal-close:hover { color: #fff; }
.dtn-video-modal-embed {
  position: relative;
  padding-bottom: 56.25%; height: 0; overflow: hidden;
  border-radius: 8px;
}
.dtn-video-modal-embed iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border-radius: 8px;
}

/* ── Toast notifications ── */
#dtn-toast {
  position: fixed;
  bottom: 76px; right: 20px;
  background: var(--dtn-navy);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  z-index: 5000;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  max-width: 280px;
  border-left: 4px solid var(--dtn-green);
}
#dtn-toast.show { opacity: 1; transform: translateY(0); }
#dtn-toast.error { border-color: var(--dtn-red); }

/* ── Company details grid on single ── */
.dtn-co-details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 20px;
  background: var(--dtn-surface-2);
  border-radius: var(--dtn-radius);
  margin: 20px 0;
}
.dtn-co-detail { text-align: center; }
.dtn-co-detail__label {
  font-size: 10px; color: var(--dtn-text-muted);
  text-transform: uppercase; letter-spacing: .8px; margin-bottom: 4px;
}
.dtn-co-detail__value { font-weight: 700; font-size: 14px; color: var(--dtn-text-primary); }

/* ── Category pills animation ── */
.dtn-cat-pill {
  opacity: 0; animation: dtn-pilin .35s ease forwards;
}
@keyframes dtn-pilin { to { opacity: 1; } }
.dtn-cat-pills-row .dtn-cat-pill:nth-child(1) { animation-delay: .05s; }
.dtn-cat-pills-row .dtn-cat-pill:nth-child(2) { animation-delay: .1s; }
.dtn-cat-pills-row .dtn-cat-pill:nth-child(3) { animation-delay: .15s; }
.dtn-cat-pills-row .dtn-cat-pill:nth-child(n+4) { animation-delay: .2s; }

/* ── Footer logo size ── */
.dtn-footer-logo .dtn-logo__name { font-size: 26px; }
.dtn-footer-logo .dtn-logo__sub { color: rgba(255,255,255,.3); font-size: 9px; }

/* ── Social grid responsive ── */
@media (max-width: 480px) {
  .dtn-social-grid { grid-template-columns: 1fr 1fr; }
  .dtn-co-details-grid { grid-template-columns: 1fr 1fr; }
  .dtn-co-details-grid .dtn-co-detail:last-child:nth-child(odd) { grid-column: 1 / -1; }
  #dtn-toast { bottom: 68px; right: 12px; left: 12px; max-width: none; }
  .dtn-video-modal-inner { width: 98%; }
  .dtn-video-modal-close { top: -36px; font-size: 26px; }
}

/* ── Dark mode transitions ── */
*, *::before, *::after {
  transition: background-color .3s ease, border-color .3s ease, color .2s ease;
}
/* Re-exclude things that should stay fast */
.dtn-card, .dtn-card:hover,
.dtn-video-card, .dtn-company-card,
img, a, button,
.dtn-hero__main .dtn-post-thumb,
.dtn-hero__thumb .dtn-post-thumb,
.dtn-ticker__inner {
  transition: inherit;
}
/* Cards get their own explicit transitions */
.dtn-card { transition: transform .28s ease, box-shadow .28s ease, background-color .3s, border-color .3s; }
.dtn-video-card { transition: transform .25s, box-shadow .25s, background-color .3s, border-color .3s; }

/* ── WP alignment on mobile ── */
@media (max-width: 640px) {
  .alignleft, .alignright { float: none; max-width: 100%; margin: 0 auto 16px; display: block; }
}

/* ═══════════════════════════════════════════════════════════
   DTN THEME PATCH — 09-08-2026
═══════════════════════════════════════════════════════════ */

/* 1. FEATURED / HERO IMAGE DISPLAY FIX */
.dtn-hero__main,
.dtn-hero__thumb,
.dtn-card,
.dtn-card__img,
.dtn-list-card__img,
.dtn-video-card__thumb {
  position: relative;
  isolation: isolate;
  contain: layout paint;
}

.dtn-hero__main img:not(.emoji):not(.wp-smiley),
.dtn-hero__thumb img:not(.emoji):not(.wp-smiley),
.dtn-card__img img:not(.emoji):not(.wp-smiley),
.dtn-list-card__img img:not(.emoji):not(.wp-smiley),
.dtn-video-card__thumb img:not(.emoji):not(.wp-smiley),
.dtn-hero-slide img:not(.emoji):not(.wp-smiley) {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center 30%;
  display: block;
}

.dtn-hero__thumb,
.dtn-card__img {
  min-height: 120px;
}

.dtn-hero__thumbs { grid-auto-rows: minmax(120px, 1fr); }

/* 2. CATEGORY BADGE — visual polish */
.dtn-hero__content .dtn-badge,
.dtn-hero__thumb-content .dtn-badge,
.dtn-card__img .dtn-badge {
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  letter-spacing: 1px;
}
.dtn-hero__thumb-content > a:first-child,
.dtn-hero__content > a.dtn-post-category {
  display: inline-block;
  padding: 3px 9px;
  margin-bottom: 4px;
  border-radius: var(--dtn-radius-sm);
  background: var(--dtn-red);
  color: #fff;
  font-family: var(--dtn-font-head);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
}

/* 3. MEGA MENU — scroll without clipping dropdown */
.dtn-nav-scroll {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
}
.dtn-nav-list {
  overflow-x: auto !important;
  overflow-y: visible;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.dtn-nav-list::-webkit-scrollbar { display: none; }
/* .dtn-mega-menu is switched to fixed positioning so the dropdown can
   escape .dtn-nav-list's overflow-x:auto clipping (an element clipped
   by an ancestor's overflow cannot otherwise render outside it).
   top/left are computed and set inline by main.js (dtnPositionMegaMenu)
   from the trigger link's actual on-screen position — position:fixed's
   containing block is the viewport, not .dtn-nav-item, so percentage/
   keyword values here can't target it. The static top/left below are
   only a no-JS fallback so the menu still opens near the header instead
   of at the literal viewport corner. */
.dtn-mega-menu {
  position: fixed;
  top: 84px;
  left: 8px;
}

/* 4. SCROLL ARROW INDICATORS */
.dtn-scroll-wrap { position: relative; }

.dtn-scroll-arrow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  z-index: 50;
  color: #fff;
  font-size: 13px;
  opacity: 1;
  transition: opacity .18s ease, visibility .18s ease;
}
#dtn-nav .dtn-scroll-arrow {
  background: linear-gradient(90deg, var(--dtn-navy) 55%, transparent);
}
#dtn-nav .dtn-scroll-arrow--next {
  right: 0;
  background: linear-gradient(270deg, var(--dtn-navy) 55%, transparent);
}
.dtn-cat-pills-row-wrap .dtn-scroll-arrow {
  background: linear-gradient(90deg, var(--dtn-surface) 55%, transparent);
  color: var(--dtn-text-primary);
}
.dtn-cat-pills-row-wrap .dtn-scroll-arrow--next {
  right: 0;
  background: linear-gradient(270deg, var(--dtn-surface) 55%, transparent);
}
.dtn-scroll-arrow--prev { left: 0; }
.dtn-scroll-arrow--next { right: 0; }

.dtn-scroll-arrow.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 900px) {
  #dtn-nav .dtn-scroll-arrow { display: none; }
}


/* ═══════════════════════════════════════════════════════════════════
   FEATURED IMAGE STANDARD — 16:9   (29-09-2026)
   Every image slot is a 16:9 frame that scales with its width, so a
   16:9 upload fills it exactly at any screen size (no fixed pixel
   heights, no stretching). Upload spec: 1600×900, min 1200×675.
   Loaded after style.css, so these replace the old px heights.
═══════════════════════════════════════════════════════════════════ */

/* 1 ── Card / video / list frames */
.dtn-card__img,
.dtn-video-card__thumb,
.dtn-list-card__img {
  aspect-ratio: 16 / 9;
  height: auto !important;
  min-height: 0 !important;
}
.dtn-card__img,
.dtn-video-card__thumb { width: 100%; }
.dtn-list-card__img    { width: 96px; }
@media (max-width: 480px) { .dtn-list-card__img { width: 78px; } }

/* 2 ── Images fill their frame (cover = no distortion; 16:9 uploads aren't cropped at all) */
.dtn-card__img img:not(.emoji):not(.wp-smiley),
.dtn-video-card__thumb img:not(.emoji):not(.wp-smiley),
.dtn-list-card__img img:not(.emoji):not(.wp-smiley),
.dtn-hero-slide img:not(.emoji):not(.wp-smiley),
.dtn-hero__main > img,
.dtn-hero__thumb > img {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center 30%;
}
/* icon placeholders (posts without an image) fill the same frame */
.dtn-card__img > div[aria-hidden],
.dtn-video-card__thumb > div[aria-hidden] { position: absolute; inset: 0; }

/* 3 ── Homepage hero */
@media (min-width: 993px) {
  /* Lead tile AND the four side tiles are all true 16:9: two equal halves, and the
     hero's height follows its width. (To go back to a wider lead tile, change the
     columns to 3fr 2fr — the side tiles will then trim ~1/3 of a 16:9 photo.) */
  .dtn-hero { height: auto !important; aspect-ratio: 3.55 / 1; grid-template-columns: 1fr 1fr; }
  .dtn-hero > * { min-height: 0; }
}
@media (min-width: 901px) and (max-width: 992px) {
  .dtn-hero { grid-template-rows: auto auto !important; }
  .dtn-hero__main { aspect-ratio: 16 / 9; }
  .dtn-hero__thumbs { grid-template-rows: auto !important; }
  .dtn-hero__thumb  { aspect-ratio: 16 / 9; min-height: 0; }
}
/* mobile / tablet slider */
.dtn-hero-slide { height: auto !important; aspect-ratio: 16 / 9; }

/* 4 ── Article / page / video-page featured image: whole picture, never cropped */
.dtn-feat-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--dtn-navy, #0D1B2A);   /* fills any letterbox for off-ratio uploads */
}
.dtn-feat-frame img {
  position: absolute; inset: 0;
  width: 100% !important; height: 100% !important;
  max-height: none !important;
  object-fit: contain;
  display: block;
}
.dtn-single-feat-img img { max-height: none !important; }

/* ═══════════════════════════════════════════════════════════════════
   NO NESTED LINKS — tiles are <div>s with a full-cover link
   (a category-badge <a> inside a tile <a> is invalid HTML: the browser
   closes the outer link early and throws the title/badges out of the
   tile, which is what made hero text pile up in the bottom-left.)
═══════════════════════════════════════════════════════════════════ */
.dtn-hero__link,
.dtn-card__img-link { position: absolute; inset: 0; }
.dtn-hero__content > *:not(.dtn-badge) { pointer-events: none; }  /* clicks fall through to the link */
.dtn-hero__content .dtn-badge,
.dtn-hero__thumb-content .dtn-badge,
.dtn-card__img .dtn-badge { pointer-events: auto; position: relative; z-index: 3; }
.dtn-card__img .dtn-badge { position: absolute; }                 /* keeps top-left placement */
.dtn-hero__overlay,
.dtn-hero__thumb-overlay { z-index: 1; }
.dtn-hero__link, .dtn-card__img-link { z-index: 2; }              /* above overlay, below text/badges */
.dtn-hero__content, .dtn-hero__thumb-content { z-index: 3; }
.dtn-hero__content h2,
.dtn-hero__thumb-content h3 { overflow-wrap: anywhere; }

/* Emoji rendered as <img> (WordPress emoji script) must always stay text-sized —
   inside badges, headlines and meta lines, whatever container they sit in. */
img.emoji, img.wp-smiley,
.dtn-badge img,
.dtn-hero__content img.emoji, .dtn-hero__thumb-content img.emoji {
  position: static !important;
  inset: auto !important;
  width: 1em !important;
  height: 1em !important;
  max-width: 1em !important;
  object-fit: contain !important;
  display: inline-block !important;
  vertical-align: -0.12em;
  margin: 0 .15em 0 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}


/* ═══════════════════════════════════════════════════════════════════
   v2.2 POLISH PASS
═══════════════════════════════════════════════════════════════════ */

/* ── Section headings: accent bar only (colour arrives as a CSS variable).
      WordPress core boxes any element whose inline style starts with
      "border-color", which is what drew the frame around "Road Transport". */
.dtn-section-title { border-left-color: var(--dtn-sec-color, var(--dtn-red)); }

/* ── Visually-hidden text (the theme had no rule, so labels showed up) */
.screen-reader-text {
  border: 0; clip: rect(1px,1px,1px,1px); clip-path: inset(50%);
  height: 1px; width: 1px; margin: -1px; padding: 0; overflow: hidden;
  position: absolute !important; white-space: nowrap; word-wrap: normal !important;
}

/* ── Layout: sidebar lines up with the hero. overflow-x:hidden turned the page
      wrapper into a scroll container, which pushed the sticky sidebar down 68px. */
.dtn-page-wrap { overflow-x: clip; }
.dtn-sidebar   { position: static; }

/* ── Hero: crisp per-tile shadow instead of a grey band under the whole block */
.dtn-hero-section { box-shadow: none !important; overflow: visible !important; }
.dtn-hero { filter: drop-shadow(0 8px 16px rgba(13, 27, 42, .18)); }

/* ── "Latest News" filter bar: pills scroll (with a fade) and never collide with "View All" */
.dtn-news-filterbar {
  display: flex; align-items: center; gap: 12px;
  flex: 1 1 340px; min-width: 0; justify-content: flex-end;
}
.dtn-news-filterbar .dtn-tabs {
  min-width: 0; flex: 0 1 auto; padding-right: 30px;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 30px), transparent);
          mask-image: linear-gradient(90deg, #000 calc(100% - 30px), transparent);
}
.dtn-news-filterbar .dtn-view-all { white-space: nowrap; }
@media (max-width: 640px) {
  .dtn-news-filterbar { display: contents; }                 /* children join the header row */
  .dtn-news-filterbar .dtn-view-all { order: 2; margin-left: auto; }
  .dtn-news-filterbar .dtn-tabs     { order: 3; flex: 1 1 100%; }
}

/* ── Stats bar adapts to however many real figures there are */
.dtn-stats-bar { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* ── Sidebar widgets added from Appearance → Widgets (Search, Recent Posts, Comments, …)
      now match the theme's own widget cards */
.dtn-sb-block h2.wp-block-heading, .dtn-sb-block h3.wp-block-heading, .dtn-sb-block h4.wp-block-heading,
.dtn-sb-block > h2, .dtn-sb-block .wp-block-search__label, .dtn-sb-block .widgettitle, .dtn-sb-block .widget-title {
  display: block; margin: 0; padding: 12px 16px;
  background: var(--dtn-navy); color: #fff;
  font-family: var(--dtn-font-head); font-size: 13px; font-weight: 800;
  letter-spacing: 1px; text-transform: uppercase; line-height: 1.3;
}
.dtn-sb-block .wp-block-search__inside-wrapper { display: flex; gap: 8px; padding: 14px 16px 16px; }
.dtn-sb-block .wp-block-search__input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px; font: inherit; font-size: 13px;
  border: 1.5px solid var(--dtn-border); border-radius: 6px; background: var(--dtn-bg, #fff); color: inherit;
}
.dtn-sb-block .wp-block-search__input:focus { border-color: var(--dtn-red); outline: none; }
.dtn-sb-block .wp-block-search__button {
  height: 40px; padding: 0 16px; border: 0; border-radius: 6px; cursor: pointer;
  background: var(--dtn-red); color: #fff; font-weight: 700; font-size: 12px;
  letter-spacing: .5px; text-transform: uppercase; margin: 0;
}
.dtn-sb-block .wp-block-search__button:hover { filter: brightness(1.08); }
.dtn-sb-block ul.wp-block-latest-posts, .dtn-sb-block ol.wp-block-latest-comments,
.dtn-sb-block ul.wp-block-archives, .dtn-sb-block ul.wp-block-categories, .dtn-sb-block ul.wp-block-page-list {
  list-style: none; margin: 0; padding: 4px 16px 10px;
}
.dtn-sb-block ul.wp-block-latest-posts li, .dtn-sb-block ol.wp-block-latest-comments li,
.dtn-sb-block ul.wp-block-archives li, .dtn-sb-block ul.wp-block-categories li, .dtn-sb-block ul.wp-block-page-list li {
  padding: 10px 0; margin: 0; border-bottom: 1px solid var(--dtn-border); font-size: 13.5px; line-height: 1.45;
}
.dtn-sb-block ul.wp-block-latest-posts li:last-child, .dtn-sb-block ol.wp-block-latest-comments li:last-child,
.dtn-sb-block ul.wp-block-archives li:last-child, .dtn-sb-block ul.wp-block-categories li:last-child { border-bottom: 0; }
.dtn-sb-block .wp-block-latest-posts a, .dtn-sb-block .wp-block-archives a,
.dtn-sb-block .wp-block-categories a, .dtn-sb-block .wp-block-latest-comments a {
  color: var(--dtn-text-primary); font-weight: 600; text-decoration: none;
}
.dtn-sb-block .wp-block-latest-posts a:hover, .dtn-sb-block .wp-block-archives a:hover,
.dtn-sb-block .wp-block-categories a:hover, .dtn-sb-block .wp-block-latest-comments a:hover { color: var(--dtn-red); }
.dtn-sb-block .wp-block-latest-posts__post-date, .dtn-sb-block .wp-block-latest-comments__comment-date { color: var(--dtn-text-muted); font-size: 11.5px; }
.dtn-sb-block .wp-block-latest-comments__comment-excerpt p { margin: 4px 0 0; font-size: 12.5px; color: var(--dtn-text-secondary); }
.dtn-sb-block > p, .dtn-sb-block > div:not([class]) { padding: 12px 16px; margin: 0; font-size: 13.5px; }

/* ── Safety net: card images fade in via JS, but never stay invisible if JS is slow/blocked */
@keyframes dtn-img-safety { to { opacity: 1; } }
.dtn-card__img img:not(.loaded):not(.emoji),
.dtn-video-card__thumb img:not(.loaded):not(.emoji),
.dtn-list-card__img img:not(.loaded):not(.emoji) { animation: dtn-img-safety .01s linear 2.5s forwards; }

/* ── Typographic finishing */
/* balance only large headlines; card titles keep natural wrapping (balance made them 3 short lines) */
h1, .dtn-hero__content h2, .dtn-archive-header h1 { text-wrap: balance; }
.dtn-card__title, .dtn-hero__thumb-content h3 { text-wrap: pretty; }
.dtn-card__excerpt, .dtn-article-content p { text-wrap: pretty; }
.dtn-fuel-price, .dtn-stat__number, .dtn-fuel-table td { font-variant-numeric: tabular-nums; }
::selection { background: var(--dtn-red); color: #fff; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

.dtn-sb-block .wp-block-group { margin: 0; padding: 0; }
.dtn-sb-block .no-comments, .dtn-sb-block .wp-block-latest-comments__no-comments { padding: 12px 16px 16px; margin: 0; color: var(--dtn-text-muted); font-size: 13px; }
