:root {
  --cream: #F5F0E8;
  --stone: #3D3630;
  --stone-light: #6B5E54;
  --sage: #7A8B6F;
  --sage-light: #A4B396;
  --sage-pale: #E8EDE4;
  --amber: #C4935A;
  --amber-light: #E8C9A0;
  --rose: #C49A8B;
  --white: #FEFCF9;
  --danger: #B0563E;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --shadow: 0 2px 12px rgba(61, 54, 48, 0.08), 0 1px 3px rgba(61, 54, 48, 0.06);
  --radius: 14px;
}

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

/* The lightbox/PIN overlays set display:flex, which would otherwise defeat the hidden attribute */
[hidden] { display: none !important; }

body {
  background: var(--cream);
  color: var(--stone);
  font-family: var(--font-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 5rem;
}

/* ─── Header ─── */

.admin-link {
  position: absolute;
  top: max(0.8rem, env(safe-area-inset-top));
  right: 1rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone-light);
  text-decoration: none;
  border: 1px solid rgba(61, 54, 48, 0.18);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
}
.admin-link:hover { color: var(--sage); border-color: var(--sage); }

.site-header {
  text-align: center;
  padding: 3rem 1.5rem 1.6rem;
}
.overline {
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--sage);
  margin-bottom: 0.6rem;
}
.site-header h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.1rem, 7vw, 2.9rem);
  line-height: 1.15;
  color: var(--stone);
}
.subtitle {
  color: var(--stone-light);
  font-size: 0.92rem;
  margin-top: 0.5rem;
  font-style: italic;
  font-family: var(--font-display);
  font-size: 1.05rem;
}
.subtitle a { color: inherit; }

/* ─── Day navigation ─── */

.day-jump {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 0.65rem 1.1rem;
  background: rgba(245, 240, 232, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(61, 54, 48, 0.07);
}
.day-jump select {
  display: block;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  background: var(--white);
  color: var(--stone);
  border: 1px solid rgba(61, 54, 48, 0.18);
  border-radius: 999px;
  padding: 0.55rem 2.2rem 0.55rem 1rem;
  font-size: 0.92rem;
  font-family: var(--font-body);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B5E54' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  box-shadow: var(--shadow);
}

/* ─── Timeline ─── */

main { max-width: 600px; margin: 0 auto; padding: 0 1.1rem; }
.loading, .empty {
  text-align: center;
  color: var(--stone-light);
  padding: 4rem 1.5rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.15rem;
}

.day-section { margin-top: 2.6rem; scroll-margin-top: 4.2rem; }
.day-header {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding-bottom: 0.7rem;
  margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--amber-light);
}
.day-num {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
  color: var(--amber);
  white-space: nowrap;
}
.day-header h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.25rem;
  line-height: 1.25;
  color: var(--stone);
}
.day-date {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone-light);
  margin-top: 0.15rem;
}

.entry {
  background: var(--white);
  border-radius: var(--radius);
  margin-top: 1.1rem;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.entry-photo { display: block; cursor: zoom-in; background: var(--sage-pale); }
.entry-photo img { display: block; width: 100%; height: auto; min-height: 100px; }

.entry-body { padding: 0.8rem 1.05rem 1rem; }
.entry-photo + .entry-body { padding-top: 0.75rem; }
.entry-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.7rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.entry-place { color: var(--sage); font-weight: 600; }
.entry-place a { color: inherit; text-decoration: none; }
.entry-place a:hover { text-decoration: underline; }
.entry-time { color: var(--stone-light); flex-shrink: 0; }
.entry-caption {
  font-family: var(--font-display);
  font-size: 1.12rem;
  line-height: 1.5;
  color: var(--stone);
  white-space: pre-wrap;
  margin-top: 0.35rem;
}
.entry.note .entry-caption { font-size: 1.2rem; font-style: italic; }

/* ─── Lightbox ─── */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(28, 24, 20, 0.95);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.lightbox img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 6px;
}
.lightbox-caption {
  color: var(--amber-light);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
  padding: 0.9rem 1rem 0;
  text-align: center;
  max-width: 600px;
}
.lightbox-close {
  position: absolute;
  top: max(0.6rem, env(safe-area-inset-top));
  right: 0.9rem;
  background: none;
  border: none;
  color: var(--cream);
  font-size: 2.3rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.4rem;
}

/* ─── Admin ─── */

body.admin .site-header { padding-bottom: 0.8rem; }

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-top: 1.2rem;
}
.card h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.3rem;
}

.field { margin-top: 1.05rem; }
.field:first-child { margin-top: 0; }
.field > label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone-light);
  margin-bottom: 0.4rem;
  font-weight: 600;
}
.field input[type="text"], .field input[type="password"], .field select, .field textarea {
  width: 100%;
  background: var(--cream);
  color: var(--stone);
  border: 1px solid rgba(61, 54, 48, 0.18);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  font-size: 1rem;
  font-family: var(--font-body);
}
.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B5E54' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  padding-right: 2.2rem;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--sage-light);
  outline-offset: 0;
  border-color: var(--sage);
}
.field textarea { min-height: 5rem; resize: vertical; }

.seg {
  display: flex;
  background: var(--cream);
  border: 1px solid rgba(61, 54, 48, 0.15);
  border-radius: 999px;
  padding: 3px;
}
.seg button {
  flex: 1;
  background: none;
  border: none;
  border-radius: 999px;
  color: var(--stone-light);
  padding: 0.5rem;
  font-size: 0.9rem;
  font-family: var(--font-body);
  cursor: pointer;
}
.seg button.active {
  background: var(--sage);
  color: var(--white);
  font-weight: 600;
}

.btn {
  display: inline-block;
  background: var(--amber);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  letter-spacing: 0.02em;
}
.btn.block { width: 100%; }
.btn.secondary {
  background: transparent;
  color: var(--stone-light);
  border: 1px solid rgba(61, 54, 48, 0.25);
}
.btn.small { padding: 0.4rem 0.85rem; font-size: 0.82rem; }
.btn.danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* Hidden native file input; the label is the button */
.file-btn input[type="file"] { display: none; }

.hint { font-size: 0.8rem; color: var(--stone-light); margin-top: 0.35rem; }
.gps-chip { font-size: 0.84rem; color: var(--sage); margin-top: 0.45rem; font-weight: 500; }

.status-list { margin-top: 0.9rem; font-size: 0.87rem; }
.status-list li { list-style: none; padding: 0.15rem 0; color: var(--stone-light); }
.status-list li.done { color: var(--sage); }
.status-list li.err { color: var(--danger); }

.photo-previews { display: flex; gap: 0.55rem; flex-wrap: wrap; margin-top: 0.7rem; }
.photo-previews img {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.admin-entry {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  padding: 0.85rem 0;
  border-top: 1px solid rgba(61, 54, 48, 0.09);
}
.admin-entry:first-of-type { margin-top: 0.8rem; }
.admin-entry img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
}
.admin-entry .info { flex: 1; min-width: 0; font-size: 0.86rem; }
.admin-entry .info .where { color: var(--sage); font-weight: 600; font-size: 0.78rem; }
.admin-entry .info .cap { color: var(--stone-light); overflow-wrap: break-word; }
.admin-entry .actions { display: flex; flex-direction: column; gap: 0.4rem; }

/* ─── PIN overlay ─── */

.pin-overlay {
  position: fixed;
  inset: 0;
  background: var(--cream);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.pin-box {
  text-align: center;
  width: 100%;
  max-width: 300px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.5rem;
}
.pin-box h2 {
  font-family: var(--font-display);
  font-weight: 500;
  margin-bottom: 1.2rem;
}
.pin-box input {
  width: 100%;
  text-align: center;
  font-size: 1.7rem;
  letter-spacing: 0.45em;
  background: var(--cream);
  color: var(--stone);
  border: 1px solid rgba(61, 54, 48, 0.18);
  border-radius: 10px;
  padding: 0.6rem;
}
.pin-box .btn { margin-top: 1.1rem; width: 100%; }
.pin-error { color: var(--danger); margin-top: 0.6rem; font-size: 0.85rem; min-height: 1.2em; }
