:root {
  --ink: #14221f;
  --ink-soft: #3a4f49;
  --fog: #e8f3ef;
  --paper: #f4faf7;
  --mint: #1faa7a;
  --mint-deep: #0d7a56;
  --lime: #c8f560;
  --teal: #2ec4b6;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(20, 34, 31, 0.08);
  --shadow: 0 20px 50px rgba(20, 34, 31, 0.08);
  --radius: 22px;
  --font-display: "Unbounded", sans-serif;
  --font-body: "Golos Text", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--fog);
  line-height: 1.5;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea {
  font: inherit;
}

/* —— Atmosphere —— */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 10% -10%, #d4f5e8 0%, transparent 55%),
    radial-gradient(90% 70% at 100% 0%, #c7ebe4 0%, transparent 45%),
    linear-gradient(180deg, #eef8f4 0%, #e3f0eb 45%, #dceee7 100%);
}

.bg__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.55;
  animation: drift 18s var(--ease) infinite alternate;
}

.bg__orb--a {
  width: 42vw;
  height: 42vw;
  top: -12%;
  left: -8%;
  background: #9fe8c8;
}

.bg__orb--b {
  width: 36vw;
  height: 36vw;
  top: 20%;
  right: -10%;
  background: #7fd4c8;
  animation-delay: -6s;
  animation-duration: 22s;
}

.bg__orb--c {
  width: 28vw;
  height: 28vw;
  bottom: 5%;
  left: 35%;
  background: #d9f48a;
  opacity: 0.35;
  animation-delay: -3s;
  animation-duration: 16s;
}

.bg__grain {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

.bg__fog {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.45;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4%, 6%, 0) scale(1.08); }
}

/* —— Hero —— */
.hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 1.25rem clamp(1.25rem, 4vw, 3rem) 2.5rem;
  position: relative;
  color: #f4faf7;
  overflow: hidden;
}

.hero__media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 55% center;
  transform: scale(1.04);
  animation: heroDrift 18s ease-in-out infinite alternate;
  filter: saturate(1.05) contrast(1.05);
}

.hero__veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(105deg, rgba(10, 22, 18, 0.82) 0%, rgba(10, 22, 18, 0.55) 42%, rgba(10, 22, 18, 0.28) 70%, rgba(10, 22, 18, 0.45) 100%),
    linear-gradient(180deg, rgba(10, 22, 18, 0.35) 0%, transparent 35%, rgba(232, 243, 239, 0.92) 100%);
}

@keyframes heroDrift {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to { transform: scale(1.1) translate3d(-1.5%, 1%, 0); }
}

.nav,
.hero__content {
  position: relative;
  z-index: 1;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav__brand {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 0.9rem;
  color: #f4faf7;
}

.nav__links {
  display: flex;
  gap: 1.25rem;
  font-size: 0.95rem;
  color: rgba(244, 250, 247, 0.78);
}

.nav__links a {
  position: relative;
}

.nav__links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 2px;
  background: var(--lime);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}

.nav__links a:hover::after {
  transform: scaleX(1);
}

.hero__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 820px;
  padding-top: 6vh;
  padding-bottom: 8vh;
}

.hero__brand {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.hero__brand-main {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.2rem, 7.5vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  color: #f7ffe8;
  text-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
  max-width: 12ch;
}

.hero__brand-sub {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.05rem, 3.2vw, 1.65rem);
  letter-spacing: -0.02em;
  color: var(--lime);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.hero__lead {
  margin: 1.35rem 0 0;
  max-width: 32ch;
  color: rgba(244, 250, 247, 0.82);
  font-size: 1.08rem;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.hero .btn--ghost {
  border-color: rgba(244, 250, 247, 0.35);
  color: #f4faf7;
}

.hero .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* —— Buttons —— */
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.85rem 1.35rem;
  font-weight: 600;
  transition: transform 0.25s var(--ease), background 0.25s ease, box-shadow 0.25s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--ink);
  color: var(--lime);
  box-shadow: 0 10px 30px rgba(20, 34, 31, 0.2);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(20, 34, 31, 0.25);
}

.btn--ghost {
  background: transparent;
  border: 1.5px solid rgba(20, 34, 31, 0.18);
  color: var(--ink);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.45);
}

.btn--soft {
  background: rgba(20, 34, 31, 0.06);
  color: var(--ink);
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
}

.btn--soft:hover {
  background: rgba(20, 34, 31, 0.1);
}

/* —— Sections —— */
.section {
  padding: 4rem clamp(1.25rem, 4vw, 3rem) 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.section__head {
  margin-bottom: 1.75rem;
}

.section__head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.03em;
}

.section__head p {
  margin: 0.5rem 0 0;
  color: var(--ink-soft);
}

.panel {
  padding-top: 2rem;
}

/* —— Translator —— */
.translator {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: stretch;
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  border-radius: calc(var(--radius) + 6px);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.translator__pane {
  display: flex;
  flex-direction: column;
  min-height: 280px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.translator__pane--out {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.75), rgba(200, 245, 96, 0.12));
}

.translator__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(20, 34, 31, 0.07);
  color: var(--ink-soft);
}

.chip--accent {
  background: rgba(31, 170, 122, 0.15);
  color: var(--mint-deep);
}

.translator__count {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.translator__input,
.translator__output {
  flex: 1;
  width: 100%;
  border: none;
  resize: none;
  background: transparent;
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1.55;
  outline: none;
}

.translator__input::placeholder {
  color: rgba(58, 79, 73, 0.45);
}

.translator__output {
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 140px;
}

.translator__output .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(8px);
  animation: wordIn 0.45s var(--ease) forwards;
}

.translator__output .word--dict {
  color: var(--mint-deep);
  font-weight: 600;
}

.translator__output .word--rule {
  background: linear-gradient(180deg, transparent 60%, rgba(200, 245, 96, 0.55) 60%);
}

@keyframes wordIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.translator__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.translator__hint {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: rgba(58, 79, 73, 0.55);
}

.translator__hint.is-hidden {
  display: none;
}

.translator__swap {
  display: grid;
  place-items: center;
  width: 48px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--mint-deep);
  position: relative;
}

.swap-pulse {
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(31, 170, 122, 0.15);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(0.85); opacity: 0.5; }
  50% { transform: scale(1.15); opacity: 1; }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.25rem;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
}

.icon-btn:hover {
  color: var(--ink);
  background: rgba(20, 34, 31, 0.05);
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.example {
  border: 1px dashed rgba(20, 34, 31, 0.2);
  background: rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  color: var(--ink-soft);
  transition: border-color 0.2s ease, transform 0.2s var(--ease), background 0.2s ease;
}

.example:hover {
  border-color: var(--mint);
  background: rgba(255, 255, 255, 0.75);
  transform: translateY(-2px);
  color: var(--ink);
}

/* —— Dictionary —— */
.dict {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.dict__item {
  display: grid;
  gap: 0.2rem;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(20, 34, 31, 0.06);
  transition: transform 0.3s var(--ease), background 0.3s ease, box-shadow 0.3s ease;
}

.dict__item:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 12px 28px rgba(20, 34, 31, 0.06);
}

.dict__from {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.dict__to {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* —— Rules —— */
.rule {
  padding: 1.75rem;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(31, 170, 122, 0.12), rgba(200, 245, 96, 0.18)),
    rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(31, 170, 122, 0.2);
}

.rule__label {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mint-deep);
}

.rule__text {
  margin: 0.65rem 0 0;
  font-size: clamp(1.15rem, 2.5vw, 1.45rem);
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.35;
  max-width: 28ch;
}

.rule__text em {
  font-style: normal;
  color: var(--mint-deep);
  background: linear-gradient(180deg, transparent 62%, var(--lime) 62%);
}

.footer {
  text-align: center;
  padding: 3rem 1.25rem 2.5rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* —— Toast & reveal —— */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--ink);
  color: var(--lime);
  padding: 0.75rem 1.2rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 50;
  transition: transform 0.4s var(--ease);
  pointer-events: none;
}

.toast.is-on {
  transform: translateX(-50%) translateY(0);
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}

.delay-1 { transition-delay: 0.08s; }
.delay-2 { transition-delay: 0.16s; }
.delay-3 { transition-delay: 0.24s; }

/* —— Responsive —— */
@media (max-width: 860px) {
  .translator {
    grid-template-columns: 1fr;
  }

  .translator__swap {
    width: 100%;
    height: 36px;
    transform: rotate(90deg);
  }

  .nav__links {
    gap: 0.85rem;
    font-size: 0.85rem;
  }

  .hero__brand-main {
    max-width: 14ch;
  }

  .hero__img {
    object-position: 70% center;
  }
}

@media (max-width: 520px) {
  .nav__links a:last-child {
    display: none;
  }

  .translator__pane {
    min-height: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
