:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #efebe4;
  --ink: #1d1a17;
  --muted: #6e675e;
  --line: #e2ddd4;
  --accent: #e4572e;
  --accent-ink: #ffffff;
  --accent-soft: #fbe3da;
  --teal: #0f766e;
  --danger: #b42318;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 8px 24px rgb(0 0 0 / 0.06);
  --radius: 14px;
  --display: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Faint topographic contour lines behind the whole site, matching Travels. */
  --topo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='560' viewBox='0 0 560 560' fill='none' stroke='%23ddd4c5' stroke-width='1.1'%3E%3Cpath d='M-20 80C80 40 170 120 280 95S470 40 580 80'/%3E%3Cpath d='M-20 118C90 80 180 158 290 133S470 82 580 118'/%3E%3Cpath d='M-20 156C100 122 190 196 300 171S470 124 580 156'/%3E%3Cellipse cx='400' cy='330' rx='60' ry='38'/%3E%3Cellipse cx='400' cy='330' rx='100' ry='66'/%3E%3Cellipse cx='400' cy='330' rx='140' ry='94'/%3E%3Cellipse cx='120' cy='390' rx='34' ry='24'/%3E%3Cellipse cx='120' cy='390' rx='70' ry='50'/%3E%3Cpath d='M-20 520C100 480 200 556 320 522S480 476 580 520'/%3E%3C/svg%3E");
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131210;
    --surface: #1c1a17;
    --surface-2: #26231f;
    --ink: #f1ede6;
    --muted: #a39b90;
    --line: #34302a;
    --accent: #f06a43;
    --accent-soft: #3a2219;
    --teal: #2dd4bf;
    --danger: #f87171;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.35);
    --topo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='560' viewBox='0 0 560 560' fill='none' stroke='%232b2722' stroke-width='1.1'%3E%3Cpath d='M-20 80C80 40 170 120 280 95S470 40 580 80'/%3E%3Cpath d='M-20 118C90 80 180 158 290 133S470 82 580 118'/%3E%3Cpath d='M-20 156C100 122 190 196 300 171S470 124 580 156'/%3E%3Cellipse cx='400' cy='330' rx='60' ry='38'/%3E%3Cellipse cx='400' cy='330' rx='100' ry='66'/%3E%3Cellipse cx='400' cy='330' rx='140' ry='94'/%3E%3Cellipse cx='120' cy='390' rx='34' ry='24'/%3E%3Cellipse cx='120' cy='390' rx='70' ry='50'/%3E%3Cpath d='M-20 520C100 480 200 556 320 522S480 476 580 520'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--topo) center top / 560px 560px repeat, var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font: 650 1.45rem/1 var(--display);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand::before {
  content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); margin-right: 10px; vertical-align: 0.15em;
}
.owner-nav { display: flex; gap: 8px; }

main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 48px) clamp(16px, 4vw, 40px) 64px;
  outline: none;
}

.footer {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 20px clamp(16px, 4vw, 40px);
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.85rem;
}
.footer a { text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer .prompt {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-weight: 600; letter-spacing: 0.05em; padding: 0 4px;
}
.footer .prompt:hover { text-decoration: none; color: var(--accent); }
.prompt .cursor { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .prompt .cursor { animation: none; } .day-chevron { transition: none; } }

/* ---------- buttons & forms ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 16px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer;
  font-weight: 500; font-size: 0.92rem; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.05); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { min-height: 32px; padding: 4px 12px; font-size: 0.85rem; }
.btn input[type="file"] { display: none; }

label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="date"], input[type="time"], input[type="number"] {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}
input:focus, .btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent;
}
.hint { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
.error { color: var(--danger); font-size: 0.9rem; min-height: 1.4em; }

/* ---------- summary hero ---------- */

.new-entry-row { margin-top: clamp(24px, 4vw, 36px); margin-bottom: clamp(24px, 4vw, 36px); }
.new-entry-form {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
}
.new-entry-form .field { margin: 0; min-width: 160px; flex: 1; }
.new-entry-form input { width: 100%; }
.new-entry-actions { display: flex; gap: 8px; }

.photo-capture { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.photo-capture input[type="file"] { display: none; }
.upload-status { color: var(--muted); font-size: 0.82rem; }

/* ---------- day cards ---------- */

.day {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.day-header {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  border-bottom: 1px solid var(--line); padding: 0 0 10px; margin-bottom: 10px;
  background: none; border-left: none; border-right: none; border-top: none;
  cursor: pointer; text-align: left; font: inherit; color: inherit;
}
.day-header h2 { font: 600 1.15rem var(--display); margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.day-chevron { color: var(--muted); font-size: 1.1rem; transition: transform .15s; flex-shrink: 0; }
.day-chevron.open { transform: rotate(90deg); }
.chip {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 0.8rem; font-weight: 600;
  white-space: nowrap;
}
.chip-muted { background: var(--surface-2); color: var(--muted); }

.trip-list-item {
  display: flex; width: 100%; gap: 10px; align-items: center;
  padding: 12px 4px; border-bottom: 1px solid var(--line);
  background: none; border-left: none; border-right: none; border-top: none;
  cursor: pointer; text-align: left; font: inherit; color: inherit;
}
.trip-list-item:last-child { border-bottom: none; }
.trip-list-item:hover { background: var(--surface-2); }
.trip-list-name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-list-chevron { color: var(--muted); font-size: 1.1rem; }

.trip-meta { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.trip-time { color: var(--muted); font-size: 0.85rem; }
.trip-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

.back { display: inline-block; color: var(--muted); text-decoration: none; margin-bottom: 14px; font-size: 0.92rem; }
.back:hover { color: var(--ink); }

.detail-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 28px);
}
.detail-name { font: 650 1.6rem var(--display); margin: 0 0 4px; }
.detail-date { color: var(--muted); font-size: 0.92rem; margin-bottom: 16px; }
.detail-photo {
  width: 100%; max-width: 320px; aspect-ratio: 1; object-fit: cover; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2); cursor: zoom-in; display: block;
}
.detail-photo-placeholder {
  display: grid; place-items: center; color: var(--muted); font-size: 2rem;
  border-style: dashed; cursor: default;
}

.edit-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.edit-form input[type="text"] { width: 160px; }
.edit-form input[type="date"] { width: 142px; }
.edit-form input[type="time"] { width: 100px; }
.edit-form input[type="number"] { width: 90px; }

.lightbox {
  position: fixed; inset: 0; z-index: 50; cursor: zoom-out;
  background: rgb(10 9 8 / .88);
  display: grid; place-items: center; padding: 24px;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; object-fit: contain; }

.empty {
  text-align: center; padding: 64px 16px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface);
}
.empty h2 { font: 600 1.3rem var(--display); color: var(--ink); margin: 0 0 6px; }

/* ---------- login ---------- */

.card-narrow {
  max-width: 360px; margin: 4vh auto 0; background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px;
}
.card-narrow h1 { font: 650 1.7rem var(--display); margin: 0 0 18px; }
.card-narrow .field { margin-bottom: 14px; }
.card-narrow button[type="submit"] { width: 100%; margin-top: 6px; }

@media (max-width: 480px) {
  .edit-form { width: 100%; }
  .detail-photo { max-width: 100%; }
}
