/* Стили сайта: палитра и типографика повторяют дизайн-систему проекта.
   Темы переключаются средой через prefers-color-scheme, без скриптов. */

@font-face {
  font-family: "Inter";
  src: url("../fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --background: 0 0% 100%;
  --foreground: 0 0% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 0 0% 3.9%;
  --primary: 0 0% 3.9%;
  --primary-foreground: 0 0% 98%;
  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 0 0% 3.9%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --accent-foreground: 0 0% 3.9%;
  --destructive-border: 0 72% 51%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 0 0% 3.9%;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: 0 0% 3.9%;
    --foreground: 0 0% 98%;
    --card: 0 0% 3.9%;
    --card-foreground: 0 0% 98%;
    --primary: 0 0% 98%;
    --primary-foreground: 0 0% 3.9%;
    --secondary: 240 5.9% 10%;
    --secondary-foreground: 0 0% 98%;
    --muted: 240 5.9% 10%;
    --muted-foreground: 240 5% 64.9%;
    --accent: 240 5.9% 10%;
    --accent-foreground: 0 0% 98%;
    --destructive-border: 0 72% 51%;
    --border: 240 3.7% 15.9%;
    --input: 240 3.7% 15.9%;
    --ring: 240 4.9% 83.9%;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
  border-color: hsl(var(--border));
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background-color: hsl(var(--foreground));
  color: hsl(var(--background));
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.container {
  width: 100%;
  max-width: 80rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

@media (min-width: 640px) {
  .container {
    padding-inline: 2rem;
  }
}

main {
  flex: 1;
}

/* Иконки */

.icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-md {
  width: 1.5rem;
  height: 1.5rem;
}

.icon-lg {
  width: 2.5rem;
  height: 2.5rem;
}

.icon-muted {
  color: hsl(var(--muted-foreground));
}

/* Кнопки */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: calc(var(--radius) - 4px);
  font-size: 0.875rem;
  font-weight: 500;
  height: 2.5rem;
  padding: 0.5rem 1rem;
  transition: color 150ms, background-color 150ms, border-color 150ms;
}

.btn:disabled {
  pointer-events: none;
  opacity: 0.5;
}

.btn-primary {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.btn-primary:hover {
  background-color: color-mix(in srgb, hsl(var(--primary)) 85%, transparent);
}

.btn-outline {
  border: 1px solid hsl(var(--input));
  background: transparent;
}

.btn-outline:hover {
  background-color: hsl(var(--muted));
}

.btn-ghost:hover {
  background-color: hsl(var(--muted));
}

.btn-sm {
  height: 2.25rem;
  padding: 0 0.75rem;
  font-size: 13px;
}

.btn-icon {
  width: 2.25rem;
  padding: 0;
}

.btn-block {
  width: 100%;
  margin-top: 1rem;
}

:where(.btn, .chip, .dropzone, .faq-trigger):focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px hsl(var(--background)),
    0 0 0 4px hsl(var(--ring));
}

/* Шапка страницы и подвал */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 3rem;
  padding-bottom: 4rem;
  text-align: center;
}

@media (min-width: 640px) {
  .hero {
    padding-top: 4rem;
  }
}

.hero-title {
  max-width: 42rem;
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

@media (min-width: 640px) {
  .hero-title {
    font-size: 3rem;
  }
}

.hero-sub {
  margin-top: 1rem;
  max-width: 36rem;
  font-size: 1.125rem;
  line-height: 1.625;
  color: hsl(var(--muted-foreground));
}

.hero-card {
  margin-top: 2.5rem;
  width: 100%;
  display: flex;
  justify-content: center;
}

.converter {
  width: 100%;
  max-width: 36rem;
}

.site-footer {
  border-top: 1px solid hsl(var(--border));
  background-color: hsl(var(--background));
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-block: 2rem;
}

.footer-link {
  font-size: 13px;
  color: hsl(var(--muted-foreground));
  transition: color 150ms;
}

.footer-link:hover {
  color: hsl(var(--foreground));
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Конвертер */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border: 1px dashed hsl(var(--border));
  border-radius: var(--radius);
  padding: 3.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: background-color 150ms, border-color 150ms;
}

.dropzone:hover {
  background-color: hsl(var(--muted));
}

.dropzone-drag {
  border-color: hsl(var(--foreground));
  background-color: hsl(var(--muted));
}

.dropzone-title {
  font-size: 15px;
  font-weight: 500;
}

.dropzone-hint {
  font-size: 13px;
  color: hsl(var(--muted-foreground));
  overflow-wrap: anywhere;
}

.file-card {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}

.file-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
}

.file-meta {
  min-width: 0;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 500;
}

.file-sub {
  margin-top: 0.125rem;
  font-size: 13px;
  color: hsl(var(--muted-foreground));
}

.file-controls {
  border-top: 1px solid hsl(var(--border));
  padding: 1rem 1.25rem;
}

.controls-label {
  font-size: 13px;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}

.chips {
  margin-top: 0.625rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 4px);
  padding: 0.375rem 0.75rem;
  font-size: 13px;
  font-weight: 500;
  transition: background-color 150ms, border-color 150ms, color 150ms;
}

.chip:hover {
  background-color: hsl(var(--muted));
}

.chip-active {
  border-color: hsl(var(--foreground));
  background-color: hsl(var(--foreground));
  color: hsl(var(--background));
}

.chip-active:hover {
  background-color: hsl(var(--foreground));
}

.file-progress {
  border-top: 1px solid hsl(var(--border));
  padding: 1rem 1.25rem;
}

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 13px;
}

.stage {
  font-weight: 500;
}

.stage-muted {
  color: hsl(var(--muted-foreground));
}

.pct {
  color: hsl(var(--muted-foreground));
  font-variant-numeric: tabular-nums;
}

.progress {
  margin-top: 0.5rem;
  position: relative;
  height: 0.5rem;
  width: 100%;
  overflow: hidden;
  border-radius: 9999px;
  background-color: hsl(var(--secondary));
}

.progress-fill {
  height: 100%;
  width: 0;
  background-color: hsl(var(--primary));
  transition: width 150ms;
}

.failure {
  margin-top: 1rem;
}

.alert {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  border: 1px solid hsl(var(--destructive-border));
  border-radius: var(--radius);
  background-color: hsl(var(--background));
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
}

.alert-icon {
  margin-top: 0.125rem;
}

.alert-title {
  margin-bottom: 0.25rem;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.alert-text {
  line-height: 1.625;
}

.failure-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

/* Разделы главной страницы */

.section {
  padding-block: 3rem;
}

.section-last {
  padding-bottom: 5rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.steps-grid {
  margin-top: 1.5rem;
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .steps-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.step-card {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  padding: 1.5rem;
}

.step-title {
  margin-top: 1rem;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.step-text {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.625;
  color: hsl(var(--muted-foreground));
}

.table-wrap {
  margin-top: 1.5rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  overflow: hidden;
}

.formats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.formats-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  border-bottom: 1px solid hsl(var(--border));
}

.formats-table td {
  padding: 1rem;
  vertical-align: top;
  color: hsl(var(--muted-foreground));
}

.formats-table ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.formats-table li + li {
  margin-top: 0.25rem;
}

.faq-list {
  margin-top: 1.5rem;
}

.faq-item {
  border-bottom: 1px solid hsl(var(--border));
}

.faq-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding-block: 1rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
}

.faq-trigger .icon {
  color: hsl(var(--muted-foreground));
  transition: transform 200ms;
}

.faq-item[open] .faq-trigger .icon {
  transform: rotate(180deg);
}

.faq-answer {
  padding-bottom: 1rem;
  font-size: 0.875rem;
  line-height: 1.625;
  color: hsl(var(--muted-foreground));
}

/* Документы: политика и условия */

.doc {
  display: grid;
  gap: 2.5rem;
  padding-top: 3rem;
  padding-bottom: 5rem;
}

@media (min-width: 768px) {
  .doc {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .doc-nav {
    display: flex;
  }
}

.doc-nav {
  display: none;
  position: sticky;
  top: 6rem;
  align-self: start;
  flex-direction: column;
  gap: 0.625rem;
  border-left: 1px solid hsl(var(--border));
  padding-left: 1rem;
  font-size: 0.875rem;
}

.doc-nav a {
  color: hsl(var(--muted-foreground));
  transition: color 150ms;
}

.doc-nav a:hover {
  color: hsl(var(--foreground));
}

.doc-article {
  max-width: 45rem;
  font-size: 1rem;
  line-height: 1.7;
}

.doc-title {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.doc-updated {
  margin-top: 0.5rem;
  font-size: 13px;
  color: hsl(var(--muted-foreground));
}

.doc-section {
  padding-top: 2.5rem;
  scroll-margin-top: 6rem;
}

.doc-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.doc-section p {
  margin-top: 1rem;
}

/* Страница 404 */

.notfound {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 42rem;
  margin-inline: auto;
  padding: 6rem 1rem 8rem;
  text-align: center;
}

.notfound-code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.notfound-title {
  margin-top: 0.75rem;
  font-size: 1.875rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

@media (min-width: 640px) {
  .notfound-title {
    font-size: 2.25rem;
  }
}

.notfound-text {
  margin-top: 1rem;
  max-width: 28rem;
  color: hsl(var(--muted-foreground));
  text-wrap: balance;
}

.notfound .btn {
  margin-top: 2rem;
}

/* Доступность и движение */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}
