@view-transition {
  navigation: auto;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Header */
.header {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(5, 150, 105, 0.15);
}

.logo-link {
  text-decoration: none;
}

.site-logo {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  object-fit: contain;
}

/* Desktop nav */
.nav-links {
  display: flex;
  align-items: center;
}

.main-nav {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.nav-link {
  color: #ffffff;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.25s ease;
  display: inline-block;
}

.nav-link:hover {
  color: #e5e7eb;
  transform: scale(1.05);
}

/* Dropdown (click-based) */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.25s ease;
}

.dropdown-toggle:hover {
  color: #e5e7eb;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 120%;
  right: 0;
  background: #ffffff;
  min-width: 220px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  margin-top: 8px;
  overflow: hidden;
  animation: fadeInDown 0.3s ease;
  z-index: 1100;
}

.dropdown.open .dropdown-content {
  display: block;
}

.dropdown-content a {
  color: #4a5568;
  padding: 12px 20px;
  text-decoration: none;
  display: block;
  transition: all 0.25s ease;
  font-size: 14px;
}

.dropdown-content a:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  padding-left: 28px;
}

/* Mobile menu button */
.mobile-menu-btn {
  display: none;
  background: none;
  border: 0;
  color: #ffffff;
  font-size: 26px;
  cursor: pointer;
}

/* Mobile slide-down menu (inside header) */
.mobile-menu {
  display: none; /* overridden on mobile */
}

/* Page header */
.page-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 80px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120"><path d="M0,0 Q300,60 600,30 T1200,0 L1200,120 L0,120 Z" fill="rgba(255,255,255,0.05)"/></svg>')
    repeat-x bottom;
  background-size: 1200px 120px;
  opacity: 0.3;
}

.page-header h1 {
  font-size: 56px;
  font-weight: 900;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  animation: slideInDown 0.6s ease;
}

.page-header p {
  font-size: 22px;
  opacity: 0.95;
  position: relative;
  z-index: 1;
  animation: slideInUp 0.6s ease;
}

/* Animations */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.float-animation {
  animation: float 3s ease-in-out infinite;
}

/* Calculator container */
.calculator-container {
  max-width: 1200px;
  margin: -60px auto 60px;
  padding: 0 20px;
  position: relative;
  z-index: 10;
}

.calculator-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.6s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.intro-text {
  color: #4a5568;
  font-size: 16px;
  line-height: 1.7;
  margin-bottom: 32px;
  text-align: justify;
}

/* Mode toggle */
.mode-toggle {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
  background: #f7fafc;
  padding: 12px;
  border-radius: 16px;
}

.mode-btn {
  padding: 16px;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  color: #4a5568;
  transition: all 0.3s ease;
  font-size: 14px;
}

.mode-btn:hover {
  background: #edf2f7;
}

.mode-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: #764ba2;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Inputs */
.input-section {
  margin-bottom: 32px;
}

.input-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 12px;
  font-size: 16px;
}

.input-wrapper {
  position: relative;
}

.input-field {
  width: 100%;
  padding: 18px 20px;
  border: 2px solid #cbd5e0;
  border-radius: 12px;
  font-size: 20px;
  transition: all 0.3s ease;
  font-weight: 600;
  font-family: 'Courier New', monospace;
}

.input-field:focus {
  outline: none;
  border-color: #764ba2;
  box-shadow: 0 0 0 3px rgba(118, 75, 162, 0.1);
}

.input-hint {
  font-size: 13px;
  color: #718096;
  margin-top: 6px;
  font-style: italic;
}

/* Two-number grid */
.two-number-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

/* Calculate button */
.calculate-btn {
  width: 100%;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.calculate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.calculate-btn:active {
  transform: scale(0.98);
}

/* Results */
.results-section {
  margin-top: 32px;
  padding: 32px;
  background: linear-gradient(135deg, #f3f4ff 0%, #e9e4f7 100%);
  border-radius: 16px;
  border-left: 4px solid #764ba2;
  display: none;
  animation: fadeIn 0.5s ease;
}

.results-section.show {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-title {
  font-size: 24px;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.result-box {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.result-box:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(118, 75, 162, 0.15);
}

.result-main-box {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-left: 4px solid #10b981;
}

.steps-box {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-left: 4px solid #ef4444;
}

.breakdown-box {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-left: 4px solid #0ea5e9;
}

.result-label {
  font-weight: 600;
  color: #4a5568;
  font-size: 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-value {
  font-weight: 700;
  color: #764ba2;
  font-size: 24px;
  font-family: 'Courier New', monospace;
  word-break: break-all;
}

.standard-value {
  font-size: 18px;
}

.breakdown-text,
.steps-text {
  color: #4a5568;
  line-height: 1.8;
  margin-top: 12px;
  font-size: 14px;
}

/* Download buttons */
.download-buttons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.download-btn {
  flex: 1;
  padding: 14px 24px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Info cards */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 40px;
}

.info-card {
  background: white;
  padding: 28px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  border-left: 4px solid #764ba2;
}

.info-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(118, 75, 162, 0.2);
}

.info-card h3 {
  font-size: 20px;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 12px;
}

.info-card p {
  color: #4a5568;
  line-height: 1.7;
  font-size: 15px;
}

.info-card a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

.info-card a:hover {
  text-decoration: underline;
}

/* Blog section */
.blog-section {
  max-width: 900px;
  margin: 80px auto;
  padding: 0 20px;
}

.blog-content {
  background: white;
  border-radius: 24px;
  padding: 60px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  line-height: 1.8;
}

.blog-content h2 {
  font-size: 42px;
  font-weight: 900;
  color: #1a202c;
  margin-bottom: 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.blog-content h3 {
  font-size: 28px;
  font-weight: 700;
  color: #2d3748;
  margin-top: 40px;
  margin-bottom: 20px;
}

.blog-content p {
  color: #4a5568;
  font-size: 17px;
  margin-bottom: 24px;
  line-height: 1.9;
}

.blog-content ul,
.blog-content ol {
  color: #4a5568;
  margin-left: 32px;
  margin-bottom: 24px;
}

.blog-content li {
  margin-bottom: 12px;
  line-height: 1.8;
}

.blog-content strong {
  color: #764ba2;
  font-weight: 700;
}

.blog-content a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

.blog-content a:hover {
  text-decoration: underline;
}

.highlight-box {
  background: linear-gradient(135deg, #f3f4ff 0%, #e9e4f7 100%);
  padding: 24px;
  border-radius: 12px;
  border-left: 4px solid #764ba2;
  margin: 32px 0;
}

.formula-box {
  background: #2d3748;
  color: #e2e8f0;
  padding: 20px;
  border-radius: 12px;
  font-family: 'Courier New', monospace;
  margin: 24px 0;
  overflow-x: auto;
  line-height: 1.6;
  font-size: 14px;
}

.example-box {
  background: #f0f9ff;
  padding: 20px;
  border-radius: 12px;
  border-left: 4px solid #0ea5e9;
  margin: 24px 0;
}

/* FAQ section */
.faq-section {
  max-width: 900px;
  margin: 0 auto 80px;
  padding: 0 20px;
}

.faq-inner {
  background: #ffffff;
  border-radius: 24px;
  padding: 40px 32px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

.faq-section h2 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 24px;
  color: #1a202c;
}

.faq-item {
  border-top: 1px solid #e5e7eb;
  padding: 18px 0;
}

.faq-item:first-child {
  border-top: none;
}

.faq-item h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #1f2933;
}

.faq-item p {
  font-size: 15px;
  color: #4a5568;
  line-height: 1.8;
}

/* Footer */
.footer {
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  color: white;
  padding: 60px 0 20px;
  margin-top: 80px;
}

.footer-column h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.footer-column ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-column ul li {
  margin-bottom: 12px;
}

.footer-column ul li a {
  color: #cbd5e0;
  text-decoration: none;
  transition: all 0.3s ease;
  display: inline-block;
}

.footer-column ul li a:hover {
  color: #14b8a6;
  transform: translateX(5px);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 40px;
  padding-top: 30px;
  text-align: center;
  color: #a0aec0;
}

/* Responsive */
@media (min-width: 769px) {
  .mobile-menu {
    display: none !important;
  }
}

@media (max-width: 1024px) {
  .main-nav {
    position: static;
    transform: none;
  }
}

@media (max-width: 768px) {
  /* Hide top-level desktop nav completely on mobile */
  header .nav-links,
  header .main-nav,
  header .more-nav {
    display: none !important;
  }

  /* Only show hamburger button on mobile */
  .mobile-menu-btn {
    display: block !important;
  }

  /* Slide-down mobile menu */
  .mobile-menu {
    display: block;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #ffffff;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
    border-radius: 0 0 12px 12px;
    margin-top: 8px;
  }

  .mobile-menu.open {
    max-height: 500px;
  }

  .mobile-menu ul {
    list-style: none;
    margin: 0;
    padding: 10px 18px 18px;
  }

  .mobile-menu li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  }

  .mobile-menu li:last-child {
    border-bottom: none;
  }

  .mobile-menu a {
    display: block;
    padding: 10px 0;
    color: #f9fafb;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
  }

  .mobile-menu a:hover {
    color: #bbf7d0;
  }

  .page-header h1 {
    font-size: 36px;
  }

  .page-header p {
    font-size: 18px;
  }

  .calculator-card {
    padding: 24px;
  }

  .two-number-grid {
    grid-template-columns: 1fr;
  }

  .download-buttons {
    flex-direction: column;
  }

  .mode-toggle {
    grid-template-columns: 1fr;
  }

  .blog-content {
    padding: 32px 24px;
  }

  .blog-content h2 {
    font-size: 32px;
  }

  .blog-content h3 {
    font-size: 24px;
  }

  .faq-inner {
    padding: 28px 22px;
  }
}
