@font-face {
  font-family: SUIT;
  src: url("./assets/SUIT-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #263c32;
  --green: #31584a;
  --green-deep: #283f35;
  --muted: #576357;
  --paper: #f8f6ef;
  --white: #fefcf6;
  --line: #d9d9cb;
  --clay: #95512f;
  --serif: Didot, "Bodoni 72", Georgia, serif;
  font: 14px/1.6 SUIT, "Apple SD Gothic Neo", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
button, select, a { -webkit-tap-highlight-color: transparent; }
button, select { font: inherit; }
button { border: 0; color: inherit; background: none; cursor: pointer; }
button:disabled, select:disabled { opacity: .5; cursor: default; }
a { color: inherit; }
:focus-visible { outline: 2px solid #b06b44; outline-offset: 3px; }
[hidden] { display: none !important; }

.masthead {
  min-height: 73px;
  padding: 12px clamp(20px, 4.6vw, 72px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand > svg { width: 29px; height: 33px; fill: none; stroke: currentColor; stroke-width: 1.1; }
.brand > span { font: 24px/1 var(--serif); letter-spacing: .12em; }
.brand small {
  display: block;
  margin: 6px 0 0 2px;
  font: 650 8px/1 SUIT, sans-serif;
  letter-spacing: .26em;
}
.artis-link { font-size: 12px; font-weight: 650; text-decoration: none; }
.artis-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.artis-link span { margin-inline-start: 3px; }

main { max-width: 1680px; margin: auto; padding: 29px clamp(20px, 4.6vw, 72px) 40px; }
.page-heading {
  min-height: 124px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  padding: 0 0 23px;
}
.location, .survey-date { color: var(--muted); font-size: 12px; font-weight: 620; letter-spacing: .035em; margin: 0; }
.page-heading-actions { display: grid; justify-items: end; align-items: center; gap: 8px; }
.living-jump {
  display: inline-flex;
  min-height: 42px;
  gap: 14px;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid #a8b6a6;
  border-radius: 4px;
  background: #eff2e8;
  font-weight: 730;
  text-decoration: none;
}
.living-jump:hover { background: #e2ebdf; }
.living-jump span { color: var(--green); font-size: 17px; }
h1 { font-size: clamp(34px, 5.7vw, 62px); font-weight: 510; line-height: 1.06; letter-spacing: -.068em; margin: 9px 0 11px; }
h1 em { font: 400 1.13em/.86 var(--serif); letter-spacing: -.045em; color: var(--clay); margin-left: .08em; }
.lead { color: var(--muted); font-size: 14px; margin: 0; }

.workspace {
  display: grid;
  grid-template: "map residence" auto "map places" 1fr / minmax(0, 1fr) minmax(280px, 342px);
  gap: 14px 19px;
  align-items: start;
}
.map-panel { grid-area: map; background: var(--white); border: 1px solid var(--line); min-width: 0; }
.map-heading { min-height: 59px; padding: 10px 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
h2 { font-weight: 720; line-height: 1.35; letter-spacing: -.035em; margin: 0; font-size: 17px; }
.map-switch {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid #d9ddce;
  background: #eeefe4;
  border-radius: 5px;
}
.map-switch button { min-width: 62px; min-height: 32px; padding: 3px 10px; font-size: 12px; border-radius: 3px; font-weight: 660; }
.map-switch button[aria-pressed="true"] { background: var(--green); color: var(--white); }
.map-switch button[aria-pressed="false"]:hover { background: var(--white); }

.map-stage {
  position: relative;
  height: clamp(430px, 61vh, 734px);
  isolation: isolate;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background: #e9e9dc;
  border-block: 1px solid var(--line);
}
.map-stage:active { cursor: grabbing; }
.map-stage:focus-visible { outline-offset: -3px; }
.map-stage > svg, .markers { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-stage > svg { pointer-events: none; background: #e9e9dc; }
.markers { overflow: hidden; pointer-events: none; }
.land-1 { fill: #c5d1b5; }
.land-2 { fill: #c7d9bd; }
.land-3 { fill: #dcd6b7; }
.land-4 { fill: #b5ccd0; }
.land-5 { fill: #e0ddd0; }
.contours { fill: none; stroke: #7c8e70; stroke-opacity: .33; stroke-width: .65; vector-effect: non-scaling-stroke; }
.contours.major { stroke-opacity: .44; }
.map-roads { fill: none; stroke: #fffdf5; stroke-linejoin: round; stroke-linecap: round; }
.map-roads.main { stroke: #fff1ca; }
.road-casing { stroke: #c8c9b6; opacity: .8; }
.road-casing.main { stroke: #bc9c6c; }
.buildings { fill: #a9a99a; opacity: .73; }
.map-stage[data-mode="plans"] .buildings { opacity: .45; }
.map-overlay {
  stroke: var(--green);
  stroke-width: 1.8;
  fill: #56846b2b;
  fill-rule: evenodd;
  vector-effect: non-scaling-stroke;
}
.map-overlay[data-state="planned"], .map-overlay[data-state="work"] { stroke: #a4613e; fill: url(#plan-hatch); stroke-dasharray: 5 3; }
.map-overlay[data-state="work"] { stroke-dasharray: 7 3; }
.map-overlay[data-line="true"] { fill: none; }
.map-overlay.is-selected { stroke-width: 2.8; }
.map-overlay.is-site { stroke: #354e44; fill: #31584a26; stroke-width: 2.4; }
.map-overlay[hidden] { display: none; }
.view-direction { fill: #3e6c513b; stroke: #385c4a; stroke-width: 1.2; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 5px 8px 5px 6px;
  min-height: 30px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #a8b3a1;
  border-radius: 4px;
  box-shadow: 0 2px 5px #2a3a251d;
  color: #293e32;
  background: #fdfcf2;
  font-size: 11px;
  font-weight: 700;
  pointer-events: auto;
  transition: background-color .15s, border-color .15s;
}
.map-marker i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }
.map-marker[data-state="planned"] i, .map-marker[data-state="work"] i { background: #a05b3b; }
.map-marker.is-selected, .map-marker:hover { color: white; border-color: var(--green); background: var(--green); z-index: 3; }
.map-marker.is-selected i, .map-marker:hover i { background: #ede0ad; }
.map-marker.is-site { z-index: 2; border-color: #647b69; }
.map-marker.is-site i { width: 9px; height: 9px; border-radius: 1px; transform: rotate(45deg); background: var(--green); }
.map-marker.is-site.is-selected i, .map-marker.is-site:hover i { background: #ede0ad; }
.map-marker.marker-dot { min-width: 22px; min-height: 22px; padding: 4px; justify-content: center; }
.map-marker.marker-dot span { display: none; }
.compass, .map-controls, .scale { position: absolute; z-index: 4; }
.compass {
  top: 13px;
  left: 13px;
  width: 35px;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 4px;
  background: #faf8f0e6;
  border: 1px solid #d3d6c7;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 750;
  pointer-events: none;
}
.compass svg { width: 20px; height: 22px; fill: #ced6c5; stroke: var(--ink); stroke-width: 1.25; }
.map-controls {
  display: grid;
  right: 12px;
  bottom: 13px;
  background: #fbfaf1;
  border: 1px solid #bfc7b9;
  border-radius: 4px;
  box-shadow: 0 2px 8px #606c5b25;
}
.map-controls button { width: 41px; height: 41px; display: grid; place-items: center; font-weight: 550; font-size: 24px; line-height: 1; }
.map-controls button + button { border-top: 1px solid var(--line); }
.map-controls button:hover:not(:disabled) { background: #e1eadc; }
.map-controls svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.scale {
  left: 12px;
  bottom: 12px;
  padding: 3px 7px 6px;
  color: var(--ink);
  background: #faf8f0e9;
  border: 1px solid #d5d9cc;
  border-radius: 3px;
  font-size: 10px;
  pointer-events: none;
}
.scale i { display: block; width: 60px; height: 5px; border: 1px solid currentColor; border-top: 0; }
.map-status {
  position: absolute;
  z-index: 5;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: calc(100% - 40px);
  padding: 13px 18px;
  margin: 0;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  font-size: 13px;
}
.map-footer { display: flex; align-items: center; justify-content: space-between; gap: 9px; padding: 10px 15px 6px; }
.map-footer p { margin: 0; color: var(--muted); font-size: 11px; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 13px; margin: 0; padding: 0; font-size: 11px; color: var(--ink); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 9px; border: 1px solid #52735b; background: #dce4d3; }
.legend i[data-mark="site"] { border-color: #40584a; background: #c5d6c4; }
.legend i[data-mark="planned"] { border: 1px dashed #9b6244; background: #dfbba440; }
.legend i[data-mark="work"] { border: 1px solid #9b6244; background: repeating-linear-gradient(135deg, transparent 0 2px, #ba806899 2px 3px); }
.legend i[data-mark="direction"] { background: #82a08a; clip-path: polygon(0 50%, 100% 0, 100% 100%); border: 0; }
.attribution { display: flex; flex-wrap: wrap; gap: 5px 11px; padding: 0 15px 9px; font-size: 10px; color: var(--muted); }
.attribution a { text-underline-offset: 3px; }

.places { grid-area: places; padding: 16px 15px; background: var(--white); border: 1px solid var(--line); min-width: 0; }
.places h2 { margin: 0 0 12px; }
.place-list { display: grid; gap: 2px; max-height: 240px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-right: 2px; }
.place-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 7px;
  font-size: 13px;
  font-weight: 680;
  min-height: 36px;
}
.place-item i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.place-item[data-state="planned"] i, .place-item[data-state="work"] i { background: #a05b3b; }
.place-item.is-selected, .place-item:hover { border-color: #d3dccc; background: #ebefe4; }
.place-item small { color: var(--muted); font-size: 10px; font-weight: 620; max-width: 100px; text-align: right; }
.place-details { margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--line); }
.detail-heading { display: flex; gap: 5px 9px; align-items: baseline; flex-wrap: wrap; }
.detail-heading h3 { margin: 0; font-size: 16px; font-weight: 710; letter-spacing: -.02em; }
.detail-heading .place-state { font-size: 11px; color: var(--clay); font-weight: 700; }
.place-details p { font-size: 12px; color: var(--muted); margin: 6px 0; }
.place-sources { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.place-details a { font-size: 12px; font-weight: 690; text-underline-offset: 3px; }
.place-details small { display: block; margin-top: 5px; font-size: 10px; color: var(--muted); }

.preview { grid-area: residence; padding: 17px 16px; background: var(--green-deep); color: #f8f4e9; min-width: 0; }
.preview h2 { margin: 0 0 4px; }
.preview p { font-size: 12px; color: #d9e0d3; margin: 0 0 13px; }
.preview-fields { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, .8fr); gap: 8px; margin: 0 0 10px; }
.preview-fields label { display: grid; gap: 4px; font-size: 11px; font-weight: 660; }
.preview-fields select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid #728378;
  border-radius: 3px;
  color-scheme: dark;
  background: #365246;
  color: #fffdf4;
  padding: 5px;
  font-size: 12px;
}
.preview-selection {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 10px;
  padding-block: 8px;
  border-top: 1px solid #758578;
  color: #dce4d7;
  font-size: 12px;
}
.preview-selection strong { color: #f5e4b1; font-size: 15px; margin-inline-start: 3px; }
.preview-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 7px 10px;
  border-radius: 3px;
  background: #e9e9d4;
  color: #263c32;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}
.preview-link:hover { background: #fff9e3; }

@media (max-width: 890px) {
  .workspace { grid-template: "residence" auto "map" auto "places" auto / minmax(0, 1fr); }
  .map-stage { height: clamp(370px, 55vh, 540px); }
}

@media (max-width: 540px) {
  .masthead { min-height: 62px; }
  .brand > span { font-size: 19px; }
  .brand > svg { width: 23px; }
  .artis-link { font-size: 11px; }
  main { padding: 17px 14px 25px; }
  .page-heading { display: block; min-height: unset; padding-bottom: 15px; }
  .page-heading-actions { display: flex; flex-wrap: wrap-reverse; justify-content: space-between; gap: 7px 14px; margin-top: 13px; }
  .survey-date { font-size: 10px; }
  .living-jump { font-size: 12px; }
  .lead { font-size: 12px; }
  .map-heading { min-height: 53px; padding: 8px; }
  .map-heading h2 { font-size: 15px; }
  .map-switch button { min-width: 53px; padding: 3px 6px; font-size: 11px; }
  .map-stage { height: clamp(350px, 55svh, 500px); }
  .map-footer { display: block; padding-inline: 9px; }
  .map-footer p { margin-top: 3px; }
  .attribution { padding-inline: 9px; }
  .map-marker { font-size: 10px; padding: 4px; min-height: 27px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
