@view-transition {
  navigation: auto;
}

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

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

body {
  height: 100%;
  margin: 0;
  padding: 0;
  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);
}

.header-inner {
  position: relative;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

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

.site-title {
  color: #ffffff;
  font-weight: 700;
  font-size: 1.1rem;
  margin-left: 0.5rem;
}

/* Desktop nav */
.nav-links {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

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

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

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  background: none;
  border: none;
  color: #ffffff;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  transition: color 0.3s ease;
}

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

.dropdown-content {
  display: none;
  position: absolute;
  top: 110%;
  left: 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.25s 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;
}

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

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

.mobile-menu {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  padding: 16px 24px 24px;
  animation: slideDown 0.25s ease-out;
  z-index: 1050;
}

.mobile-menu.open {
  display: block;
}

.mobile-menu-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-menu-link {
  color: #e6fffa;
  text-decoration: none;
  font-weight: 500;
  padding: 8px 0;
  border-bottom: 1px solid rgba(226, 255, 250, 0.15);
}

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

.mobile-menu-link:hover {
  color: #ffffff;
}

.mobile-menu-section-title {
  margin-top: 12px;
  margin-bottom: 4px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a7f3d0;
}

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

/* Page header */
.page-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  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.25);
  animation: slideInDown 0.6s ease;
}

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

@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);
  }
}

/* Calculator layout */
.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);
  }
}

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

.calculator-intro a {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
}

.calculator-intro a:hover {
  text-decoration: underline;
}

/* Display */
.calculator-display {
  background: #2d3748;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.display-main {
  background: #1a202c;
  color: #48bb78;
  font-family: 'Courier New', monospace;
  font-size: 32px;
  font-weight: 700;
  padding: 20px;
  border-radius: 12px;
  text-align: right;
  min-height: 60px;
  word-break: break-all;
  margin-bottom: 12px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.display-expression {
  color: #a0aec0;
  font-family: 'Courier New', monospace;
  font-size: 16px;
  text-align: right;
  min-height: 24px;
  padding: 0 8px;
}

/* Mode tabs */
.angle-mode-toggle {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.mode-tab {
  flex: 1;
  padding: 12px 16px;
  background: #ffffff;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  color: #4a5568;
  transition: all 0.25s ease;
}

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

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

/* Calculator grid */
.calculator-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.calc-btn {
  padding: 18px;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.calc-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.calc-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.num-btn {
  background: #ffffff;
  color: #2d3748;
}

.num-btn:hover {
  background: #f7fafc;
}

.operator-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
}

.operator-btn:hover {
  background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%);
}

.func-btn {
  background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%);
  color: #ffffff;
}

.func-btn:hover {
  background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
}

.equals-btn {
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  color: #ffffff;
}

.equals-btn:hover {
  background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
}

.span-two {
  grid-column: span 2;
}

/* History */
.history-wrapper {
  background: #f7fafc;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.history-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #2d3748;
  margin: 0;
}

.history-clear-btn {
  background: #e53e3e;
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.25s ease;
}

.history-clear-btn:hover {
  background: #c53030;
}

.history-list {
  max-height: 300px;
  overflow-y: auto;
}

.history-empty {
  color: #718096;
  text-align: center;
  padding: 20px;
  font-style: italic;
}

.history-item {
  background: #ffffff;
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 12px;
  border-left: 4px solid #667eea;
  transition: all 0.3s ease;
  cursor: pointer;
}

.history-item:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.history-expression {
  color: #4a5568;
  font-size: 14px;
  margin-bottom: 4px;
  font-family: 'Courier New', monospace;
}

.history-result {
  color: #2d3748;
  font-size: 16px;
  font-weight: 700;
  font-family: 'Courier New', monospace;
}

.history-meta {
  color: #a0aec0;
  font-size: 12px;
  margin-top: 2px;
}

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

.download-btn {
  flex: 1;
  min-width: 140px;
  padding: 12px 24px;
  background: #ffffff;
  color: #667eea;
  border: 2px solid #667eea;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 16px;
}

.download-btn:hover {
  background: #667eea;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 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: #ffffff;
  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 #667eea;
}

.info-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(102, 126, 234, 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: #667eea;
  font-weight: 600;
  text-decoration: none;
}

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

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

.blog-content {
  background: #ffffff;
  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 h4 {
  font-size: 22px;
  font-weight: 600;
  color: #4a5568;
  margin-top: 32px;
  margin-bottom: 16px;
}

.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: #667eea;
  font-weight: 700;
}

.blog-content em {
  font-style: italic;
  color: #764ba2;
}

.blog-content a {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
}

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

.highlight-box {
  background: linear-gradient(135deg, #f3f4ff 0%, #f8f5ff 100%);
  padding: 24px;
  border-radius: 12px;
  border-left: 4px solid #667eea;
  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;
}

/* FAQ */
.faq-wrapper {
  border-top: 1px solid #e2e8f0;
  padding-top: 16px;
}

.faq-item {
  border-bottom: 1px solid #edf2f7;
}

.faq-question {
  width: 100%;
  text-align: left;
  padding: 12px 0;
  border: none;
  background: none;
  font-size: 16px;
  font-weight: 600;
  color: #2d3748;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-question::after {
  content: '+';
  font-weight: 700;
  color: #667eea;
}

.faq-item.open .faq-question::after {
  content: '−';
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, padding-top 0.25s ease, padding-bottom 0.25s ease;
  font-size: 15px;
  color: #4a5568;
}

.faq-item.open .faq-answer {
  padding-top: 4px;
  padding-bottom: 12px;
  max-height: 300px;
}

/* Footer */
.footer {
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  color: #ffffff;
  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: #667eea;
  transform: translateX(5px);
}

.footer-text {
  color: #cbd5e0;
  line-height: 1.7;
}

.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 (max-width: 1024px) {
  .nav-links {
    position: static;
    transform: none;
  }
}

@media (max-width: 991px) {
  /* Hide desktop nav completely on tablets & phones */
  .nav-links {
    display: none !important;
  }

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

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

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

  .calculator-card {
    padding: 24px;
  }

  .display-main {
    font-size: 26px;
  }

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

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

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

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

  .download-btn {
    width: 100%;
  }

  .angle-mode-toggle {
    flex-direction: column;
  }
}
