:root {
  --bg: #f3faf5;
  --surface: #ffffff;
  --text: #1a2733;
  --muted: #4f6356;
  --border: #d5e8db;
  --brand: #25d366;
  --brand-dark: #0f7a66;
  --brand-contrast: #ffffff;
  --focus: #075e54;
  --radius: 14px;
  --maxw: 720px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
}

a { color: var(--brand-dark); }
a:hover { color: var(--focus); }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  padding: 8px 14px;
  z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

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

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
  padding-bottom: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
}
.brand-mark { display: block; }
.brand-name { font-size: 18px; }
.site-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-nav a { text-decoration: none; font-size: 15px; }

/* Main */
/* <main class="container"> — .container sets margin:0 auto AND padding:0 16px
   (specificity 0,1,0), so bare `main { margin/padding }` is ignored.
   Use main.container so vertical spacing wins. */
main.container {
  margin-top: 64px;
  margin-bottom: 40px;
  margin-left: auto;
  margin-right: auto;
}

/* Phone: tighter top gap on all pages except slug transition */
@media (max-width: 559px) {
  body:not(.tpl-slug) main.container {
    margin-top: 28px;
  }
}

.hero h1 { font-size: 28px; line-height: 1.25; margin: 0 0 10px; }
.lead { color: var(--muted); margin: 0 0 24px; font-size: 18px; }
.prose.intro { margin-bottom: 24px; }
.prose.intro p:last-child { margin-bottom: 0; }

/* Generator */
.generator {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 32px;
}
.tabs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.tab {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: #e8f6ee;
  color: var(--text);
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.3;
  cursor: pointer;
  text-align: left;
}
.tab.is-active {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: var(--brand-contrast);
  font-weight: 600;
}
.panel { margin-bottom: 8px; }
.panel.is-hidden { display: none; }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 15px; }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

.gen-input, .gen-output {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}
.gen-output { background: #f4faf6; }

.gen-error {
  color: #b3261e;
  font-size: 15px;
  margin: 12px 0 0;
}

.result { margin-top: 18px; }
.result-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.result-row .gen-output { flex: 1 1 auto; width: 100%; }
.result-row .btn-copy { width: 100%; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--brand-dark);
  color: var(--brand-contrast);
  border-color: var(--focus);
  width: 100%;
}
.btn-primary:hover { background: var(--focus); color: #fff; }
.btn-secondary {
  background: #e8f6ee;
  color: var(--brand-dark);
  border-color: var(--border);
}
.btn-secondary:hover { background: #d8f0e0; }
.btn-copy {
  display: inline-flex;
  justify-content: center;
  align-items: center;
}
.btn-copy-label {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.btn-copy-label::after {
  content: "Скопировано";
  height: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

/* "Открыть в браузере" — только на десктопе, на мобильных скрыто */
.btn-web { display: none; }
@media (min-width: 768px) {
  .btn-web { display: inline-block; }
}

/* Prose */
.prose { max-width: 100%; }
.prose h2 { font-size: 21px; margin: 28px 0 8px; }
.prose p, .prose ul { margin: 0 0 14px; }
.prose ul { padding-left: 22px; }
.prose code {
  background: #e8f6ee;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.92em;
  word-break: break-all;
}
.prose code.copyable {
  cursor: pointer;
  border: 1px dashed transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.prose code.copyable:hover {
  border-color: var(--brand);
}
.prose code.copyable.is-copied {
  background: #d4f0df;
  color: #1c7c3b;
  border-color: #1c7c3b;
}
.internal-links { color: var(--muted); font-size: 15px; margin-top: 24px; }

.callout {
  background: #e8f7ee;
  border: 1px solid #c5e8d1;
  border-left: 4px solid var(--brand);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 20px 0;
}
.callout h2 { margin-top: 0; font-size: 19px; }
.callout ul { margin-bottom: 0; }

/* Transition (slug) card */
.transition .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 22px;
  text-align: center;
  margin-bottom: 8px;
}
.avatar {
  width: 84px;
  height: 84px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  font-size: 38px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-icon { width: 46px; height: 46px; display: block; }
.card-title { font-size: 23px; margin: 0 0 28px; word-break: break-word; }
.card-sub { color: var(--muted); margin: 0 0 22px; font-size: 16px; word-break: break-word; }
.cta { display: grid; gap: 10px; max-width: 360px; margin: 0 auto; }
.write-phone-cta { margin-top: 16px; max-width: none; }
.back-home { font-weight: 600; }

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: 24px;
}
.disclaimer { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; }
.footer-nav a { font-size: 15px; text-decoration: none; }
.copyright { color: var(--muted); font-size: 13px; margin: 0; }
.legal-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin: 14px 0 0;
}

.internal-links a { white-space: nowrap; }

@media (min-width: 560px) {
  .hero h1 { font-size: 34px; }
  main.container { margin-top: 88px; margin-bottom: 56px; }
  .tabs {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .tab {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    padding: 10px 12px;
    text-align: center;
  }
  .result-row {
    flex-direction: row;
    align-items: stretch;
  }
  .result-row .btn-copy { width: auto; }
}

@media (max-width: 360px) {
  body { font-size: 16px; }
  .generator { padding: 16px; }
  .transition .card { padding: 22px 16px; }
}
