/* Materialka.ru — public UI v1.2 */

:root {
  --bg: #f7f7f4;
  --card: #fff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7e0;
  --accent: #3d8a62;
  --accent-dark: #2f6f4f;
  --accent-soft: #eef4ef;
  --danger: #b42318;
  --shadow: 0 1px 3px rgba(20, 28, 20, 0.06);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --space-section: 40px;
  --space-hero: 44px;
  --font-semibold: 600;
  --font-bold: 650;
  --content-max: 52rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 16px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

.container {
  width: min(1140px, calc(100% - 32px));
  margin: 0 auto;
}

.narrow {
  width: min(48rem, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

.text-muted {
  color: var(--muted);
}

.stack-sm {
  display: grid;
  gap: 8px;
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Header */
.site-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  gap: 16px;
  position: relative;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
}

.logo:hover {
  text-decoration: none;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #fff;
  font-size: 15px;
}

.main-nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

.main-nav a {
  color: #374151;
  font-weight: 500;
  font-size: 14px;
}

.menu-toggle {
  display: none;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

/* Typography */
h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 12px;
  font-weight: var(--font-semibold);
}

h1 {
  font-size: clamp(26px, 4vw, 38px);
  letter-spacing: -0.02em;
  font-weight: var(--font-bold);
}

h2 {
  font-size: clamp(22px, 2.5vw, 28px);
  letter-spacing: -0.02em;
}

h3 {
  font-size: 18px;
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin: 0 0 8px;
}

.hero-text,
.lead,
.page-hero p {
  font-size: 16px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 42rem;
  margin: 0;
}

.lead {
  margin-top: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  text-decoration: none;
}

.btn-sm {
  padding: 9px 14px;
  font-size: 13px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-secondary {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: #d8e8dc;
}

.btn-secondary:hover {
  background: #e4efe6;
}

.btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: #fecaca;
}

.btn-ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

/* Hero & home */
.hero {
  padding: var(--space-hero) 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.85fr);
  gap: 24px;
  align-items: center;
}

.hero-actions,
.estimate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-card,
.card,
.calculator-box,
.estimate-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 18px;
}

.mini-search label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}

.quick-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.quick-list a {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fafaf8;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.quick-list a:hover {
  text-decoration: none;
  border-color: #d0d6ce;
  background: #fff;
}

/* Forms (global) */
.mini-search input,
.catalog-search,
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font: inherit;
  font-size: 15px;
  background: #fff;
  color: var(--text);
  min-height: 42px;
}

textarea {
  min-height: auto;
}

input[type="checkbox"] {
  width: 18px;
  min-height: 0;
  padding: 0;
}

input:disabled,
select:disabled {
  background: #f3f4f1;
  color: var(--muted);
  cursor: not-allowed;
}

.catalog-search {
  margin-top: 12px;
}

/* Sections & cards */
.section {
  padding: var(--space-section) 0;
}

.section-muted {
  background: #fff;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-head h2 {
  margin-bottom: 0;
}

.section-head a {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.card {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
}

.card h3 {
  font-size: 17px;
  margin-bottom: 6px;
}

.card h3 a {
  color: var(--text);
}

.card h3 a:hover {
  color: var(--accent);
}

.card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  margin: 0 0 10px;
  flex: 1;
}

.card-link {
  font-weight: 600;
  font-size: 14px;
}

.badge {
  display: inline-flex;
  padding: 3px 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 8px;
}

/* Page hero (lists, estimate) */
.page-hero {
  padding: 32px 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.page-hero h1 {
  margin-bottom: 8px;
}

/* Article (single column) */
.article-wrap {
  padding: 28px 0 40px;
}

.article-layout {
  max-width: var(--content-max);
  margin: 0 auto;
}

.article {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.article--single {
  width: 100%;
}

.article .eyebrow {
  margin-bottom: 6px;
}

.content-body {
  margin-top: 20px;
}

.content-body h2 {
  font-size: 22px;
  margin-top: 28px;
}

.content-body h3 {
  font-size: 18px;
  margin-top: 20px;
}

.content-body p,
.content-body li {
  font-size: 16px;
  line-height: 1.55;
}

.content-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 6px 0 6px 14px;
  background: #f8faf8;
  margin: 18px 0;
  color: #374151;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

.breadcrumbs a {
  color: var(--muted);
  font-weight: 500;
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.breadcrumbs__sep {
  color: #9ca3af;
}

.breadcrumbs__current {
  color: var(--text);
  font-weight: 600;
}

/* Calculator */
.calculator-box {
  padding: 20px;
  margin: 20px 0;
}

.calculator-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calculator-form__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  align-items: start;
}

.field-group-title {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.field .field-checkbox {
  width: 100%;
}

.field input:not([type="checkbox"]),
.field select {
  width: 100%;
  min-height: 42px;
}

.field > label:not(.field-checkbox) {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.field--full.field--checkbox {
  padding: 10px 12px;
  background: #fafaf8;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.field small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.4;
}

.field--checkbox {
  justify-content: flex-start;
}

.field-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.4;
  margin: 0;
}

.field-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.field-checkbox__text {
  flex: 1;
}

.calculator-result {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: #fff;
  border: 1px solid var(--border);
}

.calculator-result h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.35;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.result-item {
  background: #fafaf8;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.result-item span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}

.result-item strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.calc-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.calculator-loading {
  color: var(--muted);
  font-size: 14px;
}

/* Tables */
.table-scroll {
  overflow-x: auto;
  margin: 20px 0;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 14px;
}

th,
td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f6f6f2;
  font-weight: 600;
  font-size: 13px;
}

/* FAQ */
.faq {
  margin-top: 28px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.faq > h2 {
  font-size: 20px;
  margin-bottom: 12px;
}

.faq details {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin: 6px 0;
  background: #fafaf8;
}

.faq summary {
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  padding: 12px 14px;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq details div {
  padding: 0 14px 12px;
  color: #374151;
  font-size: 15px;
  line-height: 1.5;
}

/* CTA */
.calculator-cta {
  margin: 24px 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
}

.calculator-cta__title {
  font-size: 18px;
  margin: 0 0 6px;
  font-weight: 600;
}

.calculator-cta__text {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 15px;
  max-width: 50ch;
  line-height: 1.45;
}

.calculator-cta__body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.calculator-cta__btn {
  flex-shrink: 0;
}

/* Related */
.related-section {
  margin: 28px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.related-section__title {
  font-size: 20px;
  margin-bottom: 14px;
}

.related-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.related-card {
  display: flex;
  flex-direction: column;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fafaf8;
}

.related-card__title {
  font-size: 16px;
  margin: 0 0 6px;
  line-height: 1.3;
}

.related-card__title a {
  color: var(--text);
}

.related-card__excerpt {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-card__link {
  font-weight: 600;
  font-size: 14px;
  margin-top: auto;
}

.related-card .badge {
  margin-bottom: 6px;
}

.related-list {
  padding-left: 20px;
}

/* Footer */
.site-footer {
  padding: 24px 0;
  border-top: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 14px;
}

.site-footer p {
  margin: 6px 0 0;
  line-height: 1.45;
  max-width: 36rem;
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.footer-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.footer-links a {
  font-size: 14px;
  font-weight: 500;
}

/* Estimate */
.estimate-box {
  padding: 20px;
}

.estimate-table input {
  min-width: 0;
  width: 100%;
  min-height: 38px;
  padding: 6px 10px;
  font-size: 14px;
}

.estimate-table tfoot th {
  font-size: 15px;
}

.hidden {
  display: none !important;
}

.notice {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: #f4faf5;
  border: 1px solid #d8eadc;
  font-size: 14px;
}

.error {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: #fff0ee;
  border: 1px solid #ffdad5;
  color: #912018;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .calculator-form__row,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .main-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 12px;
    flex-direction: column;
    align-items: stretch;
  }

  .main-nav.is-open {
    display: flex;
  }

  .main-nav a {
    padding: 8px 4px;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .calculator-cta__body {
    flex-direction: column;
    align-items: stretch;
  }

  .calculator-cta__btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .container,
  .narrow {
    width: calc(100% - 24px);
  }

  .card-grid,
  .related-cards {
    grid-template-columns: 1fr;
  }

  .article {
    padding: 18px;
  }

  .hero {
    padding: 28px 0;
  }

  :root {
    --space-section: 32px;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .footer-grid {
    flex-direction: column;
  }

  .hero-actions .btn,
  .estimate-actions .btn {
    width: 100%;
  }

  .page-hero {
    padding: 24px 0 20px;
  }

  /* Estimate stacked cards */
  .estimate-table thead {
    display: none;
  }

  .estimate-table tbody tr,
  .estimate-table tfoot tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    padding: 8px 10px;
    background: #fff;
  }

  .estimate-table tfoot tr {
    margin-bottom: 0;
    background: #f8faf8;
  }

  .estimate-table td,
  .estimate-table th {
    display: block;
    border: 0;
    padding: 6px 2px;
  }

  .estimate-table td::before,
  .estimate-table th::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 2px;
  }

  .estimate-table td:last-child {
    text-align: right;
  }

  .estimate-table td[data-label=""]::before {
    display: none;
  }

  .estimate-table tfoot th::before {
    content: "Итого";
  }
}

@media (max-width: 360px) {
  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }
}
