:root {
  --paper: #f3ede2;
  --paper-deep: #ece4d3;
  --ink: #1a1a1a;
  --muted: #6b655b;
  --accent: #d9582b;
  --accent-soft: #f2b39a;
  --rule: #1a1a1a;
  --card-border: #1a1a1a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--paper-deep);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#map {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--paper-deep);
}

#panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(440px, 100%);
  background: var(--paper);
  z-index: 1000;
  overflow-y: auto;
  padding: 28px 28px 40px;
  box-shadow: 2px 0 18px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease;
}

body.panel-collapsed #panel {
  transform: translateX(-100%);
}

.panel-toggle {
  position: fixed;
  top: 50%;
  left: min(440px, 100%);
  transform: translate(-0%, -50%);
  z-index: 1001;
  width: 28px;
  height: 56px;
  border: none;
  border-radius: 0 10px 10px 0;
  background: #3a3a3a;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.25);
  transition: left 0.3s ease, transform 0.3s ease;
}

body.panel-collapsed .panel-toggle {
  left: 0;
}

body.panel-collapsed .panel-toggle svg {
  transform: rotate(180deg);
}

/* Masthead */
.masthead { margin-bottom: 22px; }

.volume {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin-bottom: 10px;
}

.title {
  font-family: "DM Serif Display", "EB Garamond", Georgia, serif;
  font-weight: 400;
  font-size: clamp(56px, 13vw, 84px);
  line-height: 0.92;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}

.subtitle {
  font-family: "EB Garamond", Georgia, serif;
  font-style: italic;
  font-size: 22px;
  margin: 0 0 18px;
  color: var(--ink);
}

.established {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.5;
  padding-left: 64px;
  margin-bottom: 14px;
}

.established-label {
  display: block;
  letter-spacing: 0.12em;
}

.established-date {
  display: block;
  color: var(--ink);
}

.rule {
  border: 0;
  border-top: 2px solid var(--rule);
  margin: 14px 0 22px;
}

/* Step cards */
.step-card {
  position: relative;
  background: var(--paper);
  border: 1.5px solid var(--card-border);
  padding: 18px 18px 20px;
  margin-bottom: 18px;
}

.step-card::before {
  content: "";
  position: absolute;
  top: 4px; left: 4px; right: 4px;
  height: 8px;
  background-image: repeating-linear-gradient(
    -45deg,
    var(--paper) 0 4px,
    var(--accent-soft) 4px 8px
  );
  opacity: 0.6;
  pointer-events: none;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 14px;
}

.step-icon {
  color: var(--accent);
  display: inline-flex;
}

.step-label {
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ink);
}

/* Search row */
.search-row {
  display: flex;
  gap: 0;
  margin-bottom: 10px;
}

#location-input {
  flex: 1;
  min-width: 0;
  padding: 14px 14px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  font-family: "Inter", sans-serif;
  font-size: 15px;
  color: var(--ink);
  border-right: none;
}

#location-input::placeholder { color: #a9a195; }
#location-input:focus { outline: none; border-color: var(--accent); }
#location-input:focus + .icon-button { border-color: var(--accent); }

.icon-button {
  width: 56px;
  border: 1.5px solid var(--ink);
  background: #8a8681;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.icon-button:hover { background: var(--ink); }

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-family: "Inter", sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
}
.link-button:hover { color: var(--ink); }

.tiny {
  margin-top: 8px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted);
  min-height: 14px;
}

/* Duration */
.duration-display {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 4px 0 14px;
}

.duration-number {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 88px;
  line-height: 0.9;
  color: var(--ink);
}

.duration-unit {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--ink);
}

input[type="range"]#duration {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) 25%, #d7d1c5 25%, #d7d1c5 100%);
  border-radius: 3px;
  outline: none;
  margin: 10px 0 8px;
}

input[type="range"]#duration::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input[type="range"]#duration::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink);
  cursor: pointer;
}

.slider-bounds {
  display: flex;
  justify-content: space-between;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* CTA */
.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 18px 20px;
  background: var(--accent-soft);
  border: 1.5px solid var(--card-border);
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 22px;
  font-style: italic;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
  position: relative;
}

.cta:hover:not(:disabled) { background: #eea284; }
.cta:active:not(:disabled) { transform: translateY(1px); }
.cta:disabled { opacity: 0.6; cursor: not-allowed; }

.summary {
  margin-top: 18px;
  text-align: center;
  font-family: "EB Garamond", Georgia, serif;
  font-style: italic;
  font-size: 18px;
  color: var(--ink);
  min-height: 22px;
}

/* Leaflet attribution style override to fit the look */
.leaflet-container { background: var(--paper-deep); }

@media (max-width: 520px) {
  #panel { width: 100%; padding: 22px 20px 32px; }
  .panel-toggle { left: 100%; }
  body.panel-collapsed .panel-toggle { left: 0; }
  .title { font-size: 64px; }
  .duration-number { font-size: 72px; }
}
