/**
 * taandc.com - Enterprise Design System & Core Web Vitals Optimization Engine
 * Architecture: Ultra-Lightweight, Modern CSS, Zero External Render Blocking
 * Performance Targets: LCP < 0.8s, CLS = 0.00, INP < 25ms, Google PageSpeed 99-100
 * Mobile-First: 100% Touch-Friendly, Accessible Tap Targets, Zero Horizontal Overflow
 */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --color-primary: #1e40af;
  --color-primary-hover: #1d4ed8;
  --color-primary-dark: #0f172a;
  --color-accent: #0284c7;
  --color-accent-light: #e0f2fe;
  --color-surface: #ffffff;
  --color-bg: #f8fafc;
  --color-border: #e2e8f0;
  --color-border-hover: #cbd5e1;
  --color-text-main: #0f172a;
  --color-text-muted: #64748b;
  --color-text-light: #94a3b8;
  --color-success: #16a34a;
  --color-warning: #d97706;
  
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ==========================================================================
   Mobile-Friendly Utilities & Scroll Controls
   ========================================================================== */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ==========================================================================
   Google AdSense & Ezoic 100% Policy-Safe Ad Slots (Strict Zero-CLS)
   Strict bounding boxes prevent layout shift when ads asynchronously inject
   ========================================================================== */
.ad-slot-wrapper {
  margin: 1.25rem auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  clear: both;
}

@media (min-width: 768px) {
  .ad-slot-wrapper {
    margin: 1.75rem auto;
  }
}

.ad-badge {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 0.35rem;
  user-select: none;
}

.ad-slot-container {
  background-color: #f1f5f9;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  contain: layout;
  transform: translateZ(0); /* GPU Hardware Accelerated Compositing */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Universal Mobile-Friendly Content Constraints (AdSense, iFrames, Banners, Images) */
.ad-slot-container ins.adsbygoogle {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  text-align: center !important;
}

.ad-slot-container iframe,
.ad-slot-container embed,
.ad-slot-container object {
  max-width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  display: block !important;
  border: 0 !important;
}

.ad-slot-container img {
  max-width: 100% !important;
  height: auto !important;
  margin: 0 auto !important;
  display: block !important;
}

/* Slot: Top Leaderboard (Above The Fold) & Mid-Content (Base Fallbacks) */
.ad-slot-top-banner:not([class*="ad-size-"]) {
  min-height: 90px;
  max-width: 728px;
}
.ad-slot-in-content:not([class*="ad-size-"]) {
  min-height: 120px;
  max-width: 728px;
}

/* ==========================================================================
   Multi-Size Responsive Ad Slots (Desktop Custom Size & Mobile Auto Adapt)
   ========================================================================== */
.ad-size-responsive {
  width: 100%;
  max-width: 970px;
  min-height: 90px;
}
.ad-size-728x90 {
  width: 100%;
  max-width: 728px;
  min-height: 90px;
}
.ad-size-970x250 {
  width: 100%;
  max-width: 970px;
  min-height: 250px;
}
.ad-size-970x90 {
  width: 100%;
  max-width: 970px;
  min-height: 90px;
}
.ad-size-300x250 {
  width: 100%;
  max-width: 300px;
  min-height: 250px;
}
.ad-size-336x280 {
  width: 100%;
  max-width: 336px;
  min-height: 280px;
}
.ad-size-300x600 {
  width: 100%;
  max-width: 300px;
  min-height: 600px;
}
.ad-size-custom {
  width: 100%;
  max-width: 100%;
  min-height: auto;
}

/* Automatic Mobile Size Selection (< 768px):
   Prevents horizontal overflow, scales responsive ads, and adapts to mobile screen bounds (Zero CLS) */
@media (max-width: 768px) {
  .ad-slot-wrapper {
    margin: 1rem auto;
    width: 100%;
    max-width: 100%;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
    box-sizing: border-box;
  }

  .ad-slot-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  /* Desktop leaderboards automatically scale down to mobile banner ratios */
  .ad-size-responsive {
    max-width: 100% !important;
    min-height: 50px;
  }

  .ad-size-728x90,
  .ad-size-970x90 {
    max-width: 100% !important;
    min-height: 50px;
  }

  .ad-size-970x250 {
    max-width: 100% !important;
    min-height: 100px;
  }

  .ad-size-300x250,
  .ad-size-336x280 {
    max-width: 100% !important;
    min-height: 250px;
  }

  .ad-size-300x600 {
    max-width: 100% !important;
    min-height: 250px;
  }

  .ad-size-custom {
    max-width: 100% !important;
    min-height: auto;
  }
}

/* ==========================================================================
   Desktop-Only Floating Sticky Side Rails (Left & Right Gutters)
   100% AdSense Policy Safe: NEVER overlaps content, hidden on screens < 1520px
   Strictly display: none on Mobile, Tablet, and smaller laptops
   ========================================================================== */
.side-ad-rail {
  display: none !important;
}

@media (min-width: 1520px) {
  .side-ad-rail {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    position: fixed;
    top: 96px;
    width: 160px;
    height: 600px;
    z-index: 25;
    contain: layout size;
  }

  .side-ad-left {
    left: calc(50% - 580px - 175px);
  }

  .side-ad-right {
    right: calc(50% - 580px - 175px);
  }

  .side-ad-box {
    width: 160px;
    min-height: 600px;
    background: #f1f5f9;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
  }
}

/* ==========================================================================
   UI Components & Touch-Optimized Cards
   ========================================================================== */
.card-hover {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
  touch-action: manipulation;
}

@media (hover: hover) and (pointer: fine) {
  .card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #93c5fd;
  }
}

.tool-card-item:active {
  transform: scale(0.985);
}

/* Search input with 16px font to prevent iOS Safari auto-zoom */
.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  font-size: 1rem;
  background-color: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 9999px;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
  touch-action: manipulation;
}

@media (min-width: 640px) {
  .search-input {
    padding: 0.875rem 1rem 0.875rem 3rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  }
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(30, 64, 175, 0.15);
}

/* Touch-friendly horizontal category pills */
.pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 9999px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  color: #334155;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
  touch-action: manipulation;
  user-select: none;
}

@media (hover: hover) and (pointer: fine) {
  .pill-tag:hover {
    background-color: #f1f5f9;
    border-color: #93c5fd;
    color: var(--color-primary);
  }
}

.pill-tag:active {
  transform: scale(0.96);
}

.pill-tag.active {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

/* E-E-A-T Trust Section Badges */
.trust-badge {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

@media (min-width: 640px) {
  .trust-badge {
    align-items: center;
  }
}

/* Accessible details accordion with 48px touch targets (Global Standardized) */
.faq-item,
details.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: #ffffff;
  margin-bottom: 0.75rem;
  overflow: hidden;
  padding: 0 !important; /* Strict enforcement to prevent bulky box inflation */
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.faq-item[open],
details.faq-item[open] {
  border-color: #93c5fd;
  box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.06);
}

.faq-item summary,
details.faq-item summary {
  list-style: none;
  padding: 0.875rem 1.125rem;
  font-weight: 700;
  font-size: 0.9375rem;
  color: #0f172a;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  min-height: 48px;
  touch-action: manipulation;
  transition: background-color 0.15s ease, color 0.15s ease;
}

@media (min-width: 640px) {
  .faq-item summary,
  details.faq-item summary {
    padding: 1rem 1.25rem;
    font-size: 1rem;
  }
}

.faq-item summary:hover,
details.faq-item summary:hover {
  background-color: #f8fafc;
  color: var(--color-primary);
}

.faq-item summary::-webkit-details-marker,
details.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after,
details.faq-item summary::after {
  content: "+";
  font-size: 1.25rem;
  font-weight: 600;
  color: #64748b;
  flex-shrink: 0;
  margin-left: 0.75rem;
  line-height: 1;
}

.faq-item[open] summary::after,
details.faq-item[open] summary::after {
  content: "−";
  color: var(--color-primary);
  font-weight: 700;
}

.faq-item .faq-answer,
details.faq-item .faq-answer {
  padding: 0.875rem 1.125rem 1.125rem;
  color: #475569;
  font-size: 0.875rem;
  line-height: 1.625;
  border-top: 1px solid #f1f5f9;
}

@media (min-width: 640px) {
  .faq-item .faq-answer,
  details.faq-item .faq-answer {
    padding: 1rem 1.25rem 1.25rem;
    font-size: 0.9375rem;
  }
}

/* Floating Scroll-to-Top Button */
.scroll-top-btn {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  background-color: var(--color-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  border: none;
  cursor: pointer;
}

.scroll-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.scroll-top-btn:active {
  transform: scale(0.92);
}

/* Hide number input spinners to avoid collision with unit badges and rounded borders */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}
