/* ============================================================
   planner.css - "Your best floats" recommender + tabs + inputs.
   Reuses the CSS variables declared in planner.html's <style>
   (--bg, --surface, --ink, --accent, --copper, --rule, ...).
   ============================================================ */

/* ---------- Trip inputs strip ---------- */
.planner-controls { margin: 6px 0 14px; }
.ti-row {
  display: flex; flex-wrap: wrap; gap: 18px 26px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 14px;
  padding: 16px 18px;
}
.ti-group { display: flex; flex-direction: column; gap: 8px; }
.ti-label {
  font-family: 'DM Mono', monospace; font-size: 9.5px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--ink-faint);
}
.ti-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ti-chip {
  font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-3);
  padding: 7px 13px; border-radius: 999px; border: 1.5px solid var(--rule);
  background: var(--bg); cursor: pointer; transition: all .14s;
}
.ti-chip:hover { border-color: var(--accent-soft); color: var(--ink); }
.ti-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.ti-from { justify-content: center; }
.ti-from-val { font-weight: 700; color: var(--ink); font-size: 14px; }
.ti-from-actions { display: inline-flex; gap: 12px; }
.ti-fromset {
  background: none; border: none; padding: 0; cursor: pointer; text-align: left;
  color: var(--accent); font: inherit; font-size: 11.5px; font-weight: 600; text-decoration: underline;
}
.ti-fromclear { color: var(--ink-faint); }
.ti-fromclear:hover { color: var(--copper); }

/* ---------- Tabs ---------- */
.planner-tabs { display: flex; gap: 6px; margin: 4px 0 16px; border-bottom: 1px solid var(--rule); }
.pt-tab {
  font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 600; letter-spacing: .06em;
  padding: 11px 16px; border: none; background: none; color: var(--ink-3); cursor: pointer;
  border-bottom: 2.5px solid transparent; margin-bottom: -1px; transition: all .14s;
}
.pt-tab:hover { color: var(--ink); }
.pt-tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.planner-tab-panel[hidden] { display: none; }

/* ---------- Best floats head ---------- */
.bf-head { margin-bottom: 16px; }
.bf-h { font-family: 'Fraunces', serif; font-weight: 700; font-size: 26px; letter-spacing: -.015em; margin: 0 0 6px; }
.bf-sub { font-size: 14px; color: var(--ink-3); line-height: 1.5; }
.bf-sub strong { color: var(--ink); }
.bf-livenote { color: var(--good, #4a9431); font-weight: 700; }
.bf-foot { font-size: 12px; color: var(--ink-faint); font-style: italic; margin-top: 18px; line-height: 1.5; }

/* ---------- Grid + cards ---------- */
.bf-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.bf-card {
  background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--rule);
  border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px;
}
.bf-card.tier-great { border-left-color: var(--q-stellar-edge, #4a8b2c); }
.bf-card.tier-good  { border-left-color: var(--q-good-edge, #7ba349); }
.bf-card.tier-fair  { border-left-color: var(--q-mixed-edge, #c69200); }
.bf-card.tier-long  { border-left-color: var(--q-poor-edge, #c25a26); }

.bf-top { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; }
.bf-rank {
  font-family: 'Fraunces', serif; font-weight: 700; font-size: 22px; color: var(--accent);
  line-height: 1; min-width: 22px;
}
.bf-name { font-family: 'Fraunces', serif; font-size: 19px; font-weight: 700; margin: 0; line-height: 1.15; }
.bf-trip { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; line-height: 1.4; }
.bf-trip-detail { color: var(--ink-faint); }
.bf-score {
  font-family: 'DM Mono', monospace; font-size: 9.5px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint); white-space: nowrap; padding-top: 4px;
}
.tier-great .bf-score { color: var(--q-stellar-edge, #4a8b2c); }
.tier-good .bf-score  { color: var(--q-good-edge, #7ba349); }

/* chips */
.bf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bf-chip {
  font-size: 11.5px; font-weight: 600; color: var(--ink-3); padding: 4px 10px;
  border-radius: 999px; border: 1px solid var(--rule-soft); background: var(--bg);
}
.bf-chip.diff-easy { color: #2b5a18; border-color: #b6cf9a; background: #eef4e4; }
.bf-chip.diff-moderate { color: #5e4500; border-color: #e3cf94; background: #f7efd8; }
.bf-chip.diff-whitewater { color: #6e2f10; border-color: #e0b199; background: #f7e6dc; }
.bf-chip.bf-cold { color: #164b63; border-color: #a9cbd8; background: #e6f0f4; }
.bf-drive { color: var(--ink); }

/* conditions */
.bf-cond { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12.5px; }
.bf-live { font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.bf-live.in { color: #1f3d10; background: #d7e7c3; }
.bf-live.out { color: #6e2f10; background: #f0dcc9; }
.bf-hist { color: var(--ink-3); }
.bf-wx { color: var(--ink-3); }

/* outfitter + actions */
.bf-book { font-size: 13px; color: var(--ink); }
.bf-book-k {
  font-family: 'DM Mono', monospace; font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-faint); margin-right: 6px;
}
.bf-book a { color: var(--copper); font-weight: 600; text-decoration: none; }
.bf-book a:hover { text-decoration: underline; }
.bf-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.bf-act {
  font-family: 'DM Mono', monospace; font-size: 10.5px; font-weight: 600; letter-spacing: .04em;
  padding: 7px 11px; border-radius: 8px; border: 1.5px solid var(--rule);
  background: var(--bg); color: var(--ink-2); text-decoration: none; transition: all .14s;
}
.bf-act:hover { border-color: var(--accent); color: var(--accent); }

/* loading */
.bf-loading { display: flex; align-items: center; gap: 10px; padding: 40px 8px; color: var(--ink-3); font-size: 14px; }
.bf-spin {
  width: 16px; height: 16px; border: 2.5px solid var(--rule); border-top-color: var(--accent);
  border-radius: 50%; animation: bf-spin 0.8s linear infinite;
}
@keyframes bf-spin { to { transform: rotate(360deg); } }

/* ---------- 14-day "best days" ribbon ---------- */
.bf-ribbon-wrap { margin-bottom: 18px; }
.bf-ribbon-label {
  font-family: 'DM Mono', monospace; font-size: 9.5px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 8px;
}
.bf-ribbon-hint { color: var(--accent); margin-left: 8px; letter-spacing: .1em; }
.bf-ribbon {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.bf-day {
  flex: 0 0 auto; width: 52px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 4px; border: 1.5px solid var(--rule); border-radius: 10px; background: var(--surface);
  cursor: pointer; transition: all .14s;
}
.bf-day:hover { border-color: var(--accent-soft); }
.bf-day.on { border-color: var(--accent); background: rgba(168,200,144,.14); box-shadow: 0 0 0 1.5px var(--accent) inset; }
.bf-day-wd { font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }
.bf-day-num { font-family: 'Fraunces', serif; font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1; }
.bf-day-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--q-unknown-edge, #b8b09b); }
.bf-day-dot.tier-great { background: var(--q-stellar-edge, #4a8b2c); }
.bf-day-dot.tier-good  { background: var(--q-good-edge, #7ba349); }
.bf-day-dot.tier-fair  { background: var(--q-mixed-edge, #c69200); }
.bf-day-dot.tier-long  { background: var(--q-poor-edge, #c25a26); }
.bf-day-wx { font-size: 10px; color: var(--ink-3); font-weight: 600; }

.bf-h-date { color: var(--accent); }

/* ---------- Live trend tag ---------- */
.bf-trend { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.bf-trend.rising { color: #6e2f10; background: #f3ddc7; }
.bf-trend.falling { color: #164b63; background: #dfeef4; }

/* ---------- Trip logistics ---------- */
.bf-logi {
  background: var(--surface-2, #faf6ea); border: 1px solid var(--rule-soft); border-radius: 8px;
  padding: 8px 11px; font-size: 12.5px; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px;
}
.bf-logi-row { color: var(--ink-3); }
.bf-leave { color: var(--ink); }
.bf-leave strong { color: var(--accent); }
.bf-leave.late { color: var(--copper); }
.bf-leave.late strong { color: var(--copper); }

/* ---------- "Plan this trip" CTA ---------- */
.bf-cta { margin-top: 2px; }
.bf-plan {
  width: 100%; font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 600;
  letter-spacing: .06em; padding: 11px 14px; border-radius: 9px; border: 1.5px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer; transition: all .14s;
}
.bf-plan:hover { background: #244c2f; }

/* ============================================================
   TRIP SHEET modal
   ============================================================ */
#tsRoot { position: fixed; inset: 0; z-index: 1000; display: none; }
#tsRoot.open { display: block; }
.ts-backdrop { position: fixed; inset: 0; background: rgba(20,18,12,.5); backdrop-filter: blur(2px); }
.ts-modal {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(660px, calc(100vw - 28px)); max-height: 90vh; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 16px;
  box-shadow: var(--shadow-2, 0 6px 24px rgba(20,18,12,.10));
}
.ts-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 14px;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--rule-soft); position: sticky; top: 0;
  background: var(--bg); z-index: 2; border-radius: 16px 16px 0 0;
}
.ts-eyebrow { font-family: 'DM Mono', monospace; font-size: 9.5px; letter-spacing: .28em; text-transform: uppercase; color: var(--copper); }
.ts-title { font-family: 'Fraunces', serif; font-weight: 700; font-size: 25px; margin: 5px 0 3px; line-height: 1.1; }
.ts-section { font-size: 13.5px; color: var(--ink-2); font-weight: 600; }
.ts-date { font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.ts-close { background: none; border: none; font-size: 26px; line-height: 1; color: var(--ink-faint); cursor: pointer; padding: 0 4px; }
.ts-close:hover { color: var(--ink); }
.ts-body { padding: 8px 24px 22px; }
.ts-block { padding: 16px 0; border-bottom: 1px solid var(--rule-soft); }
.ts-block-h {
  font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 12px; display: flex; align-items: center; gap: 10px;
}
.ts-block-sub { color: var(--ink-3); letter-spacing: .04em; text-transform: none; font-weight: 600; }
/* editable form */
.ts-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.ts-f { display: flex; flex-direction: column; gap: 4px; }
.ts-f span { font-family: 'DM Mono', monospace; font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }
.ts-f input, .ts-f select {
  font-family: 'Inter Tight', system-ui, sans-serif; font-size: 14px; color: var(--ink);
  padding: 9px 11px; border: 1.5px solid var(--rule); border-radius: 8px; background: var(--surface);
  width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box;
}
/* iOS date/time inputs have an intrinsic min-width and ignore width:100%,
   overflowing the right edge - neutralize the native sizing. */
.ts-f input[type="date"], .ts-f input[type="time"] { -webkit-appearance: none; appearance: none; }
.ts-f select { cursor: pointer; }
.ts-f input:focus, .ts-f select:focus { outline: none; border-color: var(--accent); }
.ts-dynamic { margin-top: 2px; }
.ts-ok { color: #2b5a18; font-weight: 700; }
.ts-bad { color: var(--copper); font-weight: 700; }

.ts-facts { display: grid; grid-template-columns: 1fr; gap: 8px; }
.ts-fact { display: grid; grid-template-columns: 130px 1fr; gap: 12px; font-size: 13.5px; }
.ts-fact-k { font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); padding-top: 2px; }
.ts-fact-v { color: var(--ink); line-height: 1.45; }
.ts-fact-v strong { color: var(--accent); }
.ts-warn { margin-top: 12px; font-size: 12.5px; color: #164b63; background: #e6f0f4; border: 1px solid #a9cbd8; border-radius: 8px; padding: 9px 12px; line-height: 1.45; }
.ts-navlinks { margin-top: 14px; display: flex; align-items: center; gap: 18px; }
.ts-navlinks-label { font-family: 'DM Mono', monospace; font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint); }
.ts-navlinks a { color: var(--accent); font-size: 13px; font-weight: 600; text-decoration: none; }
.ts-navlinks a:hover { text-decoration: underline; }
.ts-pk-tag { margin-left: 4px; }
.ts-cond { font-weight: 700; padding: 1px 7px; border-radius: 6px; }
.ts-cond.in { color: #1f3d10; background: #d7e7c3; }
.ts-cond.out { color: #6e2f10; background: #f0dcc9; }
.ts-cond-h { color: var(--ink-3); }
.ts-boats { font-size: 15px; color: var(--ink); margin: 0 0 6px; line-height: 1.5; }
.ts-boats-note { font-size: 13px; color: var(--ink-3); margin: 0 0 10px; line-height: 1.45; }
.ts-inline-links { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.ts-inline-links a { color: var(--accent); font-weight: 600; text-decoration: none; font-size: 13px; }
.ts-inline-links a:hover { text-decoration: underline; }
.ts-book { font-size: 13px; color: var(--ink-3); }
.ts-book a { color: var(--copper); font-weight: 600; text-decoration: none; }
.ts-pk { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 22px; }
.ts-pk-sec { break-inside: avoid; margin-bottom: 8px; }
.ts-pk-h { font-family: 'Fraunces', serif; font-weight: 700; font-size: 14px; color: var(--ink); margin: 6px 0 6px; }
.ts-pk-item { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; color: var(--ink-2); padding: 4px 0; cursor: pointer; line-height: 1.4; }
.ts-pk-item input { margin-top: 2px; accent-color: var(--accent); width: 15px; height: 15px; flex-shrink: 0; }
.ts-pk-item input:checked + span { color: var(--ink-faint); text-decoration: line-through; }
.ts-pk-reset { font-family: inherit; font-size: 11px; color: var(--ink-faint); background: none; border: none; cursor: pointer; text-decoration: underline; margin-left: auto; }
.ts-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 16px; }
.ts-btn {
  font-family: 'DM Mono', monospace; font-size: 11px; font-weight: 600; letter-spacing: .04em;
  padding: 9px 14px; border-radius: 8px; border: 1.5px solid var(--rule); background: var(--surface);
  color: var(--ink-2); cursor: pointer; text-decoration: none; transition: all .14s;
}
.ts-btn:hover { border-color: var(--accent); color: var(--accent); }
.ts-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.ts-btn.primary:hover { background: #244c2f; color: #fff; }
.ts-share-note { margin-top: 10px; font-size: 12.5px; color: var(--good, #4a9431); font-weight: 600; }
.ts-phone { color: var(--copper); font-weight: 600; text-decoration: none; margin-left: 8px; }
.ts-phone:hover { text-decoration: underline; }
.ts-print-url { display: none; }
.ts-sub { color: var(--ink-faint); font-size: 12px; }

/* add-your-own checklist items */
.ts-add {
  margin-top: 12px; font-family: 'DM Mono', monospace; font-size: 11.5px; font-weight: 600;
  color: var(--accent); background: none; border: 1.5px dashed var(--rule); border-radius: 8px;
  padding: 8px 13px; cursor: pointer; transition: all .14s;
}
.ts-add:hover { border-color: var(--accent); background: var(--surface-2, #faf6ea); }
.ts-pk-custom { margin-top: 6px; }
.ts-pk-empty { font-size: 12.5px; color: var(--ink-faint); font-style: italic; }
.ts-custom-item { align-items: center; gap: 9px; }
.ts-custom-text {
  flex: 1; font-family: 'Inter Tight', system-ui, sans-serif; font-size: 13px; color: var(--ink);
  border: none; border-bottom: 1px solid var(--rule); background: none; padding: 3px 2px;
}
.ts-custom-text:focus { outline: none; border-bottom-color: var(--accent); }
.ts-custom-del { background: none; border: none; color: var(--ink-faint); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }
.ts-custom-del:hover { color: var(--copper); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .bf-grid { grid-template-columns: 1fr; }
  .ti-row { gap: 14px 20px; padding: 14px; }
  .bf-h { font-size: 22px; }
  .ts-pk { grid-template-columns: 1fr; }
  .ts-fact { grid-template-columns: 110px 1fr; }
  .ts-form { grid-template-columns: 1fr; }
}

/* ---------- Print: a clean shareable document ---------- */
@media print {
  body > *:not(#tsRoot) { display: none !important; }
  #tsRoot, #tsRoot.open { display: block !important; position: static; }
  .ts-backdrop, .ts-close, .ts-pk-reset, .ts-block-sub, .ts-add, .ts-custom-del { display: none !important; }
  .ts-modal { position: static; transform: none; max-height: none; width: 100%; border: none; box-shadow: none; background: #fff; }
  /* Render form controls as plain text, no boxes or dropdown arrows. */
  .ts-f input, .ts-f select, .ts-custom-text {
    border: none !important; background: none !important; padding: 0 !important;
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    color: #000 !important; font-weight: 600; font-size: 13.5px;
  }
  /* Keep the guide / boat / float-mode + access links CLICKABLE in the PDF. */
  .ts-actions { display: block !important; margin-top: 12px; }
  .ts-actions button { display: none !important; }
  .ts-actions a.ts-link { display: inline; border: none !important; background: none !important; padding: 0 !important; margin-right: 16px; color: #1a5a2a !important; text-decoration: underline; font-size: 12px; }
  .ts-navlinks { display: block !important; }
  .ts-navlinks a { color: #1a5a2a !important; }
  .ts-f { flex-direction: row; align-items: baseline; gap: 8px; }
  .ts-f span { min-width: 96px; }
  .ts-form { grid-template-columns: 1fr; gap: 4px 0; }
  .ts-phone { color: #000 !important; }
  .ts-pk-item input { -webkit-appearance: none; appearance: none; width: 12px; height: 12px; border: 1px solid #444; border-radius: 2px; }
  .ts-print-url { display: block; margin-top: 14px; font-size: 11px; color: #444; word-break: break-all; }
  /* Keep sections whole: never orphan a heading from its content. */
  .ts-block-h { break-after: avoid; page-break-after: avoid; }
  .ts-pk-sec, .ts-form, .ts-facts, .ts-warn { break-inside: avoid; page-break-inside: avoid; }
}
