:root {
  --primary-color: #ff6f61; 
  --secondary-color: #4ade80; 
  --bg-color: #f0f4f8; 
  --text-color: #1e293b; 
  --card-bg: #fff1f0; 
  --border-color: #ffd6d0;
}

[data-theme="dark"] {
  --primary-color: #ff9472;
  --secondary-color: #22c55e;
  --bg-color: #0f172a;
  --text-color: #f0f4f8;
  --card-bg: #1e293b;
  --border-color: #334155;
}

* {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: background-color 0.3s, color 0.3s;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
}

nav {
  background-color: var(--bg-color);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
}

nav.scrolled {
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
}

.navbar-brand {
  font-weight: 700;
  color: var(--text-color) !important;
  font-size: 1.5rem;
  letter-spacing: -0.5px;
  transition: color 0.3s ease;
}

.navbar-brand:hover {
  color: var(--primary-color) !important;
}

.nav-link {
  color: var(--text-color) !important;
  transition: all 0.3s ease;
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  padding: 0.5rem 1rem !important;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transform: translateX(-50%);
  transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 80%;
}

.nav-link:hover {
  color: var(--primary-color) !important;
}

.nav-link.active {
  color: var(--primary-color) !important;
}

.dark-mode-toggle {
  width: 44px;
  height: 24px;
  background: #e0e0e0;
  border-radius: 20px;
  cursor: pointer;
  position: relative;
  transition: background 0.3s ease;
}

.dark-mode-toggle::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.dark-mode-toggle:hover {
  background: #d0d0d0;
}

[data-theme="dark"] .dark-mode-toggle::before {
  left: calc(100% - 21px);
}

.navbar-toggler {
  border: none;
  padding: 0.5rem;
}

.navbar-toggler:focus {
  box-shadow: none;
}

.navbar-toggler-icon {
  filter: opacity(0.7);
  transition: filter 0.3s ease;
}

.navbar-toggler:hover .navbar-toggler-icon {
  filter: opacity(1);
}

@media (max-width: 991px) {
  .navbar-collapse {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
  }
  
  [data-theme="dark"] .navbar-collapse {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  
  .nav-link::after {
    display: none;
  }
}

.hero {
  padding: 120px 0 80px;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  text-align: center;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.3rem;
  opacity: 0.95;
}

section {
  padding: 80px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.law-title {
  font-size: 2.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.law-description {
  font-size: 1.2rem;
  margin-bottom: 3rem;
  line-height: 1.8;
}

.gestalt-in-web {
  background-color: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 3rem;
  height: 100%;
  transition: transform 0.3s, background-color 0.3s;
}

.gestalt-in-web:hover {
  transform: translateY(-5px);
  background-color: var(--border-color);
}

.visual-example {
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-color);
  border-radius: 12px;
  padding: 2rem;
  border: 2px solid var(--border-color);
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.visual-example:hover {
  box-shadow: 0 0 0 6px rgba(100, 150, 255, 0.4); 
  transform: scale(1.02); 
}

ol {
  padding-left: 1.5rem;
}

ol li {
  margin-bottom: 0.5rem;
  font-weight: 500;
}

ol li::marker {
  color: var(--primary-color);
  font-weight: bold;
}

.parallax {
  background-attachment: fixed;
  background-position: top;
  background-repeat: no-repeat;
  background-size: cover;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: white;
}

.parallax::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
}

.parallax-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem;
}

.parallax-inner h1 {
  font-size: 3rem;
  font-weight: 800;
}

.parallax-inner p {
  font-size: 1.5rem;
  margin-top: 1rem;
}

.proximity-dots {
  display: flex;
  gap: 60px;
}

.dot-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.dot {
  width: 20px;
  height: 20px;
  background-color: var(--primary-color);
  border-radius: 50%;
}

.similarity-shapes {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
  justify-content: center;
}

.shape {
  width: 50px;
  height: 50px;
}

.shape-primary {
  background-color: var(--primary-color);
}

.shape-secondary {
  background-color: var(--secondary-color);
}

.circle {
  border-radius: 50%;
}

.square {
  border-radius: 4px;
}

.continuity-line {
  width: 100%;
  height: 200px;
}

.closure-shape {
  width: 150px;
  height: 150px;
  border: 4px dashed var(--primary-color);
  border-radius: 50%;
  border-top: none;
  border-right: none;
}

.figure-ground {
  width: 200px;
  height: 200px;
  background-color: var(--card-bg);
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.figure-ground::after {
  content: "";
  width: 100px;
  height: 100px;
  background-color: var(--primary-color);
  border-radius: 50%;
}

.symmetry-shape {
  width: 200px;
  height: 200px;
  background: linear-gradient(
    135deg,
    var(--primary-color) 50%,
    var(--secondary-color) 50%
  );
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.common-region {
  display: flex;
  gap: 30px;
}

.region-box {
  border: 3px solid var(--primary-color);
  border-radius: 12px;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.region-item {
  width: 30px;
  height: 30px;
  background-color: var(--secondary-color);
  border-radius: 4px;
}

.common-fate {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.arrow {
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-bottom: 30px solid var(--primary-color);
  animation: moveUp 2s infinite;
}

@keyframes moveUp {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

footer {
  background-color: var(--card-bg);
  padding: 40px 0;
  text-align: center;
  border-top: 2px solid var(--border-color);
}

@media (max-width: 768px) {
  .parallax {
    background-attachment: scroll;
    min-height: 400px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .section-title {
    font-size: 2rem;
  }
}