/* =========================================================================
   Shared trip site. Structure and layout live here; themes only set tokens
   and add decoration under [data-trip-theme="…"] (see css/themes/).
   ========================================================================= */

/* ---------- token contract (defaults; every theme overrides) ---------- */
.trip-site {
  --t-bg: #eef3f8;
  --t-bg-image: none;
  --t-bg-size: auto;
  --t-ink: #172b4d;
  --t-muted: #52657a;
  --t-surface: #ffffff;
  --t-surface-2: #f2f5f9;
  --t-border: #cbd6e2;
  --t-border-w: 2px;
  --t-primary: #1f5fa8;   --t-on-primary: #ffffff;
  --t-secondary: #7a46b8; --t-on-secondary: #ffffff;
  --t-accent: #f0aa44;    --t-on-accent: #172b4d;
  --t-btn-border: transparent;
  --t-link: var(--t-primary);
  --t-focus: #164fbd;
  --t-warn-bg: #fff1c2;   --t-warn-ink: #5c3d00;
  --t-shadow: 0 8px 26px rgba(15, 35, 70, .10);
  --t-shadow-btn: none;
  --t-radius-card: 16px;
  --t-radius-btn: 12px;
  --t-font-display: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --t-font-body: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --t-font-num: var(--t-font-display);
  --t-title-size: clamp(2rem, 4.6vw + .6rem, 3.6rem);
  --t-title-weight: 800;
  --t-title-ink: var(--t-hero-ink);
  --t-title-shadow: none;
  --t-title-transform: none;
  --t-hero-bg: var(--t-surface);
  --t-hero-ink: var(--t-ink);
  --t-hero-muted: var(--t-muted);
  --t-hero-border: var(--t-border);
  --t-eyebrow-ink: var(--t-hero-muted);
  --t-count-bg: var(--t-accent);
  --t-count-ink: var(--t-on-accent);
  --t-count-border: transparent;
  --t-card-bg: var(--t-surface);
  --t-card-ink: var(--t-ink);
  --t-card-muted: var(--t-muted);
  --t-card-border: var(--t-border);
  /* --t-card-head-bg is left unset so headers default to each day's own --accent (set on the card) */
  --t-card-head-ink: #ffffff;
  --t-home-bg: var(--t-card-bg);
  --t-home-ink: var(--t-card-ink);
  --t-page-ink: var(--t-ink);       /* text that sits straight on the page background */
  --t-page-muted: var(--t-muted);
  --t-sheet-bg: var(--t-surface);
  --t-sheet-ink: var(--t-ink);

  /* park + day-kind accents: white text must stay readable on these */
  --park-mk: #1f5cff;
  --park-ep: #7d36e8;
  --park-hs: #d42a24;
  --park-ak: #1e7d1e;
  --park-water: #0b7f9c;
  --park-springs: #b35f00;
  --kind-travel: #0b7f9c;
  --kind-event: #c75400;
  --kind-rest: #c43d6b;
  --kind-open: #66708a;

  /* hand shared brand controls (buttons, fields, dialogs) the theme's colors */
  --sheet-bg: var(--t-sheet-bg);
  --sheet-ink: var(--t-sheet-ink);
  --sheet-muted: var(--t-muted);
  --sheet-border: var(--t-border);
  --sheet-radius: var(--t-radius-card);
  --sheet-font-display: var(--t-font-display);
  --field-bg: var(--t-surface);
  --field-border: var(--t-border);
  --btn-primary-bg: var(--t-primary);
  --btn-primary-ink: var(--t-on-primary);
  --btn-radius: var(--t-radius-btn);
  --focus: var(--t-focus);
  --choice-on-bg: var(--t-surface-2);
  --choice-on-border: var(--t-primary);

  position: relative;
  isolation: isolate;
  min-height: 100vh;
  color: var(--t-ink);
  font-family: var(--t-font-body);
  background-color: var(--t-bg);
  background-image: var(--t-bg-image);
  background-size: var(--t-bg-size);
  -webkit-font-smoothing: antialiased;
}
.trip-shell { container: trip / inline-size; }
.trip-shell.is-mini .trip-site { min-height: 0; }
.trip-site *, .trip-site *::before, .trip-site *::after { box-sizing: border-box; }
.trip-site :focus-visible { outline: 3px solid var(--t-focus); outline-offset: 3px; }
.trip-site a:not(.btn) { color: inherit; }
.trip-site button { font: inherit; }

.ts-backdrop { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.ts-content { position: relative; z-index: 1; }
.ts-wrap { max-width: 1260px; margin: 0 auto; padding: 28px 20px 72px; }
.ts-deco { display: none; pointer-events: none; }

/* ---------- hero ---------- */
.ts-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  margin-bottom: 30px;
}
.ts-masthead { position: relative; min-width: 0; }
.ts-frame {
  position: relative;
  text-align: center;
  padding: 26px 28px 24px;
  color: var(--t-hero-ink);
  background: var(--t-hero-bg);
  border: var(--t-border-w) solid var(--t-hero-border);
  border-radius: var(--t-radius-card);
}
.ts-frame > * { position: relative; z-index: 1; }
.ts-eyebrow {
  margin: 0 0 10px;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--t-eyebrow-ink);
}
.ts-title {
  margin: 0;
  font-family: var(--t-font-display);
  font-size: var(--t-title-size);
  font-weight: var(--t-title-weight);
  line-height: 1.05;
  text-transform: var(--t-title-transform);
  color: var(--t-title-ink);
  text-shadow: var(--t-title-shadow);
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.ts-dates { margin: 12px 0 0; font-weight: 700; font-size: 1rem; color: var(--t-hero-muted); }

.ts-side { display: flex; flex-direction: column; align-items: stretch; gap: 14px; width: 200px; }
.ts-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 112px;
  padding: 12px 16px;
  text-align: center;
  color: var(--t-count-ink);
  background: var(--t-count-bg);
  border: var(--t-border-w) solid var(--t-count-border);
  border-radius: var(--t-radius-card);
}
.ts-count-n { font-family: var(--t-font-num); font-size: 3.2rem; font-weight: 800; line-height: 1; }
.ts-count-l { font-size: .8rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.ts-actions { display: flex; flex-direction: column; gap: 10px; }

.ts-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 16px;
  font-family: var(--t-font-body);
  font-size: .95rem;
  font-weight: 800;
  line-height: 1.1;
  text-decoration: none;
  color: var(--t-on-primary);
  background: var(--t-primary);
  border: var(--t-border-w) solid var(--t-btn-border);
  border-radius: var(--t-radius-btn);
  box-shadow: var(--t-shadow-btn);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.trip-site a.ts-btn { color: var(--t-on-primary); }
.ts-btn-2 { background: var(--t-secondary); color: var(--t-on-secondary); }
.ts-btn-3 { background: var(--t-accent); color: var(--t-on-accent); }
.ts-btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.ts-btn:active { transform: translateY(1px); }
.ts-btn-sm { min-height: 44px; padding: 8px 14px; font-size: .88rem; }

/* ---------- setup nudge (planner only) ---------- */
.ts-nudge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin: -6px 0 26px;
  padding: 12px 16px;
  color: var(--t-card-ink);
  background: var(--t-card-bg);
  border: 2px dashed var(--t-card-border);
  border-radius: var(--t-radius-card);
}
.nudge-meter { width: 120px; height: 10px; border-radius: 99px; overflow: hidden; background: var(--t-surface-2); }
.nudge-meter span { display: block; height: 100%; background: var(--t-primary); border-radius: inherit; }
.nudge-text { margin: 0; font-weight: 800; }
.nudge-links { display: flex; flex-wrap: wrap; gap: 8px; }
.trip-site .nudge-link {
  display: inline-flex; align-items: center; min-height: 36px; padding: 4px 12px;
  font-size: .85rem; font-weight: 700; text-decoration: none;
  color: var(--t-card-ink); background: var(--t-surface-2); border-radius: 999px;
}
.trip-site .nudge-link::before { content: "+"; margin-right: 6px; font-weight: 900; color: var(--t-primary); }

/* ---------- day cards ---------- */
.ts-day-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  gap: 16px;
}
.dc-li { display: flex; min-width: 0; }
.day-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 210px;
  padding: 0;
  text-align: center;
  color: var(--t-card-ink);
  background: var(--t-card-bg);
  border: var(--t-border-w) solid var(--t-card-border);
  border-radius: var(--t-radius-card);
  box-shadow: var(--t-shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.day-card:hover { transform: translateY(-3px); }
.dc-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 8px 6px 7px;
  color: var(--t-card-head-ink);
  background: var(--t-card-head-bg, var(--accent, var(--t-primary)));
}
.dc-dow { font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.dc-date { font-family: var(--t-font-display); font-size: 1.2rem; line-height: 1.1; }
.dc-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px 6px;
  min-width: 0;
}
.dc-icon { font-size: 2.6rem; line-height: 1.05; }
.dc-title { font-family: var(--t-font-display); font-size: 1.06rem; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.dc-sub { font-size: .8rem; font-weight: 700; line-height: 1.25; color: var(--t-card-muted); overflow-wrap: anywhere; }
.dc-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 6px;
  padding: 6px 8px 10px;
  font-size: .74rem;
  font-weight: 800;
}
.dc-plans { color: var(--t-card-muted); }
.dc-warn { padding: 1px 8px; border-radius: 999px; color: var(--t-warn-ink); background: var(--t-warn-bg); }
.dc-open .dc-icon { opacity: .8; }

/* weather chip */
.wx { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; background: var(--t-surface-2); color: var(--t-card-ink); white-space: nowrap; }
.wx-lo { opacity: .75; }
.wx-typical { color: var(--t-card-muted); filter: grayscale(1); }
.wx-tag { font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; }
.wx-rain { color: #0b5f86; }

/* ---------- info cards ---------- */
.ts-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); align-items: start; gap: 18px; margin-top: 30px; }
.info-card {
  position: relative;
  padding: 18px 20px;
  color: var(--t-card-ink);
  background: var(--t-card-bg);
  border: var(--t-border-w) solid var(--t-card-border);
  border-radius: var(--t-radius-card);
  box-shadow: var(--t-shadow);
  min-width: 0;
}
.home-card {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  color: var(--t-home-ink);
  background: var(--t-home-bg);
}
.ic-art { display: grid; place-items: center; width: 92px; height: 92px; font-size: 3.4rem; border-radius: var(--t-radius-card); background: var(--t-surface-2); }
.ic-kicker { margin: 0; font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; opacity: .8; }
.ic-title { margin: 2px 0 8px; font-family: var(--t-font-display); font-size: 1.4rem; line-height: 1.15; }
.ic-line { margin: 3px 0; font-size: .93rem; line-height: 1.45; }
.ic-note { margin: 8px 0 0; font-size: .9rem; line-height: 1.45; opacity: .9; }
.ic-links { display: flex; flex-direction: column; gap: 10px; }
/* A resort stay shows that resort's postcard (public/img/resorts/) in place of the theme's house art. Themes only frame it,
   through --resort-frame, --resort-radius and --resort-shadow. */
.trip-site .home-card .ic-art.ic-resort {
  align-self: center; width: 300px; height: auto; min-height: 0; aspect-ratio: 8 / 5; margin: 0; padding: 0; overflow: hidden;
  font-size: 0; background: var(--t-surface-2); filter: none; -webkit-mask-image: none; mask-image: none;
  border: var(--resort-frame, 4px solid #FFFFFF); border-radius: var(--resort-radius, 16px);
  box-shadow: var(--resort-shadow, 0 8px 20px rgba(27, 16, 48, .22));
}
.ic-resort img { display: block; width: 100%; height: 100%; object-fit: cover; }
.leg-list, .pc-list { list-style: none; margin: 0; padding: 0; }
.leg + .leg { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--t-card-border); }
.leg-head { margin: 0 0 4px; font-weight: 800; }
.pc-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pc-chip { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--t-surface-2); }
.pc-emoji { display: grid; place-items: center; width: 32px; height: 32px; font-size: 1.3rem; border-radius: 50%; background: var(--t-card-bg); }
.pc-name { font-weight: 800; }
.pc-meta { font-size: .78rem; color: var(--t-card-muted); font-weight: 700; }

/* secrets: confirmation numbers and door codes hide behind a tap */
.secret-l { font-weight: 700; }
.trip-site .reveal {
  min-height: 32px;
  padding: 2px 10px;
  font-size: .85rem;
  font-weight: 800;
  color: inherit;
  background: var(--t-surface-2);
  border: 1px dashed currentColor;
  border-radius: 8px;
  cursor: pointer;
}
.trip-site .reveal.shown { border-style: solid; font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .06em; }

.ts-footer { margin-top: 44px; text-align: center; font-size: .85rem; font-weight: 600; color: var(--t-page-muted); }
.ts-footer a { color: var(--t-page-ink); font-weight: 800; }
.ts-banner {
  margin: -10px 0 24px; padding: 10px 16px; text-align: center; font-weight: 700;
  color: var(--t-warn-ink); background: var(--t-warn-bg); border-radius: var(--t-radius-card);
}
.ts-print { display: none; }

/* ---------- day sheet (themed dialog) ---------- */
.day-sheet .sheet-inner { max-width: 620px; }
.ds-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; font-size: .85rem; font-weight: 700; }
.ds-chip, .day-sheet .wx { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--t-surface-2); color: var(--t-ink); }
.ds-issues { list-style: none; margin: 0 0 14px; padding: 0; }
.ds-issues li, .tl-issue {
  padding: 8px 12px; border-radius: 10px; font-weight: 700; font-size: .9rem;
  color: var(--t-warn-ink); background: var(--t-warn-bg);
}
.ds-issues li + li { margin-top: 6px; }
.ds-empty { padding: 18px; text-align: center; color: var(--t-muted); background: var(--t-surface-2); border-radius: 12px; }
.tl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tl-item {
  --accent: var(--t-primary);
  display: grid;
  grid-template-columns: 4.6rem 2.4rem minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: start;
  padding: 12px 12px 12px 10px;
  background: var(--t-surface);
  border: 1px solid var(--t-border);
  border-left: 6px solid var(--accent);
  border-radius: 12px;
}
.tl-time { padding-top: 3px; font-size: .8rem; font-weight: 800; color: var(--t-muted); white-space: nowrap; }
.tl-icon { font-size: 1.7rem; line-height: 1.1; text-align: center; }
.tl-main > p { margin: 0; }
.tl-tag { font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--t-muted); }
.tl-title { font-weight: 800; font-size: 1.02rem; line-height: 1.25; }
.tl-meta, .tl-who, .tl-secret { font-size: .88rem; margin-top: 2px !important; }
.tl-notes { margin-top: 6px !important; font-size: .9rem; line-height: 1.45; white-space: pre-wrap; }
.tl-issue { margin-top: 8px !important; }
.tl-edit {
  align-self: center; min-height: 40px; padding: 6px 12px; font-size: .85rem; font-weight: 800; text-decoration: none;
  color: var(--t-ink); background: var(--t-surface-2); border: 1px solid var(--t-border); border-radius: 10px; cursor: pointer;
}
.tl-hop { padding: 4px 0 4px 5.6rem; font-weight: 800; font-size: .88rem; color: var(--t-muted); }
.tl-leg { --accent: var(--kind-travel); }
.tl-rest { --accent: var(--kind-rest); }
.tl-note { --accent: var(--kind-open); }
.tl-reservation { --accent: var(--t-secondary); }
.tl-ll { --accent: var(--t-accent); }
.ds-add { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--t-border); }
.ds-add-h { margin: 0 0 10px; font-weight: 800; }
.ds-add-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.ds-add-btn {
  display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 12px; text-align: left;
  font-weight: 700; color: var(--t-ink); background: var(--t-surface-2); border: 1px solid var(--t-border); border-radius: 12px; cursor: pointer;
}
.ds-add-btn:hover { border-color: var(--t-primary); }

/* theme preview bar (settings → try a theme) */
.theme-bar {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 50; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; width: min(680px, calc(100% - 24px)); padding: 10px;
  color: #fff; background: rgba(15, 45, 86, .96); border-radius: 18px; box-shadow: 0 12px 40px rgba(0,0,0,.35);
  font-family: "Poppins", system-ui, sans-serif;
}
.theme-bar .tb-name { flex: 1; min-width: 0; text-align: center; font-weight: 700; line-height: 1.2; }
.theme-bar .tb-name small { display: block; font-weight: 500; opacity: .8; }
.theme-bar button { min-height: 44px; min-width: 44px; padding: 8px 12px; font-weight: 700; color: #fff; background: rgba(255,255,255,.12); border: 0; border-radius: 12px; cursor: pointer; }
.theme-bar .tb-use { background: #FF8B7A; color: #0F2D56; }

/* ---------- tablet ---------- */
@container trip (max-width: 899px) {
  .ts-hero { grid-template-columns: 1fr; }
  .ts-side { width: auto; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; }
  .ts-count { min-height: 0; min-width: 150px; }
  .ts-actions { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .trip-site .home-card .ic-art.ic-resort { width: 240px; }
}

/* ---------- phone: one column, cards turn sideways ---------- */
@container trip (max-width: 599px) {
  .ts-wrap { padding: 16px 16px 64px; }
  .ts-hero { gap: 16px; margin-bottom: 22px; }
  .ts-frame { padding: 20px 16px 18px; }
  .ts-count { flex-direction: row; gap: 8px; min-width: 0; padding: 8px 14px; }
  .ts-count-n { font-size: 2rem; }
  .ts-actions { gap: 8px; }
  .ts-actions .ts-btn { padding: 8px 12px; font-size: .88rem; }
  .ts-day-grid { grid-template-columns: 1fr; gap: 12px; }
  .day-card { flex-direction: row; min-height: 84px; text-align: left; }
  .dc-head { flex: none; justify-content: center; width: 74px; padding: 8px 4px; }
  .dc-body {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: center;
    justify-items: start;
    column-gap: 12px;
    row-gap: 2px;
    padding: 10px 6px 10px 12px;
  }
  .dc-icon { grid-row: 1 / span 2; font-size: 2rem; align-self: center; }
  .dc-sub { grid-column: 2; }
  .dc-foot { flex: none; flex-direction: column; align-items: flex-end; justify-content: center; max-width: 128px; padding: 8px 10px 8px 0; }
  .dc-foot .dc-warn { white-space: nowrap; }
  .dc-foot .wx { padding: 1px 6px; }
  .dc-foot .wx-tag { display: none; }
  .dc-foot .dc-warn, .dc-foot .dc-plans { text-align: right; }
  .dc-date { font-size: 1.05rem; }
  .home-card { grid-template-columns: auto minmax(0, 1fr); gap: 14px; padding: 16px; }
  .ic-art { width: 60px; height: 60px; font-size: 2.2rem; align-self: start; }
  .trip-site .home-card:has(.ic-resort) { grid-template-columns: minmax(0, 1fr); }
  .trip-site .home-card .ic-art.ic-resort { grid-column: 1 / -1; width: auto; }
  .ic-links { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .ic-links .ts-btn { flex: 1 1 140px; }
  .tl-item { grid-template-columns: 2.2rem minmax(0, 1fr) auto; }
  .tl-time { grid-column: 2; grid-row: 1; padding: 0; }
  .tl-icon { grid-column: 1; grid-row: 1 / span 2; }
  .tl-main { grid-column: 2; }
  .tl-edit { grid-column: 3; grid-row: 1 / span 2; }
  .tl-hop { padding-left: 3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .trip-site *, .trip-site *::before, .trip-site *::after { animation: none !important; transition: none !important; }
}
