/* Route 66 Copilot: trip journal (scrapbook days, composer, photo viewer) and the 4-tab side panel. */

/* ---------- Side panel: four tabs as a 2 x 2 grid, so no label is ever cut at 320 px or on phones ---------- */
.side .tabs { display: grid; grid-template-columns: 1fr 1fr; border-radius: 22px; }
.side .tabs [role="tab"] { border-radius: 18px; padding: 0 8px; white-space: nowrap; }
.side .tabs .ico { display: inline-block; }

/* ---------- Side panel: Journal tab ---------- */
.j-side { display: flex; flex-direction: column; gap: 8px; padding: 8px 4px; }
.j-side-row { flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; }
.j-side-row img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex-shrink: 0; border: 2px solid #fff; box-shadow: var(--shadow-warm); }
.j-side-ico { width: 48px; height: 48px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--paper); color: var(--rust-ink); }
.j-side-row > span:last-child { display: flex; flex-direction: column; min-width: 0; }

/* ---------- Header ---------- */
.j-head { margin-bottom: 18px; }
.j-head .page-title { margin-bottom: 8px; font-size: 2.6rem; }
.j-lead { margin: 0 0 16px; font-size: 1.06rem; color: var(--ink-2); font-weight: 600; }
.j-head-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.j-big { min-height: 56px; font-size: 1.1rem; padding: 12px 22px; }

/* ---------- Empty state ---------- */
.j-empty { margin-top: 8px; }
.j-empty .bezel-core { text-align: center; padding: 32px 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.j-empty h2 { margin: 6px 0 0; font-family: var(--head); font-weight: 800; font-size: 1.8rem; line-height: 1.05; }
.j-empty p { margin: 0 0 8px; max-width: 34em; }

/* ---------- Days and entries (scrapbook) ---------- */
.j-day { margin: 26px 0 8px; }
.j-day-title {
  margin: 0 0 14px; padding-bottom: 10px; font-family: var(--head); font-weight: 800; font-size: 1.75rem; line-height: 1.05;
  background: repeating-linear-gradient(90deg, var(--yellow) 0 22px, transparent 22px 36px) bottom left / 100% 3px no-repeat;
}
.j-entry-wrap { margin-bottom: 16px; scroll-margin-top: 16px; }
.j-entry {
  position: relative; padding: 18px 18px 10px; border-radius: 6px 22px 22px 22px; background: var(--paper);
  border: 1px solid var(--hair); box-shadow: var(--inner-hl), var(--shadow-warm);
}
.j-entry::before { /* a strip of tape holding the page */
  content: ""; position: absolute; top: -9px; left: 22px; width: 76px; height: 20px; transform: rotate(-3deg);
  background: rgba(232, 183, 48, 0.38); border: 1px solid rgba(143, 106, 20, 0.18); border-radius: 2px;
}
.j-place { margin: 0 0 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-family: var(--head); font-weight: 800; font-size: 1.4rem; line-height: 1.1; color: var(--rust-ink); }
.j-place .ico { color: var(--rust-ink); }
.j-stopno { font-family: var(--body); font-weight: 700; font-size: 0.85rem; color: var(--ink-2); letter-spacing: .02em; }
.j-text { margin: 0 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.08rem; line-height: 1.65; }
.j-meta { margin: 0 0 4px; font-weight: 700; font-size: 0.95rem; color: var(--ink-2); }
.j-entry-tools { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px -8px 0; }
.j-del:hover { color: var(--error-ink); }
.j-confirm { margin: 10px 0 8px; padding: 14px; border-radius: 14px; background: var(--paper); border: 1.5px solid var(--error-ink); }
.j-confirm p { margin: 0 0 10px; }

/* Photo grid: 1 wide, 2 side by side, 3 = one big + two, 4 = 2 x 2. White borders like prints. */
.j-photos { display: grid; gap: 10px; margin: 4px 0 14px; }
.j-photos-1 { grid-template-columns: 1fr; }
.j-photos-2, .j-photos-4 { grid-template-columns: 1fr 1fr; }
.j-photos-3 { grid-template-columns: 1fr 1fr; }
.j-photos-3 .j-photo:first-child { grid-column: 1 / -1; }
.j-photo {
  display: block; padding: 6px; border: 0; border-radius: 4px; background: #fff; cursor: zoom-in; min-height: 48px;
  box-shadow: 0 1px 2px rgba(92, 58, 28, 0.14), 0 6px 16px -8px rgba(92, 58, 28, 0.35);
}
.j-photo img { display: block; width: 100%; height: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 2px; background: var(--sand); }
.j-photos-1 .j-photo img { aspect-ratio: auto; max-height: 70vh; object-fit: contain; height: auto; }
.j-photos-2 .j-photo img { aspect-ratio: 4 / 5; }
.j-photos-3 .j-photo:first-child img { aspect-ratio: 16 / 9; }
.j-photo:focus-visible { outline-offset: 2px; }

/* ---------- Composer ---------- */
.j-composer { margin: 4px 0 22px; }
.j-composer-title { margin: 0 0 14px; font-family: var(--head); font-weight: 800; font-size: 1.7rem; line-height: 1.05; }
.j-textarea { min-height: 170px; resize: vertical; line-height: 1.55; display: block; }
.j-hint { margin: -10px 0 14px; font-size: 0.95rem; color: var(--ink-2); font-weight: 600; }
.j-optional { font-weight: 400; color: var(--ink-2); }
.j-field-group { margin-bottom: 16px; }
.j-field-group .field { margin-bottom: 10px; }
.j-thumbs { list-style: none; margin: 0 0 10px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.j-thumbs li { position: relative; padding: 4px; background: #fff; border-radius: 4px; box-shadow: var(--shadow-warm); }
.j-thumbs img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 2px; }
.j-thumb-x {
  position: absolute; top: -10px; right: -10px; width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--paper);
  background: var(--ink); color: var(--paper); display: flex; align-items: center; justify-content: center; padding: 0;
}
.j-add-photos { border-style: dashed; min-height: 56px; }
.j-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.j-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 14px; min-height: 48px; border-radius: var(--r-pill);
  background: var(--sand); border: 1px solid var(--hair); font-weight: 700; font-size: 0.95rem; overflow-wrap: anywhere;
}
.j-chip-x { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; padding: 0; }
.j-chip-x:hover { background: var(--paper); }
.j-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; align-items: end; }
select.field { appearance: auto; }
.j-msg { margin: 0 0 12px; font-weight: 600; }
.j-composer .inline-error { margin: 0 0 12px; }
.j-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.j-save { min-height: 56px; font-size: 1.1rem; padding: 12px 24px; }

/* ---------- Photo viewer ---------- */
.j-viewer { position: fixed; inset: 0; z-index: 320; background: #14110E; color: #fff; display: flex; flex-direction: column; padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); }
.j-viewer-bar, .j-viewer-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; font-weight: 700; }
.j-viewer-nav { justify-content: center; }
.j-viewer-img { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 8px; }
.j-viewer-img img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.j-viewer-btn { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.7); box-shadow: none; }
.j-viewer-btn:hover { background: rgba(255, 255, 255, 0.12); }
.j-viewer :focus-visible { outline-color: #fff; }

@media (max-width: 560px) {
  .j-head .page-title { font-size: 2.2rem; }
  .j-head-btns .btn { width: 100%; }
  .j-entry { padding: 16px 14px 8px; }
  .j-thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .j-photos { gap: 8px; }
  .j-photo { padding: 4px; }
}
