/* ========================================
   TOOLS PAGE - Professional Design
   Light Theme
   ======================================== */

/* Page Container */
.tools-page {
  background: #ffffff;
  color: #000;
  min-height: 100vh;
}

/* Hero Section */
.hero-section {
  position: relative;
  width: 100%;
  height: clamp(320px, 35vw, 460px);
  overflow: hidden;
  margin-bottom: 0;
}

.hero-bg {
  position: absolute;
  inset: 0;
  opacity: 1;
}

.hero-bg img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
}

.hero-section .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.55) 0%,
    rgba(0,0,0,0.25) 45%,
    rgba(0,0,0,0.0) 100%
  );
  pointer-events: none;
}

.hero-credit {
  position: absolute;
  bottom: 12px;
  right: 16px;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.75);
  z-index: 1;

  /* allow clicking the link */
  pointer-events: auto;

  /* helps on bright cloud areas */
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.hero-credit a {
  color: rgba(255,255,255,0.85);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.hero-credit a:hover {
  color: rgba(255,255,255,1);
}

.hero-credit .sep {
  margin: 0 8px;
}

/* Main Content Container with Dual Sidebars */
.tools-page-wrapper {
  width: 100%;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem 4rem;
  box-sizing: border-box;
}

.tools-container {
  flex: 0 0 auto;
  max-width: 1200px;
  width: 100%;
}

/* Main Content Container */
.tools {
  width: 100%;
}

/* Page Title */
.tools h1 {
  font-size: clamp(1.75rem, 4vw + 1rem, 4rem);
  font-weight: 700;
  margin: 0 0 1rem 0;
  color: #000;
  text-align: left;
  letter-spacing: -0.02em;
}

/* Intro Text */
.tools-intro {
  font-size: 1.125rem;
  line-height: 1.7;
  color: rgba(0, 0, 0, 0.7);
  margin-bottom: 3rem;
  max-width: 900px;
}

/* Tools List - Card Layout */
.tools-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 3rem;
}

/* Individual Tool Card */
.tool-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.tool-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.tool-link {
  display: flex;
  flex-direction: row;
  color: inherit;
  text-decoration: none;
  gap: 1.5rem;
  align-items: flex-start;
  padding: 1.5rem;
}

/* Tool Image */
.tool-image {
  flex-shrink: 0;
  width: 280px;
  height: 157px;
  overflow: hidden;
  border-radius: 6px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.tool-card:hover .tool-image img {
  transform: scale(1.05);
}

/* Tool Content */
.tool-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

/* Tool Title */
.tool-title {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  color: #000;
  line-height: 1.3;
}

/* Tool Description */
.tool-description {
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(0, 0, 0, 0.7);
  margin: 0 0 1rem 0;
}

/* Tool Meta Container */
.tool-meta {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Tool Tags */
.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  background: #f3f4f6;
  color: rgba(0, 0, 0, 0.7);
  font-size: 0.875rem;
  border-radius: 4px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.tool-card:hover .tag {
  background: #e5e7eb;
  color: rgba(0, 0, 0, 0.85);
}

/* Tool Updated Date */
.tool-updated {
  font-size: 0.875rem;
  color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tool-updated i {
  font-size: 0.875rem;
}

.tool-updated time {
  font-style: normal;
}

/* Responsive Layout */
@media (max-width: 768px) {
  .tool-link {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
  }

  .tool-image {
    width: 100%;
    height: 180px;
  }

  .tool-title {
    font-size: 1.5rem;
  }

  .tools-intro {
    font-size: 1rem;
  }

  .tool-meta {
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .hero-section {
    height: 240px;
  }

  .tool-title {
    font-size: 1.375rem;
  }

  .tool-description {
    font-size: 0.9375rem;
  }

  .tag {
    font-size: 0.8125rem;
    padding: 0.3125rem 0.625rem;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .tools-page {
    background: #0a0a0a;
    color: #ffffff;
  }

  .tools h1 {
    color: #ffffff;
  }

  .tools-intro {
    color: rgba(255, 255, 255, 0.7);
  }

  .tool-card {
    background: #1a1a1a;
    border-color: #2a2a2a;
  }

  .tool-card:hover {
    border-color: #3a3a3a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  }

  .tool-title {
    color: #ffffff;
  }

  .tool-description {
    color: rgba(255, 255, 255, 0.7);
  }

  .tool-image {
    background: #2a2a2a;
  }

  .tag {
    background: #2a2a2a;
    color: rgba(255, 255, 255, 0.7);
  }

  .tool-card:hover .tag {
    background: #3a3a3a;
    color: rgba(255, 255, 255, 0.85);
  }

  .tool-updated {
    color: rgba(255, 255, 255, 0.5);
  }
}

/* Accessibility */
.tool-link:focus {
  outline: 2px solid #4a90e2;
  outline-offset: 2px;
}

.tool-link:focus:not(:focus-visible) {
  outline: none;
}

/* Print Styles */
@media print {
  .hero-section,
  .hero-credit {
    display: none;
  }

  .tool-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .tool-image {
    display: none;
  }
}

/* ========================================
   AD SIDEBAR STYLING - DUAL AD UNIT SYSTEM
   (Copied from updates.css - see that file for complete documentation)
   ======================================== */
.ad-sidebar {
  /* Default base styling - overridden by breakpoints */
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.ad-container {
  position: sticky;
  top: 100px;
  margin: 0 auto;
  text-align: center;
  padding: 12px;
  box-sizing: border-box;
}

/* Ad label styling */
.ad-label {
  font-size: 0.7rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  font-weight: 500;
  text-align: center;
}

/* Center the <ins> within each ad unit */
.ad-unit {
  display: flex;
  justify-content: center;
}

/* Default: show 300x600, hide 160x600 */
.ad-160 {
  display: none;
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   Based on CSS viewport width for AdSense optimization
   ======================================== */

/* Large viewports (≥1920px) - Full layout with 300×600 ads */
@media (min-width: 1920px) {
  .tools-page-wrapper {
    padding: 2rem 2rem 4rem;
    gap: 2rem;
  }
  
  .tools-container {
    max-width: 1200px;
  }
  
  .ad-sidebar {
    flex: 1 1 300px;
    min-width: 300px;
  }
}

/* Medium-Large viewports (1600-1919px) - 300×600 ads with constrained content */
@media (min-width: 1600px) and (max-width: 1919px) {
  .tools-page-wrapper {
    padding: 2rem 1.5rem 4rem;
    gap: 1.5rem;
  }
  
  .tools-container {
    max-width: clamp(900px, 50vw, 1100px);
  }
  
  .ad-sidebar {
    flex: 1 1 300px;
    min-width: 300px;
  }
}

/* Medium viewports (1400-1599px) - Switch to 160×600 wide skyscraper */
@media (min-width: 1400px) and (max-width: 1599px) {
  .tools-page-wrapper {
    padding: 2rem 1rem 4rem;
    gap: 1rem;
  }
  
  .tools-container {
    max-width: clamp(900px, 70vw, 1100px);
  }
  
  .ad-sidebar {
    flex: 1 1 160px;
    min-width: 160px;
  }
  
  /* Toggle ad sizes: hide 300x600, show 160x600 */
  .ad-300 {
    display: none;
  }
  
  .ad-160 {
    display: block;
  }
}

/* Small-Medium viewports (1200-1399px) - 160×600 with tighter spacing */
@media (min-width: 1200px) and (max-width: 1399px) {
  .tools-page-wrapper {
    padding: 2rem 1rem 4rem;
    gap: 1rem;
  }
  
  .tools-container {
    max-width: clamp(800px, 70vw, 1000px);
  }
  
  .ad-sidebar {
    flex: 1 1 160px;
    min-width: 160px;
  }
  
  /* Toggle ad sizes: hide 300x600, show 160x600 */
  .ad-300 {
    display: none;
  }
  
  .ad-160 {
    display: block;
  }
}

/* Below 1200px - Hide sidebar ads, expand content */
@media (max-width: 1199px) {
  .tools-page-wrapper {
    justify-content: center;
    padding: 2rem 1.5rem 4rem;
  }
  
  .ad-sidebar {
    display: none;
  }
  
  .tools-container {
    max-width: clamp(600px, 90vw, 900px);
  }
}

/* Tablet (768-1199px) - No ads, optimized content width */
@media (min-width: 768px) and (max-width: 1199px) {
  .tools-page-wrapper {
    padding: 2rem 1.5rem 4rem;
  }
  
  .tools-container {
    max-width: clamp(600px, 85vw, 800px);
  }
}

/* Mobile (below 768px) - No ads, full-width responsive */
@media (max-width: 767px) {
  .tools-page-wrapper {
    padding: 1.5rem 1rem 3rem;
  }
  
  .tools-container {
    max-width: 100%;
  }
}
