/* EveryTamTrail — shared styles. Tokens follow the Claude Design canvas. */
:root {
  --ink: #1B2A24;
  --ink-2: #2E3C35;
  --muted: #4C5A53;
  --fog: #F3F5F1;
  --card: #FFFFFF;
  --line: #D5DBD5;
  --line-2: #E6EAE6;
  --red: #C23A24;
  --red-on-dark: #E5553D;
  --red-tint: #FBEDEA;
  --forest: #2F5D46;
  --forest-dark: #26382F;
  --track-gray: #AEB7B0;
  --strava: #FC5200;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Barlow', system-ui, sans-serif;
  --wrap: 1280px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fog); color: var(--ink); font-family: var(--body); font-size: 18px; line-height: 1.5; }
a { color: var(--ink); }
a:hover { color: var(--red); }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; }
p { margin: 0; }
button { font: inherit; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding-left: 32px; padding-right: 32px; }
@media (max-width: 640px) { .wrap { padding-left: 16px; padding-right: 16px; } }

/* Type */
.display { font-family: var(--display); font-weight: 800; text-transform: uppercase; line-height: 0.92; letter-spacing: -0.3px; }
.eyebrow { font-weight: 600; font-size: 14px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.h-xl { font-size: clamp(56px, 7.2vw, 108px); }
.h-lg { font-size: clamp(40px, 4.4vw, 56px); line-height: 1; }
.h-md { font-size: clamp(30px, 3.2vw, 44px); line-height: 1; }
.lede { font-size: 21px; line-height: 1.5; color: var(--ink-2); max-width: 36ch; }
.muted { color: var(--muted); }
.red { color: var(--red); }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--fog); }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-top: 14px; padding-bottom: 14px; }
.wordmark { font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: 0.5px; text-decoration: none; }
.wordmark span { color: var(--red); }
.nav-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 24px; font-weight: 600; font-size: 16px; }
.nav-links a { text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.nav-links a[aria-current="page"] { color: var(--red); box-shadow: inset 0 -3px 0 var(--red); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 22px; border-radius: 8px; font-weight: 600; font-size: 18px; text-decoration: none; border: 2px solid transparent; cursor: pointer; }
.btn-strava { background: var(--strava); color: #fff; font-weight: 700; font-size: 19px; }
.btn-strava:hover { color: #fff; filter: brightness(0.95); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { color: #fff; background: #000; }
.btn-ghost { border-color: var(--ink); background: transparent; color: var(--ink); }
.btn-sm { min-height: 44px; font-size: 16px; padding: 0 16px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Layout bits */
.row { display: flex; flex-wrap: wrap; gap: 48px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.card-dark { background: var(--ink); color: var(--fog); border-radius: 14px; padding: 40px; }
.card-dark a { color: #fff; }
.section { padding-top: 72px; padding-bottom: 32px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 24px; }
.stat-num { font-family: var(--display); font-weight: 800; font-size: 64px; line-height: 1; }
.stat-label { font-size: 17px; color: var(--muted); }
.band { background: var(--card); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* Maps */
.map { width: 100%; height: 520px; border-radius: 14px; border: 1px solid var(--line); background: #E9EDE8; overflow: hidden; }
.map-sm { height: 380px; }
@media (max-width: 640px) { .map { height: 380px; } }
.leaflet-tile-pane { filter: grayscale(0.85) contrast(0.85) brightness(1.08); opacity: 0.55; }
.leaflet-container { font-family: var(--body); }
.legend { display: flex; flex-wrap: wrap; gap: 18px; font-size: 15px; color: var(--muted); padding-top: 10px; }
.legend i { display: inline-block; width: 24px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 8px; }

/* Progress ticks */
.ticks { display: grid; grid-template-columns: repeat(27, minmax(0, 1fr)); gap: 3px; }
.ticks span { height: 20px; border-radius: 2px; background: var(--line); }
.ticks span.on { background: var(--red); }
.ticks span.part { background: linear-gradient(0deg, var(--red) 50%, var(--line) 50%); }

/* Bars */
.bar { height: 10px; border-radius: 5px; background: #DDE2DD; overflow: hidden; }
.bar > div { height: 100%; border-radius: 5px; background: var(--red); }
.bar > div.full { background: var(--forest); }

/* Lists */
.trail-list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.trail-list li + li { border-top: 1px solid var(--line-2); }
.trail-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 8px 16px; background: none; border: 0; text-align: left; color: var(--ink); cursor: pointer; }
.trail-row:hover { background: #F8FAF7; }
.trail-row .name { font-size: 17px; font-weight: 600; display: block; }
.trail-row .meta { font-size: 14px; color: var(--muted); display: block; }
.trail-row .grow { flex: 1 1 auto; min-width: 0; }
.dot { flex: 0 0 14px; width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid #9AA59E; }
.dot.done { background: var(--red); border-color: var(--red); }
.dot.part { border: 3px solid var(--red); background: linear-gradient(90deg, var(--red) 50%, #fff 50%); }
.pill-badge { font-size: 13px; font-weight: 600; color: var(--red); border: 1.5px solid var(--red); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { min-height: 44px; padding: 0 16px; border-radius: 999px; font-weight: 600; font-size: 15px; cursor: pointer; background: #fff; color: var(--ink); border: 2px solid #C5CCC6; }
.pill[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
input[type="search"], select { min-height: 44px; padding: 0 12px; border: 2px solid #C5CCC6; border-radius: 8px; font: inherit; font-size: 16px; background: #fff; color: var(--ink); }

/* Trail sheet (dialog) */
dialog.sheet { border: 0; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 48px); box-shadow: 0 12px 40px rgba(27, 42, 36, 0.25); color: var(--ink); }
dialog.sheet::backdrop { background: rgba(27, 42, 36, 0.35); }
.sheet-body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 18px; }
.sheet-close { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #EEF1EE; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.segs { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 2px; }
.segs span { height: 12px; border-radius: 2px; background: var(--line); }
.segs span.on { background: var(--red); }

/* Status banner */
.status { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--muted); }
.status .led { width: 8px; height: 8px; border-radius: 50%; background: var(--forest); }
.status .led.busy { background: var(--red); animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: 0.3; } }
.notice { background: var(--red-tint); border-radius: 10px; padding: 14px 16px; font-size: 16px; }

/* Sync panel: shown while reading and matching activities */
.sync { background: var(--card); border: 2px solid var(--ink); border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.sync-found { font-size: 18px; }
.sync-found strong { color: var(--red); }
.sync-bar { height: 12px; border-radius: 6px; background: #DDE2DD; overflow: hidden; position: relative; }
.sync-bar > div { height: 100%; border-radius: 6px; background: var(--red); width: 0; transition: width 0.4s ease; }
.sync-bar.indeterminate > div { width: 30%; position: absolute; animation: slide 1.3s ease-in-out infinite; }
@keyframes slide { from { left: -30%; } to { left: 100%; } }
.sync-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: 18px; }
.sync-steps li { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.sync-steps li::before { content: ''; flex: 0 0 18px; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid #9AA59E; box-sizing: border-box; }
.sync-steps li.active { color: var(--ink); font-weight: 600; }
.sync-steps li.active::before { border-color: var(--red); border-right-color: transparent; animation: spin 0.9s linear infinite; }
.sync-steps li.done { color: var(--ink); }
.sync-steps li.done::before { border-color: var(--forest); background: var(--forest); box-shadow: inset 0 0 0 3px #fff; }
.sync-steps .detail { font-weight: 400; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sync-bar.indeterminate > div, .sync-steps li.active::before { animation: none; } }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 72px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; padding-top: 24px; padding-bottom: 32px; font-size: 14px; color: var(--muted); }
.powered { font-weight: 600; letter-spacing: 0.5px; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
th { font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
tr[data-id] { cursor: pointer; }
tr[data-id]:hover, tr.selected { background: var(--red-tint); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Story */
.climb { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 6px; align-items: end; height: 280px; border-bottom: 2px solid var(--ink); min-width: 680px; }
.climb div { border-radius: 3px 3px 0 0; background: var(--ink); }
.climb div.big { background: var(--red); }
.climb div.zero { opacity: 0.35; }
.runs { list-style: none; margin: 0; padding: 0; }
.runs li { display: flex; flex-wrap: wrap; gap: 6px 28px; padding: 20px 0; border-top: 1px solid var(--line); align-items: baseline; }
.runs .date { flex: 0 0 130px; font-size: 15px; font-weight: 600; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.runs .what { flex: 1 1 380px; min-width: 0; }
.runs .what a { font-size: 21px; font-weight: 600; text-decoration: none; }
.runs .what p { font-size: 16px; color: var(--muted); }
.runs .mi { flex: 0 0 80px; font-size: 16px; color: var(--muted); }
.runs .tally { flex: 0 0 110px; text-align: right; font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1; }
.runs .tally small { font-size: 18px; color: var(--muted); }
