/* ===== Family uploads, highlight picker, real day maps — japan-trips.html (Sept 2026) ===== */

/* --- highlight tiles: keep each photo's own shape (portrait stays portrait) --- */
.dd-stops { display: flex !important; flex-wrap: nowrap; gap: 1rem; align-items: flex-start; }
.dd-stop { position: relative; flex: var(--ar, 1.5) 1 0; min-width: 0; }
.dd-stop img { aspect-ratio: var(--ar, 1.5) !important; width: 100%; height: auto; object-fit: cover; }
.dd-stop.is-empty .dd-stop-ph { aspect-ratio: 4/3; border: 1px dashed rgba(244,241,234,0.35); border-radius: 2px; display: flex; align-items: center; justify-content: center; color: #9DB5B1; font-size: 0.9rem; }
.dd-stop-edit { position: absolute; top: 0.5rem; right: 0.5rem; z-index: 2; border: 0; border-radius: 100px; padding: 0.3rem 0.7rem; font-family: var(--sans); font-size: 0.78rem; background: rgba(15,25,25,0.72); color: #fff; cursor: pointer; opacity: 0.85; }
.dd-stop-edit:hover { opacity: 1; background: var(--ochre); }
@media (max-width: 900px) { .dd-stops { display: grid !important; grid-template-columns: 1fr 1fr; gap: 0.8rem; } }

/* --- real route map --- */
.dd-map { height: 340px; border-radius: 3px; overflow: hidden; background: #dfe7e4; border: 6px solid #fff; }
.dd-map .leaflet-control-attribution { font-size: 10px; }
.dd-route .dd-map svg { width: auto; height: auto; display: inline; }  /* undo the old diagram rule so map lines show */
.fm-pin { width: 30px; height: 30px; border-radius: 50%; background: #B3334A; color: #fff; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; font: 600 14px/1 'Kanit', sans-serif; }
.fm-pin.is-end { background: #1F2A2E; }
.fm-dot { width: 12px; height: 12px; border-radius: 50%; background: #2E7D6B; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.fm-arrow { width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 12px solid #B3334A; }
.fm-label { background: rgba(255,255,255,0.88); border: 0; box-shadow: none; color: #222; font: 600 12px 'Kanit', sans-serif; padding: 1px 5px; border-radius: 3px; }
.fm-label::before { display: none; }
.dd-map-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.78rem; color: #9DB5B1; margin-top: 0.5rem; }
.dd-map-legend i { display: inline-block; width: 22px; height: 0; border-top: 3px solid #B3334A; vertical-align: middle; margin-right: 0.35rem; }
.dd-map-legend i.dash { border-top: 2px dashed #2E7D6B; }
.dd-time .n { display: inline-flex; width: 1.35rem; height: 1.35rem; border-radius: 50%; background: #B3334A; color: #fff; font-size: 0.72rem; align-items: center; justify-content: center; margin-right: 0.45rem; vertical-align: 0.1em; }
.dd-time .n.is-end { background: #0f1618; border: 1px solid #9DB5B1; }

/* --- add button --- */
.fm-add { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--sans); font-size: 0.95rem; background: var(--ochre); color: #fff; border: 0; border-radius: 100px; padding: 0.7rem 1.3rem; cursor: pointer; box-shadow: 0 8px 22px rgba(0,0,0,0.18); }
.fm-add:hover { background: var(--forest-d); }
.fm-add-bar { display: flex; justify-content: flex-end; gap: 0.6rem; margin: 1rem 0 0; flex-wrap: wrap; }
.fm-fab { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 150; display: none; }
.fm-fab.show { display: inline-flex; }

/* --- family items inside sections --- */
.fm-family-title { font-size: 0.75rem; letter-spacing: 0.25em; color: var(--ochre); font-weight: 600; margin-top: 1.4rem; }
.dd-grid button { position: relative; }
.fm-by { position: absolute; left: 0; right: 0; bottom: 0; font-size: 0.7rem; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,0.55)); padding: 1rem 0.4rem 0.25rem; text-align: left; pointer-events: none; }
.fm-item-edit { position: absolute; top: 0.35rem; right: 0.35rem; z-index: 3; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(0,0,0,0.55); color: #fff; font-size: 16px; line-height: 30px; cursor: pointer; padding: 0; }
.dd-video { position: relative; }
.fm-empty { color: var(--muted); font-style: italic; padding: 1.5rem 0; }

/* --- generic day panel --- */
.fm-day-sub { color: #BFE3DA; margin-top: 0.3rem; }

/* --- modal --- */
.fm-modal { position: fixed; inset: 0; z-index: 400; background: rgba(15,20,15,0.6); display: none; align-items: flex-start; justify-content: center; padding: 4vh 1rem; overflow-y: auto; }
.fm-modal.open { display: flex; }
.fm-box { background: var(--cream); width: 100%; max-width: 760px; border-radius: 8px; box-shadow: 0 30px 80px rgba(0,0,0,0.35); padding: 1.6rem clamp(1rem, 4vw, 2rem) 1.8rem; position: relative; font-family: var(--sans); }
.fm-box h3 { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--forest); font-size: 1.8rem; margin-bottom: 0.3rem; }
.fm-box p.fm-help { color: var(--muted); font-size: 0.95rem; margin-bottom: 1rem; }
.fm-x { position: absolute; top: 0.8rem; right: 0.8rem; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--sand); font-size: 1.4rem; cursor: pointer; }
.fm-field { display: block; margin: 0.7rem 0; }
.fm-field span { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.25rem; }
.fm-field input, .fm-field select, .fm-row select, .fm-row input { width: 100%; font: inherit; font-size: 16px; padding: 0.55rem 0.7rem; border: 1px solid var(--stone); border-radius: 6px; background: #fff; }
.fm-btn { font: inherit; font-size: 1rem; border: 0; border-radius: 100px; padding: 0.7rem 1.4rem; cursor: pointer; background: var(--forest-d); color: #fff; }
.fm-btn:disabled { opacity: 0.5; cursor: default; }
.fm-btn.alt { background: var(--sand); color: var(--ink); }
.fm-btn.danger { background: #A33; }
.fm-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1.2rem; flex-wrap: wrap; }
.fm-err { color: #A33; font-size: 0.9rem; min-height: 1.2em; margin-top: 0.4rem; }
.fm-drop { display: block; border: 2px dashed var(--ochre); border-radius: 8px; padding: 1.6rem 1rem; text-align: center; color: var(--forest); cursor: pointer; background: #fff; }
.fm-drop b { display: block; font-size: 1.1rem; margin-bottom: 0.2rem; }
.fm-drop input { display: none; }
.fm-list { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.8rem; }
.fm-row { display: grid; grid-template-columns: 84px 1fr; gap: 0.8rem; background: #fff; border: 1px solid var(--stone); border-radius: 8px; padding: 0.6rem; }
.fm-row .fm-thumb { width: 84px; height: 84px; border-radius: 4px; object-fit: cover; background: var(--sand); }
.fm-row .fm-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.fm-row .fm-meta .full { grid-column: 1 / -1; }
.fm-row .fm-info { grid-column: 1 / -1; font-size: 0.78rem; color: var(--muted); }
.fm-bar { height: 6px; background: var(--sand); border-radius: 3px; overflow: hidden; grid-column: 1 / -1; }
.fm-bar i { display: block; height: 100%; width: 0; background: var(--ochre); transition: width 0.2s; }
.fm-row.done { border-color: #5a9; }
.fm-row.bad { border-color: #c55; }
.fm-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.5rem; max-height: 46vh; overflow-y: auto; padding: 0.2rem; }
.fm-pick button { border: 3px solid transparent; padding: 0; border-radius: 4px; overflow: hidden; background: none; cursor: pointer; }
.fm-pick button.sel { border-color: var(--ochre); }
.fm-pick img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
@media (max-width: 600px) { .fm-row .fm-meta { grid-template-columns: 1fr; } .fm-row { grid-template-columns: 64px 1fr; } .fm-row .fm-thumb { width: 64px; height: 64px; } }

/* portrait (phone) videos keep their tall shape */
.dd-video.portrait video { aspect-ratio: 9/16; max-height: 78vh; object-fit: contain; }
.dd-videos:has(.portrait) { grid-template-columns: repeat(auto-fill, minmax(240px, 300px)); }

/* --- editable timetable --- */
.fm-tl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.9rem; margin-top: 0.8rem; }
.fm-tl-edit { font: inherit; font-size: 0.85rem; background: transparent; color: #F2C98A; border: 1px solid rgba(242,201,138,0.6); border-radius: 100px; padding: 0.35rem 0.9rem; cursor: pointer; }
.fm-tl-edit:hover { background: #F2C98A; color: #1B2B2F; }
.fm-tl-by { font-size: 0.75rem; color: #9DB5B1; }
.dd-time .tl-x { border-bottom: 1px dotted rgba(244,241,234,0.35); }
.dd-time li.fm-tl-empty { display: block; color: #9DB5B1; font-size: 0.9rem; font-style: italic; }
.fm-tl-list { display: flex; flex-direction: column; gap: 0.7rem; max-height: 58vh; overflow-y: auto; padding: 0.2rem; }
.fm-tl-row { display: grid; grid-template-columns: 8.5rem 1fr 40px; gap: 0.45rem; background: #fff; border: 1px solid var(--stone); border-radius: 8px; padding: 0.6rem; }
.fm-tl-row input, .fm-tl-row textarea { width: 100%; font: inherit; font-size: 16px; padding: 0.45rem 0.6rem; border: 1px solid var(--stone); border-radius: 6px; background: #fff; }
.fm-tl-row .tl-t { font-weight: 600; color: var(--forest); }
.fm-tl-row textarea { grid-column: 1 / -1; resize: vertical; min-height: 3.2rem; font-size: 15px; }
.fm-tl-row .tl-del { border: 0; background: var(--sand); border-radius: 6px; cursor: pointer; font-size: 1rem; }
.fm-tl-row .tl-del:hover { background: #f3d6d6; }
.fm-tl-addrow { margin-top: 0.8rem; }
@media (max-width: 600px) { .fm-tl-row { grid-template-columns: 1fr 40px; } .fm-tl-row .tl-t { grid-row: 1; grid-column: 1; } .fm-tl-row .tl-del { grid-row: 1; grid-column: 2; } .fm-tl-row .tl-title { grid-row: 2; grid-column: 1 / -1; } .fm-tl-row textarea { grid-row: 3; } }

/* --- Journey Comments & Notes --- */
.fm-notes { margin-top: 4rem; padding-top: 2.2rem; border-top: 1px solid rgba(191,163,106,0.45); }
.fm-notes-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem 2rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.fm-notes-kicker { font-size: 0.75rem; letter-spacing: 0.3em; color: var(--ochre); font-weight: 600; }
.fm-notes-head h4 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 2rem; color: var(--forest); margin: 0.2rem 0 0.3rem; }
.fm-notes-head p { color: var(--muted); max-width: 38rem; }
.fm-notes-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.fm-note { position: relative; background: #fff; border: 1px solid var(--stone); border-left: 4px solid var(--ochre); border-radius: 6px; padding: 1.1rem 2.6rem 1rem 1.2rem; box-shadow: 0 6px 18px rgba(0,0,0,0.05); }
.fm-note p { line-height: 1.65; color: var(--ink); white-space: normal; overflow-wrap: anywhere; }
.fm-note-by { margin-top: 0.7rem; font-size: 0.85rem; color: var(--muted); }
.fm-note-by b { color: var(--forest); font-weight: 600; }
.fm-note .fm-item-edit { background: var(--sand); color: var(--ink); }
.fm-notes-list .fm-empty { grid-column: 1 / -1; }
.fm-field textarea { width: 100%; font: inherit; font-size: 16px; padding: 0.6rem 0.7rem; border: 1px solid var(--stone); border-radius: 6px; background: #fff; resize: vertical; line-height: 1.6; }

/* --- ⋯ menu on every photo & video (download / edit / remove) --- */
.fm-hidden { display: none !important; }
.dd-grid > button { position: relative; }
.fm-dots { position: absolute; top: 0.4rem; right: 0.4rem; z-index: 4; width: 36px; height: 36px; border-radius: 50%; border: 0; padding: 0;
  background: rgba(15,20,20,0.62); color: #fff; font: 700 20px/34px sans-serif; text-align: center; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,0.35); }
.fm-dots:hover { background: var(--ochre); }
figure.dd-video > .fm-dots { top: 0.5rem; right: 0.5rem; }
.fm-menu { position: absolute; z-index: 500; min-width: 230px; background: #fff; border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,0.25); padding: 0.35rem; font-family: var(--sans); }
.fm-mi { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 7px; padding: 0.75rem 0.9rem; font: inherit; font-size: 1.05rem; color: var(--ink); text-decoration: none; cursor: pointer; }
.fm-mi:hover { background: var(--sand); }
.fm-mi.danger { color: #A33; }
.fm-rm-prev { display: block; max-width: 100%; max-height: 40vh; margin: 0.6rem auto 0.8rem; border-radius: 6px; }
.fm-restore { background: #fff !important; color: var(--forest) !important; border: 1px solid var(--stone) !important; box-shadow: none !important; }
.fm-rs-list { display: flex; flex-direction: column; gap: 0.6rem; max-height: 60vh; overflow-y: auto; }
.fm-rs { display: grid; grid-template-columns: 90px 1fr auto; gap: 0.8rem; align-items: center; background: #fff; border: 1px solid var(--stone); border-radius: 8px; padding: 0.5rem; }
.fm-rs img { width: 90px; height: 68px; object-fit: cover; border-radius: 4px; background: var(--sand); }
.fm-rs small { color: var(--muted); }
@media (max-width: 600px) { .fm-rs { grid-template-columns: 64px 1fr; } .fm-rs img { width: 64px; height: 50px; } .fm-rs .fm-btn { grid-column: 1 / -1; } }
.fm-mi.fm-mi-save { font-weight: 600; color: var(--ink); background: rgba(0,0,0,0.04); }
.fm-mi.fm-mi-save:disabled { opacity: 0.75; cursor: wait; }

/* v8 · show every photo in full inside its frame (no cropping); blurred copy of the same photo fills the empty space */
.dd-grid button.fit, .fitbox { position: relative; overflow: hidden; background: #2b3533; }
.dd-grid button.fit::before, .fitbox::before { content: ''; position: absolute; inset: -14px; background: var(--bg) center / cover no-repeat; filter: blur(12px) brightness(0.78); }
.dd-grid button.fit img, .fitbox img { position: relative; object-fit: contain !important; }
.dd-grid button.fit:hover img { transform: scale(1.03); }
.fitbox { display: block; }
