/* global base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: #334155;
  background: #f8fafc;
  min-height: 100vh;
}

html,
body {
  height: 100%;
}

h1,
.section-title {
  font-size: clamp(1.5rem, 4vw, 2.25rem); /* scales with screen width */
}

p,
.section-description,
.hero-description {
  font-size: clamp(0.9rem, 2.5vw, 1.125rem);
  line-height: 1.5;
}

h1,
h2,
p {
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh; /* full height */
}

main {
  flex: 1; /* take all available space so footer is pushed down */
}
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* header & nav (shared) */
header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 0 0 24px 24px;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  margin-bottom: 40px;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 700;
  color: #1e40af;
  text-decoration: none;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
}

/* shared section helpers */
.section-header {
  text-align: center;
  margin-bottom: 60px;
}
.section-title {
  font-size: 36px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 16px;
}
.section-description {
  font-size: 18px;
  color: #64748b;
  max-width: 700px;
  margin: 0 auto;
}

/* reusable tags/chips */
.feature-tag {
  background: rgba(59, 130, 246, 0.1);
  color: #1e40af;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* reusable grid + cards */
.stocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
  margin-top: 40px;
}

.stock-card {
  background: white;
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(226, 232, 240, 0.8);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.6s ease-out;
}
.stock-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}
.stock-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(59, 130, 246, 0.15);
}
.stock-card:hover::before {
  transform: scaleX(1);
}

.stock-logo {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  color: white;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}
.stock-name {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
}
.stock-symbol {
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
}

/* footer (shared) */
footer {
  background: white;
  border-radius: 32px 32px 0 0;
  padding: 40px 0;
  margin-top: 80px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

footer p {
  text-align: center;
  color: darkgray;
  font-size: 14px;
}
.footer-content {
  text-align: center;
  color: #64748b;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 24px;
}
.footer-links a {
  color: #64748b;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}
.footer-links a:hover {
  color: #1e40af;
}

/* animations (shared) */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.stock-card:nth-child(even) {
  animation-delay: 0.1s;
}
.stock-card:nth-child(3n) {
  animation-delay: 0.2s;
}

/* responsive (shared) */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .feature-tag {
    font-size: 12px;
    padding: 6px 12px;
  }
  .stocks-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
  }
  .stock-card {
    padding: 20px 16px;
  }
  .footer-links {
    flex-direction: column;
    gap: 16px;
  }
}
@media (max-width: 480px) {
  .section-title {
    font-size: 28px;
  }
}

.stock-logo-img {
  max-width: 100%;
  height: auto;
  max-height: 80px;
  object-fit: contain;
  margin-bottom: 10px;
}

.nav-container nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-search {
  position: relative;
  flex: 1;
  max-width: 400px;
  margin: 0 24px;
}

.nav-search-box {
  width: 100%;
  padding: 8px 14px;
  font-size: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  background: #fff;
  transition: all 0.2s ease;
}

.nav-search-box:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.3);
  outline: none;
}

.nav-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  max-height: 250px;
  overflow-y: auto;
  z-index: 1000;
}

.nav-search-results .search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.nav-search-results .search-result-item:hover {
  background: rgba(59, 130, 246, 0.08);
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  animation: fadeIn 0.15s ease-out;
}

.search-result-item {
  display: flex;
  flex-direction: column; /* stack vertically */
  align-items: flex-start; /* align left */
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.search-result-item strong {
  font-weight: 700;
  color: #1e293b;
  font-size: 14px;
  margin-bottom: 4px; /* spacing between ticker and name */
}

.search-result-item span {
  color: #64748b;
  font-size: 13px;
  margin: 0;
}

/* remove link native styling */
.search-result-item a {
  color: inherit;
  text-decoration: none;
}

@media (max-width: 480px) {
  h1,
  .section-title {
    font-size: 1.5rem;
  }
  p,
  .section-description {
    font-size: 0.9rem;
  }
}
