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

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1rem 3rem;
  gap: 0;
  background-color: #0f0f0f;
  background-image: radial-gradient(circle, #242424 1px, transparent 1px);
  background-size: 22px 22px;
  color: #f0f0f0;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

/* ── Page header ─────────────────────────────────── */
.page-header {
  width: min(95vw, 1200px);
  margin-bottom: 1.75rem;
  padding: 0 0.25rem;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.page-subtitle {
  font-size: 0.8rem;
  color: #666;
  margin-top: 0.3rem;
  letter-spacing: 0.05em;
}

/* ── Controls row (search + sort) ───────────────── */
.controls-row {
  width: min(95vw, 1200px);
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

/* ── Search bar ──────────────────────────────────── */
.search-bar {
  flex: 1;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #444;
  font-size: 0.85rem;
  pointer-events: none;
}

#search {
  width: 100%;
  background: #171717;
  border: 1px solid #2e2e2e;
  border-radius: 10px;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  color: #e0e0e0;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

#search::placeholder { color: #444; }
#search:focus { border-color: #555; }

/* hide the native clear button */
#search::-webkit-search-cancel-button { display: none; }

/* ── Sort dropdown ───────────────────────────────── */
.sort-wrap {
  flex-shrink: 0;
}

#sort {
  height: 100%;
  background: #171717;
  border: 1px solid #2e2e2e;
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  color: #aaa;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
  appearance: none;
}

#sort:focus,
#sort:hover { border-color: #555; }

/* ── Grid ────────────────────────────────────────── */
.grid {
  width: min(95vw, 1200px);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

/* ── Project card ────────────────────────────────────── */
.project-card {
  background: #171717;
  border: 1px solid #2e2e2e;
  border-radius: 16px;
  padding: 1.5rem 1.75rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: border-color 0.2s;
}

.project-card:hover {
  border-color: #444;
}

.project-card--link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.project-card--link:hover {
  border-color: #555;
}

/* ── Card top row ────────────────────────────────── */
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
  letter-spacing: -0.2px;
}

.card-subtitle {
  font-size: 0.78rem;
  color: #777;
  letter-spacing: 0.03em;
  font-style: italic;
}

.card-github {
  color: #666;
  font-size: 1.1rem;
  text-decoration: none;
  flex-shrink: 0;
  margin-top: 0.1rem;
  transition: color 0.2s;
  line-height: 1;
  cursor: pointer;
}

.card-github:hover {
  color: #ddd;
}

/* ── Description ─────────────────────────────────── */
.card-desc {
  font-size: 0.88rem;
  color: #999;
  line-height: 1.65;
  flex: 1;
}

.card-desc a,
.desc-link {
  color: #bbb;
  text-decoration: none;
  border-bottom: 1px solid #444;
  transition: color 0.15s, border-color 0.15s;
  cursor: pointer;
}

.card-desc a:hover,
.desc-link:hover {
  color: #fff;
  border-color: #888;
}

/* ── Card bottom row ─────────────────────────────── */
.card-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* ── Tech capsules ───────────────────────────────── */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.tag {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #aaa;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.tag:hover {
  color: #ddd;
  border-color: #555;
}

/* ── Status dot ──────────────────────────────────── */
.card-top-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.status-dot--active   { background: #22c55e; box-shadow: 0 0 5px rgba(34,197,94,0.4); }
.status-dot--inactive { background: #6b2f2f; }

.project-card--inactive .card-title    { color: #555; }
.project-card--inactive .card-subtitle { color: #3a3a3a; }
.project-card--inactive .card-desc     { color: #444; }
.project-card--inactive .tag           { color: #444; border-color: #262626; }
.project-card--inactive .card-date     { color: #383838; }

/* ── Date ────────────────────────────────────────── */
.card-date {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #555;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 860px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  body { padding: 1.5rem 0.75rem 2rem; }
  .page-title { font-size: 1.3rem; }
  .project-card { padding: 1.25rem 1.25rem 1.2rem; border-radius: 12px; }
}
