.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}

.project-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.project-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

.project-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  padding: 2px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 13px 13px 0 0;
}

.project-image-inner {
  width: 100%;
  height: 100%;
  background: var(--bg-alt);
  border-radius: 11px 11px 0 0;
  overflow: hidden;
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.project-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.project-name {
  font-size: 1.1rem;
  margin: 0;
}

.project-description {
  color: var(--text-dim);
  font-size: 0.88rem;
  margin: 0;
  line-height: 1.4;
}

.project-url {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  word-break: break-all;
  margin-top: auto;
  padding-top: 6px;
}

/* Admin */

.admin-header .subtitle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-header .subtitle a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.inline-form { display: inline; }

.admin-section-title {
  font-size: 1.15rem;
  margin: 24px 0 14px;
}

.admin-section-title:first-of-type { margin-top: 0; }

.admin-project {
  margin-bottom: 4px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.admin-order {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  padding-top: 4px;
}

.order-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
}

.order-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.order-btn:not(:disabled):hover {
  border-color: var(--accent);
  color: var(--accent);
}

.admin-project .admin-row {
  flex: 1;
  min-width: 0;
}

.admin-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.admin-row-top {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.admin-row-top input[type="text"],
.admin-row-top input[type="url"] {
  flex: 1;
  min-width: 160px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.9rem;
}

.visible-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
}

.admin-row textarea {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.88rem;
  font-family: inherit;
  resize: vertical;
}

.admin-row-bottom {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-thumb {
  width: 56px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.admin-save-btn {
  width: auto;
  padding: 9px 18px;
  font-size: 0.9rem;
}

.danger-link {
  color: var(--danger);
  font-size: 0.8rem;
  margin-bottom: 18px;
}

.admin-login-card {
  max-width: 360px;
  margin: 80px auto 0;
}

.admin-title {
  margin: 0 0 18px;
  font-size: 1.3rem;
  text-align: center;
}

@media (max-width: 640px) {
  .projects-grid { grid-template-columns: 1fr; }
}
