/* ---- TripTrack — shared styles ------------------------------------------ */

/* Smooth same-origin page changes (iOS Safari 18+ / Chrome; no-op elsewhere).
   Switching stops via the chevrons slides left/right; everything else cross-fades. */
@view-transition {
  navigation: auto;
}

@keyframes vt-out-left  { to   { transform: translateX(-100%); } }
@keyframes vt-in-right  { from { transform: translateX(100%);  } }
@keyframes vt-out-right { to   { transform: translateX(100%);  } }
@keyframes vt-in-left   { from { transform: translateX(-100%); } }

@media (prefers-reduced-motion: no-preference) {
  /* next stop → current slides out left, next slides in from the right */
  :root:active-view-transition-type(forward)::view-transition-old(root) {
    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both vt-out-left;
  }
  :root:active-view-transition-type(forward)::view-transition-new(root) {
    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both vt-in-right;
  }
  /* previous stop → the reverse */
  :root:active-view-transition-type(back)::view-transition-old(root) {
    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both vt-out-right;
  }
  :root:active-view-transition-type(back)::view-transition-new(root) {
    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both vt-in-left;
  }
}

:root {
  --accent: #c1813c;                 /* IBM Plex Mono dates, thumbnail tint  */
  --accent-30: rgba(193, 129, 60, 0.30); /* solid thumbnail placeholder      */
  --accent-20: rgba(193, 129, 60, 0.20); /* card border                       */
  --ink: #111111;                    /* grey-900 — titles & area names        */
  --pill-bg: rgba(243, 230, 216, 0.5); /* stat pills                          */
  --page-top: #ffffff;
  --page-bottom: #f9f6f1;
  --phone-w: 393px;                  /* iPhone-ish column width               */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-family: "Barlow Condensed", system-ui, sans-serif;
  color: var(--ink);
  /* White on mobile so iOS Safari's status-bar tint (which falls back to the
     body background when theme-color isn't honored) stays white. The neutral
     desktop backdrop is applied only on wider screens below. */
  background: #ffffff;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

/* The mobile "device" column — full-width on phones, framed on larger screens. */
.phone {
  width: 100%;
  max-width: var(--phone-w);
  min-height: 100vh;
  background: linear-gradient(180deg, var(--page-top) 0%, var(--page-bottom) 100%);
  position: relative;
  overflow-x: hidden;
}

@media (min-width: 430px) {
  body { padding: 24px 0; background: #ded7cb; }
  .phone {
    min-height: calc(100vh - 48px);
    border-radius: 28px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    overflow: hidden;
  }
}

/* ---- Homepage ------------------------------------------------------------ */

.home__header {
  padding: 24px 16px 8px;
  text-align: center;
}

.home__title {
  margin: 0;
  font-weight: 600;                 /* Barlow Condensed SemiBold */
  font-size: 36px;
  line-height: 1.05;
  color: var(--ink);
}

.stats {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.stat {
  background: var(--pill-bg);
  border-radius: 100px;
  padding: 4px 12px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
}

/* Vertical route line running down through the thumbnails. */
.stops {
  position: relative;
  padding: 24px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stops::before {
  content: "";
  position: absolute;
  top: 24px;
  bottom: 40px;
  left: calc(16px + 38.5px);        /* centered on the 77px thumbnails */
  width: 0;
  border-left: 1px dashed var(--accent);
  z-index: 0;
}

/* ---- Stop card ----------------------------------------------------------- */

.card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 8px;                         /* name over date (Figma) */
  text-decoration: none;
  color: inherit;
  background: #ffffff;
  border: 1px solid var(--accent-20);
  border-radius: 12px;
  overflow: hidden;
  min-height: 77px;
  padding: 16px 16px 16px 93px;     /* leaves room for the 77px thumbnail */
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.03);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.card:active { transform: scale(0.99); }

@media (hover: hover) {
  .card:hover { box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08); }
}

/* Solid-color thumbnail placeholder (real images come later). */
.card__thumb {
  position: absolute;
  top: -1px;
  left: -1px;
  width: 77px;
  height: calc(100% + 2px);           /* fill full card height (+2px for borders) */
  object-fit: cover;                  /* when it's an <img> illustration */
  background: var(--accent-30);       /* fallback color */
}

/* ---- trip-day states (homepage, during the trip only) ------------------- */

/* Past day: contents fade to 30% (card frame stays). */
.card--past .card__date,
.card--past .card__area,
.card--past .card__thumb {
  opacity: 0.3;
}

/* Current day: full-accent border + a "Today" pill. */
.card--current {
  border-color: var(--accent);
}

.card__today {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  background: #d6f7dc;
  color: #008412;
  opacity: 0.6;
  border-radius: 100px;
  padding: 4px 12px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 14px;
  line-height: 1;
}

.card__date {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.1;
  color: var(--accent);
}

.card__area {
  font-weight: 500;                 /* Barlow Condensed Medium */
  font-size: 24px;
  line-height: 1.2;
  color: var(--ink);
}

/* ---- Stop detail --------------------------------------------------------- */

.detail__header {
  position: relative;
  margin: 0 16px 10px;                /* everything moved up 24px */
}

/* On the framed desktop layout there's no status bar above the frame, so the
   back button would sit flush against the top edge. (Must come after the rule
   above: media queries add no specificity, and that `margin` shorthand would
   otherwise reset the top margin.) */
@media (min-width: 430px) {
  .detail__header { margin-top: 24px; }
}

/* text "← Back" at the top */
.detail__back {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  /* keep it out of the sliding page layer so it stays fixed during transitions */
  view-transition-name: detail-back;
}

/* stop name centered, with a chevron on each side */
.detail__nav {
  position: relative;
  min-height: 48px;                   /* grows for a two-line title */
  margin-top: 9px;                    /* space below the back button (−5px) */
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail__title {
  margin: 0;
  max-width: calc(100% - 96px);       /* leave room for the 48px chevrons */
  font-family: "Barlow Condensed", system-ui, sans-serif;
  font-weight: 600;                   /* SemiBold */
  font-size: 36px;
  line-height: 1.02;
  color: var(--ink);
  text-align: center;
}

.detail__chev {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.detail__chev--prev { left: 0; view-transition-name: chev-prev; }
.detail__chev--next { right: 0; view-transition-name: chev-next; }
.detail__chev--hidden { visibility: hidden; }

/* Main "sleeping at" card */
.detail__card {
  margin: 0 16px;
  border: 1px solid var(--accent-20);
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.03);
  overflow: hidden;
  background: #fff;
}

.detail__hero {
  position: relative;
  height: 203px;
  background: var(--accent-30);       /* fallback color */
  overflow: hidden;
}

.detail__hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* date badge on the image */
.detail__tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #fff;
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.03);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 600;                   /* SemiBold */
  font-size: 14px;
  line-height: 1;
  color: var(--accent);
}

.detail__body {
  padding: 24px 16px;                 /* py 24 / px 16 */
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.detail__block {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail__label {
  margin: 0;                          /* reset UA <p> margin (collapsed to 14px) */
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 14px;
  color: var(--accent);
}

.detail__place {
  margin: 4px 0 0;
  font-weight: 600;
  font-size: 32px;
  line-height: 38px;
  color: var(--ink);
}

.detail__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Payment-status pills (dot + colored background). */
.pill--status {
  display: inline-flex;
  align-items: center;
}

.pill--paid          { background: #e2f9e7; color: #008211; } /* green  */
.pill--free          { background: #e7efff; color: #002b80; } /* blue   */
.pill--partial       { background: #fff7c4; color: #806f00; } /* amber  */
.pill--booked-unpaid { background: #fff1e1; color: #ab5900; } /* orange */
.pill--not-booked    { background: #ffeeeb; color: #c51700; } /* red    */

.detail__map {
  display: flex;
  height: 48px;
  padding: 10px;
  justify-content: center;
  align-items: center;
  gap: 10px;
  align-self: stretch;
  border: 0;
  border-radius: 4px;
  background: #3e60ed;
  color: #fff;
  font-family: "Barlow Condensed", system-ui, sans-serif;
  font-weight: 600;
  font-size: 22px;
  text-decoration: none;
  cursor: pointer;
}

/* No map link yet (e.g. a friend's house / not-booked stop). */
.detail__map--disabled {
  background: #c9c4bb;
  cursor: default;
}

/* Optical tweak: shift the label up 1px within the button. */
.detail__map {
  padding-top: 9px;
  padding-bottom: 11px;
}

/* "We might wanna see…" */
.suggest {
  margin: 30px 0 40px;                /* 30px gap below the card (Figma) */
}

.suggest__label {
  padding: 0 16px;
  margin: 0 0 12px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 14px;
  color: var(--accent);
}

.suggest__row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 0 0 10px;                   /* room for the card shadow (not clipped) */
  scroll-snap-type: x proximity;
  scroll-padding-left: 16px;          /* so snap rests at the 16px inset */
  -webkit-overflow-scrolling: touch;
}

/* Start/end insets via margins — a scrolling flex row drops its own
   left/right padding once the content overflows. */
.suggest__row > .suggest__card:first-child { margin-left: 16px; }
.suggest__row > .suggest__card:last-child { margin-right: 16px; }

.suggest__row::-webkit-scrollbar { display: none; }
.suggest__row { scrollbar-width: none; }

.suggest__card {
  flex: 0 0 auto;
  /* adaptive: 2 full cards + both 12px gaps + 16px left inset + ~6px peek of the
     3rd card = viewport width  →  card = (100% - 16 - 12 - 12 - 6) / 2 */
  width: calc((100% - 46px) / 2);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--accent-20);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  scroll-snap-align: start;
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.03);   /* same as the homepage cards */
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.suggest__card { cursor: pointer; }
.suggest__card:active { transform: scale(0.98); }

@media (hover: hover) {
  .suggest__card:hover { box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08); }
}

.suggest__img {
  height: 118px;
  background: var(--accent-30);
  display: flex;
  align-items: center;
  justify-content: center;
}

.suggest__img span {                  /* "AI" placeholder glyph */
  font-family: "Lora", Georgia, serif;
  font-weight: 500;
  font-size: 54px;
  color: #f6e2ca;
}

.suggest__photo {                     /* real photo fills the image area */
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.suggest__meta {
  padding: 10px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* name + description group (its own tappable link) */
.suggest__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: inherit;
  text-decoration: none;
}

.suggest__name {
  font-weight: 500;
  font-size: 20px;
  line-height: 1.1;
  color: var(--ink);
  display: -webkit-box;                /* wrap to 2 lines instead of truncating */
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.suggest__desc {                      /* short description under the name */
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-weight: 500;                   /* Medium */
  font-size: 13px;
  line-height: 1.25;
  color: #7a7a7a;
  display: -webkit-box;
  -webkit-line-clamp: 3;              /* max 3 lines, then ellipsis */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* category chip + rating (AI-generated cards) */
.suggest__foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.suggest__chip {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 11px;
  text-transform: capitalize;
  padding: 2px 8px;
  border-radius: 100px;
  white-space: nowrap;
}

.suggest__chip--sight   { background: #d6e4fb; color: #2f5fd0; }
.suggest__chip--food    { background: #fbe6b8; color: #8a6300; }
.suggest__chip--nature  { background: #d6f7dc; color: #08843f; }
.suggest__chip--culture { background: #ece0f7; color: #6b3fb0; }
.suggest__chip--detour  { background: #ece6dc; color: #7a6b53; }

.suggest__rating {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 12px;
  color: var(--accent);
}

.suggest__empty {
  padding: 0 16px;
  margin: 0;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 14px;
  color: #8a8178;
}

.suggest__sub {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 14px;
  color: var(--accent);
}

/* ---- bottom sheet ("Why go?") ------------------------------------------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  visibility: hidden;
  pointer-events: none;
}
.sheet.is-open { visibility: visible; pointer-events: auto; }

.sheet__scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.sheet.is-open .sheet__scrim { opacity: 1; }

.sheet__panel {
  position: relative;
  width: 100%;
  max-width: 393px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border-radius: 32px 32px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.sheet.is-open .sheet__panel { transform: translateY(0); }

/* circular close button, floating over the image (stays put while content scrolls) */
.sheet__close {
  position: absolute;
  top: 12px;
  right: 13px;
  z-index: 2;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 1000px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(2px);
  color: #111;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sheet__scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;   /* don't chain scroll to the page behind */
}

.sheet__img {
  width: 100%;
  height: 221px;
  object-fit: cover;
  display: block;
}

.sheet__body {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom, 0px));
}

.sheet__textgroup {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sheet__title {
  margin: 0;
  font-family: "Barlow Condensed", system-ui, sans-serif;
  font-weight: 600;
  font-size: 32px;
  line-height: 38px;
  color: #111;
}

.sheet__why {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.4;
  color: #111;
}
.sheet__why p { margin: 0 0 12px; }
.sheet__why p:last-child { margin-bottom: 0; }
.sheet__why-label { margin: 0 0 4px !important; }
.sheet__why ul { margin: 0 0 12px; padding-left: 24px; }
.sheet__why li { margin-bottom: 2px; }

.sheet__map {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  border-radius: 4px;
  background: #3e60ed;
  color: #fff;
  font-family: "Barlow Condensed", system-ui, sans-serif;
  font-weight: 600;
  font-size: 22px;
  text-decoration: none;
}
