/* Base reset and defaults */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Light mode (default) */
:root {
  --bg: #fafafa;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #888888;
  --border: #e5e5e5;
  --accent: #1a1a1a;
  --accent-hover: #333333;
  --shadow: rgba(0, 0, 0, 0.06);
  --modal-overlay: rgba(250, 250, 250, 0.85);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --card-bg: #1a1a1a;
    --text: #f0f0f0;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --border: #2a2a2a;
    --accent: #f0f0f0;
    --accent-hover: #cccccc;
    --shadow: rgba(0, 0, 0, 0.3);
    --modal-overlay: rgba(15, 15, 15, 0.9);
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Profile card sits at a fixed offset from the top; work below never shifts it */
.hero {
  max-width: 588px; /* 540 card + 2x24 padding */
  margin: 0 auto;
  padding: 240px 24px 0;
}

.hero .card {
  max-width: 540px;
}

/* Card */
.card {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  display: flex;
  align-items: flex-start;
  gap: 24px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Photo */
.photo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%);
  transition: filter 0.3s ease;
}

.photo:hover img {
  filter: grayscale(0%);
}

/* Content */
.content {
  flex: 1;
  min-width: 0;
}

.name {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.3px;
  margin-bottom: 2px;
}

.title {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
  letter-spacing: 0.2px;
}

.blurb {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.65;
}

.blurb:last-of-type {
  margin-bottom: 24px;
}

/* Button */
.btn {
  display: inline-block;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  letter-spacing: 0.2px;
}

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

.btn:active {
  transform: scale(0.98);
}

/* Footer */
footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}

/* Projects */
.projects {
  width: 100%;
  max-width: 588px; /* 540 card + 2x24 padding */
  margin: 0 auto;
  padding: 24px 24px 80px;
}

.section-heading {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 0 4px;
  margin-bottom: 12px;
}

.project-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.project:hover {
  border-color: var(--text-muted);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--shadow);
}

.project:active {
  transform: translateY(0);
}

.project:focus-visible {
  outline: none;
  border-color: var(--text);
}

.project-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.favicon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
}

.project-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
}

.project-domain {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.project:hover .project-domain {
  color: var(--text-secondary);
}

.project-year {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 8px;
  font-variant-numeric: tabular-nums;
}

.project-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 14px;
}

.project-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.tags {
  letter-spacing: 0.2px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  letter-spacing: 0.2px;
}

.status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
}

.status--active {
  color: var(--text-secondary);
}

.status--active::before {
  opacity: 1;
}

.status--archived {
  opacity: 0.7;
}

/* Responsive */
@media (max-width: 540px) {
  .hero {
    padding: 72px 16px 0;
  }

  .projects {
    padding: 20px 16px 48px;
  }

  .card {
    flex-direction: column;
    padding: 28px;
    gap: 20px;
  }

  .photo {
    width: 56px;
    height: 56px;
  }

  .name {
    font-size: 18px;
  }

  .project {
    padding: 18px 20px;
  }

  .project-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .tags {
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .project {
    transition: border-color 0.2s ease;
  }

  .project:hover {
    transform: none;
  }
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--modal-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: calc(100% - 48px);
  max-width: 380px;
  box-shadow: 0 8px 32px var(--shadow);
}

.close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
}

.close:hover {
  color: var(--text);
}

.modal-content h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.modal-content .blurb {
  margin-bottom: 16px;
}

/* Email row */
.email-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.email-text {
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.copy-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--bg);
}

.copy-btn.copied {
  color: var(--text);
  border-color: var(--text);
}

.copy-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.copy-status {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.copy-status.visible {
  opacity: 1;
  color: var(--text-secondary);
}

/* Form elements (if needed) */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--text-muted);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.modal-content .btn {
  width: 100%;
  margin-top: 8px;
}

.modal-content .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-message {
  margin-top: 16px;
  padding: 12px;
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
}

.form-message.success {
  background: rgba(0, 128, 0, 0.08);
  color: #2e7d32;
  border: 1px solid rgba(0, 128, 0, 0.15);
}

.form-message.error {
  background: rgba(200, 0, 0, 0.08);
  color: #c62828;
  border: 1px solid rgba(200, 0, 0, 0.15);
}

@media (prefers-color-scheme: dark) {
  .form-message.success {
    background: rgba(76, 175, 80, 0.1);
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.2);
  }

  .form-message.error {
    background: rgba(244, 67, 54, 0.1);
    color: #e57373;
    border: 1px solid rgba(244, 67, 54, 0.2);
  }
}
