/* /projects: project index built from projects/projects.js */
.projects-page {
  --paper: #f7f5f1;
  --card: #ffffff;
  --line: #e7e2d9;
  --ink: #060a11;
  --muted: #5b5d6b;
  --accent: #d9693f;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --cat-hardware: #f3d9b5;
  --cat-mac: #f6d2c4;
  --cat-mobile: #cfe3d6;
  --cat-web: #d5dcf2;
  --cat-tools: #e4dcef;
  background: var(--paper);
  color: var(--ink);
  padding: 150px 0 110px;
}

.pj-eyebrow { font-family: var(--mono); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.pj-title {
  font-family: "Manrope", sans-serif; font-weight: 800; letter-spacing: -0.03em;
  font-size: clamp(44px, 7vw, 88px); line-height: 1; margin: 16px 0 20px;
}
.pj-lead { max-width: 620px; font-size: 18px; line-height: 1.7; color: var(--muted); }

.pj-stats { display: flex; flex-wrap: wrap; gap: 28px; margin: 32px 0 48px; padding: 0; list-style: none; }
.pj-stats b { display: block; font-family: "Manrope", sans-serif; font-weight: 800; font-size: 34px; line-height: 1.1; }
.pj-stats span { font-size: 13px; color: var(--muted); }

/* Filters */
.pj-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 32px; }
.pj-filter {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 600;
  transition: background .15s, color .15s, border-color .15s;
}
.pj-filter small { font-family: var(--mono); font-weight: 400; color: var(--muted); margin-left: 6px; }
.pj-filter:hover { border-color: var(--ink); }
.pj-filter.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.pj-filter.is-active small { color: #aab0ba; }

/* Grid */
.pj-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.pj-card {
  display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; overflow: hidden; transition: transform .2s ease, box-shadow .2s ease;
}
.pj-card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px -24px rgba(6, 10, 17, .35); }
.pj-card.is-hidden { display: none; }

.pj-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; display: grid; place-items: center; }
/* absolute fill so object-position works inside the aspect-ratio box */
.pj-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pj-media.is-contain img { position: static; width: 56%; height: 72%; object-fit: contain; }
.pj-media .pj-emoji { font-size: 64px; line-height: 1; filter: drop-shadow(0 6px 10px rgba(0,0,0,.12)); }
.pj-media[data-cat="hardware"] { background: var(--cat-hardware); }
.pj-media[data-cat="mac"] { background: var(--cat-mac); }
.pj-media[data-cat="mobile"] { background: var(--cat-mobile); }
.pj-media[data-cat="web"] { background: var(--cat-web); }
.pj-media[data-cat="tools"] { background: var(--cat-tools); }

.pj-body { display: flex; flex-direction: column; flex-grow: 1; padding: 22px 22px 20px; }
.pj-meta { display: flex; justify-content: space-between; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.pj-body h3 { font-family: "Manrope", sans-serif; font-weight: 800; font-size: 22px; margin-bottom: 8px; }
.pj-body p { color: var(--muted); font-size: 15px; line-height: 1.6; flex-grow: 1; }
.pj-stack { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 16px; padding: 0; list-style: none; }
.pj-stack li { font-family: var(--mono); font-size: 11px; background: var(--paper); border-radius: 6px; padding: 3px 8px; }
.pj-links { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; font-size: 14px; font-weight: 600; }
.pj-links a { color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--line); }
.pj-links a:hover { border-color: var(--accent); }
.pj-private { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--muted); }

/* Featured card spans the full row */
.pj-card.is-featured { grid-column: 1 / -1; flex-direction: row; }
.pj-card.is-featured .pj-media { flex: 0 0 58%; aspect-ratio: auto; min-height: 380px; }
.pj-card.is-featured .pj-media img { object-position: 0 0; }
.pj-card.is-featured .pj-body { padding: 40px; justify-content: center; }
.pj-card.is-featured h3 { font-size: clamp(30px, 3.4vw, 44px); }
.pj-card.is-featured p { flex-grow: 0; font-size: 17px; margin-bottom: 20px; }
.pj-badge {
  display: inline-block; align-self: flex-start; font-family: var(--mono); font-size: 12px;
  color: #fff; background: var(--accent); border-radius: 999px; padding: 4px 10px; margin-bottom: 14px;
}

.pj-note { margin-top: 40px; font-size: 13px; color: var(--muted); }

@media (max-width: 1199.98px) {
  .pj-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
  .projects-page { padding-top: 120px; }
  .pj-card.is-featured { flex-direction: column; }
  .pj-card.is-featured .pj-media { flex: none; min-height: 0; aspect-ratio: 16 / 10; }
  .pj-card.is-featured .pj-body { padding: 26px; }
}
@media (max-width: 639.98px) {
  .pj-grid { grid-template-columns: 1fr; }
  .pj-stats { gap: 20px; }
  .pj-media { aspect-ratio: 2 / 1; }
}
@media (prefers-reduced-motion: reduce) {
  .pj-card { transition: none; }
  .pj-card:hover { transform: none; }
}

/* ---------- Cards that open a reels overlay ---------- */
.pj-card.has-reels { cursor: pointer; }
.pj-play {
  position: absolute; left: 16px; bottom: 16px; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(6, 10, 17, .82); color: #fff; font-size: 14px; font-weight: 600;
  padding: 8px 14px; border-radius: 999px; backdrop-filter: blur(6px);
  transition: transform .2s ease, background .2s ease;
}
.pj-play i { font-size: 18px; }
.pj-card.has-reels:hover .pj-play { transform: translateY(-3px); background: linear-gradient(90deg, #f58529, #dd2a7b 50%, #8134af); }
.pj-reels-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 600; font-size: 14px; padding: 7px 14px;
}
.pj-reels-btn:hover { background: linear-gradient(90deg, #f58529, #dd2a7b 50%, #8134af); }
.pj-links a i { vertical-align: -2px; }

/* ---------- Reels overlay ---------- */
.reels-lock, .reels-lock body { overflow: hidden; }
.reels {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 24px;
  --ink: #060a11; --muted: #8b93a3; --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
.reels[hidden] { display: none; }
.reels-backdrop {
  position: absolute; inset: 0; background: rgba(6, 10, 17, .72); backdrop-filter: blur(10px);
  opacity: 0; transition: opacity .28s ease;
}
.reels-panel {
  position: relative; width: min(1120px, 100%); max-height: calc(100vh - 48px); overflow: auto;
  background: #0f1218; color: #fff; border-radius: 28px; padding: 28px;
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, .6);
  opacity: 0; transform: translateY(40px) scale(.96);
  transition: opacity .28s ease, transform .4s cubic-bezier(.2, .9, .25, 1.15);
}
.reels.is-open .reels-backdrop { opacity: 1; }
.reels.is-open .reels-panel { opacity: 1; transform: none; }
.reels.is-closing .reels-panel { transform: translateY(24px) scale(.98); transition-timing-function: ease-in; }

.reels-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.reels-id { display: flex; align-items: center; gap: 14px; }
.reels-avatar {
  flex-shrink: 0; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 26px;
  background: conic-gradient(from 200deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5, #feda75);
  box-shadow: inset 0 0 0 3px #0f1218;
}
.reels-id h2 { font-family: "Manrope", sans-serif; font-weight: 800; font-size: 24px; margin: 0; color: #fff; }
.reels-bio { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.reels-actions { display: flex; align-items: center; gap: 10px; }
.reels-follow {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: #fff; font-weight: 600; font-size: 14px;
  padding: 10px 16px; border-radius: 999px; background: linear-gradient(90deg, #f58529, #dd2a7b 50%, #8134af);
  transition: transform .15s ease, filter .15s ease;
}
.reels-follow:hover { color: #fff; transform: translateY(-1px); filter: brightness(1.08); }
.reels-close, .reels-back, .reels-nav button {
  border: 1px solid #2a2f3a; background: #171b23; color: #fff; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600;
}
.reels-close { width: 42px; height: 42px; justify-content: center; font-size: 20px; }
.reels-close:hover, .reels-back:hover, .reels-nav button:not(:disabled):hover { background: #232937; }

/* Grid: hottest reel is big, the rest fill around it */
.reels-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin: 0; }
.reels-grid li:first-child { grid-column: span 2; grid-row: span 2; }
.reel {
  position: relative; display: block; width: 100%; height: 100%; aspect-ratio: 9 / 16; padding: 0; border: 0;
  border-radius: 16px; overflow: hidden; background: #000; color: #fff; text-align: left;
  opacity: 0; transform: translateY(28px) scale(.92) rotate(-2deg);
  transition: transform .25s ease, box-shadow .25s ease;
}
.reels.is-open .reel { animation: reel-in .55s cubic-bezier(.2, .9, .25, 1.2) forwards; animation-delay: calc(var(--i) * 55ms + 120ms); }
.reels-grid.is-back .reel { animation: reel-in .4s cubic-bezier(.2, .9, .25, 1.2) forwards; animation-delay: calc(var(--i) * 25ms); }
@keyframes reel-in { to { opacity: 1; transform: none; } }
.reel img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.reel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(0,0,0,.85)); }
.reel:hover img, .reel:focus-visible img { transform: scale(1.06); }
.reel:hover, .reel:focus-visible { box-shadow: 0 0 0 2px #dd2a7b, 0 18px 40px -16px rgba(221, 42, 123, .6); }
.reel:focus-visible { outline: none; }
.reel-rank {
  position: absolute; z-index: 1; top: 10px; left: 10px; font-family: var(--mono); font-size: 12px;
  background: rgba(0, 0, 0, .6); border-radius: 999px; padding: 3px 9px;
}
.reels-grid li:first-child .reel-rank { background: linear-gradient(90deg, #f58529, #dd2a7b); font-size: 13px; }
.reel-info { position: absolute; z-index: 1; left: 12px; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.reel-likes { font-family: var(--mono); font-size: 12px; color: #ffd3e6; }
.reel-cap { font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.reels-grid li:first-child .reel-cap { font-size: 17px; font-weight: 600; -webkit-line-clamp: 3; }

/* Player */
.reels-back { padding: 8px 14px; margin-bottom: 16px; }
.reels-player.is-in .reels-player-inner { animation: player-in .4s cubic-bezier(.2, .9, .25, 1.1); }
@keyframes player-in { from { opacity: 0; transform: scale(.94); } }
.reels-player-inner { display: flex; gap: 32px; align-items: flex-start; justify-content: center; }
.reels-frame { flex: 0 0 min(400px, 100%); }
.reels-frame iframe { display: block; width: 100%; height: min(76vh, 650px); border: 0; border-radius: 16px; background: #fff; }
.reels-player-meta { flex: 0 1 340px; padding-top: 8px; }
.reels-player-meta .reel-rank { position: static; display: inline-block; margin-bottom: 14px; background: linear-gradient(90deg, #f58529, #dd2a7b); }
.reels-player-cap { font-family: "Manrope", sans-serif; font-weight: 800; font-size: 26px; line-height: 1.25; color: #fff; margin-bottom: 8px; }
.reels-player-sub { color: var(--muted); font-family: var(--mono); font-size: 13px; margin-bottom: 20px; }
.reels-nav { display: flex; gap: 8px; margin-top: 20px; }
.reels-nav button { padding: 8px 14px; }
.reels-nav button:disabled { opacity: .35; }

@media (max-width: 767.98px) {
  .reels { padding: 0; align-items: end; }
  .reels-panel { border-radius: 24px 24px 0 0; max-height: 94vh; padding: 20px 16px 28px; transform: translateY(100%); }
  .reels.is-closing .reels-panel { transform: translateY(100%); }
  .reels-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .reels-follow { padding: 8px 12px; font-size: 13px; }
  .reels-head { padding-right: 52px; }
  .reels-close { position: absolute; top: 18px; right: 16px; }
  .reels-player-inner { flex-direction: column; align-items: stretch; gap: 16px; }
  .reels-frame { flex-basis: auto; }
  .reels-frame iframe { height: min(72vh, 600px); }
  .reels-player-meta { flex-basis: auto; padding-top: 0; }
  .reels-player-cap { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .reels-backdrop, .reels-panel, .reel, .reel img, .pj-play { transition: none; }
  .reels.is-open .reel, .reels-grid.is-back .reel, .reels-player.is-in .reels-player-inner { animation: none; opacity: 1; transform: none; }
}
