:root {
  --bg: #f3f1ec;
  --surface: #ffffff;
  --ink: #7f7574;
  --muted: #958b88;
  --teal-900: #6b9bc2;
  --teal-700: #5d8bb1;
  --teal-600: #7eaed0;
  --sand: #ddcb8a;
  --line: #ddd5c6;
  --hero-light: #d9c47c;
  --focus-ring: rgba(107, 155, 194, 0.22);
  --hero-ink: #3f474f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  -webkit-text-size-adjust: 100%;
  font-family: "Source Sans 3", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #efede7 0%, var(--bg) 320px);
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  font-family: "Playfair Display", serif;
  letter-spacing: 0.01em;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 2000;
  background: rgba(248, 246, 241, 0.97);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid #d6cebe;
  box-shadow: 0 6px 18px rgba(54, 59, 66, 0.08);
}

.nav {
  min-height: 128px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  flex-wrap: nowrap;
  padding: 0.4rem 0;
}

.auth-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.logo-wrap {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 10px 24px rgba(42, 48, 56, 0.1);
  padding: 0.5rem 1rem;
}

.logo {
  display: block;
  max-height: 112px;
  width: auto;
}

.brand-block {
  flex: 1;
  min-width: 240px;
  text-align: left;
  padding: 0.2rem 0.3rem;
}

.brand-title {
  font-family: "Playfair Display", serif;
  font-size: clamp(1.25rem, 2.4vw, 1.9rem);
  font-weight: 700;
  line-height: 1.05;
  color: #6f6665;
  letter-spacing: 0.01em;
}

.brand-subtitle {
  margin-top: 0.22rem;
  color: #8f8684;
  font-size: clamp(0.78rem, 1.05vw, 0.92rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.logo-fallback {
  font-family: "Playfair Display", serif;
  letter-spacing: 0.12em;
  font-size: 0.96rem;
  color: var(--teal-900);
}

.hero {
  margin: 1rem auto 0;
}

.hero__content {
  background: #ffffff;
  color: var(--hero-ink);
  border: 1px solid #d2cec3;
  border-radius: 18px;
  padding: clamp(1.1rem, 2.4vw, 1.9rem);
  box-shadow: 0 10px 24px rgba(59, 68, 82, 0.09);
}

.hero h1 {
  margin: 0.4rem 0 0.2rem;
  font-size: clamp(0.86rem, 1.15vw, 1.02rem);
  line-height: 1.45;
  font-weight: 400;
}

.hero p {
  max-width: 760px;
  margin: 0;
  font-size: 1.08rem;
  opacity: 0.95;
}

.eyebrow {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.01em;
  font-size: clamp(2.25rem, 4.1vw, 3.2rem);
  text-transform: none;
  color: #6f6665;
}

.page-main {
  padding: 1.2rem 0 2.4rem;
}

.toolbar,
.map-section,
.editor {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(15, 31, 31, 0.06);
}

.toolbar {
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 1rem;
  align-items: end;
}

.search label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--teal-900);
}

input,
textarea {
  width: 100%;
  font: inherit;
  border-radius: 10px;
  border: 1px solid #cfd6ce;
  padding: 0.72rem 0.82rem;
  color: var(--ink);
  background: #fff;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--teal-600);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.search input {
  width: min(100%, 560px);
  min-width: 0;
  padding-right: 2.2rem;
}

.search-input-wrap {
  position: relative;
  width: min(100%, 560px);
}

.search-clear {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  border: 0;
  background: #e5e1d6;
  color: #6b6463;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.search-clear:hover {
  background: #d8d1bf;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 0.68rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn--primary {
  background: var(--teal-700);
  color: #f7faf8;
}

.btn--primary:hover {
  background: #4f7ea5;
}

.btn--ghost {
  background: #efe6c8;
  color: #6c7f8f;
}

.map-section {
  margin-top: 1rem;
  padding: 1rem;
}

.map-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.map-head h2,
.section-title {
  margin: 0;
}

.map-head p {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

#mapFrame {
  margin-top: 0.8rem;
  width: 100%;
  height: clamp(280px, 42vw, 420px);
  border: 0;
  border-radius: 12px;
  position: relative;
  z-index: 1;
}

.map-preview {
  width: 220px;
}

.map-preview img {
  width: 100%;
  height: 120px;
  object-fit: contain;
  object-position: center;
  background: #f3f2ee;
  padding: 0.2rem;
  border-radius: 8px;
}

.map-preview__body {
  padding-top: 0.45rem;
}

.map-preview__body p {
  margin: 0.2rem 0;
  font-size: 0.88rem;
  color: #5d666c;
}

.editor {
  margin-top: 1rem;
  padding: 1.2rem;
}

.editor h2 {
  margin: 0 0 0.8rem;
}

.grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full {
  grid-column: 1 / -1;
}

.section-title {
  margin: 1.2rem 0 0.85rem;
  color: var(--teal-900);
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(9, 20, 23, 0.08);
  animation: rise-in 280ms ease;
}

.card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  object-position: center;
  background: #f3f2ee;
  padding: 0.35rem;
}

.card__body {
  padding: 0.9rem;
}

.card__body h3 {
  margin: 0 0 0.45rem;
}

.meta {
  margin: 0.35rem 0;
  color: var(--muted);
}

.map-link {
  display: inline-flex;
  margin-top: 0.5rem;
  text-decoration: none;
  color: #5a86aa;
  font-weight: 700;
}

.map-link:hover {
  color: #4b7395;
}

#emptyState {
  margin: 1rem 0 0;
  color: var(--muted);
  font-weight: 700;
}

dialog {
  width: min(460px, 92vw);
  border: none;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 15, 20, 0.3);
}

.leaflet-popup-content {
  margin: 10px 12px;
}

dialog::backdrop {
  background: rgba(17, 23, 27, 0.45);
}

.login-form {
  display: grid;
  gap: 0.7rem;
}

.login-form h3 {
  margin: 0.2rem 0;
}

.login-form p {
  margin: 0;
  color: var(--muted);
}

.login-form__actions {
  margin-top: 0.65rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.hidden {
  display: none !important;
}

.admin-page .page-main {
  padding-top: 1rem;
}

.admin-login {
  max-width: 720px;
  margin: 0 auto;
}

.admin-editor-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.9rem;
}

.admin-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem;
  background: #fff;
}

.admin-card h3 {
  margin: 0 0 0.5rem;
}

.admin-card p {
  margin: 0.25rem 0;
}

.admin-card-actions {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.6rem;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .container {
    width: min(1120px, calc(100vw - 20px));
  }

  .nav {
    min-height: 88px;
    gap: 0.6rem;
    flex-wrap: wrap;
  }

  .logo {
    max-height: 80px;
  }

  .brand-block {
    order: 3;
    width: 100%;
    min-width: 0;
    text-align: center;
    padding: 0.2rem 0 0.1rem;
  }

  .brand-title {
    font-size: 1.22rem;
  }

  .brand-subtitle {
    font-size: 0.74rem;
    letter-spacing: 0.07em;
  }

  .logo-fallback {
    font-size: 0.84rem;
    letter-spacing: 0.08em;
  }

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

  #mapFrame {
    height: 300px;
  }

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

@media (max-width: 1024px) {
  .nav {
    min-height: 108px;
  }

  .logo {
    max-height: 94px;
  }

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

  #mapFrame {
    height: clamp(280px, 44vw, 360px);
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .nav {
    justify-content: center;
    gap: 0.5rem;
  }

  .auth-actions {
    width: 100%;
    justify-content: center;
  }

  .btn {
    width: 100%;
  }

  .logo {
    max-height: 72px;
  }

  .brand-title {
    font-size: 1.08rem;
  }

  .brand-subtitle {
    font-size: 0.7rem;
  }

  .eyebrow {
    font-size: clamp(1.5rem, 8vw, 2.1rem);
  }

  .hero h1 {
    font-size: 0.96rem;
  }

  input,
  textarea {
    font-size: 16px;
  }

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

  .map-preview {
    width: 180px;
  }

  .map-preview img {
    height: 96px;
  }
}
