/*--------------------------------------------------------------
# Projects – cat trail + project pop-up
--------------------------------------------------------------*/
.trail-section {
  --trail-ink: #1d1d1f;
  --trail-line: color-mix(in srgb, var(--default-color), transparent 86%);
  --trail-muted: color-mix(in srgb, var(--default-color), transparent 40%);
  --trail-gap: 92px;
  overflow: hidden; /* the cat's jump can poke outside the column */
}

.trail-hint {
  text-align: center;
  font-size: 0.92rem;
  color: var(--trail-muted);
  margin: -18px 0 22px;
}

.trail-hint i {
  margin-right: 4px;
}

/* ---------- Filters ---------- */
.trail-filters {
  list-style: none;
  padding: 0;
  margin: 0 auto 40px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.trail-filters button {
  font: 500 0.88rem var(--nav-font);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--trail-line);
  background: var(--surface-color);
  color: var(--default-color);
  transition: all 0.25s ease;
}

.trail-filters button:hover {
  border-color: var(--trail-ink);
  color: var(--trail-ink);
}

.trail-filters button.active {
  background: var(--trail-ink);
  border-color: var(--trail-ink);
  color: #fff;
}

/* ---------- Trail ---------- */
.trail {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
  padding-top: 64px; /* room for the cat above the first card */
  padding-bottom: 20px;
}

.trail-stop {
  position: relative;
  margin-bottom: var(--trail-gap);
  scroll-margin-top: 140px;
}

.trail-stop[hidden] {
  display: none;
}

.trail-card {
  position: relative;
  display: flex;
  gap: 24px;
  align-items: stretch;
  padding: 26px 28px 24px;
  background: var(--surface-color);
  border: 1px solid var(--trail-line);
  border-radius: 18px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.7s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.trail-stop.in-view .trail-card {
  opacity: 1;
}

.trail-card:hover {
  border-color: color-mix(in srgb, var(--trail-ink), transparent 65%);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.22);
}

/* the stop the cat is currently on */
.trail-stop.is-current .trail-card {
  border-color: color-mix(in srgb, var(--trail-ink), transparent 55%);
  box-shadow: 0 22px 48px -22px rgba(0, 0, 0, 0.28);
}

.trail-card-text {
  flex: 1;
  min-width: 0;
}

.trail-date {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--trail-muted);
  margin-bottom: 8px;
}

.trail-stop .trail-date::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--trail-muted);
  transition: all 0.3s ease;
}

.trail-stop.visited .trail-date::before {
  background: var(--trail-ink);
  border-color: var(--trail-ink);
}

.trail-card h3 {
  margin: 0 0 10px;
  font-size: 1.28rem;
  font-weight: 600;
  line-height: 1.3;
}

.trail-open {
  all: unset;
  cursor: pointer;
  color: var(--heading-color);
  background-image: linear-gradient(var(--trail-ink), var(--trail-ink));
  background-size: 0% 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.35s ease;
}

.trail-card:hover .trail-open,
.trail-open:focus-visible {
  background-size: 100% 2px;
}

.trail-open:focus-visible {
  outline: 2px solid var(--trail-ink);
  outline-offset: 4px;
  border-radius: 2px;
}

.trail-summary {
  font-size: 0.95rem;
  line-height: 1.65;
  margin-bottom: 14px;
}

.trail-tags {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.trail-tags li {
  font-size: 0.74rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--default-color), transparent 93%);
  color: color-mix(in srgb, var(--default-color), transparent 10%);
}

.trail-card-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--trail-muted);
}

.trail-card-foot .more {
  margin-left: auto;
  color: var(--trail-ink);
  font-weight: 500;
  white-space: nowrap;
}

.trail-card-foot .more i {
  display: inline-block;
  transition: transform 0.3s ease;
}

.trail-card:hover .trail-card-foot .more i {
  transform: translateX(4px);
}

.trail-card-foot .badge-media i {
  margin-right: 4px;
}

/* thumbnail generated from the first gallery item */
.trail-thumb {
  position: relative;
  flex: 0 0 168px;
  align-self: center;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: color-mix(in srgb, var(--default-color), transparent 92%);
}

.trail-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.trail-card:hover .trail-thumb img {
  transform: scale(1.06);
}

.trail-thumb .play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.25);
}

/* side year labels (desktop) */
.trail-year {
  position: absolute;
  right: calc(100% + 36px);
  font: 700 2.6rem/1 var(--heading-font);
  color: color-mix(in srgb, var(--default-color), transparent 82%);
  letter-spacing: -0.02em;
  pointer-events: none;
  transition: color 0.4s ease;
}

.trail-year.active {
  color: var(--trail-ink);
}

@media (max-width: 1199px) {
  .trail-year {
    display: none;
  }
}

@media (max-width: 640px) {
  .trail-section {
    --trail-gap: 76px;
  }

  .trail-card {
    flex-direction: column-reverse;
    padding: 22px 20px 20px;
  }

  .trail-thumb {
    flex-basis: auto;
    width: 100%;
    aspect-ratio: 16 / 9;
  }

  .trail-card h3 {
    font-size: 1.12rem;
  }
}

/* ---------- The cat ---------- */
.trail-cat {
  position: absolute;
  left: 0;
  top: 0;
  width: 72px;
  height: 50px;
  z-index: 3;
  pointer-events: auto;
  cursor: pointer;
  will-change: transform;
}

.trail-cat .cat {
  width: 100%;
  height: 100%;
  overflow: visible;
  transform-origin: 50% 100%;
  transition: transform 0.18s ease;
}

.trail-cat.face-left .cat {
  transform: scaleX(-1);
}

.cat .cat-fur { fill: var(--trail-ink); }
.cat .cat-fur-far { fill: #3a3a3d; }

.cat .cat-tail {
  fill: none;
  stroke: var(--trail-ink);
  stroke-width: 5.5;
  stroke-linecap: round;
}

.cat .cat-ear-in { fill: #e9a3a8; }
.cat .cat-eye { fill: #f6cf57; }
.cat .cat-pupil { fill: #111; }
.cat .cat-nose { fill: #e9a3a8; }

.cat .cat-whisker {
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 0.8;
  stroke-linecap: round;
}

.cat .cat-collar {
  fill: none;
  stroke: #e0483e;
  stroke-width: 3;
  stroke-linecap: round;
}

.cat .cat-bell { fill: #f6cf57; }

.cat .cat-leg {
  transform-box: fill-box;
  transform-origin: 50% 8%;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.cat .cat-tail {
  transform-box: fill-box;
  transform-origin: 100% 100%;
  animation: cat-tail 2.6s ease-in-out infinite;
}

.cat .cat-upper {
  transform-box: view-box;
  transform-origin: 50px 42px;
  transition: transform 0.35s ease;
}

.cat .cat-eyes {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: cat-blink 5s infinite;
}

.cat .cat-haunch {
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* walking */
.trail-cat.walking .cat-leg {
  animation: cat-step 0.5s linear infinite;
}

.trail-cat.walking .leg-back-near,
.trail-cat.walking .leg-front-far {
  animation-delay: -0.25s;
}

.trail-cat.walking .cat-upper {
  animation: cat-bob 0.25s ease-in-out infinite alternate;
}

.trail-cat.walking .cat-tail {
  animation-duration: 0.9s;
}

/* jumping: stretch out */
.trail-cat.jumping .leg-front {
  transform: rotate(-60deg);
}

.trail-cat.jumping .leg-back {
  transform: rotate(55deg);
}

/* resting: sit down */
.trail-cat.sitting .cat-upper {
  transform: rotate(-24deg);
}

.trail-cat.sitting .leg-back {
  opacity: 0;
}

.trail-cat.sitting .cat-haunch {
  opacity: 1;
}

@keyframes cat-step {
  0%   { transform: rotate(24deg); }
  50%  { transform: rotate(-24deg); }
  100% { transform: rotate(24deg); }
}

@keyframes cat-bob {
  from { transform: translateY(0); }
  to   { transform: translateY(-1.6px); }
}

@keyframes cat-tail {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(-14deg); }
}

@keyframes cat-blink {
  0%, 46%, 50%, 100% { transform: scaleY(1); }
  48%                { transform: scaleY(0.1); }
}

/* speech bubble */
.trail-cat-bubble {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  translate: -50% 0;
  white-space: nowrap;
  padding: 5px 11px;
  border-radius: 12px;
  background: var(--trail-ink);
  color: #fff;
  font: 600 0.8rem var(--heading-font);
  opacity: 0;
  scale: 0.6;
  transform-origin: 50% 100%;
  transition: opacity 0.2s ease, scale 0.25s cubic-bezier(.3, 1.6, .5, 1);
  pointer-events: none;
}

.trail-cat-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  translate: -50% -1px;
  border: 6px solid transparent;
  border-top-color: var(--trail-ink);
}

.trail-cat-bubble.show {
  opacity: 1;
  scale: 1;
}

.trail-heart {
  position: absolute;
  z-index: 4;
  color: #e0483e;
  font-size: 14px;
  pointer-events: none;
  animation: trail-heart 1s ease-out forwards;
}

@keyframes trail-heart {
  from { opacity: 1; transform: translate(0, 0) scale(0.6); }
  to   { opacity: 0; transform: translate(var(--dx, 0), -46px) scale(1.2); }
}

/*--------------------------------------------------------------
# Project pop-up
--------------------------------------------------------------*/
.project-modal {
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--surface-color, #fff);
  color: var(--default-color);
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.project-modal[open] {
  display: flex;
  animation: pm-in 0.35s cubic-bezier(.2, .9, .3, 1.1);
}

.project-modal::backdrop {
  background: rgba(15, 15, 18, 0.55);
  backdrop-filter: blur(6px);
}

@keyframes pm-in {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.pm-inner {
  position: relative;
  width: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.pm-close {
  position: sticky;
  top: 14px;
  float: right;
  margin: 14px 14px -54px 0;
  z-index: 5;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.pm-close:hover {
  transform: rotate(90deg);
}

.pm-content {
  padding: 34px 44px 10px;
}

.pm-title {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 14px;
  padding-right: 40px;
}

.pm-tags {
  margin-bottom: 24px;
}

.pm-body p,
.pm-body li {
  font-size: 0.98rem;
  line-height: 1.75;
}

.pm-body h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 26px 0 8px;
}

.pm-body ul {
  padding-left: 1.2rem;
}

.pm-body li::marker {
  color: var(--trail-muted, #999);
}

.pm-body a {
  border-bottom: 1px solid currentColor;
}

.pm-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 44px 30px;
  border-top: 1px solid color-mix(in srgb, var(--default-color), transparent 88%);
  margin-top: 18px;
}

.pm-nav button {
  border: 0;
  background: none;
  padding: 6px 0;
  font-size: 0.88rem;
  color: var(--default-color);
  max-width: 48%;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pm-nav .pm-next {
  margin-left: auto;
  text-align: right;
}

.pm-nav button:hover {
  color: var(--heading-color);
}

.pm-nav button[hidden] {
  display: none;
}

@media (max-width: 640px) {
  .pm-content { padding: 26px 22px 6px; }
  .pm-nav { padding: 16px 22px 24px; }
  .pm-title { font-size: 1.35rem; }
}

/* ---------- Gallery ---------- */
.pm-gallery {
  position: relative;
  background: #0e0e10;
}

.pm-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.pm-track::-webkit-scrollbar {
  display: none;
}

.pm-slide {
  position: relative;
  flex: 0 0 100%;
  scroll-snap-align: center;
  margin: 0;
  aspect-ratio: 16 / 9;
  max-height: 62dvh;
  min-height: 0;
  overflow: hidden;
}

.pm-slide > img,
.pm-slide > video,
.pm-slide > iframe,
.pm-slide > .pm-yt {
  position: absolute;
  inset: 0;
}

.pm-slide img,
.pm-slide video,
.pm-slide iframe {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: 0;
  display: block;
}

.pm-slide img {
  cursor: zoom-in;
}

.pm-slide figcaption {
  position: absolute;
  left: 16px;
  bottom: 14px;
  max-width: calc(100% - 32px);
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.8rem;
  pointer-events: none;
}

.pm-yt {
  all: unset;
  display: block;
  cursor: pointer;
}

.pm-yt img {
  object-fit: cover;
  cursor: pointer;
}

.pm-yt .yt-play {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: 74px;
  height: 52px;
  border-radius: 14px;
  background: #ff0033;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.8rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
}

.pm-yt:hover .yt-play {
  transform: scale(1.08);
}

.pm-arrow {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.9);
  color: #111;
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: opacity 0.2s ease;
  z-index: 2;
}

.pm-arrow.prev { left: 14px; }
.pm-arrow.next { right: 14px; }

.pm-arrow:disabled {
  opacity: 0;
  pointer-events: none;
}

.pm-dots {
  position: absolute;
  left: 50%;
  bottom: 14px;
  translate: -50% 0;
  display: flex;
  gap: 7px;
  z-index: 2;
}

.pm-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  transition: all 0.25s ease;
}

.pm-dots button.active {
  width: 22px;
  background: #fff;
}

/* fullscreen image zoom inside the dialog */
.pm-zoom {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.92);
  display: grid;
  place-items: center;
  cursor: zoom-out;
  animation: pm-fade 0.2s ease;
}

.pm-zoom img {
  max-width: 94vw;
  max-height: 94vh;
  object-fit: contain;
}

@keyframes pm-fade {
  from { opacity: 0; }
}

html.pm-lock {
  overflow: hidden;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .trail-card { transition: none; opacity: 1; }
  .cat .cat-tail,
  .cat .cat-eyes,
  .trail-cat.walking .cat-leg,
  .trail-cat.walking .cat-upper { animation: none; }
  .project-modal[open] { animation: none; }
}
