:root {
  --ink: #15323a;
  --ink-soft: #3a5a60;
  --paper: #eef1ec;
  --paper-raised: #ffffff;
  --accent: #c97b3d;
  --accent-deep: #a85f2b;
  --sage: #4f7d58;
  --rust: #a8432a;
  --line: #d9ddd4;
  --radius: 10px;
  --font-display: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

a { color: var(--accent-deep); }

/* ---------- Header ---------- */

.app-header {
  position: relative;
  background: var(--ink);
  color: #fff;
  padding: 2.4rem 1.5rem 2rem;
  overflow: hidden;
}

.app-header::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image:
    repeating-radial-gradient(circle at 18% 30%, transparent 0 18px, rgba(255,255,255,0.5) 19px 20px, transparent 21px 38px),
    repeating-radial-gradient(circle at 82% 70%, transparent 0 24px, rgba(255,255,255,0.5) 25px 26px, transparent 27px 50px);
  pointer-events: none;
}

.app-header-inner {
  position: relative;
  max-width: 980px;
  margin: 0 auto;
}

.app-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 0 0 0.3rem;
  letter-spacing: -0.01em;
}

.app-header h1 .dot { color: var(--accent); }

.app-header p {
  margin: 0;
  color: rgba(255,255,255,0.78);
  font-size: 0.98rem;
  max-width: 46ch;
}

/* ---------- Layout ---------- */

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.6rem 1.5rem 4rem;
}

section.panel {
  margin-top: 2.2rem;
}

section.panel h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin: 0 0 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

section.panel h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---------- Import cards ---------- */

.import-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
}

@media (max-width: 760px) {
  .import-grid { grid-template-columns: 1fr; }
}

.import-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.import-card h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.import-card p.hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  background: var(--ink);
  color: #fff;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: center;
}
.file-label:hover { background: var(--ink-soft); }
.file-label input { display: none; }

textarea#urlInput {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
}

button {
  font-family: var(--font-body);
  border: none;
  cursor: pointer;
}

.btn {
  padding: 0.55rem 0.9rem;
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 500;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-deep); }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--ink-soft); color: var(--ink); }

button:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Journal ---------- */

#busyBanner {
  margin-top: 0.9rem;
  padding: 0.5rem 0.8rem;
  background: #fff3e2;
  border: 1px solid #f0cf9f;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--accent-deep);
}
#busyBanner[hidden] { display: none; }

ul#importLog {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
}

ul#importLog li {
  padding: 0.45rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  border-bottom: 1px solid var(--line);
}
ul#importLog li:last-child { border-bottom: none; }
ul#importLog li.log-ok::before { content: "✓ "; color: var(--sage); }
ul#importLog li.log-warn::before { content: "– "; color: var(--accent-deep); }
ul#importLog li.log-error::before { content: "✕ "; color: var(--rust); }

/* ---------- Map ---------- */

#map {
  height: 440px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper-raised);
}

.popup-photo { display: flex; flex-direction: column; gap: 0.4rem; font-family: var(--font-body); }
.popup-photo img { width: 100%; max-width: 220px; border-radius: 6px; display: block; }
.popup-photo-meta { display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.78rem; color: var(--ink-soft); }
.popup-photo-meta strong { color: var(--ink); font-size: 0.85rem; }

.photo-marker-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(45deg);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
  margin: 0 0 0 1px;
}
.photo-marker-pin svg { transform: rotate(-45deg); }

/* ---------- Export ---------- */

.export-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
}

.export-row input[type="text"] {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-raised);
  color: var(--ink);
  min-width: 220px;
}

#photoCount {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0 0 0.8rem;
}

/* ---------- Footer ---------- */

footer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-soft);
  padding: 1.5rem 1.5rem 2.5rem;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
