/* ImgHaul — утилитарный «швейцарский» стиль: крупная типографика, один акцент,
   шахматный фон под картинками как мотив «прозрачности». Системные шрифты — ради скорости (LCP). */

:root {
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-2: #efefea;
  --text: #16181a;
  --muted: #5d6166;
  --line: #dcdcd5;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #d6efe9;
  --danger: #b42318;
  --checker-a: #ececE6;
  --checker-b: #f8f8f5;

  --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-hero: clamp(2.1rem, 1.2rem + 3.6vw, 3.6rem);
  --space-section: clamp(3rem, 2rem + 4vw, 6rem);
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px rgb(0 0 0 / 0.06);
  --duration: 160ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111314;
    --surface: #191c1d;
    --surface-2: #222627;
    --text: #ecedeb;
    --muted: #a2a7a9;
    --line: #2f3436;
    --accent: #2dd4bf;
    --accent-ink: #062a26;
    --accent-soft: #123a35;
    --danger: #f97066;
    --checker-a: #1f2324;
    --checker-b: #262a2b;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--font);
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
code { font-family: var(--mono); font-size: 0.92em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Шапка */
.site-header { border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 750; font-size: 1.15rem; letter-spacing: -0.02em; }
.header-nav { display: flex; gap: 20px; }
.header-nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.header-nav a:hover { color: var(--text); }

/* Первый экран */
.hero {
  padding-block: clamp(2.5rem, 1.5rem + 4vw, 5rem) clamp(2rem, 1rem + 3vw, 3.5rem);
  background:
    linear-gradient(to bottom, transparent 55%, var(--bg)),
    repeating-conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%) 0 0 / 28px 28px;
}
.hero .wrap { text-align: center; }
.hero h1 {
  margin: 0 auto 0.4em;
  max-width: 20ch;
  font-size: var(--text-hero);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 800;
}
.lead { margin: 0 auto 2rem; max-width: 60ch; font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem); color: var(--muted); }

.tool {
  max-width: 820px;
  margin-inline: auto;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 8px 16px 16px;
}

.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tab {
  appearance: none; border: 0; background: none; cursor: pointer;
  padding: 10px 12px; font: 600 0.92rem var(--font); color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--duration);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

.panel { display: grid; gap: 10px; }
.panel[hidden] { display: none; }
.input-row { display: flex; gap: 8px; }
input[type="text"], textarea, select {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius);
}
input[type="text"] { flex: 1; min-width: 0; padding: 14px; font-size: 1.05rem; }
textarea { width: 100%; padding: 12px 14px; font-family: var(--mono); font-size: 0.9rem; resize: vertical; }
input[type="text"]:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.btn {
  appearance: none; cursor: pointer; border-radius: var(--radius);
  font: 650 1rem var(--font); padding: 14px 20px; border: 1px solid transparent;
  transition: transform var(--duration), filter var(--duration), opacity var(--duration);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not([disabled]) { filter: brightness(1.08); }
.panel > .btn { justify-self: start; }

.status { min-height: 1.5em; margin: 10px 2px 0; font-size: 0.95rem; color: var(--muted); }
.status[data-tone="error"] { color: var(--danger); }

/* Результаты */
.results { margin-top: 8px; }
.results[hidden] { display: none; }
.results-bar {
  position: sticky; top: 0; z-index: 2;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  padding: 12px 0; background: var(--bg); border-bottom: 1px solid var(--line);
}
.found { margin: 0 auto 0 0; font-weight: 700; font-size: 1.1rem; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; font-size: 0.9rem; color: var(--muted); }
.filters select { padding: 6px 8px; margin-left: 6px; }
.formats { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  appearance: none; cursor: pointer; font: 600 0.8rem var(--font); text-transform: uppercase; letter-spacing: 0.04em;
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

.zip-note { margin: 12px 0 0; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); font-size: 0.95rem; }

.grid {
  list-style: none; margin: 16px 0 0; padding: 0;
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform var(--duration), box-shadow var(--duration);
}
.card[hidden] { display: none; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.thumb {
  display: grid; place-items: center; aspect-ratio: 1; padding: 8px;
  background: repeating-conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%) 0 0 / 16px 16px;
}
.thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.card.is-broken .thumb img { display: none; }
.card.is-broken .thumb::after { content: "Preview blocked"; font-size: 0.8rem; color: var(--muted); }
.meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 10px; font-size: 0.8rem; color: var(--muted); }
.meta a { font-weight: 600; text-decoration: none; }
.fmt { font-family: var(--mono); text-transform: uppercase; }

.skeleton .thumb { animation: pulse 1.2s ease-in-out infinite; }
.skeleton .meta { height: 34px; }
@keyframes pulse { 50% { opacity: 0.5; } }
@media (prefers-reduced-motion: reduce) { .skeleton .thumb { animation: none; } .card:hover { transform: none; } }

/* Текст страницы */
.content { padding-block: var(--space-section); width: min(760px, 100% - 32px); margin-inline: auto; }
.content h2 { margin: 2.6em 0 0.6em; font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); line-height: 1.2; letter-spacing: -0.02em; }
.content h2:first-child { margin-top: 0; }
.steps { padding-left: 1.3em; display: grid; gap: 10px; }
.steps li::marker { font-weight: 800; color: var(--accent); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
thead th { background: var(--surface-2); font-size: 0.85rem; }
tbody th { font-weight: 600; color: var(--muted); }

.ext-cta { margin-top: 14px; color: var(--muted); }
.ext-cta:empty { display: none; }

.faq { display: grid; gap: 8px; }
details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px; }
summary { cursor: pointer; padding: 14px 0; font-weight: 650; }
details[open] summary { border-bottom: 1px solid var(--line); }
details p { margin: 12px 0 16px; }

/* Подвал */
.site-footer { border-top: 1px solid var(--line); padding-block: 24px; font-size: 0.9rem; color: var(--muted); }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.footer-row nav { display: flex; flex-wrap: wrap; gap: 18px; }

/* Юридические страницы и 404 */
.legal { padding-block: 3rem var(--space-section); width: min(720px, 100% - 32px); margin-inline: auto; }
.legal h1 { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem); letter-spacing: -0.03em; line-height: 1.1; }
.legal h2 { font-size: 1.2rem; margin-top: 2em; }

@media (max-width: 560px) {
  .input-row { flex-direction: column; }
  .btn { width: 100%; }
  .panel > .btn { justify-self: stretch; }
  .header-nav { gap: 14px; }
  .results-bar { position: static; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}
