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

:root {
  --accent: #2d5bff;
  --accent-light: #eef2ff;
  --accent-glow: rgba(45, 91, 255, 0.08);
  --bg: #fcfcfc;
  --fg: #111;
  --muted: #777;
  --faint: #bbb;
  --border: #e8e8e8;
  --card-bg: #fff;
  --radius: 14px;
  --radius-sm: 8px;
  --font-body: 'Space Grotesk', -apple-system, sans-serif;
  --font-mono: 'Space Mono', monospace;
}

html {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Subtle grain texture overlay */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  z-index: 9999;
}

/* ─── Public homepage ─── */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 2rem;
}

/* Hero */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6rem 0 3rem;
  gap: 0.75rem;
}

.logo {
  font-family: var(--font-mono);
  font-size: 2.8rem;
  letter-spacing: 0.35em;
  font-weight: 400;
  background: linear-gradient(135deg, var(--fg) 0%, var(--muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 400;
  text-align: center;
  max-width: 400px;
  line-height: 1.6;
}

.hero-line {
  width: 48px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 2px;
  margin-top: 0.75rem;
}

/* Projects section */
.projects-section {
  width: 100%;
  max-width: 720px;
  padding: 2rem 0 4rem;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--faint);
  margin-bottom: 1.5rem;
}

.project-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Project card */
.project-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.project-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 24px var(--accent-glow), 0 1px 4px rgba(0,0,0,0.04);
  transform: translateY(-2px);
}

.project-card-static {
  cursor: default;
}

.project-card-static:hover {
  border-color: var(--border);
  box-shadow: none;
  transform: none;
}

.project-logo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--accent-light);
}

.project-logo-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  flex-shrink: 0;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 500;
}

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

.project-name {
  font-weight: 500;
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.project-desc {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.project-arrow {
  color: var(--faint);
  font-size: 1.1rem;
  transition: color 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.project-card:hover .project-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding: 3rem 0 2.5rem;
  text-align: center;
  width: 100%;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.footer-email,
.footer-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.15s;
}

.footer-email:hover,
.footer-link:hover {
  color: var(--accent);
}

.footer-sep {
  color: var(--faint);
  font-size: 0.8rem;
}

.copyright {
  color: var(--faint);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}


/* ─── Admin panel ─── */

.admin-wrap {
  max-width: 600px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.admin-wrap h1 {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  letter-spacing: 0.2em;
  font-weight: 400;
  margin-bottom: 2rem;
}

/* Login form */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 300px;
}

.login-form input {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  transition: border-color 0.15s;
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

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

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: #1a47e6;
}

.btn-danger {
  color: #c0392b;
  border-color: #e0c4c0;
}

.btn-danger:hover {
  background: #c0392b;
  color: #fff;
  border-color: #c0392b;
}

.btn-small {
  font-size: 0.75rem;
  padding: 0.35rem 0.7rem;
}

.error-msg {
  color: #c0392b;
  font-size: 0.8rem;
}

.success-msg {
  color: #27ae60;
  font-size: 0.8rem;
}

/* Dashboard sections */
.section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.section:last-child {
  border-bottom: none;
}

.section label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 0.5rem;
}

.section input[type="text"],
.section input[type="url"],
.section input[type="email"] {
  font-family: inherit;
  font-size: 0.85rem;
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  transition: border-color 0.15s;
}

.section input:focus {
  outline: none;
  border-color: var(--accent);
}

.field-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.field-row input {
  flex: 1;
}

/* Project list in admin */
.project-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.project-item:last-child {
  border-bottom: none;
}

.project-item .drag-handle {
  cursor: grab;
  color: var(--faint);
  user-select: none;
  font-size: 1rem;
}

.project-item .project-info {
  flex: 1;
}

.project-item .project-logo-thumb {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--accent-light);
}

.project-actions {
  display: flex;
  gap: 0.3rem;
}

/* Add/edit project form */
.project-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
}

.project-form input {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s;
}

.project-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.project-form .form-actions {
  display: flex;
  gap: 0.5rem;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.admin-header h1 {
  margin-bottom: 0;
}

.hidden {
  display: none !important;
}

/* ─── Responsive ─── */

@media (max-width: 520px) {
  .hero {
    padding: 4rem 0 2rem;
  }

  .logo {
    font-size: 2rem;
  }

  .project-card {
    padding: 1rem 1.1rem;
    gap: 1rem;
  }

  .project-logo,
  .project-logo-placeholder {
    width: 42px;
    height: 42px;
  }

  .footer-inner {
    flex-direction: column;
    gap: 0.4rem;
  }

  .footer-sep {
    display: none;
  }
}
