.projects-page {
  --archive-accent: #6d4aff;
  --archive-accent-soft: rgba(109, 74, 255, 0.14);
  position: relative;
  isolation: isolate;
  max-width: 1200px;
}

.projects-intro {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  max-width: 1040px;
  min-height: 220px;
  margin: 0 0 4rem;
  padding: clamp(2rem, 5vw, 3.5rem);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.14), 0 8px 28px rgba(93, 63, 211, 0.08);
}

.projects-intro::before {
  position: absolute;
  z-index: -1;
  top: 0;
  left: 0;
  width: min(42%, 360px);
  height: 5px;
  border-radius: 0 0 6px 0;
  background: linear-gradient(90deg, var(--purple), #9c4dff 48%, var(--ember));
  content: "";
}

.projects-intro::after {
  position: absolute;
  z-index: -1;
  top: 5px;
  right: 0;
  width: 240px;
  height: 180px;
  background: radial-gradient(ellipse, rgba(255, 122, 26, 0.07), transparent 72%);
  content: "";
  pointer-events: none;
}

[data-theme="light"] .projects-intro::after {
  background: radial-gradient(ellipse, rgba(93, 63, 211, 0.07), transparent 72%);
}

.projects-intro-copy {
  max-width: 820px;
}

.projects-kicker,
.section-eyebrow {
  margin-bottom: 0.55rem;
  color: var(--purple);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.projects-intro .archive-intro-title {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0.4rem 0 0.8rem;
  padding-bottom: 0.75rem;
  color: var(--ember);
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.projects-lede,
.section-description {
  max-width: 760px;
  margin: 0;
  color: var(--dim);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.6;
}

.hoard-page .card-content h2 {
  font-size: 1.08rem;
  line-height: 1.35;
  transition: color 0.18s;
}

.hoard-page .archive-card:hover .card-content h2 {
  color: var(--archive-accent);
}

.archive-section {
  margin: 0 0 5rem;
  scroll-margin-top: 5rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.projects-page .section-title {
  margin: 0.35rem 0 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.section-description {
  max-width: 390px;
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0 0 1.4rem;
}

.hoard-filter-bar {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 3px 3px 8px;
  scrollbar-width: thin;
}

.hoard-filter-bar .filter-pill {
  flex: 0 0 auto;
  white-space: nowrap;
}

.filter-pill {
  min-height: 38px;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--dim);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s, background-color 0.18s, transform 0.18s;
}

.filter-pill:hover {
  border-color: var(--archive-accent);
  color: var(--text);
}

.filter-pill.is-active {
  border-color: var(--archive-accent);
  background: var(--archive-accent);
  color: #fff;
}

.filter-pill:focus-visible,
.archive-card:focus-visible {
  outline: 3px solid var(--archive-accent);
  outline-offset: 3px;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.archive-card {
  position: relative;
  z-index: 1;
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.archive-card::before {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--archive-accent), var(--ember));
  content: "";
}

.note-card-stack {
  position: relative;
  z-index: 0;
  min-width: 0;
  isolation: isolate;
}

.note-card-stack.has-pages::after {
  position: absolute;
  z-index: -1;
  inset: 4px -6px -6px 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.08);
  content: "";
  pointer-events: none;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.note-card-stack.has-pages:hover::after {
  transform: translate(2px, 2px);
  border-color: var(--archive-accent);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.note-card-stack.has-pages:hover .archive-card {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

.note-card-stack[hidden] {
  display: none !important;
}

.archive-card:hover {
  transform: translateY(-4px);
  border-color: var(--archive-accent);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
}

.card-image-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(ellipse at 50% 100%, var(--archive-accent-soft), transparent 65%),
    var(--code-bg);
}

.card-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s;
}

.archive-card:hover .card-image {
  transform: scale(1.035);
}

.type-badge {
  position: absolute;
  left: 0.8rem;
  bottom: 0.8rem;
  padding: 0.28rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 5px;
  background: rgba(15, 17, 21, 0.82);
  color: #fff;
  font: 700 0.67rem/1.2 'JetBrains Mono', monospace;
  letter-spacing: 0.06em;
}

.card-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1.1rem 1.15rem 1rem;
}

.card-content h3 {
  font-size: 1.08rem;
  line-height: 1.35;
  transition: color 0.18s;
}

.archive-card:hover .card-content h3 {
  color: var(--archive-accent);
}

.hoard-invite-art {
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 25% 25%, rgba(93, 63, 211, 0.38), transparent 56%),
    radial-gradient(ellipse at 80% 75%, rgba(255, 122, 26, 0.2), transparent 52%),
    var(--code-bg);
}

.hoard-invite-mark {
  color: var(--text);
  font: 800 clamp(2.5rem, 7vw, 4.25rem)/1 'JetBrains Mono', monospace;
  letter-spacing: -0.08em;
  text-shadow: 0 0 30px rgba(109, 74, 255, 0.5);
}

.hoard-invite-card .card-content h2 {
  font-size: 1.08rem;
  line-height: 1.35;
  transition: color 0.18s;
}

.hoard-invite-card:hover .card-content h2 {
  color: var(--archive-accent);
}

.card-excerpt {
  display: -webkit-box;
  overflow: hidden;
  min-height: 4.35em;
  margin: 0;
  color: var(--dim);
  font-size: 0.9rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.latest-update {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-left: 2px solid var(--archive-accent);
  border-radius: 0 6px 6px 0;
  background: var(--archive-accent-soft);
}

.latest-update-label {
  color: var(--archive-accent);
  font: 700 0.63rem 'JetBrains Mono', monospace;
  letter-spacing: 0.08em;
}

.latest-update-title {
  overflow: hidden;
  color: var(--text);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  color: var(--dim);
  font: 0.72rem 'JetBrains Mono', monospace;
}

.card-meta time {
  white-space: nowrap;
}

.card-topic {
  overflow: hidden;
  color: var(--archive-accent);
  text-align: right;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.filter-empty {
  margin: 1rem 0;
  color: var(--dim);
}

.projects-page [hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 580px) {
  .projects-intro {
    margin-bottom: 3rem;
    min-height: 0;
    padding: 1.75rem;
  }

  .projects-intro::before {
    width: 58%;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }

  .archive-grid {
    grid-template-columns: 1fr;
  }

  .card-excerpt {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .filter-pill,
  .archive-card,
  .note-card-stack.has-pages::after,
  .card-image,
  .card-content h3 {
    transition: none;
  }
}
