/* Trail rides — a folded field guide, with the landscape doing the talking. */
:root {
  --trail-line: #bfcbb1;
  --trail-paper: #edf0df;
  --trail-muted: #68765d;
}

.trail-entry {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 62px;
  margin-top: 10px;
  padding: 10px 15px 10px 12px;
  border: 1px solid var(--trail-line);
  border-radius: 10px;
  background: linear-gradient(115deg, var(--paper), var(--trail-paper));
  box-shadow: 0 2px 0 #c9d2b840, inset 0 0 0 3px #fffaf066;
  text-align: left;
  transition: border-color .16s, transform .16s, background .16s;
}

.trail-entry:hover {
  transform: translateY(-1px);
  border-color: var(--sage);
  background: linear-gradient(115deg, var(--paper), #e2e9d4);
}

.trail-entry:active { transform: translateY(1px); }

.trail-entry-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 1px dashed #8caa7d;
  border-radius: 50%;
  background: #e0e8d1;
  color: var(--green);
  font: 29px/1 var(--serif);
  transform: rotate(-12deg);
}

.trail-entry-copy { display: flex; flex: 1; flex-direction: column; gap: 5px; min-width: 0; }
.trail-entry-copy b { font: 700 16px/1.1 var(--serif); }
.trail-entry-copy small { color: var(--trail-muted); font-size: 10.5px; line-height: 1.35; }
.trail-entry > span:last-child { flex: none; color: var(--green); font: 24px/1 var(--serif); }

#trail-dialog {
  width: calc(100% - 28px);
  max-width: 580px;
  padding: 24px 28px 28px;
  background: radial-gradient(ellipse at 85% 0%, #e8edda80, transparent 50%), var(--paper);
  scrollbar-width: thin;
  scrollbar-color: #bec9ac var(--paper);
}

#trail-dialog h2 { margin: 10px 0 8px; font-size: 34px; letter-spacing: -.7px; }
#trail-dialog .dialog-note { margin-bottom: 16px; color: var(--trail-muted); }
.trail-preview { overflow: hidden; margin-bottom: 17px; border: 5px solid var(--sheet); border-radius: 5px; box-shadow: 0 0 0 1px var(--line), 0 3px 10px #4a3a1f12; transform: rotate(-.5deg); background: #d4e7c4; }
#trail-preview { display: block; width: 100%; height: 144px; object-fit: cover; }
#trail-settings { display: flex; flex-direction: column; gap: 14px; }
.trail-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.trail-fieldset legend { margin-bottom: 7px; padding: 0; color: var(--trail-muted); font-size: 9px; font-weight: 700; letter-spacing: 1.7px; text-transform: uppercase; }
.trail-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.trail-options:has([data-time]) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#trail-terrains { grid-template-columns: repeat(6, minmax(0, 1fr)); }
#trail-terrains button { grid-column: span 2; }
#trail-terrains button[data-terrain="market"],
#trail-terrains button[data-terrain="waterway"] { grid-column: span 3; }
.trail-options button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 59px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffdf680;
  text-align: left;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.trail-options button:hover { border-color: #99ad88; background: #f2f4e7; }
.trail-options button b { padding-right: 5px; font: 700 14px/1.1 var(--serif); }
.trail-options button small { color: var(--trail-muted); font-size: 9px; line-height: 1.3; }
.trail-options button[aria-pressed="true"] { border-color: var(--green); background: #e8eddc; box-shadow: inset 0 0 0 1px var(--green); }
.trail-options button[aria-pressed="true"]::after { position: absolute; top: 6px; right: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--green); content: ""; }
.trail-options button[data-time] { padding-top: 29px; }
.trail-options button[data-time]::before { position: absolute; top: 9px; left: 12px; width: 13px; height: 13px; border-radius: 50%; background: #db8b61; box-shadow: 0 0 0 3px #e6b79b33; content: ""; }
.trail-options button[data-time="day"]::before { background: #d4a840; box-shadow: 0 0 0 3px #e8d18740; }
.trail-options button[data-time="noon"]::before { background: #dfb44a; box-shadow: 0 0 0 3px #efd48570, 0 0 0 5px #efd48520; }
.trail-options button[data-time="night"]::before { background: #506174; box-shadow: inset -4px -1px 0 #f2e8bc, 0 0 0 3px #a6b6c133; }
.trail-options button[data-terrain="market"] { border-color: #d5b7a0; background: #f7e6d780; }
.trail-options button[data-terrain="waterway"] { border-color: #a4c6c2; background: #dcefeb80; }
.trail-options button[data-terrain="market"][aria-pressed="true"] { border-color: #a65236; background: #f5dfcc; box-shadow: inset 0 0 0 1px #a65236; }
.trail-options button[data-terrain="waterway"][aria-pressed="true"] { border-color: #327b7b; background: #d8ede7; box-shadow: inset 0 0 0 1px #327b7b; }
.trail-description { margin: 13px 0 11px; min-height: 34px; color: #647157; font: italic 13px/1.5 var(--serif); }
#trail-go { margin: 1px 0 4px; min-height: 50px; }

.ride-speed { display: inline-flex; align-items: baseline; flex: none; gap: 3px; color: #637257; font: 9px/1 Arial, Helvetica, sans-serif; white-space: nowrap; }
.ride-speed b { color: var(--green); font: 700 15px/1 Arial, Helvetica, sans-serif; font-variant-numeric: tabular-nums; }
.score-strip:has(.ride-speed:not([hidden])) { gap: 12px; }
.score-strip:has(.ride-speed:not([hidden])) .score-target { max-width: 160px; }

@media (max-width: 700px) {
  .trail-entry { order: 6; min-height: 60px; margin-top: 10px; }
  .trail-entry-copy b { font-size: 15px; }
  #trail-dialog { padding: 18px 20px 22px; }
  #trail-dialog h2 { font-size: 29px; }
  #trail-preview { height: 125px; }
  .trail-preview { margin-bottom: 15px; }
  .trail-options button { padding-inline: 10px; }
  .trail-options button[data-time]::before { left: 10px; }
  .trail-options button b { font-size: 13px; }
  .trail-options button small { font-size: 8.5px; }
  .score-strip:has(.ride-speed:not([hidden])) { margin-left: 3px; gap: 10px; }
}

@media (max-width: 390px) {
  #trail-dialog { width: calc(100% - 20px); padding-inline: 15px; }
  #trail-dialog h2 { font-size: 27px; }
  #trail-dialog .dialog-note { font-size: 12px; }
  .trail-options { gap: 5px; }
  .trail-options button { padding-inline: 8px; }
  .trail-options button[data-time]::before { left: 8px; }
  .trail-options button b { font-size: 12px; }
  .trail-options button small { font-size: 8px; }
  .score-strip:has(.ride-speed:not([hidden])) { gap: 9px; }
  .score-strip:has(.ride-speed:not([hidden])) .chain-pill > span,
  .score-strip:has(.ride-speed:not([hidden])) .daily-clock > span { display: none; }
  .ride-speed { font-size: 8px; }
  .ride-speed b { font-size: 14px; }
}

@media (max-height: 600px) {
  #trail-dialog { padding-top: 14px; }
  #trail-dialog h2 { margin-top: 4px; }
  #trail-dialog .dialog-note { margin-bottom: 12px; }
  #trail-preview { height: 95px; }
}

@media (max-height: 500px) and (orientation: landscape) {
  #trail-dialog { max-width: 680px; padding: 14px 22px 20px; }
  #trail-dialog h2 { font-size: 27px; }
  .trail-preview { display: none; }
  #trail-settings { gap: 11px; }
  .trail-options button { min-height: 49px; }
  .trail-options button[data-time] { padding: 10px 10px 10px 33px; }
  .trail-options button[data-time]::before { top: 12px; left: 11px; }
  .trail-description { min-height: 0; font-size: 12px; }
  .trail-entry { min-height: 57px; }
  .score-strip:has(.ride-speed:not([hidden])) { margin: 0; gap: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .trail-entry, .trail-options button { transition: none; }
  .trail-entry:hover, .trail-entry:active { transform: none; }
}
