/* ── Prevent FOUC ────────────────────────────────────────────────────────── */
html { visibility: visible; }

/* ── Trip page wrapper ───────────────────────────────────────────────────── */
.trip-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Trip header bar ─────────────────────────────────────────────────────── */
.trip-topbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid oklch(var(--b3));
    flex-shrink: 0;
    background: oklch(var(--b1));
}

/* ── Trip content area ───────────────────────────────────────────────────── */
.trip-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

/* ── Mode switching ──────────────────────────────────────────────────────── */
.trip-content[data-mode="list"] #map-layout  { display: none; }
.trip-content[data-mode="map"]  #list-layout { display: none; }

/* ── List layout ─────────────────────────────────────────────────────────── */
#list-layout {
    display: flex;
    height: 100%;
    overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
#sidebar-pane {
    width: 380px;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid oklch(var(--b3));
}

.entries-list {
    flex: 1;
    overflow-y: auto;
}

/* ── Detail pane (desktop only) ──────────────────────────────────────────── */
#detail-pane {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: none;
    flex-direction: column;
}

/* ── Resize handle ───────────────────────────────────────────────────────── */
#resize-handle {
    width: 6px;
    cursor: col-resize;
    flex-shrink: 0;
    background: oklch(var(--b3));
    transition: background .15s;
    display: none;
}
#resize-handle:hover { background: oklch(var(--p)); }

/* ── Map layout ──────────────────────────────────────────────────────────── */
#map-layout {
    display: flex;
    height: 100%;
    overflow: hidden;
}

#map-nav {
    width: 240px;
    min-width: 240px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid oklch(var(--b3));
    background: oklch(var(--b1));
}

.map-nav-list {
    flex: 1;
    overflow-y: auto;
}

#map-container {
    flex: 1;
    position: relative;
}

#trip-map {
    position: absolute;
    inset: 0;
}

/* ── Map marker ──────────────────────────────────────────────────────────── */
.map-marker {
    width: 30px;
    height: 30px;
    background: oklch(var(--p));
    color: oklch(var(--pc));
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
.map-marker i { transform: rotate(45deg); font-size: 0.9rem; }
.map-marker.active {
    background: oklch(var(--s));
    color: oklch(var(--sc));
    box-shadow: 0 0 0 3px oklch(var(--s)/0.4), 0 2px 10px rgba(0,0,0,0.5);
}

/* ── Entry timeline connector ────────────────────────────────────────────── */
.entry-item.entry-has-next { position: relative; }
.entry-item.entry-has-next::after {
    content: '';
    position: absolute;
    left: 24px;
    top: 36px;
    bottom: 0;
    width: 2px;
    background: oklch(var(--b3));
    pointer-events: none;
}

/* ── Accordion ───────────────────────────────────────────────────────────── */
.entry-body { transition: none; }
.entry-item.entry-open .entry-header {
    background: oklch(var(--b2));
    border-radius: 0.5rem;
}

/* ── Entry selected state ────────────────────────────────────────────────── */
.entry-item.entry-selected > .entry-header {
    background: oklch(var(--p)/0.12);
    border-radius: 0.5rem;
}

/* ── Photo grid ──────────────────────────────────────────────────────────── */
.photo-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    transition: opacity .15s;
}
.photo-thumb:hover { opacity: .75; }

/* ── Desktop: fixed viewport height so flex scroll chain works ───────────── */
@media (min-width: 1024px) {
    body.trip-body { height: 100vh; overflow: hidden; }
    #detail-pane  { display: flex; }
    #resize-handle { display: block; }
    #map-nav      { display: flex; }
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
    .trip-page    { flex: none; overflow: visible; min-height: unset; }
    .trip-content { overflow: visible; }
    .trip-content[data-mode="list"] #list-layout { height: auto; flex-direction: column; }
    #sidebar-pane { width: 100% !important; min-width: unset !important; border-right: none; }
    #detail-pane  { display: none !important; }
    #resize-handle { display: none !important; }
    .trip-content[data-mode="map"] #map-layout { height: calc(100vh - 120px); min-height: 400px; }
}
