/* Plain HTML: layout + hierarchy only. Prefer browser defaults for controls. */
* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 20px;
  line-height: 1.5;
  color: #222;
  background: #f6f6ef;
}

a { color: #0000ee; }
a:visited { color: #551a8b; }

/* Brand + tabs on one row (HN-like) */
.site-header { margin-bottom: 20px; }
.site-header nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 0;
}
.wordmark {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
  color: inherit;
  text-decoration: none;
  margin-right: 4px;
}
.wordmark:visited { color: inherit; }
.site-header nav a:not(.wordmark) { text-decoration: none; }
.site-header nav a[aria-current="page"] { font-weight: 700; text-decoration: underline; }
.nav-space { flex: 1; min-width: 12px; }
#account { display: inline-flex; align-items: center; gap: 8px; }

main { min-height: 40vh; padding: 8px 0 40px; }

.page-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-bottom: 12px;
}
.page-heading h1 {
  margin: 0;
  font-size: 1.25rem;
}
.page-heading p {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
}

.map-note {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
}

/* Columns stack whole cards vertically without leaving grid-row gaps. */
.posts {
  column-count: 4;
  column-gap: 12px;
}
.post {
  display: inline-block;
  width: 100%;
  min-width: 0;
  margin-bottom: 12px;
  break-inside: avoid;
}
.post-card {
  border: 1px solid #ccc;
  background: #fff;
}
.post-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.post-open img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}
.post-open p {
  margin: 0;
  padding: 8px 10px 2px;
  font-size: 0.85rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}
.meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 8px;
  padding: 2px 10px 8px;
  font-size: 0.75rem;
  color: #666;
}
.meta a,
.meta a:visited { color: #666; }
.meta a:hover { color: #000; }

.profile { margin-bottom: 20px; }
.profile h1 { margin: 0 0 4px; font-size: 1.25rem; }
.profile p { margin: 0; color: #666; font-size: 0.9rem; }
.profile button { margin-top: 10px; }
.empty { padding: 28px 0; }
.empty h2 { margin: 0 0 8px; font-size: 1.1rem; }

dialog {
  width: min(620px, calc(100% - 24px));
  max-height: 90dvh;
  overflow: auto;
  padding: 20px;
  border: 1px solid #999;
  background: #fff;
  color: #222;
}
#detail-dialog { width: min(720px, calc(100% - 24px)); }
.dialog-heading,
.field-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.dialog-heading h2 { margin-top: 0; font-size: 1.15rem; }
form label { display: block; margin-top: 14px; }
form input:not([type="file"]),
form textarea { display: block; width: 100%; margin-top: 4px; }
input[type="file"] { max-width: 100%; }
textarea { min-height: 120px; resize: vertical; }
.hint { color: #666; font-size: 0.85rem; }
.form-error { color: #a00; min-height: 1.2em; }
#image-preview {
  display: block;
  max-height: 200px;
  margin-top: 10px;
}
#image-preview[hidden] { display: none; }
.detail-image {
  display: block;
  max-width: 100%;
  max-height: 58vh;
  width: auto;
  height: auto;
  margin: 8px auto;
}
.detail-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

#notice {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  padding: 8px 12px;
  border: 1px solid #999;
  background: #fff;
  z-index: 10;
}

.map-wrap { margin: 16px 0 12px; }
.world-map { display: block; width: 100%; height: auto; background: #fff; border: 1px solid #ccc; }
.map-marker { cursor: pointer; }
.map-controls {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.map-controls select { max-width: 100%; }

footer {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid #ddd;
  color: #666;
  font-size: 0.9rem;
}
footer p { margin: 0; }

@media (max-width: 1050px) {
  .posts { column-count: 3; }
}
@media (max-width: 760px) {
  .posts { column-count: 2; }
}
@media (max-width: 520px) {
  body { padding: 12px; }
  .posts { column-count: 1; }
  .nav-space { display: none; }
  #publish-button { width: 100%; }
  dialog { padding: 14px; }
}
