:root {
  --paper: #f7f4ee;
  --panel: #fbf9f3;
  --ink: #15181a;
  --muted: #74716a;
  --line: #d9d2c5;
  --line-dark: #b7ab99;
  --accent: #7a6248;
  --accent-dark: #403529;
  --selected: #1f3f3a;
  --selected-soft: #e2ebe7;
  --map-edge: #cfc7ba;
  --shadow: 0 18px 45px rgba(23, 24, 22, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

button,
a {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
.leaflet-marker-icon:focus-visible {
  outline: 2px solid rgba(122, 98, 72, 0.55);
  outline-offset: 3px;
}

.map-app {
  display: grid;
  grid-template-columns: minmax(460px, 44vw) minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  background: var(--panel);
}

.project-rail {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  padding: 22px 32px 24px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  z-index: 500;
}

.rail-header {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.return-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-bottom: 18px;
  color: var(--selected);
  border-bottom: 1px solid currentColor;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

.return-link:hover {
  color: var(--accent-dark);
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.94rem;
  font-weight: 700;
}

h1 {
  max-width: 15ch;
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.25rem, 3.25vw, 3.15rem);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: 0;
}

.project-list-wrap {
  min-height: 0;
  padding: 18px 0 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-dark) transparent;
}

.project-list-wrap::-webkit-scrollbar {
  width: 8px;
}

.project-list-wrap::-webkit-scrollbar-thumb {
  background: var(--line-dark);
}

.list-heading-row {
  margin-bottom: 10px;
}

.list-heading-row h2 {
  margin: 0;
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.project-list {
  display: grid;
  align-content: start;
  gap: 0;
  min-height: 0;
  padding-right: 8px;
  overflow: visible;
}

.project-row {
  border-bottom: 1px solid rgba(217, 210, 197, 0.9);
}

.project-row button {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  width: 100%;
  padding: 12px 2px;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  border: 0;
  background: transparent;
}

.project-row button:hover,
.project-row.is-active button {
  color: var(--selected);
}

.project-row.is-active .list-index {
  color: #fffdf7;
  border-color: var(--selected);
  background: var(--selected);
}

.list-index {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  color: var(--accent);
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 800;
}

.list-name {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.1;
}

.list-meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.expanded-project {
  padding: 0 0 16px 38px;
}

.expanded-project p {
  max-width: 40rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.48;
}

.expanded-project ul {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 16px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.expanded-project li {
  position: relative;
  padding-left: 14px;
  color: #4f4d49;
  font-size: 0.78rem;
  line-height: 1.3;
}

.expanded-project li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.58em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.expanded-project a {
  display: inline-flex;
  align-items: center;
  margin-top: 12px;
  color: var(--selected);
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
}

.expanded-project a::after {
  content: "";
  width: 24px;
  height: 1px;
  margin-left: 9px;
  background: currentColor;
}

.empty-list {
  margin: 0;
  padding: 14px 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.map-panel,
#map {
  min-width: 0;
  min-height: 0;
}

.map-panel {
  position: relative;
  background: #dcd8ce;
}

#map {
  width: 100%;
  height: 100%;
}

.leaflet-container {
  font: inherit;
  background: #dcd8ce;
}

.leaflet-control-attribution {
  max-width: 66vw;
  padding: 3px 6px !important;
  color: rgba(21, 24, 26, 0.72);
  background: rgba(251, 249, 243, 0.86) !important;
  font-size: 0.64rem;
  line-height: 1.25;
}

.portfolio-point {
  position: relative;
  display: block;
  width: 16px;
  height: 16px;
  border: 2px solid #fffdf8;
  border-radius: 50%;
  background: var(--accent-dark);
  box-shadow:
    0 0 0 1px rgba(64, 53, 41, 0.7),
    0 8px 18px rgba(23, 24, 22, 0.28);
  transition:
    transform 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

.portfolio-point.is-preview,
.portfolio-point.is-active {
  transform: scale(1.28);
  background: var(--selected);
  box-shadow:
    0 0 0 2px #fffdf8,
    0 0 0 7px rgba(31, 63, 58, 0.23),
    0 11px 24px rgba(23, 24, 22, 0.34);
}

.leaflet-tooltip.project-tooltip {
  padding: 7px 9px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(251, 249, 243, 0.95);
  box-shadow: 0 10px 24px rgba(23, 24, 22, 0.12);
  font-size: 0.78rem;
  font-weight: 700;
}

@media (max-width: 900px) {
  .map-app {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .project-rail {
    padding: 20px 18px 14px;
  }

  h1 {
    font-size: 2rem;
  }
}

@media (max-width: 720px) {
  html,
  body {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .map-app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(300px, 42vh) minmax(0, 1fr);
    min-height: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .project-rail {
    grid-row: 2;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
    padding: 18px 18px 20px;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    border-right: 0;
    box-shadow: none;
  }

  .map-panel {
    grid-row: 1;
    min-height: 300px;
  }

  .project-list-wrap {
    padding-top: 16px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .expanded-project ul {
    grid-template-columns: 1fr;
  }

  .leaflet-control-attribution {
    max-width: calc(100vw - 24px);
  }
}

@media (max-height: 760px) and (min-width: 721px) {
  .project-rail {
    padding-top: 18px;
  }

  h1 {
    font-size: 2.15rem;
  }

  .project-list-wrap {
    padding-top: 12px;
  }

  .project-row button {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .expanded-project ul {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
