:root {
  --bg-primary: #7fa9ae;
  --bg-secondary: #7e5475;
  --white-text: #f0f0f0;
  --bg-secondary-yellow: #f9db61;
  --bg-secondary-red: #da291c;
  --text-primary: #3a3a3a;
  --text-secondary: #2b3b52;
  --accent: #3a3a3a;
  --accent-secondary: #86abdc;
  --border: #e0ddd6;
  font-family: Inter, sans-serif;
  font-feature-settings: "liga" 1, "calt" 1; /* fix for Chrome */
  font-weight: 300;
  color-scheme: light;
}

@supports (font-variation-settings: normal) {
  :root {
    font-family: InterVariable, sans-serif;
  }
}
/* Viewport height fix for mobile */
html {
  height: -webkit-fill-available;
}
/* Base */
body {
  background: url("backgrounds/grid-me.png");
  margin: 0;
  background-color: var(--bg-primary);
  color: var(--white-text);
  line-height: 1.6;
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

#body-content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Navigation */
#top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: var(--bg-secondary-yellow);
  display: flex;
  align-items: center;
  padding-right: 1rem;
  padding-left: 1rem;
  z-index: 9999;
}

#top-nav a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s;
  font-weight: 900;
  cursor: pointer;
}

#top-nav a:hover {
  color: var(--accent);
}

.nav-icon {
  display: flex;
  align-items: center;
  padding-left: 0.5rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.nav-button {
  background: var(--bg-primary);
  color: #f0f0f0;
  border: 1px solid var(--border-color);
  border-radius: 0.4rem;
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: auto;
}

.nav-svg {
  width: 24px;
  height: 24px;
  fill: var(--text-primary);
}
.nav-left {
  margin-right: auto;
}
.nav-right {
  margin-left: auto;
}

.nav-divider {
  color: var(--bg-primary);
  margin: 0;
}

/* Modals */
#modal-root,#add-location-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
}
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 5px rgba(0, 0, 0, 0.25);
  z-index: 2000;
  background-color: var(--bg-secondary);
  pointer-events: auto;
}
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 10;
  pointer-events: auto;
}
.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--white-text);
}
.modal-close:hover {
  color: var(--text-primary);
}


.modal-footer {
  display: flex;
  justify-content: space-between;
}

/* Forms */
form {
  display: grid;
  gap: var(--gap);
}

/* Text input */
.form-input {
  display: flex;
  flex-direction: column;
}

.form-input label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.form-input input {
  padding: 0.65rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.95rem;
}

.form-input input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.25);
}

/* Checkbox rows */
.form-input.checkbox {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.8rem;
  background: var(--bg-surface);
}

.form-input.checkbox span {
  font-size: 0.9rem;
}

/* Toggle switch */
.form-input.checkbox input[type="checkbox"] {
  appearance: none;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #374151;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
}

.form-input.checkbox input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.form-input.checkbox input[type="checkbox"]:checked {
  background: var(--bg-primary);
}

.form-input.checkbox input[type="checkbox"]:checked::after {
  transform: translateX(18px);
}

.form-input.checkbox input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--bg-primary);
  outline-offset: 2px;
}

button {
  padding: 0.5rem;
  border-radius: 6px;
  border: none;
  background: var(--text-secondary);
  color: var(--white-text);
  cursor: pointer;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}


.confirmation-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.confirmation-modal-box {
  width: 320px;
  max-width: 90%;
  background: #fff;
  color: black;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.confirmation-modal-title {
  margin: 0 0 8px;
  font-size: 16px;
}

.confirmation-modal-message {
  margin-bottom: 12px;
  font-size: 14px;
}

.confirmation-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.confirmation-btn-ok {
  padding: 6px 10px;
  background: var(--bg-primary);
  color: #fff;
  border: none;
  border-radius: 6px;
}

.confirmation-delete-btn-ok {
  background: var(--bg-secondary-red);
}

.confirmation-btn-cancel {
  padding: 6px 10px;
  background: var(--bg-secondary-red);
  color: #fff;
  border: none;
  border-radius: 6px;
}

.confirmation-delete-btn-cancel {
  background: #fff;
  color: #000;
}

.page-blocker {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.4);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.htmx-request.page-blocker {
  display: flex;
}

.page-blocker::before {
  content: "";
  width: 50px;
  height: 50px;
  border: 6px solid rgba(0, 0, 0, 0.2);
  border-top-color: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.feature-content {
  margin-top: 2.5rem;
  width: 100%;
  margin-right: auto;
  margin-left: auto;
  max-width: 90vw;
}

@media (min-width: 768px) {
  .feature-content {
    max-width: 75vw;
  }
}

.hero {
  height: 50vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 20px;
  color: white;
  margin-bottom: 2rem;
}


.hero h1 {
  font-size: 2.5rem;
  margin: 0 0 10px 0;
}

.hero p {
  font-size: 1.2rem;
  max-width: 400px;
}

.hero > .search-wrapper {
  margin-left: auto;
  margin-right: auto;
}

.search-wrapper {
  position: relative;
  margin-top: 1.25rem;
  width: min(420px, 100%);
}

.search-input {
  position: relative;
}

.search-input input {
  width: 100%;
  padding: 1rem;
  border-radius: 999px;
  border: 1px solid #ddd;
  font-size: 1rem;
  outline: none;
  box-sizing: border-box; 
  text-align: center;
}

.search-input input:focus {
  border-color: #888;
}

.locate-btn {
  position: absolute;
  right: 1.5rem;
  top: 0.5rem;
  border: none;
  background: none;
  font-size: 1.1rem;
  cursor: pointer;
}
.locate-btn svg {
  color: var(--bg-primary);
}

.attribution {
  position: absolute;
  bottom: 0.1rem;
  left: 2rem;
  font-size: 0.5rem;
  color: #777;
}

.attribution a {
  color: inherit;
  text-decoration: underline;
}

.feature-row {
  margin-bottom: 24px;
}
.feature-row-title {
  display: flex;
  justify-content: space-between; /* push h3 left, link right */
  align-items: center; /* vertically center */
}
.feature-row-title h1,
.feature-row-title h2,
.feature-row-title h3,
.feature-row-title h4 {
  margin: 0;
}
.feature-row-title a {
  color: var(--white-text);
}

.feature-row-maps {
  display: flex;
  overflow-x: auto;

  scroll-snap-type: x mandatory;
}

.feature-grid-maps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  padding: 12px 0;
}

.feature-row-map {
  flex: 0 0 auto;
  width: 120px;
  scroll-snap-align: start;
  font-family: sans-serif;
  color: var(--accent);
  margin-right: 1rem;
}

.feature-grid-maps .feature-row-map {
  margin: auto
}

.feature-row-tile {
  width: 120px;
  height: 120px;
  background: #e7e9f2;
  border-radius: 10px;
  margin-bottom: 4px;
  position: relative;
  color: inherit;
  text-decoration: none;
  display: block;
}
.feature-row-tile-title {
  margin: 0;
  line-height: 1;
  padding: 0.3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  word-break: break-word;
}
.feature-row-tile-author {
  display: block;
  font-size: 0.6em;
  margin: 0;
  line-height: 1;
}
.feature-row-tile-private {
  display: block;
  font-size: 0.6em;
  margin: 0;
  line-height: 1;
  position: absolute;
  bottom: 0.3rem;
  right: 0.3rem;
  font-weight: 400;
  background: white;
}
.tile-text {
  position: absolute;
  bottom: 4px; /* distance from bottom of tile */
  left: 4px; /* distance from left */
  color: white;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.7); /* makes text readable */
}

/* Navigation buttons */
.feature-row-nav {
  position: absolute;
  top: 20%;
  bottom: 0;
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.feature-row:hover .feature-row-nav {
  opacity: 1;
  pointer-events: auto;
}
.feature-row-nav-left {
  left: 0;
}
.feature-row-nav-right {
  right: 0;
}
.feature-row-nav button {
  border: none;
  background: #fff;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}

.blog-container {
  background-color: #7e5475d9;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2rem;
  text-align: left;
  margin-top: auto;
  margin-right: auto;
  margin-left: auto;
  margin-bottom: 2rem;
  box-sizing: border-box;
  width: 100%;
  max-width: 90vw;
}

@media (min-width: 768px) {
  .blog-container {
    max-width: 75vw;
  }
}

.blog-container.full-page {
  margin-top: 5rem;
  margin-right: auto;
  margin-left: auto;
  max-width: 90vw;
}
@media (min-width: 768px) {
  .blog-container.full-page {
    max-width: 75vw;
  }
}

.blog-content h1,
h2,
h3 {
  margin-bottom: 1rem;
  margin-top: 0rem;
}
.blog-divider {
  width: 95%;
  background: var(--border);
  height: 1px;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.blog-content p {
  margin-top: 0rem;
  font-size: 0.85rem;
}

.blog-teaser {
  display: block;
  cursor: pointer;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 12px;
  color: inherit;
  text-decoration: none;
}

.blog-teaser:hover {
  text-decoration: underline;
}

.blog-teaser-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

/* Map */

#map {
  width: 90vmin;
  margin: auto;
  margin-top: 2.5rem;
}

@media (min-width: 768px) {
  #map {
    width: 75vmin;
  }
}

.map-title {
  line-height: 1;
  word-break: break-word;
}
#mapstarbtn.htmx-request {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

.map-author {
  display: block;
  font-size: 0.4em;
  margin: 0;
  line-height: 1;
  color: var(--white-text);
}

.map-header {
  display: flex;
  justify-content: space-between;
  padding-bottom: 0.5rem;
  margin-top: 1rem;
}
#map-canvas-wrapper {
  position: relative;
  width: fit-content;
  width: 90vmin;
  height: 90vmin;
}
@media (min-width: 768px) {
  #map-canvas-wrapper {
    width: 75vmin;
    height: 75vmin;
  }
}


canvas[id^="map-"] {
    width: 100%;
    height: 100%;
    display: block;
    margin: auto;
    background: #f4f4f4;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
    border-radius: 2px;
    position: absolute;
    top: 0;
    left: 0;
}

#map-overlay {
  width: 100%;
  height: 100%;
  background: none;
  pointer-events: none
}

.map-control-btns {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border-radius: 8px;
  color: var(--white-text);;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 10;
  padding: 0.2rem;
}

.map-control-btns:hover {
  border: var(--border);
}

.map-control-btns:active {
  transform: scale(0.96);
}

[id^="list-"] {
  width: 90vmin;
  height: 90vmin;
  display: block;
  background: url("backgrounds/lined-paper-background.jpg");
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
  border-radius: 2px;
  padding: 0;
  margin: 0;
  color: var(--accent);
  overflow-y: auto;
}

@media (min-width: 768px) {
  [id^="list-"] {
    width: 75vmin;
    height: 75vmin;
  }
}

[id^="list-"] li {
  height: 30px;
  margin-left: 1rem;
  display: flex;
  align-items: center;
}

[id^="list-"] li button {
  margin-left: auto;
  margin-right: 1rem;
  margin-top: 0.3rem;
  background:none; 
  border:none; 
  cursor:pointer; 
  padding:0; 
  margin-bottom: 0;
}

.map-footer {
  display: flex;
  justify-content: center;
  padding-top: 0.5rem;
}

.form-input {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.form-submit,
.form-delete {
  display: flex;
  justify-content: center;
  padding-top: 0.5rem;
}

.form-add-current-location {
  display: flex;
  justify-content: center;
}

.search-locations-container {
  max-height: 300px;
  overflow-y: auto;
  padding: 5px;
}

.search-locations-results-list {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
}
