/* Current thinking rail | travishurlock.com | v20261005d
   Self-contained. Uses the site's :root tokens from styles.css. */

.th-rail {
  --rail-gap: 20px;
  --rail-inner: min(calc(100vw - 64px), 1116px);
  --rail-edge: max(32px, calc((100vw - 1180px) / 2 + 32px));
  --rail-card: calc((var(--rail-inner) - 3 * var(--rail-gap)) / 3.3);
  position: relative;
}

/* Head: section heading left, controls right */
.th-rail__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 40px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}
.th-rail__head .section-head { margin-bottom: 0; }
.th-rail__sub {
  margin: 12px 0 0;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1.5;
}
.th-rail__controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.th-rail__count {
  min-width: 7.5ch;
  margin-right: 6px;
  color: var(--text-dim);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.th-rail__btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: border-color .2s ease, opacity .2s ease;
}
.th-rail__btn svg { display: block; }
.th-rail__btn:hover:not(:disabled) { border-color: var(--text-dim); }
.th-rail__btn:disabled { opacity: .3; cursor: default; }
/* Focus rings only for keyboard users (rail.js adds .th-rail--kb on
   Tab/arrow keys, removes it on touch or click) */
.th-rail :focus { outline: none; }
.th-rail--kb .th-rail__btn:focus-visible,
.th-rail--kb .th-rail__card:focus-visible,
.th-rail--kb .th-rail__track:focus-visible,
.th-rail--kb .th-rail__close:focus-visible,
.th-rail--kb .th-rail__link:focus-visible,
.th-rail--kb .th-rail__cta:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}
.th-rail--fits .th-rail__controls,
.th-rail--fits .th-rail__progress { display: none; }

/* Viewport + track. Left edge aligns to the container, right edge bleeds
   to the window so the next card is visibly cut off. */
.th-rail__viewport { position: relative; }
.th-rail__viewport::before,
.th-rail__viewport::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  width: 72px;
  pointer-events: none;
  transition: opacity .25s ease;
}
.th-rail__viewport::before {
  left: 0;
  background: linear-gradient(90deg, var(--bg), rgba(10, 11, 15, 0));
  opacity: 0;
}
.th-rail__viewport::after {
  right: 0;
  background: linear-gradient(270deg, var(--bg), rgba(10, 11, 15, 0));
}
.th-rail:not(.is-start) .th-rail__viewport::before { opacity: 1; }
.th-rail.is-end .th-rail__viewport::after { opacity: 0; }

.th-rail__track {
  display: flex;
  gap: var(--rail-gap);
  margin: 0;
  padding: 4px 0 6px var(--rail-edge);
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--rail-edge);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.th-rail__track::-webkit-scrollbar { display: none; }
/* End spacing comes from this spacer, not padding-right, so Chrome and
   Safari agree on where the rail ends */
.th-rail__track::after {
  content: "";
  flex: 0 0 1px;
  margin-left: calc(var(--rail-edge) - var(--rail-gap) - 1px);
}

.th-rail__item {
  flex: 0 0 var(--rail-card);
  min-width: 0;
  scroll-snap-align: start;
}

.th-rail__card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
}
.th-rail__card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s cubic-bezier(.2, .7, .2, 1);
}
.th-rail__card:hover img { transform: scale(1.02); }

/* Badge sits bottom right, over the cover's URL line */
.th-rail__badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 13px 0 11px;
  border-radius: 17px;
  background: rgba(10, 11, 15, .74);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--text);
  font: 600 13px/1 var(--font);
  font-variant-numeric: tabular-nums;
}
.th-rail__badge svg { flex: none; }

.th-rail__caption {
  display: -webkit-box;
  margin: 14px 2px 0;
  overflow: hidden;
  color: var(--text-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.th-rail__meta {
  margin: 6px 2px 0;
  color: var(--text-faint);
  font-size: 13px;
}

.th-rail__progress {
  position: relative;
  height: 2px;
  margin-top: 28px;
  overflow: hidden;
  border-radius: 1px;
  background: var(--border);
}
.th-rail__progress span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 30%;
  border-radius: 1px;
  background: var(--text-dim);
}

/* Player dialog */
.th-rail__dialog {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}
.th-rail__dialog::backdrop {
  background: rgba(5, 6, 9, .88);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.th-rail__dialog[open] .th-rail__panel { animation: thRailIn .28s cubic-bezier(.2, .7, .2, 1); }
@keyframes thRailIn {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.th-rail__panel {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: auto minmax(260px, 400px);
  align-items: center;
  justify-content: center;
  gap: 48px;
  width: 100%;
  height: 100%;
  padding: 48px 72px;
}
.th-rail__media {
  height: min(86vh, 900px);
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
}
.th-rail__media video,
.th-rail__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.th-rail__copy {
  max-height: 86vh;
  overflow-y: auto;
}
.th-rail__title {
  margin: 0 0 8px;
  font: 900 44px/1.04 var(--font-display);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.th-rail__date {
  margin: 0 0 20px;
  color: var(--text-faint);
  font-size: 13px;
}
.th-rail__summary {
  margin: 0 0 16px;
  color: var(--text-body);
  font-size: 17px;
  line-height: 1.6;
}
.th-rail__footnote {
  margin: 0 0 20px;
  color: var(--text-faint);
  font-size: 12.5px;
  line-height: 1.5;
}
.th-rail__note {
  margin: 0 0 16px;
  color: var(--text-dim);
  font-size: 14px;
}
.th-rail__link {
  display: inline-block;
  margin-top: 4px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
}
.th-rail__link:hover { text-decoration-color: var(--text); }
.th-rail__close {
  /* Matches the site's existing lightbox close (.reel-lightbox__close) */
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 3;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(23, 26, 34, .85);
  color: var(--text);
  font: 400 16px/1 var(--font);
  cursor: pointer;
}
.th-rail__close:hover { background: var(--surface-2); }
.th-rail__panel:focus { outline: none; }
.th-rail__cta { margin: 4px 0 20px; }
.th-rail__cta + .th-rail__link { display: block; width: fit-content; }

/* Tablet: 2 cards plus a peek */
@media (max-width: 960px) {
  .th-rail { --rail-card: calc((var(--rail-inner) - 2 * var(--rail-gap)) / 2.3); }
  .th-rail__panel { gap: 32px; padding: 48px 40px; }
  .th-rail__title { font-size: 36px; }
}

/* Mobile: 1 card plus a peek, swipe. Dialog stacks. */
@media (max-width: 640px) {
  .th-rail {
    --rail-gap: 14px;
    --rail-edge: 32px; /* matches .container padding so cards line up with the heading */
    --rail-card: 76vw;
  }
  .th-rail__head { margin-bottom: 24px; }
  .th-rail__count { display: none; }
  .th-rail__btn { width: 40px; height: 40px; }
  .th-rail__viewport::before,
  .th-rail__viewport::after { width: 32px; }
  /* Block flow, not grid: a grid row with overflow:hidden can collapse
     to zero and let the copy slide over the image */
  .th-rail__panel {
    display: block;
    padding: 72px 20px 40px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .th-rail__media {
    height: auto;
    width: min(100%, calc(62vh * 9 / 16));
    margin: 0 auto 24px;
  }
  .th-rail__copy { max-height: none; overflow: visible; }
  .th-rail__title { font-size: 32px; }
  .th-rail__summary { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .th-rail__track { scroll-behavior: auto; }
  .th-rail__card img,
  .th-rail__btn,
  .th-rail__viewport::before,
  .th-rail__viewport::after { transition: none; }
  .th-rail__card:hover img { transform: none; }
  .th-rail__dialog[open] .th-rail__panel { animation: none; }
}

/* ==========================================================================
   Selected proof: same left/right panning on tablet and mobile.
   Desktop keeps the existing 3-column grid untouched.
   ========================================================================== */
.th-mrail__controls,
.th-mrail__progress { display: none; }

@media (max-width: 960px) {
  #proof {
    --mrail-gap: 20px;
    --mrail-edge: 32px;
    --mrail-card: calc((100vw - 2 * var(--mrail-edge) - 2 * var(--mrail-gap)) / 2.3);
  }
  #proof .th-mrail__controls {
    display: flex;
    gap: 10px;
    margin: 0 0 24px;
  }
  #proof .th-mrail__progress {
    display: block;
    margin-top: 28px;
  }
  #proof .proof-grid {
    display: flex;
    gap: var(--mrail-gap);
    margin: 0 calc(-1 * var(--mrail-edge));
    padding: 4px 0 6px var(--mrail-edge);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--mrail-edge);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  #proof .proof-grid::-webkit-scrollbar { display: none; }
  #proof .proof-grid::after {
    content: "";
    flex: 0 0 1px;
    margin-left: calc(var(--mrail-edge) - var(--mrail-gap) - 1px);
  }
  #proof .proof-card {
    flex: 0 0 var(--mrail-card);
    min-width: 0;
    scroll-snap-align: start;
  }
  #proof.th-rail--fits .th-mrail__controls,
  #proof.th-rail--fits .th-mrail__progress { display: none; }
}
@media (max-width: 640px) {
  #proof {
    --mrail-gap: 14px;
    --mrail-card: 80vw;
  }
  #proof .th-mrail__controls .th-rail__btn { width: 40px; height: 40px; }
}
/* Touch users: no focus ring left on a tapped card (keyboard keeps it) */
#proof:not(.th-rail--kb) .proof-card:focus { outline: none; }
.th-mrail.th-rail--kb .th-rail__btn:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

/* Desktop drag-to-pan (mouse). Cards keep their pointer cursor so they
   still read as clickable; the rail shows grab, and grabbing while dragging. */
.th-rail__track img,
.th-pan__track img,
#proof .proof-grid img {
  -webkit-user-drag: none;
  user-select: none;
}
@media (hover: hover) and (pointer: fine) {
  .th-rail__track { cursor: grab; }
  .th-rail__track.is-dragging,
  .th-pan__track.is-dragging,
  .th-rail__track.is-dragging *,
  .th-pan__track.is-dragging * {
    cursor: grabbing !important;
    user-select: none;
  }
}

/* Progress line with a scrubber dot. The line is the track, the filled
   part shows how far through you are, the dot shows where you are and
   can be dragged. A 28px tall hit area keeps it easy to grab. */
.th-rail__progress {
  --p: 0;
  height: 28px;
  margin-top: 14px;
  overflow: visible;
  background: none;
  border-radius: 0;
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.th-rail__progress::before,
.th-rail__progress::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 1px;
  pointer-events: none;
}
.th-rail__progress::before { right: 0; background: var(--border); }
.th-rail__progress::after {
  width: calc(var(--p) * (100% - 14px) + 7px);
  background: var(--text-dim);
}
.th-rail__progress span {
  top: 50%;
  bottom: auto;
  left: calc(var(--p) * (100% - 14px));
  z-index: 1;
  width: 14px !important;
  height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 4px var(--bg);
  transform: none !important;
  transition: scale .15s ease;
  cursor: grab;
}
.th-rail__progress:hover span { scale: 1.15; }
.th-rail__progress.is-scrubbing span { scale: 1.25; cursor: grabbing; }
.th-rail__progress.is-scrubbing { cursor: grabbing; }
@media (prefers-reduced-motion: reduce) {
  .th-rail__progress span { transition: none; }
}

/* Touch screens (phones, tablets): no arrow buttons. Swiping, the peeking
   card and the progress dot already do the job, and the arrows only cost
   space. Mouse/keyboard devices (incl. touchscreen laptops) keep them. */
@media (hover: none) and (pointer: coarse) {
  .th-rail__controls,
  #proof .th-mrail__controls,
  #proof .th-pan__controls,
  #how-i-work .th-pan__controls { display: none; }
}
