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

html {
  font-size: 100%;
  scroll-behavior: auto;
  overflow-x: clip;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  animation: page-enter 0.45s ease-out both;
  transition: opacity 0.38s cubic-bezier(0.33, 0, 0.2, 1);
}

body.is-page-leaving {
  animation: none;
  opacity: 0;
  pointer-events: none;
}

@keyframes page-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

img {
  max-width: 100%;
  display: block;
}

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

button,
input {
  font: inherit;
}

ul {
  list-style: none;
}

:focus-visible {
  outline: 0.125rem solid var(--focus);
  outline-offset: 0.125rem;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 1000;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: var(--white);
}

.skip-link:focus {
  top: 1rem;
}

.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  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(--bg-elevated);
  padding-top: 1.25rem;
  border-bottom: none;
}

.header-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem 1.5rem;
  padding-bottom: 0.65rem;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  min-width: 0;
}

.brand__logo {
  width: min(11.5rem, 100%);
  height: auto;
  display: block;
}

.header-search {
  position: relative;
  width: 100%;
  max-width: 25rem;
  justify-self: center;
  margin-inline: auto;
}

.header-search input {
  width: 100%;
  height: 2.55rem;
  padding: 0 2.5rem 0 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text);
}

.header-search input::placeholder {
  color: var(--text-light);
}

.header-search__btn {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.header-search__btn svg {
  width: 1rem;
  height: 1rem;
}

.menu-toggle {
  display: none;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--accent);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.28rem;
  justify-self: end;
}

.menu-toggle__bar {
  display: block;
  width: 1.1rem;
  height: 0.125rem;
  background: currentColor;
}

.header-contacts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  justify-self: end;
}

.header-contacts__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.22s ease;
}

.header-contacts__link:hover {
  color: var(--accent);
}

.header-contacts__icon {
  display: none;
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}

.header-contacts__email {
  color: var(--accent);
}

.header-contacts__email .header-contacts__label {
  text-decoration: underline;
  text-underline-offset: 0.15rem;
}

/* ===== Nav (sticky) ===== */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(244, 243, 239, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 0.12rem 0.5rem rgba(49, 60, 66, 0.06);
}

.nav-list {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 0.25rem 1.75rem;
  min-height: 2.75rem;
}

.nav-list a {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 0.15rem;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
  border-bottom: 0.18rem solid transparent;
  transition: color 0.22s ease, border-color 0.22s ease;
}

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

.nav-list a[aria-current="page"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ===== Main ===== */
.page-main {
  flex: 1;
  padding-block: 1.5rem 0;
  min-width: 0;
}

.page-main--home {
  padding-block: 0;
}

.page-main--catalog {
  padding-bottom: 0;
}

.catalog-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

/* ===== Map ===== */
.map-section {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0;
  border-top: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-soft);
}

.map-section__frame {
  display: block;
  width: 100%;
  height: min(70vh, 32rem);
  border: 0;
  background: var(--bg-soft);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s ease;
}

.map-section.is-loaded .map-section__frame {
  opacity: 1;
}

.map-section.is-interactive .map-section__frame {
  pointer-events: auto;
}

.map-section__overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: end center;
  padding: 1.25rem;
  cursor: pointer;
  background: transparent;
  transition: background 0.25s ease;
}

.map-section__overlay:hover {
  background: rgba(49, 60, 66, 0.04);
}

.map-section.is-interactive .map-section__overlay {
  display: none;
}

.map-section__badge {
  max-width: min(100%, 28rem);
  padding: 0.75rem 1rem;
  background: rgba(244, 243, 239, 0.96);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.35;
  pointer-events: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.map-section__overlay:hover .map-section__badge {
  transform: translateY(-0.15rem);
  box-shadow: var(--shadow-hover);
}

.map-section__hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* ===== Footer ===== */
.site-footer {
  margin-top: auto;
  background: var(--primary);
  color: rgba(255, 255, 255, 0.88);
  padding: 2.25rem 0 1.35rem;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.footer-brand__logo {
  width: min(7rem, 100%);
  height: auto;
  filter: brightness(0) invert(1);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 1.75rem 2rem;
  margin-bottom: 1.5rem;
}

.footer-title {
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.footer-cats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 1.25rem;
}

.footer-cats a,
.footer-contacts a {
  font-size: 0.8125rem;
  transition: color var(--duration) var(--ease);
}

.footer-cats a:hover,
.footer-contacts a:hover {
  color: var(--white);
}

.footer-contacts {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.8125rem;
}

.footer-hours {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8125rem;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 1rem;
  font-size: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  justify-content: space-between;
}

/* ===== Modal / buttons ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(51, 51, 51, 0.45);
}

.modal__dialog {
  position: relative;
  width: min(100%, 26rem);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 1.35rem;
}

.modal__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.modal__subtitle {
  font-size: 0.875rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.modal__close {
  position: absolute;
  top: 0.5rem;
  right: 0.65rem;
  width: 2rem;
  height: 2rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.8rem;
}

.form-field label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
}

.form-field input,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  padding: 0.55rem 0.7rem;
  color: var(--text);
  background: var(--bg-elevated);
}

.form-field textarea {
  min-height: 5rem;
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background-color 0.22s ease, color 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}

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

.btn--primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn--ghost {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text);
}

.btn--ghost:hover {
  background: var(--bg-soft);
  transform: translateY(-1px);
}

/* ===== Responsive ===== */
@media (max-width: 64rem) {
  .header-top {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .header-search {
    grid-column: 1 / -1;
    max-width: none;
    justify-self: stretch;
    order: 4;
  }

  .header-contacts {
    order: 2;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    justify-self: end;
    grid-column: auto;
  }

  .header-contacts__link {
    width: 2.35rem;
    height: 2.35rem;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--cream);
    color: var(--ink);
  }

  .header-contacts__link:hover {
    background: var(--sand);
    color: var(--sage);
  }

  .header-contacts__icon {
    display: block;
  }

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

  .header-contacts__email .header-contacts__label {
    text-decoration: none;
  }

  .menu-toggle {
    order: 3;
  }

  .catalog-layout {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .map-section__frame {
    height: min(55vh, 24rem);
  }
}

@media (max-width: 48rem) {
  .header-top {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

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

  .brand__logo {
    width: min(9rem, 62vw);
  }

  .header-contacts {
    gap: 0.3rem;
  }

  .nav-list {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-bottom: 0.5rem;
  }

  .site-nav.is-open .nav-list {
    display: flex;
  }

  .nav-list a {
    border-bottom: none;
    border-left: 0.18rem solid transparent;
    padding: 0.75rem 0.5rem;
  }

  .nav-list a[aria-current="page"] {
    border-left-color: var(--accent);
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-cats {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  body,
  body.is-page-leaving {
    opacity: 1 !important;
    animation: none !important;
    transition: none !important;
  }

  .btn,
  .nav-list a,
  .header-contacts__link,
  .map-section__frame,
  .map-section__overlay,
  .map-section__badge,
  .footer-cats a,
  .footer-contacts a {
    transition: none !important;
  }

  .btn--primary:hover,
  .btn--ghost:hover,
  .map-section__overlay:hover .map-section__badge {
    transform: none;
  }
}
