:root {
  --paper: #f1ede2;
  --paper-deep: #e5ddcd;
  --ink: #17201e;
  --muted: #666860;
  --line: #b9b2a5;
  --vermillion: #b43a2f;
  --vermillion-dark: #8f291f;
  --indigo: #183b4a;
  --moss: #52644b;
  --gold: #c6963d;
  --white: #faf8f1;
  --serif: "Newsreader", "Noto Serif JP", Georgia, serif;
  --sans: "DM Sans", Arial, sans-serif;
  --mono: "DM Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.34), transparent 27%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--vermillion);
  outline-offset: 3px;
}

.reading-progress {
  position: fixed;
  z-index: 1000;
  inset: 0 0 auto;
  height: 3px;
  pointer-events: none;
}

.reading-progress span { display: block; width: 0; height: 100%; background: var(--vermillion); }

.site-header {
  min-height: 86px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 17px clamp(22px, 3vw, 48px);
  border-bottom: 1px solid var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  color: inherit;
  font-family: var(--serif);
  font-size: 26px;
  text-decoration: none;
}

.brand-logo { width: 48px; height: 48px; display: block; object-fit: cover; }

.edition, .eyebrow, .section-number {
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.edition { color: var(--muted); }
.eyebrow { color: var(--vermillion); }
.eyebrow span { color: var(--ink); }

.text-button {
  justify-self: end;
  padding: 7px 0 5px;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.text-button:hover { color: var(--vermillion); }

.app-shell {
  display: grid;
  grid-template-columns: minmax(540px, .92fr) minmax(560px, 1.08fr);
  align-items: start;
}

.archive-panel { min-width: 0; border-right: 1px solid var(--ink); }

.intro-block { padding: clamp(58px, 6.5vw, 105px) clamp(28px, 5vw, 76px) 52px; }
.title-lockup { position: relative; width: max-content; max-width: 100%; }

h1 {
  margin: 44px 0 32px;
  font-family: var(--serif);
  font-size: clamp(70px, 7.4vw, 118px);
  font-weight: 400;
  line-height: .76;
  letter-spacing: -.065em;
}

.standfirst {
  max-width: 540px;
  margin: 0;
  color: #404743;
  font-family: var(--serif);
  font-size: clamp(20px, 1.7vw, 26px);
  line-height: 1.4;
}

.add-place {
  padding: 34px clamp(28px, 5vw, 76px) 38px;
  border-top: 1px solid var(--ink);
  background: var(--indigo);
  color: var(--white);
}

.add-place > label {
  display: block;
  margin-bottom: 13px;
  color: #d4ddd9;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.url-row { display: grid; grid-template-columns: 1fr auto; }

.url-row input {
  width: 100%;
  min-width: 0;
  padding: 17px 18px;
  border: 1px solid rgba(250,248,241,.7);
  border-right: 0;
  border-radius: 0;
  background: transparent;
  color: var(--white);
}

.url-row input::placeholder { color: #a7b2af; }

.url-row button {
  min-width: 126px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  border: 1px solid var(--gold);
  background: var(--gold);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.url-row button:hover { background: #d7ac59; }
.url-row button:disabled { cursor: wait; opacity: .65; }
.url-row button span:last-child { font-size: 18px; transition: transform .2s ease; }
.url-row button:hover span:last-child { transform: translate(3px, -3px); }

.form-help { margin: 11px 0 0; color: #aeb9b5; font-size: 11px; }
.form-help.is-error { color: #ffb7a6; }

.color-register { height: 8px; display: grid; grid-template-columns: 1.2fr .7fr .35fr 1fr; }
.color-register span:nth-child(1) { background: var(--vermillion); }
.color-register span:nth-child(2) { background: var(--gold); }
.color-register span:nth-child(3) { background: var(--moss); }
.color-register span:nth-child(4) { background: var(--paper-deep); }

.places-index { min-height: 760px; padding: 70px clamp(28px, 5vw, 76px) 100px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 44px; }
.section-number { margin-bottom: 14px; color: var(--vermillion); }

h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(45px, 5vw, 73px);
  font-weight: 400;
  line-height: .94;
  letter-spacing: -.045em;
}

.result-count { flex: 0 0 auto; margin: 0 0 5px; color: var(--muted); font-family: var(--mono); font-size: 10px; text-transform: uppercase; }
.result-count strong { color: var(--ink); font-size: 20px; font-weight: 400; }

.archive-tools { display: grid; grid-template-columns: 1fr 155px; border: 1px solid var(--ink); }
.search-field, .select-field { position: relative; display: flex; flex-direction: column; gap: 5px; padding: 10px 13px 9px; }
.search-field { border-right: 1px solid var(--ink); }
.search-field > span, .select-field > span { color: var(--muted); font-family: var(--mono); font-size: 8px; letter-spacing: .1em; text-transform: uppercase; }
.search-field input, .select-field select { width: 100%; padding: 0 24px 0 0; border: 0; outline: 0; background: transparent; font-size: 13px; }
.select-field select { appearance: none; background: linear-gradient(45deg, transparent 50%, var(--ink) 50%) calc(100% - 4px) 50%/5px 5px no-repeat; }
.search-field kbd { position: absolute; right: 12px; bottom: 11px; padding: 1px 5px; border: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 9px; }

.filters { display: flex; flex-wrap: wrap; gap: 7px; margin: 13px 0 35px; }
.filters button { padding: 7px 11px 6px; border: 1px solid var(--line); background: transparent; font-family: var(--mono); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.filters button:hover { border-color: var(--ink); }
.filters button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }

.loading-state, .no-results { padding: 38px 0; color: var(--muted); font-family: var(--serif); font-size: 19px; }
.loading-state.is-error { color: var(--vermillion-dark); }

.empty-state { padding: 62px 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; }
.empty-sun { width: 54px; height: 54px; display: block; margin: 0 auto 23px; border-radius: 50%; background: var(--vermillion); }
.empty-state h3 { margin: 0 0 8px; font-family: var(--serif); font-size: 31px; font-weight: 400; }
.empty-state p { max-width: 330px; margin: 0 auto; color: var(--muted); font-size: 13px; line-height: 1.5; }

.place-list { border-top: 1px solid var(--ink); }
.place-row {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 62px 34px;
  gap: 14px;
  align-items: center;
  padding: 21px 0;
  border-bottom: 1px solid var(--line);
  transition: padding .2s ease, background .2s ease;
}

.place-row::before { content: ""; position: absolute; inset: 0 auto 0 -12px; width: 3px; background: transparent; }
.place-row:hover, .place-row.is-active { padding-left: 11px; background: rgba(255,255,255,.28); }
.place-row:hover::before, .place-row.is-active::before { background: var(--vermillion); }
.place-order { width: 27px; height: 27px; display: grid; place-items: center; align-self: start; color: var(--vermillion); }
.place-order .category-icon { width: 21px; height: 21px; }
.place-main { min-width: 0; }

.place-taxonomy { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--muted); font-family: var(--mono); font-size: 8px; letter-spacing: .08em; text-transform: uppercase; }
.place-taxonomy .visited-mark::before { content: ""; width: 5px; height: 5px; display: inline-block; margin: 0 5px 1px 0; border-radius: 50%; background: var(--moss); }
.place-main h3 { overflow: hidden; margin: 0; font-family: var(--serif); font-size: clamp(22px, 2vw, 29px); font-weight: 400; line-height: 1.05; text-overflow: ellipsis; white-space: nowrap; }
.place-note { overflow: hidden; margin: 7px 0 0; color: #545954; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.favorite-button, .more-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
}

.favorite-button { justify-self: end; color: var(--line); font-size: 22px; }
.favorite-button[aria-pressed="true"] { color: var(--gold); }
.favorite-button:hover { color: var(--gold); transform: scale(1.08); }
.more-button { border: 1px solid var(--line); font-size: 18px; }
.more-button:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); }

.map-panel { position: sticky; top: 0; height: 100vh; min-height: 640px; overflow: hidden; background: #e5e7e0; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; background: #e5e7e0; }
.leaflet-container { isolation: isolate; }
.map-wash { position: absolute; inset: 0; z-index: 400; pointer-events: none; box-shadow: inset 20px 0 45px rgba(23,32,30,.12); }
.leaflet-tile { image-rendering: auto; }
.leaflet-control-zoom { border: 1px solid var(--ink) !important; border-radius: 0 !important; box-shadow: 4px 4px 0 rgba(23,32,30,.18) !important; }
.leaflet-control-zoom a { border-radius: 0 !important; background: var(--paper) !important; color: var(--ink) !important; }
.leaflet-control-attribution { background: rgba(241,237,226,.78) !important; font-size: 8px !important; }
.leaflet-control-attribution a { color: var(--indigo) !important; }

.map-heading {
  position: absolute;
  z-index: 500;
  top: 24px;
  left: 24px;
  min-width: 157px;
  padding: 13px 15px 12px;
  border: 1px solid var(--ink);
  background: rgba(241,237,226,.94);
  box-shadow: 5px 5px 0 rgba(23,32,30,.16);
}

.map-heading p { margin: 0 0 6px; font-family: var(--mono); font-size: 9px; letter-spacing: .09em; text-transform: uppercase; }
.map-heading strong { font-family: var(--serif); font-size: 22px; font-weight: 400; }
.live-dot { width: 7px; height: 7px; display: inline-block; margin-right: 6px; border-radius: 50%; background: var(--vermillion); box-shadow: 0 0 0 3px rgba(180,58,47,.13); }

.map-actions { position: absolute; z-index: 500; top: 24px; right: 24px; display: grid; gap: 8px; }
.map-actions button { width: 43px; height: 43px; border: 1px solid var(--ink); background: rgba(241,237,226,.94); font-size: 20px; box-shadow: 4px 4px 0 rgba(23,32,30,.14); }
.map-actions button:hover { background: var(--ink); color: var(--paper); }

.place-widget {
  position: absolute;
  z-index: 650;
  top: 118px;
  left: 24px;
  width: min(410px, calc(100% - 48px));
  max-height: calc(100vh - 142px);
  overflow: auto;
  border: 1px solid var(--ink);
  background: var(--paper);
  box-shadow: 9px 9px 0 rgba(23,32,30,.2);
}

.widget-close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; padding: 0; border: 1px solid var(--ink); background: rgba(241,237,226,.96); font-size: 24px; line-height: 1; box-shadow: 3px 3px 0 rgba(23,32,30,.16); }
.widget-close:hover { background: var(--ink); color: var(--paper); }
.widget-content { padding: 28px 66px 24px 22px; }
.widget-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.widget-meta span { padding: 5px 8px 4px; border: 1px solid var(--line); font-family: var(--mono); font-size: 8px; letter-spacing: .08em; text-transform: uppercase; }
.place-widget h2 { margin: 0; padding-right: 42px; font-size: 38px; line-height: 1; }
.widget-description { margin: 14px 0 0; color: #484d49; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.widget-coordinates { margin: 14px 0 0; color: var(--muted); font-family: var(--mono); font-size: 9px; }
.widget-actions { display: grid; grid-template-columns: 1fr auto; gap: 9px; margin-top: 20px; }
.widget-actions a, .widget-actions button { min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 13px; border: 1px solid var(--ink); font-size: 10px; font-weight: 600; letter-spacing: .06em; text-decoration: none; text-transform: uppercase; }
.widget-actions a { justify-content: space-between; background: var(--ink); color: var(--paper); }
.widget-actions a:hover { background: var(--indigo); }
.widget-actions button { background: transparent; }
.widget-actions button:hover { background: var(--paper-deep); }

.map-hint { position: absolute; z-index: 500; right: 24px; bottom: 45px; max-width: 220px; margin: 0; padding: 10px 12px; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 8px; letter-spacing: .05em; line-height: 1.5; text-transform: uppercase; }
.map-legend { position: absolute; z-index: 500; left: 24px; bottom: 24px; display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid rgba(23,32,30,.45); background: rgba(241,237,226,.88); font-family: var(--mono); font-size: 8px; letter-spacing: .07em; text-transform: uppercase; }
.map-legend span { width: 8px; height: 8px; border-radius: 50%; background: var(--vermillion); }
.leaflet-bottom.leaflet-right { bottom: 82px; right: 13px; }

.place-marker { background: transparent; border: 0; }
.place-marker-pin {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 2px solid var(--white);
  border-radius: 50% 50% 50% 5px;
  background: var(--vermillion);
  color: var(--white);
  font-family: var(--mono);
  font-size: 9px;
  box-shadow: 0 3px 12px rgba(23,32,30,.35);
  transform: rotate(-45deg);
  transform-origin: 50% 50%;
  transition: transform .18s ease, background .18s ease;
}
.place-marker-pin span { width: 100%; height: 100%; display: grid; place-items: center; transform: rotate(45deg); }
.place-marker-pin .category-icon { width: 17px; height: 17px; }
.place-marker.is-active .place-marker-pin { z-index: 800 !important; background: var(--indigo); transform: rotate(-45deg) scale(1.52); box-shadow: 0 5px 20px rgba(23,32,30,.45); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { border-radius: 0; background: var(--paper); color: var(--ink); }
.leaflet-popup-content-wrapper { border: 1px solid var(--ink); box-shadow: 6px 6px 0 rgba(23,32,30,.18); }
.leaflet-popup-content { margin: 14px 17px; font-family: var(--sans); }
.leaflet-popup-content small { color: var(--vermillion); font-family: var(--mono); font-size: 8px; letter-spacing: .07em; text-transform: uppercase; }
.leaflet-popup-content strong { display: block; margin-top: 4px; font-family: var(--serif); font-size: 21px; font-weight: 400; line-height: 1.1; }

.place-dialog { width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink); box-shadow: 14px 14px 0 rgba(23,32,30,.32); }
.place-dialog::backdrop { background: rgba(23,32,30,.65); backdrop-filter: blur(2px); }
.place-dialog form { padding: 34px; }
.dialog-heading { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
.dialog-heading .eyebrow { margin-bottom: 10px; }
.dialog-heading h2 { font-size: 49px; }
.dialog-close { width: 36px; height: 36px; padding: 0; border: 1px solid var(--ink); background: transparent; font-size: 24px; }
.dialog-close:hover { background: var(--ink); color: var(--paper); }
.place-dialog form > label { display: grid; gap: 8px; margin-top: 20px; font-family: var(--mono); font-size: 9px; letter-spacing: .09em; text-transform: uppercase; }
.place-dialog input:not([type="checkbox"]), .place-dialog select, .place-dialog textarea { width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 0; background: rgba(255,255,255,.28); font-family: var(--sans); font-size: 14px; letter-spacing: 0; text-transform: none; }
.place-dialog textarea { resize: vertical; line-height: 1.5; }
.dialog-checks { display: flex; gap: 25px; margin: 24px 0 0; }
.dialog-checks label { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; }
.dialog-checks input { appearance: none; width: 16px; height: 16px; margin: 0; border: 1px solid var(--ink); }
.dialog-checks input:checked { background: var(--vermillion); box-shadow: inset 0 0 0 3px var(--paper); }
.dialog-actions { display: flex; justify-content: space-between; gap: 16px; margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line); }
.dialog-actions button { padding: 12px 16px; border-radius: 0; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.danger-button { border: 1px solid var(--vermillion); background: transparent; color: var(--vermillion); }
.danger-button:hover { background: var(--vermillion); color: var(--white); }
.save-button { border: 1px solid var(--ink); background: var(--ink); color: var(--paper); }
.save-button:hover { background: var(--indigo); }

.toast { position: fixed; z-index: 1500; right: 20px; bottom: 20px; display: flex; align-items: center; gap: 18px; max-width: min(430px, calc(100vw - 40px)); padding: 14px 16px; border: 1px solid var(--paper); background: var(--ink); color: var(--paper); box-shadow: 6px 6px 0 rgba(180,58,47,.7); font-size: 12px; }
.toast button { padding: 4px 0; border: 0; border-bottom: 1px solid currentColor; background: transparent; color: var(--gold); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: minmax(480px, .95fr) minmax(440px, 1.05fr); }
  .place-row { grid-template-columns: 30px minmax(0, 1fr) 40px 34px; gap: 9px; }
}

@media (max-width: 820px) {
  .site-header { min-height: 70px; padding: 12px 18px; }
  .brand-logo { width: 42px; height: 42px; }
  .edition { display: none; }
  .app-shell { display: flex; flex-direction: column; }
  .archive-panel { width: 100%; border-right: 0; }
  .map-panel { position: relative; order: -1; width: 100%; height: 52vh; min-height: 390px; border-bottom: 1px solid var(--ink); }
  .intro-block { padding: 54px 22px 40px; }
  h1 { font-size: clamp(62px, 18vw, 96px); }
  .add-place { padding: 27px 22px 30px; }
  .places-index { min-height: 0; padding: 58px 22px 80px; }
  .section-heading h2 { font-size: 48px; }
}

@media (max-width: 520px) {
  .text-button { font-size: 9px; }
  .map-heading { top: 16px; left: 16px; }
  .map-actions { top: 16px; right: 16px; }
  .map-hint { display: none; }
  .place-widget { top: auto; left: 12px; right: 12px; bottom: 12px; width: auto; max-height: calc(100% - 24px); }
  .widget-content { padding: 20px 17px; }
  .place-widget h2 { font-size: 31px; }
  .leaflet-bottom.leaflet-right { bottom: 16px; }
  .map-legend { left: 16px; bottom: 18px; }
  .url-row { grid-template-columns: 1fr; }
  .url-row input { border-right: 1px solid rgba(250,248,241,.7); border-bottom: 0; }
  .url-row button { min-height: 48px; }
  .archive-tools { grid-template-columns: 1fr; }
  .search-field { border-right: 0; border-bottom: 1px solid var(--ink); }
  .place-row { grid-template-columns: 28px minmax(0, 1fr) 30px; }
  .more-button { grid-column: 2 / 4; width: 100%; height: 28px; font-family: var(--mono); font-size: 9px; }
  .more-button::after { content: " EDITAR"; }
  .dialog-heading h2 { font-size: 40px; }
  .place-dialog form { padding: 25px 21px; }
  .dialog-checks { flex-direction: column; gap: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
