*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:    #0e1c2f;
  --navy2:   #162540;
  --amber:   #e8892b;
  --amber2:  #f5a94e;
  --sand:    #f5efe6;
  --sand2:   #ede4d6;
  --fog:     #c8bfb3;
  --white:   #fdfaf7;
  --radius:  10px;
}

html, body {
  height: 100%;
  background: var(--navy);
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  overflow: hidden;
}

/* ── Header ──────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 68px;
  background: var(--navy2);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.header-inner { display: flex; flex-direction: column; gap: 1px; }

.wordmark { display: flex; align-items: baseline; gap: 8px; }
.wordmark-cape {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fog);
}
.wordmark-sunsets {
  font-family: 'Playfair Display', serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: -0.01em;
}

.tagline {
  font-size: 0.72rem;
  color: var(--fog);
  letter-spacing: 0.04em;
}

.upload-btn {
  background: var(--amber);
  color: var(--navy);
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 0.88rem;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.2s, transform 0.1s;
}
.upload-btn:hover { background: var(--amber2); transform: translateY(-1px); }
.upload-btn:active { transform: translateY(0); }

/* ── Layout ──────────────────────────────────────── */
.layout {
  display: flex;
  height: calc(100vh - 68px);
  overflow: hidden;
}

#map {
  flex: 1;
  min-width: 0;
  background: var(--navy);
}

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--navy2);
  border-left: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  font-weight: 400;
  font-style: italic;
  color: var(--fog);
  padding: 18px 20px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

#feed {
  overflow-y: auto;
  flex: 1;
}

#feed::-webkit-scrollbar { width: 4px; }
#feed::-webkit-scrollbar-track { background: transparent; }
#feed::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

.feed-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  transition: background 0.15s;
}
.feed-item:hover { background: rgba(255,255,255,0.04); }

.feed-thumb {
  width: 62px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.08);
}

.feed-info { flex: 1; min-width: 0; }
.feed-caption {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--sand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.feed-date {
  font-size: 0.68rem;
  color: var(--fog);
  letter-spacing: 0.03em;
}
.feed-coords {
  font-size: 0.65rem;
  color: rgba(200,191,179,0.55);
  margin-top: 2px;
}

.feed-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--fog);
  font-size: 0.82rem;
  line-height: 1.6;
}

/* ── Modal ───────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,18,30,0.82);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--navy2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 440px;
  position: relative;
  animation: modalIn 0.22s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 14px; right: 16px;
  background: none; border: none;
  color: var(--fog); font-size: 1rem;
  cursor: pointer; padding: 4px 8px;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--white); }

.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 4px;
}
.modal-sub {
  font-size: 0.8rem;
  color: var(--fog);
  margin-bottom: 22px;
}

/* Drop zone */
.drop-zone {
  border: 2px dashed rgba(232,137,43,0.35);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--amber);
  background: rgba(232,137,43,0.06);
}
.drop-icon { font-size: 2rem; margin-bottom: 6px; color: var(--amber); }
.drop-zone p { font-size: 0.82rem; color: var(--fog); }
.drop-zone #preview {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 6px;
  margin-top: 10px;
}

/* Location */
.location-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--fog);
  margin-bottom: 14px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
}
.loc-icon { color: var(--amber); font-size: 1rem; }

.caption-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  margin-bottom: 18px;
  outline: none;
  transition: border-color 0.2s;
}
.caption-input:focus { border-color: var(--amber); }
.caption-input::placeholder { color: var(--fog); }

.submit-btn {
  width: 100%;
  background: var(--amber);
  color: var(--navy);
  border: none;
  border-radius: var(--radius);
  padding: 13px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  letter-spacing: 0.02em;
}
.submit-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.submit-btn:not(:disabled):hover { background: var(--amber2); }

.submit-msg {
  margin-top: 12px;
  text-align: center;
  font-size: 0.82rem;
  min-height: 20px;
  line-height: 1.4;
}
.submit-msg.ok  { color: #6fcf97; }
.submit-msg.err { color: #eb5757; }
.submit-msg.pending { color: var(--amber2); }

/* ── Leaflet tweaks ───────────────────────────────── */
.leaflet-popup-content-wrapper {
  background: var(--navy2);
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  font-family: 'DM Sans', sans-serif;
}
.leaflet-popup-tip { background: var(--navy2); }
.leaflet-popup-content { margin: 0; }
.popup-img {
  width: 220px;
  height: 140px;
  object-fit: cover;
  border-radius: 8px 8px 0 0;
  display: block;
}
.popup-body {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 8px;
}
.popup-caption { font-size: 0.82rem; color: var(--sand); grid-column: 1; grid-row: 1; }
.popup-date { font-size: 0.68rem; color: var(--fog); grid-column: 1; grid-row: 2; }
.popup-share {
  grid-column: 2; grid-row: 1 / 3;
  background: rgba(232,137,43,0.15); border: 1px solid rgba(232,137,43,0.3);
  color: var(--amber); border-radius: 6px; padding: 6px 10px; font-size: 0.78rem;
  cursor: pointer; font-family: 'DM Sans', sans-serif; transition: background 0.15s;
  white-space: nowrap;
}
.popup-share:hover { background: rgba(232,137,43,0.25); }

/* ── Fullscreen image overlay ─────────────────────── */
.img-fullscreen {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.img-fullscreen.open { display: flex; }
.img-fullscreen img {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.6);
}
.popup-img { cursor: zoom-in; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 640px) {
  html, body { overflow: auto; }
  .layout { flex-direction: column; height: auto; overflow: visible; }
  #map { height: 70vw; min-height: 320px; }
  .sidebar { width: 100%; border-left: none; border-top: 1px solid rgba(255,255,255,0.07); }
  header { height: auto; padding: 14px 18px; flex-wrap: nowrap; align-items: center; }
  .header-inner { flex: 1; }
  .upload-btn { flex-shrink: 0; }
  .modal { margin: 16px; padding: 28px 20px; }
}
