*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
[hidden] { display: none !important; }

:root {
  --color-bg:      #faf9f7;
  --color-text:    #1a1a1a;
  --color-muted:   #6b6b6b;
  --color-border:  #e0ddd8;
  --color-accent:  #2d6a4f;
  --font:          -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-width:     760px;
}

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.lang-toggle {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-muted);
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  letter-spacing: 0.05em;
}

.lang-toggle:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* Main */
main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

/* Hero */
.hero {
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.hero-sub {
  color: var(--color-muted);
  font-size: 1rem;
}

/* Placeholder */
.placeholder-text {
  color: var(--color-muted);
  font-style: italic;
}

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--color-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--color-border);
}

/* Responsive */
@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.6rem;
  }
}

/* Trip cards */
.trip-cards {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.trip-card {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.trip-card-cover-link {
  display: block;
}
.trip-card-cover-img {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: cover;
}
.trip-card-body {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 1.25rem;
}
.trip-card-main {
  flex: 1;
  min-width: 0;
  display: block;
  text-decoration: none;
  color: inherit;
}
.trip-card-main:hover .trip-card-title { color: var(--color-accent); }
.trip-card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.trip-card-dates {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 0.4rem;
}
.trip-card-desc {
  font-size: 0.9rem;
  color: var(--color-muted);
}

/* Trip banner */
.trip-banner {
  margin: -2rem -1.25rem 1.5rem;
  height: 300px;
  max-height: 300px;
  overflow: hidden;
  background: var(--color-border);
}
.trip-banner-img {
  display: block;
  width: 100%;
  height: 300px;
  max-height: 300px;
  object-fit: cover;
  object-position: center;
}
@media (max-width: 480px) {
  .trip-banner, .trip-banner-img { height: 180px; max-height: 180px; }
  .trip-banner { margin: -2rem -1.25rem 1.25rem; }
}

/* Trip detail page */
.trip-header { margin-bottom: 2rem; }
.trip-subnav {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.back-link {
  display: inline-block;
  font-size: 0.88rem;
  color: var(--color-muted);
  text-decoration: none;
}
.back-link:hover { color: var(--color-accent); }
.rss-link { display: inline-flex; align-items: center; text-decoration: none; opacity: 0.8; }
.rss-link:hover { opacity: 1; }
.rss-icon { width: 16px; height: 16px; display: block; }

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.gallery-item {
  display: block;
  text-decoration: none;
  color: var(--color-text);
}
.gallery-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  background: var(--color-border);
  transition: opacity 0.15s;
}
.gallery-item:hover .gallery-thumb { opacity: 0.85; }
.gallery-title {
  font-size: 0.82rem;
  margin-top: 0.35rem;
  line-height: 1.3;
  color: var(--color-muted);
}
@media (max-width: 480px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
}
.trip-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}
.trip-dates {
  font-size: 0.88rem;
  color: var(--color-muted);
  margin-bottom: 0.6rem;
}
.trip-description {
  color: var(--color-text);
  font-size: 0.95rem;
  border-top: 1px solid var(--color-border);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

/* Entries */
.entries { display: flex; flex-direction: column; gap: 0; }
.entry {
  padding: 1.5rem 0;
  border-top: 1px solid var(--color-border);
}
.entry:last-child { border-bottom: 1px solid var(--color-border); }
.entry-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}
.entry-date {
  font-size: 0.82rem;
  color: var(--color-muted);
}
.entry-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
}
.entry-photo-link { display: block; margin-bottom: 0.9rem; }
.entry-photo {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: 8px;
}
.entry-body {
  font-size: 0.97rem;
  line-height: 1.7;
}
.entry-body p { margin-bottom: 0.6rem; }
.entry-body strong { font-weight: 600; }
.entry-body em { font-style: italic; }
.entry-body a { color: var(--color-accent); }
.entry-komoot {
  margin-top: 0.75rem;
  font-size: 0.9rem;
}
.entry-komoot a { color: var(--color-accent); text-decoration: none; }
.entry-komoot a:hover { text-decoration: underline; }
.entry-mastodon {
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--color-muted);
}
.entry-mastodon a { color: var(--color-accent); text-decoration: none; }
.entry-mastodon a:hover { text-decoration: underline; }

/* ── Maps ────────────────────────────────────────────────────────────────── */
.entry-map {
  width: 100%;
  height: 280px;
  border-radius: 8px;
  margin: 1.5rem 0 0;
  isolation: isolate;
}
.entries-sentinel {
  text-align: center;
  padding: 2rem 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.trip-map {
  width: 100%;
  height: 300px;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  isolation: isolate;
}
@media (max-width: 480px) {
  .entry-map, .trip-map { height: 220px; }
}

/* Entry title link on trip page */
.entry-title-link {
  color: inherit;
  text-decoration: none;
}
.entry-title-link:hover { text-decoration: underline; }

/* ── Single entry view ───────────────────────────────────────────────────── */
.entry-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1.5rem;
}
.entry-nav + .single-entry + .entry-nav {
  border-bottom: none;
  border-top: 1px solid var(--color-border);
  margin-bottom: 0;
  margin-top: 1.5rem;
}
.entry-nav-prev,
.entry-nav-next {
  flex: 1;
  min-width: 0;
}
.entry-nav-next { text-align: right; }
.entry-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  text-decoration: none;
  color: var(--color-muted);
  font-size: 0.88rem;
  line-height: 1.3;
  max-width: 100%;
}
.entry-nav-link:hover { color: var(--color-accent); }
.entry-nav-arrow {
  font-size: 1rem;
  flex-shrink: 0;
}
.entry-nav-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.entry-nav-date {
  font-size: 0.75rem;
  color: var(--color-muted);
  white-space: nowrap;
}
.entry-nav-trip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  text-decoration: none;
  color: var(--color-muted);
  font-size: 0.82rem;
  flex-shrink: 0;
  text-align: center;
  padding: 0 0.5rem;
}
.entry-nav-trip:hover { color: var(--color-accent); }
.entry-nav-trip-title {
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.single-entry-header {
  margin-bottom: 1rem;
}
.single-entry-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 0.25rem;
}
.single-entry-photo {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.single-entry-text {
  margin-bottom: 0.5rem;
}

/* Admin link */
.admin-link {
  display: inline-block;
  margin-top: 2rem;
  font-size: 0.8rem;
  color: var(--color-border);
  text-decoration: none;
}
.admin-link:hover { color: var(--color-muted); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.65rem 1.1rem;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary  { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }
.btn-primary:hover { background: #235a41; }
.btn-ghost    { background: none; color: var(--color-text); border-color: var(--color-border); }
.btn-ghost:hover  { border-color: var(--color-accent); color: var(--color-accent); }
.btn-danger   { background: none; color: #c0392b; border-color: #e8b4b0; }
.btn-danger:hover { background: #fdf0ef; border-color: #c0392b; }
.btn-sm       { font-size: 0.85rem; padding: 0.4rem 0.75rem; }
.btn-full     { width: 100%; margin-top: 0.5rem; }

/* ── Flash messages ──────────────────────────────────────────────────────── */
.flash {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.flash-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.flash-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ── Admin layout ────────────────────────────────────────────────────────── */
.admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 0.75rem;
}
.admin-label {
  font-weight: 600;
  color: var(--color-muted);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.admin-section {
  margin-bottom: 2rem;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.section-head h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

/* ── Item list (trips / drafts) ──────────────────────────────────────────── */
.item-list {
  list-style: none;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}
.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  gap: 0.65rem;
  border-bottom: 1px solid var(--color-border);
  background: #fff;
}
.item-row:last-child { border-bottom: none; }
.item-meta {
  font-size: 0.82rem;
  color: var(--color-muted);
  display: block;
}
/* Item thumbnail */
.item-thumb-wrap {
  width: 72px;
  height: 48px;
  min-width: 72px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 5px;
}
.item-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.item-thumb-empty {
  background: var(--color-border);
}
.item-main {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* Current cover preview in trip form */
.current-cover {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.current-cover-thumb {
  width: 80px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--color-border);
}

.item-link {
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
}
.item-link:hover { text-decoration: underline; }
.item-row-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.status-draft     { background: #fff3cd; color: #856404; }
.status-published { background: #d1e7dd; color: #0a3622; }
.empty-hint {
  color: var(--color-muted);
  font-size: 0.9rem;
  font-style: italic;
}

/* ── Admin forms ─────────────────────────────────────────────────────────── */
.admin-login,
.admin-form {
  max-width: 540px;
}
.admin-login h1,
.admin-form h1 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}
.admin-form label,
.admin-login label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 1.1rem;
  margin-bottom: 0.3rem;
}
.field-hint {
  font-weight: 400;
  color: var(--color-muted);
  font-size: 0.8rem;
}
.sub-label {
  font-size: 0.8rem !important;
  font-weight: 400 !important;
  color: var(--color-muted);
}
.admin-form input[type="text"],
.admin-form input[type="url"],
.admin-form input[type="number"],
.admin-form input[type="date"],
.admin-form input[type="datetime-local"],
.admin-form select,
.admin-form textarea,
.admin-login input[type="password"] {
  width: 100%;
  padding: 0.65rem 0.8rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: #fff;
  color: var(--color-text);
  -webkit-appearance: none;
}
.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus,
.admin-login input:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: -1px;
  border-color: var(--color-accent);
}
.admin-form input[type="file"] {
  font-size: 0.9rem;
  padding: 0.5rem 0;
}
.admin-form textarea { resize: vertical; }
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.1rem;
  font-size: 0.95rem;
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--color-accent);
  flex-shrink: 0;
}
.badge-admin-only {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  background: #f0a500;
  color: #fff;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 0.3rem;
  letter-spacing: 0.03em;
}

.form-error {
  color: #c0392b;
  background: #fdf0ef;
  border: 1px solid #f5c6c3;
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* ── Loading overlay ─────────────────────────────────────────────────────── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(250, 249, 247, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
#loading-overlay[hidden] { display: none; }
.loading-box {
  text-align: center;
  padding: 2rem;
}
.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 1.25rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.loading-sub {
  font-size: 0.88rem;
  color: var(--color-muted);
  line-height: 1.6;
}

/* ── Entry review ────────────────────────────────────────────────────────── */
.admin-form.review { max-width: 100%; }
.entry-meta {
  color: var(--color-muted);
  font-size: 0.88rem;
  margin-bottom: 1rem;
}
.entry-thumb {
  max-width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
.review-grid textarea,
.review-grid input[type="text"] {
  width: 100%;
  font-size: 0.95rem;
  font-family: inherit;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
}
.review-grid textarea { resize: vertical; }
.review-grid-titles { margin-bottom: 0.5rem; }
.review-grid label {
  font-weight: 500;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.lang-badge {
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--color-accent);
  color: #fff;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.lang-badge-auto {
  background: var(--color-muted);
}
.mastodon-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--color-muted);
}
.mastodon-row input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  cursor: pointer;
  accent-color: var(--color-accent);
}
.mastodon-row label { cursor: pointer; }
.mastodon-tags-row { margin-top: 0.5rem; }

.review-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  justify-content: flex-end;
}

.model-fieldset {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-top: 0.25rem;
}
.model-fieldset legend {
  font-size: 0.85rem;
  color: var(--color-muted);
  padding: 0 0.25rem;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.2rem 0;
}
.radio-label input[type="radio"] { cursor: pointer; accent-color: var(--color-accent); }
.skip-photo-row {
  text-align: center;
  margin-top: 1rem;
}
.btn-link {
  background: none;
  border: none;
  color: var(--color-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-link:hover { color: var(--color-accent); }

.site-notice {
  background: var(--color-surface);
  border-left: 3px solid var(--color-accent);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  color: var(--color-muted);
}
.site-notice p { margin: 0.25rem 0; }
.site-notice p:first-child { margin-top: 0; }
.site-notice p:last-child { margin-bottom: 0; }

.settings-section-head {
  font-size: 1.1rem;
  margin-top: 2rem;
  margin-bottom: 0.25rem;
}
.settings-hint { margin-bottom: 0.75rem; }
.settings-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.settings-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2rem 0;
}

@media (max-width: 600px) {
  .review-grid { grid-template-columns: 1fr; }
  .review-actions { flex-direction: column-reverse; }
  .review-actions .btn { width: 100%; }
  .field-row { grid-template-columns: 1fr; }
}
