@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: light;
  --bg: #f7f5fc;
  --surface: #fff;
  --surface-2: #f0edf7;
  --surface-3: #e9e4f2;
  --text: #201b2b;
  --muted: #777181;
  --line: #e6e0ed;
  --primary: #6750a4;
  --on-primary: #fff;
  --accent: #a18bda;
  --shadow: 0 8px 28px rgba(47, 34, 74, .055);
  --shadow-hover: 0 18px 42px rgba(47, 34, 74, .12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --page-width: 1080px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14121a;
  --surface: #201d28;
  --surface-2: #2a2534;
  --surface-3: #383044;
  --text: #f2edf8;
  --muted: #b1a8be;
  --line: #393241;
  --primary: #d0bcff;
  --on-primary: #30234f;
  --accent: #b6a0f4;
  --shadow: 0 8px 28px rgba(0, 0, 0, .16);
  --shadow-hover: 0 18px 42px rgba(0, 0, 0, .3);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(166, 143, 226, .10), transparent 48%),
    var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  transition: background-color .25s ease, color .25s ease;
}

button,
input,
a {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] {
  display: none !important;
}

.topbar {
  width: min(calc(100% - 48px), 1200px);
  min-height: 82px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.45px;
}

.brand-mark {
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 24px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform .2s ease, background .2s ease;
}

.icon-button:hover {
  background: var(--surface-2);
  transform: rotate(-8deg);
}

.icon-button svg {
  width: 21px;
  height: 21px;
}

.page-shell {
  width: min(calc(100% - 48px), var(--page-width));
  margin: 0 auto;
}

.hero {
  padding: 98px 0 78px;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.status-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #50b995;
  box-shadow: 0 0 0 4px rgba(80, 185, 149, .12);
}

h1,
h2,
p {
  margin-top: 0;
}

.hero h1 {
  margin: 27px 0 18px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(44px, 7.5vw, 78px);
  font-weight: 800;
  line-height: 1.09;
  letter-spacing: -4px;
}

.gradient-text {
  color: var(--primary);
  background: linear-gradient(100deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-description {
  max-width: 530px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.hero-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.meta-pill svg {
  width: 15px;
  height: 15px;
}

.directory-section {
  padding-bottom: 62px;
}

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

.section-kicker {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.8px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(24px, 4vw, 33px);
  font-weight: 800;
  letter-spacing: -1.3px;
}

.accent-dot {
  color: var(--primary);
}

.collection-label {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  white-space: nowrap;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 13px;
  max-width: 100%;
  height: 55px;
  margin-bottom: 24px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color .2s ease, box-shadow .2s ease;
}

.search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(161, 139, 218, .12);
}

.search-wrap > svg {
  flex: 0 0 auto;
  color: var(--muted);
}

.search-wrap input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
}

.search-wrap input:focus-visible {
  outline: none;
}

.search-wrap input::placeholder {
  color: var(--muted);
}

.search-wrap kbd {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.site-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 18px;
}

.site-card {
  position: relative;
  min-width: 0;
  min-height: 230px;
  display: flex;
  flex-direction: column;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease, background-color .25s ease;
  animation: card-appear .45s both;
}

.site-card::before {
  position: absolute;
  top: -60px;
  right: -60px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--primary);
  opacity: .045;
  content: "";
  pointer-events: none;
  transition: transform .3s ease;
}

.site-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

.site-card:hover::before {
  transform: scale(1.7);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.site-icon {
  width: 51px;
  height: 51px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface-2);
  color: var(--primary);
  font-size: 25px;
  font-weight: 700;
}

.site-icon img {
  width: 100%;
  height: 100%;
  padding: 9px;
  object-fit: contain;
}

.featured-badge {
  max-width: 60%;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.card-copy {
  min-width: 0;
  margin-top: 21px;
}

.card-copy h3 {
  margin: 0 0 7px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.35px;
  overflow-wrap: break-word;
  word-break: normal;
}

.card-copy p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
  overflow-wrap: break-word;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 20px;
}

.category-label {
  max-width: 80%;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-arrow {
  width: 32px;
  height: 32px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  transition: background .2s ease, transform .2s ease;
}

.site-card:hover .card-arrow {
  background: var(--primary);
  color: var(--on-primary);
  transform: translate(2px, -2px);
}

.loading-card {
  grid-column: 1 / -1;
  padding: 36px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  color: var(--muted);
  text-align: center;
}

.empty-state {
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.closing-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.closing-symbol {
  width: 52px;
  height: 52px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 18px;
  background: var(--surface-2);
  color: var(--primary);
  font-size: 29px;
}

.closing-copy {
  min-width: 0;
  flex: 1;
}

.closing-copy h2 {
  margin-bottom: 4px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 17px;
}

.closing-copy p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.text-link {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.text-link span {
  margin-left: 4px;
}

.footer {
  width: min(calc(100% - 48px), 1200px);
  margin: 0 auto;
  padding: 24px 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.footer p {
  margin: 0;
}

.github-link {
  color: var(--primary);
  font-weight: 700;
}

/* Project details page */
.project-shell {
  width: min(calc(100% - 48px), 820px);
  margin: 0 auto;
  padding: 54px 0 70px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.project-card,
.project-hero,
.project-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.project-hero {
  padding: clamp(24px, 5vw, 48px);
}

.project-icon-frame {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface-2);
  color: var(--primary);
  font-size: 34px;
}

.project-icon-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.project-category {
  display: inline-block;
  margin-top: 24px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
}

.project-title,
#project-title {
  margin: 10px 0 12px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(30px, 6vw, 48px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1.5px;
  overflow-wrap: anywhere;
}

.project-description,
#project-description {
  max-width: 620px;
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
  overflow-wrap: break-word;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-button,
.secondary-button,
#visit-project,
#star-link {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: transform .2s ease, opacity .2s ease, background .2s ease;
}

.primary-button:hover,
#visit-project:hover,
#star-link:hover {
  transform: translateY(-2px);
  opacity: .92;
}

.secondary-button {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.project-panel {
  margin-top: 20px;
  padding: 24px;
}

.project-panel h2 {
  margin-bottom: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 19px;
}

.project-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

#star-card {
  margin-top: 20px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

#star-card h2 {
  margin-bottom: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 20px;
}

#star-message {
  color: var(--muted);
}

#star-link svg {
  width: 18px;
  height: 18px;
}

/* Tablets */
@media (max-width: 900px) {
  .page-shell {
    width: min(calc(100% - 36px), var(--page-width));
  }

  .topbar,
  .footer {
    width: calc(100% - 36px);
  }

  .site-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .hero {
    padding: 72px 0 56px;
  }

  .hero h1 {
    letter-spacing: -2px;
  }
}

/* Mobile: one project card per row */
@media screen and (max-width: 600px) {
  .page-shell {
    width: calc(100% - 32px);
  }

  .topbar,
  .footer {
    width: calc(100% - 32px);
  }

  .topbar {
    min-height: 68px;
    gap: 10px;
  }

  .brand {
    gap: 9px;
    font-size: 14px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    font-size: 21px;
  }

  .top-actions {
    gap: 7px;
  }

  .icon-button {
    width: 42px;
    height: 42px;
  }

  .site-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px;
  }

  .site-card {
    width: 100%;
    min-width: 0;
    min-height: 190px;
    padding: 20px;
    border-radius: var(--radius-lg);
  }

  .card-top {
    align-items: center;
  }

  .card-copy {
    margin-top: 17px;
  }

  .card-copy h3 {
    font-size: 19px;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .card-copy p {
    font-size: 13px;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .card-bottom {
    padding-top: 18px;
  }

  .hero {
    padding: 54px 0 42px;
  }

  .hero h1 {
    margin-top: 22px;
    font-size: clamp(34px, 9vw, 48px);
    line-height: 1.15;
    letter-spacing: -1.8px;
    overflow-wrap: anywhere;
  }

  .hero-description {
    font-size: 15px;
  }

  .hero-meta {
    gap: 8px;
    margin-top: 22px;
  }

  .meta-pill {
    max-width: 100%;
  }

  .section-heading {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
  }

  .section-heading h2 {
    font-size: 24px;
    letter-spacing: -.8px;
  }

  .collection-label {
    max-width: 45%;
    white-space: normal;
    text-align: center;
  }

  .search-wrap {
    height: 52px;
    margin-bottom: 18px;
    padding: 0 13px;
  }

  .search-wrap kbd {
    display: none;
  }

  .directory-section {
    padding-bottom: 40px;
  }

  .closing-card {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 14px;
    padding: 20px;
  }

  .closing-copy {
    min-width: 0;
  }

  .text-link {
    margin-left: 66px;
  }

  .footer {
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 20px;
  }

  .project-shell {
    width: calc(100% - 32px);
    padding: 32px 0 48px;
  }

  .project-hero {
    padding: 24px;
    border-radius: var(--radius-lg);
  }

  .project-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .project-actions a,
  .project-actions button,
  #visit-project,
  #star-link {
    width: 100%;
  }

  .project-panel,
  #star-card {
    padding: 20px;
    border-radius: var(--radius-lg);
  }
}

/* Very small phones */
@media (max-width: 360px) {
  .page-shell,
  .topbar,
  .footer,
  .project-shell {
    width: calc(100% - 24px);
  }

  .brand {
    font-size: 12px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    font-size: 19px;
  }

  .site-card {
    padding: 16px;
  }

  .hero h1 {
    font-size: 32px;
    letter-spacing: -1px;
  }

  .section-heading h2 {
    font-size: 21px;
  }

  .project-hero {
    padding: 18px;
  }
}

@keyframes card-appear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
