/* Norway Trip Companion - styles (ported from the fjord prototype, self-contained) */

:root {
  --navy: #1e4a68;
  --red: #c8102e;
  --sand: #faf6ee;
  --card: #fffdf7;
  --border: #e9e2d2;
  --line: #cfe3f4;
  --bluebg: #eef5fb;
  --ink: #24313a;
  --muted: #5a6b76;
  --green: #4a6b4f;
  --maxw: 620px;
  --tap: 46px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--sand);
  direction: rtl;
  font-family: 'Heebo', 'Segoe UI', 'Arial Hebrew', Arial, sans-serif;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-bottom: 92px; /* room for fixed bottom bar */
}

a { color: var(--navy); }
a:hover { color: var(--red); }

.display {
  font-family: 'Amatic SC', 'Heebo', cursive;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* screen-reader only */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ===== Sticky top bar ===== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 246, 238, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 14px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; color: var(--navy); }
.brand .flag { width: 22px; height: 16px; border-radius: 2px; flex: none; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.status-pill {
  background: var(--red); color: #fff; font-weight: 700; font-size: 13.5px;
  border-radius: 999px; padding: 5px 13px; white-space: nowrap;
}
.icon-btn {
  min-width: 40px; min-height: 40px; border-radius: 50%;
  background: #fff; border: 1.5px solid var(--line); color: var(--navy);
  font-size: 18px; cursor: pointer; display: grid; place-items: center;
  font-family: inherit;
}
.icon-btn:active { transform: scale(0.94); }
.progwrap { height: 4px; background: #e3dbc9; }
.progbar { height: 100%; width: 0; background: linear-gradient(90deg, var(--red), var(--navy)); border-radius: 0 3px 3px 0; transition: width 0.6s; }

/* ===== Hero (real photo, Ken Burns pan/zoom) ===== */
.hero { position: relative; background: var(--navy); overflow: hidden; height: clamp(280px, 42vw, 460px); }
.hero .kbimg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
  animation: kb 20s ease-in-out infinite alternate;
}
@keyframes kb { from { transform: scale(1.0); } to { transform: scale(1.06); } }
.hero-scrim { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.5), rgba(0,0,0,0) 60%); pointer-events: none; }
.hero-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0 20px 20px; max-width: var(--maxw); margin: 0 auto; color: #fff;
}
.hero-badge {
  display: inline-block; align-self: flex-start; border: 2px dashed rgba(255,255,255,0.65);
  border-radius: 999px; padding: 6px 18px; font-size: 17px; font-weight: 600; margin-bottom: 10px;
  background: rgba(30,74,104,0.4);
}
.hero h1 {
  font-family: 'Amatic SC', 'Heebo', cursive; font-weight: 700; font-size: 46px; line-height: 1;
  margin: 0; text-shadow: 0 2px 14px rgba(0,0,0,0.5);
}
.hero-sub { margin: 6px 0 0; font-size: 16.5px; font-weight: 500; text-shadow: 0 1px 8px rgba(0,0,0,0.55); }

/* trip-info strip (flight + timezone, PDF page 1) */
.tripinfo {
  max-width: var(--maxw); margin: 0 auto; padding: 12px 16px 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.tripinfo .chip {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 999px;
  padding: 7px 14px; font-size: 14.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}
.tripinfo .chip b { color: var(--navy); }
.flight-status { margin-inline-start: 5px; padding-inline-start: 5px; border-inline-start: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.flight-status.landed { color: var(--green); font-weight: 700; }
.flight-status.delayed { color: #a06a1e; font-weight: 700; }
.flight-status.cancelled { color: var(--red); font-weight: 700; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* offset anchor jumps for the sticky header */
#map-sec, #finale, .date-group { scroll-margin-top: 74px; }

/* horizontal scroll rows (weather cities row only - see .wx-row) */
.hscroll { display: flex; gap: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 14px 2px 4px; }
.hscroll::-webkit-scrollbar { height: 0; }

/* quick links: no-scroll grid - weather spans the full width on top,
   the other two sit side-by-side below (zero horizontal scroll at any width) */
.quicklinks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px 2px 4px; }
.quicklinks .quicklink:first-child { grid-column: 1 / -1; }

.quicklink {
  display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px;
  background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 8px 14px;
  text-decoration: none; font-weight: 600; font-size: 14.5px; color: var(--ink);
  text-align: center; overflow-wrap: break-word;
}
.quicklink .flag-il { width: 18px; height: auto; flex: none; border-radius: 1px; }

/* ===== Card ===== */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px 18px; margin: 14px 0 0;
  box-shadow: 0 2px 5px rgba(30,74,104,0.08), 0 14px 30px -18px rgba(30,74,104,0.35);
}
.card h2 { font-family: 'Amatic SC', 'Heebo', cursive; font-weight: 700; font-size: 32px; color: var(--navy); margin: 0 0 4px; }
.card .lede { margin: 0 0 12px; font-size: 14.5px; color: var(--muted); }

/* weather */
.wx-row { display: flex; gap: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 2px 2px 6px; }
.wx-city { flex: none; text-decoration: none; background: var(--bluebg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; color: var(--ink); }
.wx-city .name { font-weight: 700; font-size: 15px; color: var(--navy); margin-bottom: 6px; text-align: center; }
.wx-days { display: flex; gap: 12px; }
.wx-day { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.wx-day .d { font-size: 14px; color: var(--muted); }
.wx-day .i { font-size: 21px; line-height: 1.2; }
.wx-day .hi { font-size: 16px; font-weight: 700; }
.wx-day .lo { font-size: 14px; color: var(--muted); }

/* packing chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
  background: #edf3ea; border: 1.5px solid #cdd9c9; color: #3c5741; border-radius: 999px;
  padding: 9px 15px; font-size: 15px; font-weight: 600; min-height: 44px; cursor: pointer;
  font-family: inherit; display: inline-flex; align-items: center; gap: 7px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.chip-btn:active { transform: scale(0.96); }
.chip-btn.done { background: var(--green); border-color: var(--green); color: #fff; }

/* ===== Route map (cartographic base layer + numbered pins) ===== */
.map-card svg { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid #b5cfe4; background: #f4f1e8; overflow: hidden; }
.map-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 10px 2px 12px; font-size: 15px; color: var(--ink); }
.map-legend span { min-width: 0; overflow-wrap: break-word; }
.map-legend b { color: var(--navy); }
.map-btns { display: flex; gap: 10px; }
.btn {
  flex: 1; min-height: var(--tap); display: flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 12px; text-decoration: none; font-weight: 700; font-size: 15px; cursor: pointer;
  font-family: inherit; border: none;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-outline { background: #fff; color: var(--navy); border: 2px solid var(--navy); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* group photos actions */
.gp-actions { display: flex; gap: 10px; }
.map-pin { cursor: pointer; }
.map-pin:focus { outline: 3px solid var(--red); outline-offset: 2px; }

/* ===== Timeline ===== */
.date-group { margin: 26px 0 0; }
.date-head {
  display: flex; align-items: center; gap: 10px; margin: 0 0 4px; padding-right: 4px;
}
.date-head .dnum {
  width: 30px; height: 30px; border-radius: 50%; background: var(--red); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none;
  box-shadow: 0 2px 6px rgba(200,16,46,0.4);
}
.date-head .dlabel { font-weight: 800; font-size: 17px; color: var(--navy); }
.date-head .dwd { background: var(--line); color: var(--navy); font-weight: 700; font-size: 13.5px; border-radius: 8px; padding: 2px 9px; }
.date-head .today-tag { background: var(--red); color: #fff; font-weight: 700; font-size: 13.5px; border-radius: 8px; padding: 2px 9px; }

.stop { scroll-margin-top: 76px; }
.stop.today .stop-card { border: 3px solid var(--red); box-shadow: 0 12px 32px -10px rgba(30,74,104,0.35); }
.stop-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 14px 18px 14px; margin: 8px 0 0;
  box-shadow: 0 2px 5px rgba(30,74,104,0.08), 0 14px 30px -18px rgba(30,74,104,0.35);
}
.today-banner {
  background: var(--red); color: #fff; font-weight: 800; font-size: 15px;
  border-radius: 12px 12px 0 0; padding: 8px 14px; margin: -14px -18px 12px; text-align: center;
}
.stop-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stop-num {
  width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none;
}
.stop-date { background: var(--navy); color: #fff; font-weight: 700; font-size: 13.5px; border-radius: 8px; padding: 3px 9px; }
.stop-card h3 { font-family: 'Heebo', 'Segoe UI', Arial, sans-serif; font-weight: 800; font-size: 23px; line-height: 1.25; color: var(--navy); margin: 9px 0 10px; }

.acts { border: 1px solid #eee6d4; border-radius: 12px; padding: 2px 12px 4px; margin-bottom: 12px; background: #fffdf7; }
.act { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 9px 0; border-bottom: 1px dashed rgba(30,74,104,0.14); }
.act:last-child { border-bottom: none; }
.act-time {
  background: var(--bluebg); color: var(--navy); font-weight: 700; font-size: 15px; border-radius: 7px;
  padding: 3px 8px; white-space: nowrap; margin-top: 2px; font-variant-numeric: tabular-nums; align-self: start;
}
.act-time.notime { background: transparent; padding: 3px 0; color: var(--muted); }
.act-body { font-size: 16px; line-height: 1.55; }
.act-body a[href^="tel:"] { font-weight: 700; white-space: nowrap; }

.hotel {
  background: var(--bluebg); border: 1.5px dashed #9dbdd6; border-radius: 12px;
  padding: 11px 14px; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 15.5px;
}
.hotel .hname { color: var(--navy); font-weight: 700; }
.hotel .hcall {
  font-weight: 600; text-decoration: none; background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; min-height: var(--tap); font-size: 16px; display: inline-flex; align-items: center; gap: 6px;
}
.hotel .href { color: #42566a; }
.hotel .href b { color: var(--navy); }
.hotel .hnote { color: var(--green); font-weight: 600; }

/* per-stop real place photo, classic polaroid frame (offline-safe, bundled + SW-precached) */
.photo-strip { display: flex; justify-content: center; padding: 14px 4px 6px; }
.polaroid { flex: none; background: #fff; padding: 8px; box-shadow: 0 5px 16px rgba(20,40,60,0.2); }
.polaroid .pic { width: 240px; height: 150px; overflow: hidden; background: var(--bluebg); }
.polaroid .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.polaroid figcaption {
  font-family: 'Amatic SC', 'Heebo', cursive; font-weight: 700; font-size: 26px;
  color: #1e4a68; text-align: center; padding: 8px 4px 2px; line-height: 1.05;
}

.stop-links { display: flex; flex-wrap: wrap; gap: 8px 8px; margin-top: 10px; }
.stop-links a {
  min-height: 44px; padding: 8px 14px; font-size: 15px; background: #fff;
  border: 1.5px solid var(--line); border-radius: 999px; display: inline-flex; align-items: center;
}
.stop-links a.nav-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.stop-actions { display: flex; gap: 10px; margin: 12px 0 2px; }

/* ===== Finale ===== */
.finale { position: relative; overflow: hidden; background: var(--navy); border-radius: 18px; padding: 40px 20px 44px; margin: 24px 0 26px; text-align: center; color: #fff; }
.finale-flag { display: flex; justify-content: center; }
.finale-flag svg { width: 40px; height: auto; border-radius: 3px; box-shadow: 0 3px 10px rgba(0,0,0,0.3); }
.finale h2 { font-family: 'Amatic SC', 'Heebo', cursive; font-weight: 700; font-size: 48px; margin: 8px 0 6px; }
.finale p { margin: 0; font-size: 16px; color: var(--line); }

/* photo credits (collapsible, offline-safe attribution list) */
.credits { max-width: var(--maxw); margin: 6px auto 0; padding: 0 16px; }
.credits summary {
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted);
  padding: 10px 0; list-style: none;
}
.credits summary::-webkit-details-marker { display: none; }
.credits summary::before { content: '\25b8'; display: inline-block; margin-inline-end: 6px; transition: transform 0.2s; }
.credits[open] summary::before { transform: rotate(90deg); }
.credits ul { margin: 0 0 8px; padding: 0 18px 0 0; font-size: 13px; line-height: 1.7; color: var(--muted); }
.credits li a { font-size: 13px; }
.credits .credits-note { margin: 0 0 10px; font-size: 13px; color: var(--muted); }

.footer { text-align: center; font-size: 14px; color: #8a8264; padding: 0 0 18px; }

/* ===== Bottom bar ===== */
.bottombar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  background: rgba(30,74,104,0.97); backdrop-filter: blur(8px);
  box-shadow: 0 -4px 18px rgba(20,40,60,0.25);
}
.bottombar-inner {
  max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px;
  padding: 6px 10px calc(8px + env(safe-area-inset-bottom));
}
.bb-btn {
  background: transparent; border: none; border-radius: 12px; color: #fff; min-height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  cursor: pointer; font-family: inherit;
}
.bb-btn.emerg { background: rgba(200,16,46,0.25); border: 1px solid rgba(200,16,46,0.55); }
/* today is the primary always-reachable quick-action (fixed, thumb-reach) - give it a
   light card-colored fill so it visibly reads as THE highlighted control vs the plain
   מפה link, without competing with emerg's red "urgent" accent */
.bb-btn.today { background: var(--card); border: 1px solid rgba(255,255,255,0.4); box-shadow: 0 2px 8px rgba(0,0,0,0.18); }
.bb-btn.today .lbl { color: var(--navy); }
.bb-btn:active { transform: scale(0.96); }
.bb-btn .ico { font-size: 19px; }
.bb-btn .lbl { font-size: 14px; font-weight: 700; }

/* ===== Emergency sheet ===== */
.backdrop { position: fixed; inset: 0; background: rgba(10,20,30,0.5); z-index: 70; opacity: 0; pointer-events: none; transition: opacity 0.28s; }
.backdrop.open { opacity: 1; pointer-events: auto; }
.sheet-wrap { position: fixed; bottom: 0; left: 0; right: 0; z-index: 80; display: flex; justify-content: center; pointer-events: none; }
.sheet {
  pointer-events: auto; width: min(var(--maxw), 100%); background: #fff; border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px rgba(10,20,30,0.35); padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(112%); transition: transform 0.32s cubic-bezier(0.3,0.8,0.3,1);
}
.sheet.open { transform: translateY(0); }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: #d8d2c2; margin: 4px auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head h2 { font-family: 'Amatic SC', 'Heebo', cursive; font-weight: 700; font-size: 32px; color: var(--red); margin: 0; }
.sheet-close { background: #f1ede2; border: none; border-radius: 50%; width: 40px; height: 40px; font-size: 16px; cursor: pointer; color: var(--ink); }
.emerg-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.emerg-big {
  background: var(--red); color: #fff; border-radius: 12px; min-height: 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; text-decoration: none;
}
.emerg-big b { font-size: 20px; }
.emerg-big span { font-size: 13.5px; font-weight: 600; }
.emerg-contact {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 56px;
  padding: 8px 4px; border-bottom: 1px solid #efe9da; text-decoration: none;
}
.emerg-contact:last-child { border-bottom: none; }
.emerg-contact .cn { font-weight: 600; font-size: 15.5px; color: var(--ink); }
.emerg-contact .cp { font-weight: 700; color: var(--navy); white-space: nowrap; }

/* LTR runs inside RTL (phone numbers, dates, codes) */
.ltr { direction: ltr; unicode-bidi: isolate; }

/* reveal-on-scroll */
.rv-t { opacity: 0; transform: translateY(22px); }
.rv { animation: rvIn 0.6s cubic-bezier(0.2,0.7,0.2,1) both; }
@keyframes rvIn { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .rv-t { opacity: 1; transform: none; }
  .kbimg { animation: none; transform: none; }
}

/* small phones */
@media (max-width: 380px) {
  body { font-size: 16px; }
  .hero h1 { font-size: 40px; }
  .card h2 { font-size: 28px; }
  .stop-card h3 { font-size: 21px; }
  .map-legend { grid-template-columns: 1fr; }
}
