/*
Theme Name: DHDA Tailwind Theme v2.1 Ultralite
Theme URI: https://dhda.pedaids.org/
Author: DHDA
Description: Tailwind + Alpine.js WordPress theme for DHDA with EGPAF-aligned colors. Uses Tailwind CDN (no build step). Minimal, fast, and installable.
Version: 2.1
License: GPLv2 or later
Text Domain: dhda-tailwind
*/

/* ---------- Brand Variables ---------- */
:root {
  --dhda-primary: #003b5c;
  --dhda-primary-600: #00598c;
  --dhda-primary-300: #4c7fa3;
  --dhda-accent: #00a3ad;
  --dhda-accent-700: #00828a;
  --dhda-accent-300: #66cfd4;
  --dhda-warm: #f7b733;
  --dhda-warm-600: #d99820;
  --dhda-warm-200: #fde68a;
  --dhda-dark: #1f2937;
  --dhda-dark-600: #111827;
  --dhda-dark-300: #374151;
  --dhda-light: #f9fafb;
  --dhda-gray: #9ca3af;
  --dhda-gray-200: #e5e7eb;
  --dhda-success: #10b981;
  --dhda-error: #ef4444;
  --dhda-warning: #f59e0b;
  --dhda-info: #3b82f6;
  --link: var(--dhda-primary-600);
  --link-hover: var(--dhda-primary-300);
  --text-on-dark: #fff;
  --text-on-light: var(--dhda-dark-600);
  --tt-h: 44px;
}

/* ---------- Base Fallbacks ---------- */
body {
  font-family: 'Inter', 'Poppins', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
               'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji',
               'Segoe UI Symbol';
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}

.site-header {
  border-bottom: 1px solid var(--dhda-gray-200);
  position: relative;
  z-index: 40;
  overflow: visible;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  min-height: 80px;
}

.site-footer {
  border-top: 1px solid var(--dhda-gray-200);
}

/* ---------- Links ---------- */
a:not(.btn) {
  color: var(--link);
  text-decoration-color: color-mix(in oklch, currentColor 45%, transparent);
  text-underline-offset: 2px;
}

a:not(.btn):hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* ---------- Utility-built Anchors (Button-like) ---------- */
a[class*="bg-"][class*="px-"][class*="py-"],
a[class*="bg-"].rounded,
a[class*="bg-"].rounded-lg {
  color: var(--text-on-dark) !important;
  text-decoration: none !important;
}

a.bg-white,
a.bg-gray-50,
a[class*="bg-white/"],
a[class*="bg-gray-100"],
a[class*="bg-[var(--dhda-light)]"] {
  color: var(--text-on-light) !important;
}

/* ---------- Brand Button Hovers ---------- */
a.bg-\[var\(--dhda-primary\)\] { color: #fff !important; }
a.bg-\[var\(--dhda-primary\)\]:hover { background: var(--dhda-primary-300) !important; color: var(--dhda-dark-600) !important; }
a.bg-\[var\(--dhda-accent\)\] { color: #fff !important; }
a.bg-\[var\(--dhda-accent\)\]:hover { background: var(--dhda-accent-300) !important; color: var(--dhda-dark-600) !important; }
a.bg-\[var\(--dhda-warm-600\)\] { color: #fff !important; }
a.bg-\[var\(--dhda-warm-600\)\]:hover { background: var(--dhda-gray-200) !important; color: var(--dhda-dark-600) !important; }

/* ---------- Button System ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.675rem 1.1rem;
  border-radius: 0.65rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--dhda-accent-300);
  outline-offset: 2px;
}

.btn-primary { background: var(--dhda-primary); color: #fff; }
.btn-primary:hover { background: var(--dhda-primary-300); color: var(--dhda-dark-600); }
.btn-accent { background: var(--dhda-primary); color: #fff; }
.btn-accent:hover { background: var(--dhda-primary-300); color: var(--dhda-dark-600); }
.btn-warm { background: var(--dhda-warm-600); color: #fff; }
.btn-warm:hover { background: var(--dhda-warm-200); color: var(--dhda-dark-600); }
.btn-ghost { background: #fff; color: var(--dhda-primary); }
.btn-ghost:hover { background: var(--dhda-gray-200); color: var(--dhda-primary-600); }

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}

/* ---------- Header & Footer Link Colors ---------- */
.site-header nav a { color: var(--dhda-primary); }
.site-header nav a:hover { color: var(--dhda-accent-700); }
.site-footer a { color: var(--dhda-accent); }
.site-footer a:hover { color: var(--dhda-primary-600); }

/* ---------- Hero Featured Cards ---------- */
.hero-cards article {
  background: linear-gradient(135deg, rgba(0, 163, 173, 0.18), rgba(0, 59, 92, 0.44));
  border: 1px solid rgba(0, 163, 173, 0.22);
  border-radius: 0.75rem;
}

.hero-cards article:hover {
  background: linear-gradient(135deg, rgba(0, 163, 173, 0.28), rgba(0, 59, 92, 0.52));
  border-color: rgba(0, 163, 173, 0.42);
}

.hero-cards article p { color: rgba(255, 255, 255, 0.88); }
.hero-cards article a { color: var(--dhda-accent-300); }

/* ---------- Softer White Card Borders (Global) ---------- */
article.bg-white.border.rounded-xl,
section .bg-white.border.rounded-xl {
  border: 0;
  border-radius: 12px;
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--dhda-primary-300) 28%, transparent),
              0 1px 2px rgba(17, 24, 39, 0.04),
              0 6px 14px rgba(17, 24, 39, 0.06);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

article.bg-white.border.rounded-xl:hover,
section .bg-white.border.rounded-xl:hover {
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--dhda-accent-300) 40%, transparent),
              0 8px 20px rgba(17, 24, 39, 0.09);
  transform: translateY(-1px);
}

/* ---------- Chapter Pager (Prev/Next) ---------- */
.doc-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  width: 100%;
}

.doc-pager__prev { grid-column: 1; justify-self: start; }
.doc-pager__next { grid-column: 2; justify-self: end; }

.doc-pager__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--dhda-primary-300) 28%, transparent),
              0 1px 2px rgba(17, 24, 39, 0.04),
              0 6px 14px rgba(17, 24, 39, 0.06);
  color: var(--dhda-primary);
  text-decoration: none;
}

.doc-pager__link:hover {
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--dhda-accent-300) 40%, transparent),
              0 8px 20px rgba(17, 24, 39, 0.09);
}

.doc-pager__meta { color: var(--dhda-gray); font-weight: 500; }
.doc-pager__title { font-weight: 600; }
.doc-pager__icon { width: 18px; height: 18px; }

@media (max-width: 640px) {
  .doc-pager { grid-template-columns: 1fr; }
  .doc-pager__prev, .doc-pager__next { grid-column: 1; justify-self: stretch; }
}

/* ---------- Blog Layout (Single Post) ---------- */
body.single-post {
  --blog-rail: 300px;
  --blog-gap: 2rem;
  --header-offset: 72px;
}

@media (min-width: 782px) {
  body.admin-bar.single-post { --header-offset: 104px; }
}

/*@media (min-width: 1024px) {*/
/*  .blog-grid { display: grid; grid-template-columns: var(--blog-rail) minmax(0, 1fr); gap: var(--blog-gap); }*/
/*  .blog-rail { position: sticky; top: calc(var(--header-offset) + 16px); align-self: start; }*/
/*}*/
/* Blog rail – sticky only on desktop */
@media (min-width:1024px){
  .blog-grid{
    display:grid;
    grid-template-columns: var(--blog-rail,300px) minmax(0,1fr);
    gap: var(--blog-gap,2rem);
  }
  .blog-rail{
    position: sticky;
    top: calc(var(--header-h,72px) + var(--adminbar-h,0px) + 16px);
    align-self: start;
    z-index: 1; /* stays above article background but not overlaying */
  }
}

/* Phones/tablets: stack and disable sticky to prevent overlap */
@media (max-width:1023px){
  .blog-grid{ display:block !important; }
  .blog-rail{
    position: static !important;
    top: auto !important;
    z-index: auto !important;
    margin-top: 1rem;
  }
}

@media (min-width: 782px) {
  body.admin-bar .sticky { top: 6.5rem; }
}

/* ---------- TechTalks Filter Bar ---------- */
.tt-filter {
  display: grid;
  gap: 0.75rem;
  align-items: center;
  background: #fff;
  border: 1px solid var(--dhda-gray-200);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
  grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
  .tt-filter { grid-template-columns: 1fr 220px 220px 120px; }
}

.tt-filter .tt-control,
.tt-filter input[type="search"],
.tt-filter select {
  height: var(--tt-h);
  line-height: var(--tt-h);
  border: 1px solid var(--dhda-gray-200);
  border-radius: 10px;
  background: #fff;
  padding: 0 0.75rem;
  width: 100%;
}

.tt-filter select.tt-control { padding-right: 2rem; }
.tt-filter .tt-control:focus,
.tt-filter input[type="search"]:focus,
.tt-filter select:focus {
  outline: none;
  border-color: var(--dhda-accent-300);
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--dhda-accent) 35%, transparent);
}

.tt-filter .btn { height: var(--tt-h); justify-content: center; }

.tt-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- TechTalks Blog Rail (Single Posts) ---------- */
.blog-rail {
  position: sticky;
  top: calc(var(--header-offset, 72px) + 16px);
  align-self: start;
}

.blog-rail .card {
  background: #fff;
  border: 1px solid var(--dhda-gray-200);
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

.blog-rail .card + .card { margin-top: 0.75rem; }
.blog-rail .card h3 {
  margin: 0 0 0.6rem 0;
  font-weight: 700;
  font-size: 1rem;
  color: var(--dhda-dark-600);
}

.blog-rail .post-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.blog-rail .post-list a {
  display: block;
  line-height: 1.35;
  color: var(--dhda-primary);
  text-decoration: none;
}

.blog-rail .post-list a:hover {
  color: var(--dhda-accent-700);
  text-decoration: underline;
}

.blog-rail .widget_categories ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
}

.blog-rail .widget_categories li {
  list-style: none;
  margin: 0;
}

.blog-rail .widget_categories a {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.875rem;
  background: #f1f5f9;
  color: var(--dhda-dark-600) !important;
  text-decoration: none;
}

.blog-rail .widget_categories a:hover {
  background: color-mix(in oklch, var(--dhda-accent) 18%, transparent);
  color: var(--dhda-primary-600) !important;
}

.blog-rail .text-white,
.blog-rail [class*="text-white"] { color: var(--dhda-dark-600) !important; }

/* ---------- Header Navigation (Desktop & Mobile) ---------- */
.site-header a span {
  font-family: 'Inter', 'Poppins', sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.site-header .mobile-menu > li > a {
  font-family: 'Inter', 'Poppins', sans-serif;
  font-weight: 600;
}

/* === Desktop Nav === */
@media (min-width: 1024px) {
  .site-header .main-menu {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .site-header .main-menu > li { position: relative; }

  .site-header .main-menu > li > a {
    display: inline-block;
    padding: 0.55rem 0.25rem;
    text-decoration: none;
    font-weight: 800;
    color: var(--dhda-primary);
  }

  .site-header .main-menu > li > a:hover,
  .site-header .main-menu > li > a:focus-visible {
    color: var(--dhda-accent-700);
    outline: 0;
  }

  .site-header .current-menu-item > a,
  .site-header .current_page_item > a { color: var(--dhda-accent-700); }

  .site-header .menu-item-has-children > .sub-menu {
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 0.25rem;
    background: #fff;
    border: 1px solid var(--dhda-gray-200);
    border-radius: 0.75rem;
    min-width: 16rem;
    padding: 0.25rem;
    box-shadow: 0 12px 28px rgba(17, 24, 39, 0.12);
    display: none;
    z-index: 60;
  }

  .site-header .menu-item-has-children:hover > .sub-menu,
  .site-header .menu-item-has-children:focus-within > .sub-menu { display: block; }

  .site-header .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0.25rem;
  }

  .site-header .sub-menu > li > a {
    display: block;
    padding: 0.6rem 0.9rem;
    border-radius: 0.5rem;
    white-space: nowrap;
    font-weight: 600;
    color: var(--dhda-primary);
    text-decoration: none;
  }

  .site-header .sub-menu > li > a:hover,
  .site-header .sub-menu > li > a:focus-visible {
    background: color-mix(in oklch, var(--dhda-accent) 12%, #fff);
    color: var(--dhda-primary-600);
    outline: 0;
  }
}

/* Hide desktop nav on small screens */
@media (max-width: 1023px) {
  .site-header nav[aria-label="Primary"] { display: none; }
}

/* === Hamburger Toggle === */
.mobile-toggle { -webkit-tap-highlight-color: transparent; }

.mobile-toggle .hamburger {
  width: 24px;
  height: 16px;
  position: relative;
  display: block;
}

.mobile-toggle .hamburger-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--dhda-primary);
  border-radius: 9999px;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.mobile-toggle .line1 { top: 0; }
.mobile-toggle .line2 { top: 50%; transform: translateY(-50%); }
.mobile-toggle .line3 { bottom: 0; }

.mobile-toggle.is-open .line1 { transform: translateY(7px) rotate(45deg); }
.mobile-toggle.is-open .line2 { opacity: 0; }
.mobile-toggle.is-open .line3 { transform: translateY(-7px) rotate(-45deg); }

/* === Mobile Drawer === */
.mobile-drawer {
  width: 80vw;
  max-width: 320px;
  background: var(--dhda-light);
  box-shadow: 0 4px 20px rgba(17, 24, 39, 0.15);
  overflow-y: auto;
  transition: transform 0.3s ease-out;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  transform: translateX(-100%);
  z-index: 50;
}

.mobile-drawer[x-show="open"] { transform: translateX(0); }

@media (max-width: 1023px) {
  .site-header .mobile-menu,
  .site-header .mobile-menu ul {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    width: 100%;
  }

  .site-header .mobile-menu > li,
  .site-header .mobile-menu ul > li { width: 100%; }

  .site-header .mobile-menu > li > a,
  .site-header .mobile-menu ul > li > a {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    transition: background 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    text-decoration: none;
    color: var(--dhda-primary);
    font-weight: 800;
  }

  .site-header .mobile-menu > li > a:hover,
  .site-header .mobile-menu > li > a:focus-visible,
  .site-header .mobile-menu ul > li > a:hover,
  .site-header .mobile-menu ul > li > a:focus-visible {
    background: color-mix(in oklch, var(--dhda-accent) 12%, #fff);
    color: var(--dhda-primary-600);
  }

  .site-header .mobile-menu .sub-menu {
    margin: 0.5rem 0 0 1rem;
    padding-left: 1rem;
    border-left: 2px solid var(--dhda-gray-200);
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    position: relative;
    z-index: 51;
  }

  .site-header .mobile-menu .menu-item-has-children.is-open > .sub-menu {
    max-height: 500px;
    opacity: 1;
  }

  .site-header .mobile-menu .sub-menu a {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    transition: background 0.2s ease, color 0.2s ease;
    display: block;
    color: var(--dhda-primary);
    font-weight: 600;
    text-decoration: none;
  }

  .site-header .mobile-menu .sub-menu a:hover,
  .site-header .mobile-menu .sub-menu a:focus-visible {
    background: color-mix(in oklch, var(--dhda-accent) 12%, #fff);
    color: var(--dhda-primary-600);
  }

  .submenu-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: color-mix(in oklch, var(--dhda-gray-200) 50%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    cursor: pointer;
  }

  .submenu-toggle:hover,
  .submenu-toggle:focus-visible {
    background: var(--dhda-accent-300);
    color: var(--dhda-dark-600);
  }

  .menu-item-has-children.is-open > .submenu-toggle svg {
    transform: rotate(180deg);
    transition: transform 0.2s ease;
  }

  .site-header .mobile-menu > li > a svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
  }

  .site-header .mobile-menu .menu-item-has-children > a {
    padding-right: 0.5rem;
  }
}

/* === Overlay === */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 40;
  transition: opacity 0.3s ease;
  opacity: 0;
}

.mobile-overlay[x-show="open"] { opacity: 1; }

@media (min-width: 1024px) {
  .mobile-drawer,
  .mobile-toggle,
  .mobile-overlay { display: none; }
}

/* Override WordPress menu defaults */
.site-header .main-menu,
.site-header .main-menu ul,
.site-header .main-menu li,
.site-header .mobile-menu,
.site-header .mobile-menu ul,
.site-header .mobile-menu li { list-style: none; }


