:root {
  --ink: #20201e;
  --charcoal: #292a28;
  --charcoal-deep: #191a18;
  --amber: #a65325;
  --amber-dark: #7d3b18;
  --paper: #f4f0e8;
  --paper-light: #fdfbf7;
  --line: #d9d1c3;
  --muted: #6c6962;
}

body {
  background-color: var(--paper);
  background-image: linear-gradient(rgba(41, 42, 40, .025) 1px, transparent 1px), linear-gradient(90deg, rgba(41, 42, 40, .025) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.journal-container { max-width: 1100px; }

.navbar {
  background: var(--charcoal-deep);
  border-bottom: 3px solid var(--amber);
  min-height: 72px;
}

.navbar-brand { letter-spacing: .01em; line-height: 1.05; }
.navbar-brand small { display: block; margin-top: .25rem; color: #c9c5bd; font-size: .58rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.brand-mark { display: grid; width: 2rem; height: 2rem; place-items: center; border: 2px solid #fff; border-radius: 50%; color: var(--amber); font-size: 1.35rem; }

.btn { border-radius: .25rem; min-height: 42px; font-weight: 700; letter-spacing: .01em; }
.btn-sm { min-height: 36px; }
.btn-primary { --bs-btn-bg: var(--amber); --bs-btn-border-color: var(--amber); --bs-btn-hover-bg: var(--amber-dark); --bs-btn-hover-border-color: var(--amber-dark); --bs-btn-color: #fff; }
.btn-dark { --bs-btn-bg: var(--charcoal); --bs-btn-border-color: var(--charcoal); }

.form-control, .form-select { border-color: #bfb7a9; border-radius: .25rem; min-height: 46px; background-color: var(--paper-light); }
.form-control:focus, .form-select:focus, .btn:focus-visible, a:focus-visible { border-color: var(--amber); box-shadow: 0 0 0 .25rem rgba(166, 83, 37, .24); outline: 0; }
.form-label { font-weight: 700; }

.eyebrow { color: var(--amber-dark); font-size: .73rem; font-weight: 800; letter-spacing: .19em; text-transform: uppercase; }
.display-6, h1, h2, .card-title { letter-spacing: -.025em; }

.filter-panel, .empty-state {
  background: rgba(253, 251, 247, .96);
  border: 1px solid var(--line);
  border-top: 3px solid var(--charcoal);
  border-radius: .35rem;
  box-shadow: 0 10px 26px rgba(32, 32, 30, .07);
  padding: 1.25rem;
}

.entry-card, .form-card, .detail-card {
  background: var(--paper-light);
  border: 1px solid var(--line);
  border-radius: .35rem;
  box-shadow: 0 10px 26px rgba(32, 32, 30, .08);
}

.entry-card { position: relative; overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; }
.entry-card::before { content: ""; display: block; height: 6px; background: repeating-linear-gradient(90deg, var(--charcoal) 0 18px, transparent 18px 24px); }
.entry-card:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(32, 32, 30, .13); }
.entry-link { color: var(--ink); text-decoration: none; }
.entry-preview { white-space: pre-line; }
.card-actions { z-index: 2; }
.featured-image-button { display: block; width: 100%; padding: 0; overflow: hidden; border: 0; border-radius: .2rem; background: #171816; cursor: zoom-in; }
.featured-image-button:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
.featured-image { display: block; width: 100%; height: 220px; object-fit: cover; transition: opacity .15s ease, transform .2s ease; }
.featured-image-button:hover .featured-image { opacity: .92; transform: scale(1.01); }
.detail-featured-image .featured-image { height: min(52vw, 470px); }
.current-image-preview { width: min(100%, 280px); height: 150px; border-radius: .2rem; object-fit: cover; }
.gallery-upload-zone { padding: 1.5rem; border: 2px dashed #bfb7a9; border-radius: .35rem; background: #f8f5ee; text-align: center; transition: border-color .15s ease, background-color .15s ease; }
.gallery-upload-zone:hover, .gallery-upload-zone.is-dragging { border-color: var(--amber); background: #f1dfd2; }
.gallery-upload-zone.is-invalid { border-color: var(--bs-danger); }
.gallery-upload-label { display: flex; align-items: center; flex-direction: column; gap: .3rem; cursor: pointer; }
.gallery-upload-icon { display: grid; width: 3rem; height: 3rem; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--paper-light); color: var(--amber-dark); font-size: 1.8rem; line-height: 1; }
.gallery-carousel-image { height: min(62vw, 620px); object-fit: cover; }
#galleryFeaturedCarousel .carousel-caption { padding-right: 1rem; padding-left: 1rem; background: rgba(25, 26, 24, .78); border-radius: .25rem; }
.gallery-menu-image { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: .2rem; object-fit: cover; }
.gallery-photo-card { height: 100%; padding: .45rem; background: var(--paper-light); border: 1px solid var(--line); border-radius: .25rem; box-shadow: 0 5px 14px rgba(32, 32, 30, .08); }
.gallery-grid-image { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.gallery-pencil-title { margin: .65rem .25rem .35rem; color: #77746e; font-family: "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive; font-size: 1rem; font-weight: 400; line-height: 1.2; text-align: center; }
.photo-details { padding: 1rem 1.1rem 1.1rem; border: 1px solid var(--line); border-radius: .35rem; background: #f8f5ee; }
.photo-details legend { float: none; width: auto; margin: 0 0 .65rem; padding: 0 .35rem; color: var(--charcoal); font-size: 1rem; font-weight: 800; }
.photo-details legend span { margin-left: .35rem; color: var(--muted); font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.toggle-group { display: flex; min-height: 46px; align-items: center; justify-content: space-around; gap: .65rem; padding: .5rem .75rem; border: 1px solid #bfb7a9; border-radius: .25rem; background: var(--paper-light); }
.form-check-input:checked { background-color: var(--amber); border-color: var(--amber); }
.weather-options { display: flex; flex-wrap: wrap; gap: .45rem; }
.weather-option { display: grid; width: 46px; height: 46px; place-items: center; border: 1px solid #bfb7a9; border-radius: .3rem; background: var(--paper-light); font-size: 1.35rem; cursor: pointer; }
.weather-option:hover { border-color: var(--amber); background: #fff; }
.btn-check:checked + .weather-option { border-color: var(--amber); background: #f1dfd2; box-shadow: inset 0 0 0 2px var(--amber); }
.btn-check:focus-visible + .weather-option { box-shadow: 0 0 0 .25rem rgba(166, 83, 37, .24); }
.social-share-options { display: flex; flex-wrap: wrap; gap: .6rem; }
.social-share-option { display: grid; width: 48px; height: 48px; place-items: center; border: 1px solid #bfb7a9; border-radius: .3rem; background: var(--paper-light); color: var(--muted); cursor: pointer; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
.social-share-option:hover { border-color: var(--amber); color: var(--charcoal); }
.social-share-option svg { width: 24px; height: 24px; fill: currentColor; }
.btn-check:focus-visible + .social-share-option { box-shadow: 0 0 0 .25rem rgba(166, 83, 37, .24); }
.btn-check:checked + .social-facebook { border-color: #1877f2; background: #1877f2; color: #fff; }
.btn-check:checked + .social-x { border-color: #000; background: #000; color: #fff; }
.btn-check:checked + .social-instagram { border-color: #c13584; background: linear-gradient(135deg, #f58529, #dd2a7b 52%, #515bd4); color: #fff; }
.capture-details { overflow: hidden; border: 1px solid var(--line); border-radius: .35rem; background: #f8f5ee; }
.capture-details-heading { padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.capture-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.capture-grid > div { min-width: 0; padding: .9rem 1.2rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.capture-grid > div:nth-child(3n) { border-right: 0; }
.capture-grid dt { color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.capture-grid dd { margin: .2rem 0 0; overflow-wrap: anywhere; font-weight: 600; }
.capture-grid .capture-notes { grid-column: 1 / -1; border-right: 0; }
.weather-display { font-size: 1.4rem; line-height: 1; }
.image-lightbox .modal-content { background: rgba(10, 10, 9, .96); }
.image-lightbox .modal-header { position: absolute; top: 0; right: 0; z-index: 2; }
.image-lightbox .btn-close { width: 1.25rem; height: 1.25rem; margin: .75rem; padding: .75rem; background-color: rgba(0, 0, 0, .45); border-radius: 50%; opacity: 1; }
.image-lightbox .modal-body { padding: 2rem; }
.image-lightbox img { display: block; max-width: 100%; max-height: calc(100vh - 4rem); object-fit: contain; }

.mood-badge { display: inline-flex; align-items: center; padding: .35rem .7rem; border: 1px solid currentColor; border-radius: 999px; font-size: .76rem; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.mood-happy { background: #fff0bf; color: #725406; }
.mood-calm { background: #dcebe7; color: #25574d; }
.mood-excited { background: #f5d9cf; color: #843d28; }
.mood-thoughtful { background: #e4e0ec; color: #52456f; }
.mood-sad { background: #dfe7ed; color: #385468; }
.mood-anxious { background: #f1ded0; color: #764323; }
.mood-tired { background: #e5e2dc; color: #56514a; }
.challenge-badge { border-color: color-mix(in srgb, var(--challenge-color) 72%, #20201e); background: var(--challenge-color); color: var(--challenge-text); }
.challenge-manager-link { min-height: auto; color: var(--amber-dark); font-size: .78rem; }
.challenge-manager-list { display: grid; gap: .55rem; }
.challenge-edit-form { padding-bottom: .55rem; border-bottom: 1px solid var(--line); }
.challenge-edit-form:last-child { padding-bottom: 0; border-bottom: 0; }
.header-public-nav { display: flex; align-items: center; gap: .25rem; }
.header-public-nav a { padding: .55rem .65rem; color: #e7e3dc; font-size: .84rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.header-public-nav a:hover { color: #fff; }
.header-public-nav a:focus-visible { color: #fff; }
.header-menu .dropdown-menu { right: 0; left: auto; width: max-content; max-width: calc(100vw - 1.5rem); margin-top: .35rem; border-color: var(--line); border-radius: .25rem; box-shadow: 0 10px 26px rgba(0,0,0,.16); }
.header-menu .dropdown-item { padding: .6rem 1rem; font-weight: 600; }
.header-menu .dropdown-item:active { background: var(--amber); }
.header-menu-icon { display: none; font-size: 1.45rem; line-height: .75; }
.challenge-admin-card { border: 1px solid var(--line); border-radius: .35rem; background: var(--paper-light); box-shadow: 0 10px 26px rgba(32,32,30,.08); }
.challenge-admin-row { display: grid; grid-template-columns: 46px minmax(0,1fr) auto; align-items: center; gap: .75rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.challenge-admin-row:last-child { border-bottom: 0; }
.challenge-color-input { width: 46px; min-height: 42px; padding: .2rem; cursor: pointer; }
.pagination { --bs-pagination-color: var(--amber-dark); --bs-pagination-hover-color: var(--charcoal); --bs-pagination-focus-color: var(--amber-dark); --bs-pagination-focus-box-shadow: 0 0 0 .25rem rgba(166,83,37,.24); --bs-pagination-active-bg: var(--amber); --bs-pagination-active-border-color: var(--amber); }
.home-location-map, .home-location-empty { width: 100%; height: 360px; overflow: hidden; border: 1px solid var(--line); border-radius: .25rem; background: #f8f5ee; }
.photo-location-map { border: 0; border-radius: 0; }
.home-location-empty { padding: 1.5rem; }
.home-location-pin { position: relative; display: grid; width: 38px; height: 38px; place-items: center; border: 2px solid #fff; border-radius: 50% 50% 50% 0; background: #b52b2b; box-shadow: 0 2px 8px rgba(32,32,30,.35); color: #fff; font-size: 19px; transform: rotate(-45deg); }
.home-location-pin span { transform: rotate(45deg); }
.leaflet-control-attribution { font-size: .68rem; }
@media (hover:hover) and (pointer:fine) { .header-menu:hover > .dropdown-menu { display: block; } }

.empty-state { padding: 4rem 1.5rem; }
.empty-icon { display: grid; width: 4.5rem; height: 4.5rem; margin: 0 auto 1.25rem; place-items: center; border: 3px solid var(--charcoal); border-radius: 50%; color: var(--amber); font-size: 2.6rem; }
.form-shell, .entry-detail { max-width: 800px; }
.back-link { color: var(--amber-dark); font-weight: 700; text-decoration: none; }
.back-link:hover { color: var(--charcoal); text-decoration: underline; }
.entry-content { font-family: Georgia, "Times New Roman", serif; font-size: 1.15rem; line-height: 1.85; overflow-wrap: anywhere; }
.metadata dt { color: var(--muted); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; }
.metadata dd { margin: .25rem 0 0; }
footer { color: var(--muted); border-top: 1px solid rgba(108, 105, 98, .2); }
code { color: #8b3d36; }

.bio-page { max-width: 920px; }
.bio-hero { overflow: hidden; border-top: 6px solid var(--amber); }
.bio-photo { display: block; width: 190px; height: 190px; margin: 0 auto; border: 6px solid var(--paper-light); border-radius: 50%; box-shadow: 0 0 0 2px var(--amber), 0 10px 26px rgba(32, 32, 30, .18); object-fit: cover; }
.bio-introduction { max-width: 620px; font-size: 1.08rem; }
.bio-equipment { display: grid; gap: 1rem; }
.bio-equipment > div { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.bio-equipment > div:last-child { padding-bottom: 0; border-bottom: 0; }
.bio-equipment dd { font-weight: 600; }

@media (max-width: 767.98px) {
  .navbar > .journal-container { flex-wrap: wrap; }
  .header-public-nav { order: 3; width: 100%; margin: .35rem 0 0 !important; padding-top: .2rem; overflow-x: auto; border-top: 1px solid rgba(255,255,255,.12); scrollbar-width: thin; }
  .header-public-nav a { flex: 1 0 auto; padding: .5rem .4rem; font-size: .76rem; text-align: center; }
}

@media (max-width: 575.98px) {
  .navbar { min-height: 68px; }
  .navbar-brand small { display: none; }
  .brand-mark { width: 1.75rem; height: 1.75rem; }
  .header-menu-button { display: grid; width: 42px; padding-right: .5rem !important; padding-left: .5rem !important; place-items: center; }
  .header-menu-button::after, .header-menu-label { display: none; }
  .header-menu-icon { display: inline; }
  .header-menu .dropdown-menu { position: absolute; right: 0; left: auto; min-width: min(220px, calc(100vw - 1.5rem)); }
  .display-6 { font-size: 2rem; }
  .card-body { padding: 1.25rem !important; }
  .entry-card:hover { transform: none; }
  .filter-panel { padding: 1rem; }
  .entry-content { font-size: 1.05rem; }
  .featured-image { height: 190px; }
  .detail-featured-image .featured-image { height: 58vw; max-height: 360px; }
  .image-lightbox .modal-body { padding: 1rem; }
  .toggle-group { justify-content: flex-start; }
  .capture-grid { grid-template-columns: repeat(2, 1fr); }
  .capture-grid > div:nth-child(3n) { border-right: 1px solid var(--line); }
  .capture-grid > div:nth-child(2n) { border-right: 0; }
  .capture-grid .capture-notes { border-right: 0; }
  .card-footer .btn { flex: 1 1 auto; }
  .home-location-map, .home-location-empty { height: 280px; }
  .bio-photo { width: 150px; height: 150px; }
}

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