/* ============================================
   Jchen lux - B2B Solar Street Light Website
   Custom Styles (Tailwind CSS complement)
   Design tokens: navy (#0f172a) + green (#16a34a)
   ============================================ */

/* === Design Tokens === */
:root {
  --color-primary: #16a34a;
  --color-primary-dark: #15803d;
  --color-primary-light: #dcfce7;
  --color-navy: #0f172a;
  --color-navy-light: #1e293b;
  --color-surface: #f9fafb;
  --color-border: #e5e7eb;
  --color-text: #1f2937;
  --color-text-secondary: #6b7280;
  --color-text-muted: #9ca3af;
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.08);
  --shadow-green: 0 4px 14px rgba(22,163,74,0.25);
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;
}

/* === Typography polish === */
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

/* === Touch target minimum === */
@media (max-width: 767px) {
  a, button, summary, [role="button"] { min-height: 44px; min-width: 44px; }
}

/* === Smooth scroll === */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}
html {
  scroll-behavior: smooth;
}

/* === Navbar scroll effect === */
.navbar.scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* === Mobile menu toggle animation === */
#mobileToggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
#mobileToggle.active span:nth-child(2) {
  opacity: 0;
}
#mobileToggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* === Desktop submenu hover === */
@media (min-width: 1024px) {
  .group:hover > .invisible {
    opacity: 1 !important;
    visibility: visible !important;
  }
  .subgroup:hover > .invisible {
    opacity: 1 !important;
    visibility: visible !important;
  }
}

/* === Mobile nav CSS transition === */
#mobileNav {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
#mobileNav.open {
  max-height: none;
}

/* === Mobile submenu open state === */
.mobile-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.mobile-submenu.open {
  max-height: none;
}
.mobile-submenu-toggle i {
  transition: transform 0.25s ease;
}
.mobile-submenu-toggle.open i {
  transform: rotate(180deg);
}

/* === Swiper container protection === */
.swiper-container {
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}

/* === ScrollReveal Animation === */
.addAnimation {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
/* Fallback: show content when JS is disabled */
@media (prefers-reduced-motion: reduce) {
  .addAnimation { opacity: 1; transform: none; transition: none; }
}
noscript .addAnimation,
.addAnimation.noscript-visible { opacity: 1; transform: none; }
.addAnimation.loaded {
  opacity: 1;
  transform: translateY(0);
}

/* === Image lazy loading === */
img[data-src] {
  background: #f1f5f9;
  min-height: 100px;
}

/* === Form submit button loading === */
button[type="submit"].loading {
  pointer-events: none;
  opacity: 0.75;
}

/* === FAQ details/summary === */
.faq-item details > summary {
  cursor: pointer;
  list-style: none;
}
.faq-item details > summary::-webkit-details-marker {
  display: none;
}
.faq-item details > summary i {
  transition: transform 0.3s ease;
}
.faq-item details[open] > summary i {
  transform: rotate(180deg);
}
.faq-content {
  padding: 0 1.5rem 1.5rem 1.5rem;
}

/* === Blog content styling (no class on inner tags) === */
article.content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e2e8f0;
}
article.content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
  margin: 1.5rem 0 0.75rem;
}
article.content h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #334155;
  margin: 1.25rem 0 0.5rem;
}
article.content p {
  margin-bottom: 1rem;
  line-height: 1.8;
  color: #334155;
}
article.content ul,
article.content ol {
  margin: 0.75rem 0 1rem 1.5rem;
  color: #334155;
}
article.content ul {
  list-style-type: disc;
}
article.content ol {
  list-style-type: decimal;
}
article.content li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
}
article.content a {
  color: #16a34a;
  text-decoration: underline;
  transition: color 0.2s;
}
article.content a:hover {
  color: #15803d;
}
article.content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1rem 0;
}
article.content figure {
  margin: 1.5rem 0;
  text-align: center;
}
article.content figcaption {
  font-size: 0.875rem;
  color: #64748b;
  margin-top: 0.5rem;
}
article.content blockquote {
  border-left: 4px solid #16a34a;
  padding: 0.75rem 1.25rem;
  margin: 1.25rem 0;
  background: #f0fdf4;
  color: #334155;
  border-radius: 0 8px 8px 0;
}
article.content blockquote p {
  margin-bottom: 0;
}
article.content code {
  background: #f1f5f9;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.875em;
  color: #e11d48;
}
article.content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1rem 0;
}
article.content pre code {
  background: none;
  color: inherit;
  padding: 0;
}
article.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.925rem;
}
article.content table th,
article.content table td {
  border: 1px solid #e2e8f0;
  padding: 0.625rem 0.875rem;
  text-align: left;
}
article.content table th {
  background: #f8fafc;
  font-weight: 600;
  color: #0f172a;
}
article.content table td {
  color: #334155;
}
article.content time {
  color: #64748b;
  font-size: 0.9rem;
}

/* === Table of Contents === */
.toc-link {
  display: block;
  padding: 0.375rem 0.75rem;
  border-left: 2px solid transparent;
  color: #64748b;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.toc-link:hover {
  color: #16a34a;
  border-left-color: #16a34a;
}
.toc-link.active {
  color: #16a34a;
  border-left-color: #16a34a;
  font-weight: 600;
}
.toc-link.level-3 {
  padding-left: 1.5rem;
}

/* === Product spec table responsive === */
.spec-table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* === Page transition === */
main {
  animation: fadeIn 0.4s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  main { animation: none; }
}

/* === Interaction State Polish === */
/* Primary CTA button active press */
a[class*="bg-green-600"]:active {
  transform: scale(0.98);
}
/* Card hover lift */
.hover-lift {
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}
.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
/* Smooth link underline */
a.hover-underline {
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0 1px;
  transition: background-size var(--transition-normal);
}
a.hover-underline:hover {
  background-size: 100% 1px;
}
/* Focus ring consistency */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
/* Skip link */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.sr-only.focus\:not-sr-only:focus {
  position: static; width: auto; height: auto; margin: 0;
  overflow: visible; clip: auto; white-space: normal;
}

/* === Horizontal Scroll Row === */
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }

/* === Resource Center === */
.resource-hero {
  position: relative;
  overflow: hidden;
  padding: 2rem 1.5rem;
  border: 1px solid rgba(22, 163, 74, 0.12);
  border-radius: 1.75rem;
  background:
    radial-gradient(circle at top right, rgba(22, 163, 74, 0.14), transparent 30%),
    linear-gradient(135deg, rgba(240, 253, 244, 0.95), rgba(255, 255, 255, 0.98) 55%, rgba(248, 250, 252, 0.95));
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.06);
  text-align: center;
}
.resource-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
}
.resource-hero__media {
  position: relative;
  min-height: 320px;
}
.resource-hero__content {
  position: relative;
  z-index: 1;
}
.resource-doc-stack {
  position: absolute;
  overflow: hidden;
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.12);
}
.resource-doc-stack img,
.resource-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.resource-doc-stack--primary {
  inset: 0 auto 0 0;
  width: min(100%, 360px);
  height: 100%;
  transform: rotate(-7deg);
}
.resource-doc-stack--secondary {
  right: 0;
  top: 1rem;
  width: min(58%, 240px);
  height: 180px;
  transform: rotate(8deg);
}
.resource-doc-stack--detail {
  right: 1.5rem;
  bottom: -0.25rem;
  width: min(66%, 280px);
  height: 190px;
}
.resource-hero__chips,
.resource-hero__stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}
.resource-hero__chips {
  margin-bottom: 1.25rem;
}
.resource-hero__stats {
  margin-top: 1.5rem;
}
.resource-chip,
.resource-section-tag,
.resource-card__tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.resource-chip {
  padding: 0.5rem 0.85rem;
  border: 1px solid rgba(22, 163, 74, 0.16);
  background: rgba(255, 255, 255, 0.86);
  color: var(--color-primary-dark);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.04);
}
.resource-stat {
  min-width: 108px;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.05);
}
.resource-stat strong {
  display: block;
  color: var(--color-navy);
  font-size: 1rem;
  line-height: 1.1;
}
.resource-stat span {
  display: block;
  margin-top: 0.35rem;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
}
.resource-section-header {
  margin-bottom: 1.2rem;
}
.resource-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.resource-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 1rem;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75);
}
.resource-section-icon i {
  font-size: 1.3rem;
}
.resource-section-tag {
  padding: 0.35rem 0.7rem;
  color: var(--color-primary-dark);
  background: rgba(22, 163, 74, 0.08);
  border: 1px solid rgba(22, 163, 74, 0.12);
}
.resource-card,
.featured-resource-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 1.2rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.05);
  transition:
    transform var(--transition-normal),
    box-shadow var(--transition-normal),
    border-color var(--transition-normal),
    background var(--transition-normal);
}
.resource-card {
  flex-direction: column;
  align-items: stretch;
  gap: 0.95rem;
}
.resource-card:hover,
.featured-resource-card:hover {
  transform: translateY(-4px);
  border-color: rgba(22, 163, 74, 0.24);
  background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
  box-shadow: 0 24px 50px rgba(22, 163, 74, 0.14);
}
.resource-card__main {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
}
.resource-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  flex-shrink: 0;
}
.resource-card__body {
  min-width: 0;
  flex: 1;
}
.resource-card__topline {
  margin-bottom: 0.45rem;
  min-height: 2rem;
}
.resource-card__tag {
  padding: 0.3rem 0.65rem;
  color: #475569;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(203, 213, 225, 0.7);
  white-space: nowrap;
}
.resource-card__title {
  max-width: 16ch;
}
.resource-card__download {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  color: #64748b;
  background: rgba(241, 245, 249, 0.95);
  border: 1px solid rgba(203, 213, 225, 0.85);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  align-self: flex-start;
  margin-left: 4.5rem;
  transition:
    color var(--transition-normal),
    background var(--transition-normal),
    border-color var(--transition-normal);
}
.group:hover .resource-card__download,
.group:hover .resource-card__download--strong {
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  border-color: transparent;
}
.featured-resource-card {
  width: 100%;
  padding: 1.3rem 1.35rem;
  border-color: rgba(167, 139, 250, 0.18);
  background:
    radial-gradient(circle at top right, rgba(167, 139, 250, 0.12), transparent 26%),
    linear-gradient(180deg, #ffffff 0%, #faf5ff 100%);
}
.resource-preview-thumb {
  width: 172px;
  height: 116px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid rgba(167, 139, 250, 0.22);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}
.resource-card__download--strong {
  background: rgba(255, 255, 255, 0.9);
}
@media (max-width: 1023px) {
  .resource-hero__grid {
    grid-template-columns: 1fr;
  }
  .resource-hero__media {
    min-height: 240px;
    order: 2;
    margin-top: 0.5rem;
  }
  .resource-hero__content {
    order: 1;
  }
}
@media (max-width: 767px) {
  .resource-hero {
    padding: 1.5rem 1rem;
    border-radius: 1.25rem;
  }
  .resource-hero__media {
    min-height: 200px;
  }
  .resource-doc-stack--primary {
    width: min(84%, 280px);
  }
  .resource-doc-stack--secondary {
    width: min(50%, 170px);
    height: 120px;
  }
  .resource-doc-stack--detail {
    right: 0.5rem;
    width: min(58%, 190px);
    height: 130px;
  }
  .resource-section-heading,
  .featured-resource-card {
    align-items: flex-start;
  }
  .resource-card,
  .featured-resource-card {
    flex-wrap: wrap;
  }
  .resource-card__main {
    grid-template-columns: 3.5rem minmax(0, 1fr);
  }
  .resource-card__download,
  .resource-card__download--strong {
    margin-left: 4.5rem;
  }
  .resource-preview-thumb {
    width: 100%;
    height: 150px;
  }
}

/* ============================================
   RTL Support for Arabic (العربية)
   ============================================ */
[dir="rtl"] .mr-2 { margin-right: 0; margin-left: 0.5rem; }
[dir="rtl"] .ml-2 { margin-left: 0; margin-right: 0.5rem; }
[dir="rtl"] .mr-3 { margin-right: 0; margin-left: 0.75rem; }
[dir="rtl"] .ml-3 { margin-left: 0; margin-right: 0.75rem; }
[dir="rtl"] .mr-4 { margin-right: 0; margin-left: 1rem; }
[dir="rtl"] .ml-4 { margin-left: 0; margin-right: 1rem; }
[dir="rtl"] .mr-5 { margin-right: 0; margin-left: 1.25rem; }
[dir="rtl"] .ml-5 { margin-left: 0; margin-right: 1.25rem; }
[dir="rtl"] .mr-6 { margin-right: 0; margin-left: 1.5rem; }
[dir="rtl"] .ml-6 { margin-left: 0; margin-right: 1.5rem; }
[dir="rtl"] .mr-8 { margin-right: 0; margin-left: 2rem; }
[dir="rtl"] .ml-8 { margin-left: 0; margin-right: 2rem; }
[dir="rtl"] .pr-8 { padding-right: 0; padding-left: 2rem; }
[dir="rtl"] .pl-8 { padding-left: 0; padding-right: 2rem; }
[dir="rtl"] .navbar .right-0 { right: auto; left: 0; }
[dir="rtl"] .text-left { text-align: right; }
[dir="rtl"] .text-right { text-align: left; }
[dir="rtl"] .divide-x > * + * { border-left: none; border-right: 1px solid; }

/* ============================================
   Missing Tailwind utilities (manual fallback)
   Tailwind v4 scanner misses classes with
   slashes / colons in .astro files
   ============================================ */
.top-1\/2 { top: 50%; }
.-translate-y-1\/2 { transform: translateY(-50%); }
.translate-y-1\/2 { transform: translateY(50%); }
.top-1\/2, .-translate-y-1\/2 { will-change: transform; }

.hover\:bg-green-600:hover { background-color: #16a34a; }
.hover\:bg-green-700:hover { background-color: #15803d; }
.hover\:scale-105:hover { transform: scale(1.05); }
.hover\:-translate-y-1:hover { transform: translateY(-0.25rem); }

.group-hover\:opacity-100:is(:where(.group):hover *) { opacity: 1; }
.group-hover\:visible:is(:where(.group):hover *) { visibility: visible; }
.group-hover\:scale-105:is(:where(.group):hover *) { transform: scale(1.05); }
