* {
  box-sizing: border-box;
}

:root {
  --background: #f5f7fb;
  --white: #ffffff;
  --text: #172033;
  --muted: #667085;
  --border: #dfe5ee;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --danger: #c62828;
  --success: #087f5b;
  --shadow: 0 18px 50px rgba(16, 24, 40, 0.07);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.container {
  width: min(1160px, calc(100% - 32px));
  margin: auto;
}

/* HEADER */

.header {
  position: sticky;
  top: 0;
  z-index: 100;

  background: rgba(255, 255, 255, 0.94);

  backdrop-filter: blur(14px);

  border-bottom: 1px solid var(--border);
}

.header-content {
  min-height: 76px;

  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 47px;
  height: 47px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 12px;
  background: white;
  flex-shrink: 0;
}

.logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand h1 {
  margin: 0;

  font-size: 17px;
}

.brand p {
  margin: 3px 0 0;

  color: var(--muted);

  font-size: 11px;
}

nav {
  display: flex;
  gap: 5px;
}

nav a {
  padding: 9px 12px;

  border-radius: 9px;

  text-decoration: none;

  color: #475467;

  font-size: 13px;
}

nav a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* HERO */

.hero {
  min-height: 330px;

  display: grid;
  grid-template-columns: 1.5fr 0.8fr;

  align-items: center;

  gap: 30px;
}

.badge {
  display: inline-block;

  padding: 6px 12px;

  border: 1px solid #bfdbfe;

  border-radius: 999px;

  background: var(--primary-light);

  color: var(--primary);

  font-size: 10px;
  font-weight: 800;

  letter-spacing: 0.08em;
}

.hero h2 {
  margin: 14px 0;

  max-width: 720px;

  font-size: clamp(30px, 5vw, 48px);

  line-height: 1.1;
}

.hero h2 span {
  color: var(--primary);
}

.hero p {
  max-width: 680px;

  color: var(--muted);

  line-height: 1.8;

  font-size: 14px;
}

/* ANIMATION */

.animation-area {
  position: relative;

  height: 250px;

  display: grid;
  place-items: center;

  overflow: hidden;
}

.math-circle {
  position: relative;
  z-index: 5;

  width: 125px;
  height: 125px;

  display: grid;
  place-items: center;

  border-radius: 50%;

  background: white;

  border: 1px solid #cfe0ff;

  box-shadow:
    0 0 0 12px #eff6ff,
    0 25px 65px rgba(37, 99, 235, 0.16);

  color: var(--primary);

  font:
    76px Georgia,
    serif;

  animation: floating 3s ease-in-out infinite;
}

.orbit {
  position: absolute;

  border: 1px dashed #abc5f8;

  border-radius: 50%;
}

.orbit-one {
  width: 210px;
  height: 85px;

  transform: rotate(25deg);

  animation: rotateOne 8s linear infinite;
}

.orbit-two {
  width: 245px;
  height: 125px;

  transform: rotate(-25deg);

  animation: rotateTwo 11s linear infinite;
}

.particle {
  position: absolute;

  width: 9px;
  height: 9px;

  border-radius: 50%;

  background: var(--primary);

  animation: particlePulse 2s infinite;
}

.particle-one {
  top: 24%;
  left: 24%;
}

.particle-two {
  right: 20%;
  bottom: 23%;

  animation-delay: 0.5s;
}

.particle-three {
  right: 28%;
  top: 16%;

  animation-delay: 1s;
}

@keyframes floating {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-12px);
  }
}

@keyframes rotateOne {
  to {
    transform: rotate(385deg);
  }
}

@keyframes rotateTwo {
  to {
    transform: rotate(-385deg);
  }
}

@keyframes particlePulse {
  50% {
    transform: scale(1.8);
    opacity: 0.35;
  }
}

/* CARDS */

.card {
  margin: 18px 0;

  padding: 25px;

  background: var(--white);

  border: 1px solid var(--border);

  border-radius: 19px;

  box-shadow: var(--shadow);
}

.section-header {
  display: flex;

  justify-content: space-between;
  align-items: flex-start;

  gap: 20px;

  margin-bottom: 18px;
}

.section-header h2 {
  margin: 0 0 5px;

  font-size: 20px;
}

.section-header p {
  margin: 0;

  color: var(--muted);

  font-size: 12px;
}

/* BUTTON */
.secondary-button {
  height: 30.5px;
  width: 130px;
  border: 0;
  border-radius: 13px;
  background: var(--primary);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  transition: 0.2s;
}

.secondary-button:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(37, 99, 235, 0.2);
}

/* INPUT */

.input-area {
  display: flex;

  gap: 10px;
}

#expression {
  flex: 1;

  min-height: 130px;

  resize: vertical;

  direction: ltr;

  text-align: left;

  padding: 16px;

  border: 2px solid #d5dce6;

  border-radius: 13px;

  outline: none;

  font:
    16px/1.7 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
}

#expression:focus {
  border-color: #7aa7ff;

  box-shadow: 0 0 0 4px var(--primary-light);
}

.solve-button {
  width: 155px;

  border: 0;

  border-radius: 13px;

  background: var(--primary);

  color: white;

  display: flex;

  flex-direction: column;

  justify-content: center;

  align-items: center;

  gap: 4px;

  font-weight: 800;

  transition: 0.2s;
}

.solve-button:hover {
  background: var(--primary-dark);

  transform: translateY(-2px);

  box-shadow: 0 12px 25px rgba(37, 99, 235, 0.2);
}

.solve-icon {
  font:
    30px Georgia,
    serif;
}

.solve-button small {
  font-size: 11px;
  opacity: 0.8;
}

/* EXAMPLES */

.examples {
  display: flex;

  flex-wrap: wrap;

  gap: 7px;

  margin-top: 13px;
}

.examples button {
  padding: 7px 11px;

  border: 1px solid var(--border);

  border-radius: 999px;

  background: white;

  font-size: 12px;

  direction: ltr;
}

.examples button:hover {
  background: var(--primary-light);

  border-color: #9dbbfa;

  color: var(--primary);
}

/* KEYBOARD */

.keyboard {
  display: grid;

  grid-template-columns: repeat(10, 1fr);

  gap: 7px;
}

.keyboard button {
  min-height: 44px;

  border: 1px solid var(--border);

  border-radius: 9px;

  background: white;

  font-weight: 700;

  direction: ltr;

  transition: 0.15s;
}

.keyboard button:hover {
  background: var(--primary-light);

  border-color: #9dbbfa;

  color: var(--primary);

  transform: translateY(-1px);
}

/* SOLUTION */

.solution-card {
  position: relative;
}

.method-box {
  margin-bottom: 15px;
}

.method {
  padding: 15px;

  background: var(--primary-light);

  border: 1px solid #bfdbfe;

  border-radius: 13px;
}

.method-name {
  color: var(--primary);

  font-weight: 800;

  margin-bottom: 4px;
}

.method-description {
  color: #475467;

  font-size: 13px;

  line-height: 1.6;
}

.answer-box {
  min-height: 100px;

  display: flex;

  align-items: center;

  justify-content: center;

  overflow-x: auto;

  padding: 25px;

  background: #f8fafc;

  border: 1px solid var(--border);

  border-radius: 14px;

  direction: ltr;
}

.empty-answer {
  color: var(--muted);

  font-size: 13px;

  text-align: center;
}

.steps-heading {
  margin: 25px 0 12px;

  font-size: 17px;
}

.steps {
  display: grid;

  gap: 10px;
}

.step {
  display: grid;

  grid-template-columns: 40px 1fr;

  gap: 12px;

  padding: 15px;

  border: 1px solid var(--border);

  border-radius: 13px;

  background: white;

  animation: stepAppear 0.4s ease both;
}

@keyframes stepAppear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-number {
  width: 33px;
  height: 33px;

  display: grid;
  place-items: center;

  border-radius: 9px;

  background: var(--primary-light);

  color: var(--primary);

  font-weight: 800;
}

.step-title {
  font-weight: 800;

  font-size: 14px;
}

.step-description {
  margin-top: 3px;

  color: var(--muted);

  font-size: 12px;

  line-height: 1.6;
}

.step-math {
  margin-top: 10px;

  overflow-x: auto;

  direction: ltr;
}

/* LOADING */

.loading {
  display: none;

  gap: 4px;
}

.loading.active {
  display: flex;
}

.loading span {
  width: 7px;
  height: 7px;

  border-radius: 50%;

  background: var(--primary);

  animation: loading 1s infinite;
}

.loading span:nth-child(2) {
  animation-delay: 0.15s;
}

.loading span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes loading {
  50% {
    transform: translateY(-6px);
    opacity: 0.4;
  }
}

/* FORMULAS */

.formula-search {
  width: 240px;

  padding: 9px 12px;

  border: 1px solid var(--border);

  border-radius: 10px;

  outline: none;
}

.formula-search:focus {
  border-color: #7aa7ff;

  box-shadow: 0 0 0 4px var(--primary-light);
}

.formula-grid {
  display: grid;

  grid-template-columns: repeat(2, 1fr);

  gap: 10px;
}

.formula {
  padding: 14px;

  border: 1px solid var(--border);

  border-radius: 12px;
}

.formula h3 {
  margin: 0 0 3px;

  font-size: 13px;
}

.formula small {
  color: var(--muted);
}

.formula-math {
  padding-top: 8px;

  overflow-x: auto;

  direction: ltr;
}

/* ERROR */

.error {
  width: 100%;

  padding: 14px;

  border-radius: 10px;

  border: 1px solid #ffc9c9;

  background: #fff5f5;

  color: var(--danger);

  direction: ltr;

  text-align: left;

  font-size: 13px;
}

/* FOOTER */

/* =========================================
   FOOTER
========================================= */

.lab-footer {
  max-width: 1400px;
  margin: 0 auto;
  padding: 25px 6% 35px;
  display: flex;
  flex-direction: column;
  align-items: left-start;
  justify-content: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  color: var(--text-light);
  font-size: 11px;
}

.lab-footer strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  margin-bottom: 4px;
}

.site-footer {
  margin-top: 30px;
  padding: 28px 6%;
  background: #0b1728;
  border-top: 1px solid var(--border);
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.footer-site-link {
  color: var(--primary-dark);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  transition: 0.2s ease;
}

.footer-copyright {
  color: var(--text-light);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}

.brand-icon {
  width: 47px;
  height: 47px;
  display: flex;
  align-items: left;
  justify-content: cleft;
  overflow: hidden;
  border-radius: 12px;
  background: white;
  flex-shrink: 0;
}

.brand-icon img {
  width: 100%;
  height: 100%;
  object-fit: left;
  display: block;
}

/* RESPONSIVE */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .animation-area {
    height: 190px;
  }

  .keyboard {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 650px) {
  .container {
    width: min(100% - 20px, 1160px);
  }

  nav {
    display: none;
  }

  .hero {
    min-height: auto;

    padding: 40px 0 20px;
  }

  .hero h2 {
    font-size: 31px;
  }

  .card {
    padding: 16px;
  }

  .input-area {
    flex-direction: column;
  }

  .solve-button {
    width: 100%;

    height: 58px;

    flex-direction: row;
  }

  .keyboard {
    grid-template-columns: repeat(4, 1fr);
  }

  .formula-grid {
    grid-template-columns: 1fr;
  }

  .formula-search {
    width: 100%;
  }

  .section-header {
    flex-direction: column;
  }

  .footer-content {
    flex-direction: column;

    justify-content: center;

    gap: 6px;

    padding: 15px 0;
  }
}
