/* ========================================
  Open by Default - BOMBASTIC GEOMETRIC MORPH
  Option C: drifting polygons, rotating squares, scaling triangles
  + Carousel (horizontal scroll) + Stacked Articles (vertical)
  ======================================== */

:root {
  /* Tri-Color Primary Scheme */
  --color-primary-1: #ff4d4d;
  --color-primary-2: #4d4dff;
  --color-primary-3: #44ff44;
  
  /* Base Colors */
  --color-bg: #0a0a0c;
  --color-text: #e2e0e7;
  --color-muted: #c0bdd0;
  --color-accent-white: #ffffff;
  
  /* Fonts */
  --font-heading: 'Inter Tight', system-ui, sans-serif;
  --font-body: 'Inter Tight', system-ui, sans-serif;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;
  
  /* Effects */
  --radius-lg: 24px;
  --transition-base: 350ms cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

/* ===== DYNAMIC BACKGROUND – MORPHING GEOMETRIC SHAPES ===== */
body {
  background-color: #050508;
  position: relative;
  overflow-x: hidden;
}

/* Base dark canvas */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 30% 40%, #1a0a2a, #000000);
  z-index: -3;
  pointer-events: none;
}

/* Shape 1: Rotating Square (Red/Blue gradient) */
.geometric-shape-1 {
  position: fixed;
  top: 15%;
  left: -5%;
  width: 40vmax;
  height: 40vmax;
  background: linear-gradient(135deg, rgba(255,77,77,0.4), rgba(77,77,255,0.3));
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  animation: morphRotate 18s infinite alternate ease-in-out;
  filter: blur(20px);
  z-index: -2;
  pointer-events: none;
}

/* Shape 2: Morphing Triangle (Green/Blue) */
.geometric-shape-2 {
  position: fixed;
  bottom: 10%;
  right: -10%;
  width: 50vmax;
  height: 50vmax;
  background: linear-gradient(45deg, rgba(68,255,68,0.3), rgba(77,77,255,0.4));
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  animation: morphTriangle 22s infinite alternate cubic-bezier(0.68, -0.55, 0.27, 1.55);
  filter: blur(25px);
  z-index: -2;
  pointer-events: none;
}

/* Shape 3: Pulsing Pentagon (Yellow/Red) */
.geometric-shape-3 {
  position: fixed;
  top: 50%;
  left: 30%;
  width: 30vmax;
  height: 30vmax;
  background: radial-gradient(circle, rgba(255,200,100,0.35), rgba(255,77,77,0.2));
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
  animation: pulseScale 14s infinite alternate;
  filter: blur(30px);
  z-index: -2;
  pointer-events: none;
}

/* Shape 4: Drifting Hexagon (Mixed) */
.geometric-shape-4 {
  position: fixed;
  bottom: 20%;
  left: 15%;
  width: 35vmax;
  height: 35vmax;
  background: linear-gradient(120deg, rgba(255,77,77,0.25), rgba(68,255,68,0.25));
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  animation: driftRotate 25s infinite alternate-reverse;
  filter: blur(35px);
  z-index: -2;
  pointer-events: none;
}

/* Keyframes for geometric morphing */
@keyframes morphRotate {
  0% {
    transform: rotate(0deg) scale(1);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  }
  50% {
    transform: rotate(180deg) scale(1.2);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  }
  100% {
    transform: rotate(360deg) scale(0.9);
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
  }
}

@keyframes morphTriangle {
  0% {
    transform: translate(0, 0) scale(1);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  }
  33% {
    transform: translate(-8%, -12%) scale(1.1);
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
  }
  66% {
    transform: translate(5%, 8%) scale(0.9);
    clip-path: polygon(20% 0%, 80% 0%, 100% 20%, 100% 80%, 80% 100%, 20% 100%, 0% 80%, 0% 20%);
  }
  100% {
    transform: translate(0, 0) scale(1);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  }
}

@keyframes pulseScale {
  0% {
    transform: scale(0.8) rotate(0deg);
    opacity: 0.4;
  }
  100% {
    transform: scale(1.4) rotate(45deg);
    opacity: 0.8;
  }
}

@keyframes driftRotate {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  100% {
    transform: translate(-12%, -8%) rotate(180deg);
  }
}

/* Document Base */
html {
  font-size: 100%;
  scroll-behavior: smooth;
}
body {
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  background-color: var(--color-bg);
  position: relative;
  z-index: 1;
}

/* Typography (bombastic) */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: var(--space-md);
  color: var(--color-text);
}
h1 {
  font-size: clamp(2.75rem, 7vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--color-primary-1), var(--color-primary-2), var(--color-primary-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 15px rgba(255,77,77,0.4);
  animation: titlePulse 3s infinite alternate;
}
@keyframes titlePulse {
  0% { text-shadow: 0 0 5px rgba(255,77,77,0.2); }
  100% { text-shadow: 0 0 25px rgba(77,77,255,0.6); }
}
h2 {
  border-left: 5px solid var(--color-primary-1);
  padding-left: var(--space-md);
}

/* Navigation (glassmorphic, sharp) */
header {
  padding: var(--space-lg) 0;
  position: relative;
  z-index: 20;
}
.nav-container {
  width: 100%;
  margin: 0 auto;
  padding: 1em var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-primary-1);
  border-radius: 60px;
}
.site-title a {
  font-size: 2em;
  font-weight: 800;
  background: linear-gradient(135deg, #fff, var(--color-primary-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-decoration: none;
}
.site-title a:hover {
  text-decoration: underline;
}
.menu-toggle {
  background: rgba(255,77,77,0.2);
  border: 1px solid var(--color-primary-1);
  border-radius: 8px;
  padding: 1em;
  cursor: pointer;
}
.hamburger-icon {
  background-color: red;
}
.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}
.nav-links a {
  color: #ddd;
  font-weight: 500;
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary-1), var(--color-primary-2));
  transition: width 0.2s;
}
.nav-links a:hover::after { width: 100%; }

/* Hero */
.hero-container {
  width: 100%;
  margin: 0 auto;
  padding: var(--space-3xl) var(--space-lg);
  position: relative;
}
.hero-lead {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  border-left: 4px solid var(--color-primary-1);
  padding-left: 1.5rem;
  background: linear-gradient(135deg, #ccc, #fff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Tool Cards – geometric borders, glass */
.tools-grid {
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: grid;
  gap: var(--space-xl);
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
@media (min-width: 1024px) {
  .tools-grid {
    grid-template-columns: 1.2fr 1fr 1fr;
    grid-auto-flow: dense;
  }
  .tools-grid > :first-child { grid-row: span 2; }
}
.tool-card {
  background: rgba(15, 15, 25, 0.65);
  backdrop-filter: blur(12px);
  border: 2px solid rgba(255, 77, 77, 0.6);
  border-radius: 28px;
  transition: all var(--transition-base);
  overflow: hidden;
}
.tool-card:hover {
  transform: translateY(-6px) scale(1.01);
  border-color: var(--color-primary-2);
  box-shadow: 0 15px 35px rgba(77,77,255,0.4);
  background: rgba(0,0,0,0.8);
}
.tool-header {
  background: linear-gradient(135deg, rgba(255,77,77,0.7), rgba(77,77,255,0.7));
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.tool-icon { font-size: 2rem; filter: drop-shadow(0 0 3px white); }
.tool-card h3 a { color: white; text-shadow: 0 1px 3px black; }
.tool-content p { 
  color: #f0f0f0; 
  padding: 1em;
}

/* ===== CAROUSEL (horizontal scroll) ===== */
.carousel-container {
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}
.carousel-container.mobile-scroll {
  display: flex;
  overflow-x: auto;
  gap: var(--space-xl);
  scroll-snap-type: x mandatory;
  padding-bottom: var(--space-lg);
  -webkit-overflow-scrolling: touch;
}
.carousel-item {
  flex: 0 0 85%;
  scroll-snap-align: start;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(12px);
  border: 2px solid var(--color-primary-1);
  border-radius: 32px;
  padding: var(--space-xl);
  transition: all var(--transition-base);
}
.carousel-item:hover {
  border-color: var(--color-primary-2);
  transform: scale(1.01);
}
.carousel-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}
.carousel-icon {
  font-size: 2rem;
  line-height: 1;
}
.carousel-item h3 {
  color: var(--color-primary-1);
  margin: 0;
}
.carousel-item .article-content {
  color: var(--color-muted);
  line-height: 1.6;
}

/* ===== STACKED ARTICLES (full width, vertical) ===== */
.articles-container {
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: block;
}
.articles-container .article-item {
  display: block;
  width: 100%;
  margin-bottom: var(--space-2xl);
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(12px);
  border: 2px solid var(--color-primary-1);
  border-radius: 32px;
  padding: var(--space-xl);
  transition: all var(--transition-base);
}
.articles-container .article-item:last-child {
  margin-bottom: 0;
}
.articles-container .article-item:hover {
  border-color: var(--color-primary-2);
  transform: translateY(-4px);
  box-shadow: 0 20px 30px -15px rgba(0,0,0,0.5);
}
.article-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}
.article-icon {
  font-size: 2rem;
  line-height: 1;
}
.articles-container .article-item h3 {
  color: var(--color-primary-1);
  margin: 0;
}
.articles-container .article-content {
  color: var(--color-muted);
  line-height: 1.6;
}

/* Ensure shared .article-content works in both contexts */
.article-content p {
  margin-bottom: var(--space-md);
}
.article-content p:last-child {
  margin-bottom: 0;
}

/* Footer */
footer {
  border-top: 2px solid var(--color-primary-1);
  margin-top: var(--space-3xl);
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  padding: var(--space-2xl) 0;
}
.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-xl);
}
footer h3 { color: var(--color-primary-1); }

/* Responsive */
@media (max-width: 767px) {
  .nav-container { border-radius: 30px; }
  .menu-toggle { display: block; }
  .nav-links {
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(20px);
    padding: var(--space-lg);
    border-radius: 0 0 30px 30px;
    transform: translateY(-120%);
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
  }
  .nav-links.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }
  .tools-grid { 
    grid-template-columns: 1fr; 
  }
  /* Carousel on mobile: keep full width */
  .carousel-item {
    flex: 0 0 100%;
  }
  /* Stacked articles: no extra change */
}
@media (min-width: 768px) {
  .menu-toggle { display: none; }
  /* On tablet/desktop, carousel items can be narrower if desired */
  .carousel-item {
    flex: 0 0 80%;
  }
}
@media (min-width: 1024px) {
  .carousel-item {
    flex: 0 0 70%;
  }
}

/* Accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: var(--space-md);
  background: var(--color-primary-1);
  color: black;
  padding: var(--space-sm) var(--space-md);
  border-radius: 4px;
}
.skip-link:focus { top: var(--space-md); }
a:focus-visible {
  outline: 2px solid var(--color-primary-2);
  outline-offset: 4px;
}