/* ============================================================
   Log — the commute diary. Filter chips + paired-day log rows
   (day stamp + AM leg + PM leg).
   ============================================================ */

.filter-chips {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: var(--sp-4);
  padding: var(--sp-1) 0;
}
.filter-chips::-webkit-scrollbar { display: none; }

.filter-group {
  display: flex;
  gap: var(--sp-1);
  padding-right: var(--sp-3);
  border-right: 1px dashed var(--ink-line);
}
.filter-group:last-child { border-right: 0; }

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  height: 34px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--ink-line);
  border-radius: var(--r-full);
  background: var(--paper-light);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out);
}
.chip:active { transform: scale(0.97); }

/* Neutral selected for generic filters; direction chips carry am/pm color */
.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper-light);
  border-color: var(--ink);
  font-weight: 600;
}
.chip[data-value="to_work"][aria-pressed="true"] {
  background: var(--am); color: var(--ink); border-color: var(--am-deep);
}
.chip[data-value="from_work"][aria-pressed="true"] {
  background: var(--pm); color: var(--paper-light); border-color: var(--pm-deep);
}

/* ---------- Paired-day log ---------- */
.log-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: 96px 1fr 1fr;
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-muted);
  border: 1px solid var(--ink-line);
  border-bottom: none;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.log-header > span {
  padding: 9px 14px;
  border-right: 1px dashed var(--ink-line);
}
.log-header > span:last-child { border-right: none; }

.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--ink-line);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  overflow: hidden;
  background: var(--paper-light);
  background-image: var(--paper-texture);
}

.log-day {
  display: grid;
  grid-template-columns: 96px 1fr 1fr;
  align-items: stretch;
  position: relative;
  font-family: var(--font-body);
  color: var(--ink);
}
.log-day:not(:first-child)::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 1px;
  background-image: repeating-linear-gradient(to right, var(--ink-line) 0 4px, transparent 4px 8px);
}

.log-day .day-stamp {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--paper);
  border-right: 1px dashed var(--ink-line);
}
.log-day .day-stamp .d {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
  color: var(--ink);
  font-feature-settings: "tnum" 1;
}
.log-day .day-stamp .wd {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--ink-muted);
}
.log-day.today .day-stamp { background: rgba(217, 164, 65, 0.12); box-shadow: inset 3px 0 0 var(--am); }

.log-day .leg {
  display: grid;
  grid-template-columns: 20px 1fr auto auto auto;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-3);
  border-right: 1px dashed var(--ink-line);
  min-width: 0;
}
.log-day .leg:last-child { border-right: none; }
.log-day .leg .dir {
  font-family: var(--font-mono);
  font-weight: 700;
  text-align: center;
}
.log-day .leg.am .dir { color: var(--am-deep); }
.log-day .leg.pm .dir { color: var(--pm-deep); }
.log-day .leg .times {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
}
.log-day .leg .times b { color: var(--ink); font-weight: 500; }
.log-day .leg .times .arr { color: var(--ink-faint); margin: 0 3px; }
.log-day .leg .dur .min {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  font-feature-settings: "tnum" 1;
}
.log-day .leg .dur .min .unit { font-size: 9px; color: var(--ink-muted); letter-spacing: 0.08em; margin-left: 1px; }
.log-day .leg .dur .min.active { color: var(--leaf-deep); }
.log-day .leg .dur .min.muted { color: var(--ink-faint); }
.log-day .leg .wx {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  font-feature-settings: "tnum" 1;
}
.log-day .leg .wx.unavailable { color: var(--ink-faint); opacity: 0.6; }
.log-day .leg.empty {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: repeating-linear-gradient(45deg, transparent 0 6px, rgba(180, 160, 120, 0.07) 6px 7px);
}

.log-day .leg .delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border: 1px solid var(--ink-line);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-muted);
  transition: background var(--motion-fast) var(--ease-out);
}
.log-day .leg .delete-btn:active { background: var(--surface-press); }
.log-day .leg .delete-btn.confirm {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
  width: auto;
  padding: 0 var(--sp-2);
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.log-day .leg .delete-btn[disabled] { opacity: 0.5; pointer-events: none; }

/* Neutral ink CTA — generic navigation */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  transition: background var(--motion-fast) var(--ease-out);
}
.btn-primary { background: var(--ink); color: var(--paper-light); border-color: var(--ink); }
.btn-primary:active { background: var(--ink-soft); }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-16) var(--sp-4);
  color: var(--ink-muted);
  font-family: var(--font-body);
  text-align: center;
  list-style: none;
}
.empty-state .icon-lg { width: 48px; height: 48px; color: var(--ink-faint); }

.log-list .skeleton-row { display: block; padding: var(--sp-3) var(--sp-4); }

/* ---------- Mobile: stack the two legs under the day stamp ---------- */
@media (max-width: 560px) {
  .log-header { display: none; }
  .log-day {
    grid-template-columns: 64px 1fr;
    grid-template-areas: "stamp am" "stamp pm";
  }
  .log-day .day-stamp { grid-area: stamp; border-right: 1px dashed var(--ink-line); }
  .log-day .leg.am { grid-area: am; border-right: none; }
  .log-day .leg.pm { grid-area: pm; border-right: none; border-top: 1px dashed var(--ink-line); }

  /* Two lines per leg: full time on top, duration / weather / delete below */
  .log-day .leg {
    grid-template-columns: 20px auto auto 1fr;
    grid-template-areas:
      "dir  times times times"
      "dir  dur   wx    del";
    column-gap: var(--sp-2);
    row-gap: var(--sp-1);
    padding: var(--sp-2) var(--sp-3);
  }
  .log-day .leg .dir        { grid-area: dir; align-self: center; }
  .log-day .leg .times      { grid-area: times; }
  .log-day .leg .dur        { grid-area: dur; }
  .log-day .leg .wx         { grid-area: wx; }
  .log-day .leg .delete-btn { grid-area: del; justify-self: end; }

  /* Uniform text size across the two lines */
  .log-day .leg .times,
  .log-day .leg .dur .min,
  .log-day .leg .wx          { font-size: var(--fs-sm); }
  .log-day .leg .dur .min .unit,
  .log-day .leg .wx .temp    { font-size: var(--fs-xs); }
}
