/* ============ Tokens ============ */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --text: #201f1d;
  --text-muted: #6b6a66;
  --border: #e6e3da;
  --accent: #33564b;
  --accent-soft: #e6ede9;
  --accent-contrast: #ffffff;
  --shadow-sm: 0 1px 2px rgba(32, 31, 29, 0.06);
  --shadow-md: 0 8px 24px rgba(32, 31, 29, 0.10);
  --shadow-lg: 0 16px 40px rgba(32, 31, 29, 0.16);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --font-display: "Newsreader", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ============ Reset ============ */
* {
  box-sizing: border-box;
}
html, body {
  margin: 0;
  padding: 0;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: inherit;
}
button {
  font-family: inherit;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============ Layout ============ */
.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 64px 24px 40px;
}

/* ============ Profile ============ */
.profile {
  display: flex;
  align-items: center;
  gap: 40px;
  padding-bottom: 56px;
  border-bottom: 1px solid var(--border);
  opacity: 0;
  transform: translateY(12px);
  animation: rise 0.6s ease forwards;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.profile__media {
  flex-shrink: 0;
}

.profile__photo {
  width: 168px;
  height: 168px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  background: var(--accent-soft);
}

.profile__info {
  min-width: 0;
}

.profile__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.15;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.profile__title {
  font-size: 1.05rem;
  color: var(--accent);
  font-weight: 500;
  margin: 0 0 18px;
}

.profile__bio {
  max-width: 60ch;
  color: var(--text-muted);
  font-size: 1rem;
  margin: 0 0 16px;
}

.profile__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.profile__meta a {
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: border-color 0.15s ease, color 0.15s ease;
}

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

/* ============ Projects ============ */
.projects {
  padding-top: 56px;
}

.projects__heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.6rem;
  margin: 0 0 28px;
}

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

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: transparent;
}

.project-card__image-wrap {
  aspect-ratio: 16 / 10;
  background: var(--accent-soft);
  overflow: hidden;
}

.project-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-card__body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-card__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  margin: 0 0 8px;
}

.project-card__desc {
  color: var(--text-muted);
  font-size: 0.94rem;
  margin: 0 0 20px;
  flex: 1;
}

.project-card__link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--accent-soft);
  transition: background 0.15s ease, color 0.15s ease;
}

.project-card__link:hover {
  background: var(--accent);
  color: var(--accent-contrast);
}

.projects__empty {
  color: var(--text-muted);
  font-size: 0.95rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  grid-column: 1 / -1;
}

/* ============ Footer ============ */
.site-footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ============ Floating add button ============ */
.fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.fab:hover {
  transform: scale(1.08);
}

.fab:active {
  transform: scale(0.96);
}

/* ============ Modal ============ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(32, 31, 29, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.overlay[hidden] {
  display: none;
}

.modal {
  background: var(--surface);
  width: 100%;
  max-width: 420px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  animation: pop 0.18s ease;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0 0 6px;
}

.modal__hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.field input,
.field textarea,
#password-input {
  font-family: var(--font-body);
  font-size: 0.96rem;
  color: var(--text);
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
#password-input:focus {
  outline: none;
  border-color: var(--accent);
}

#password-input {
  width: 100%;
  margin-bottom: 6px;
}

.error-text {
  color: #b3402b;
  font-size: 0.85rem;
  min-height: 1.1em;
  margin: 4px 0 0;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn--primary:hover {
  opacity: 0.9;
}

.btn--primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
}

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

/* ============ Responsive ============ */
@media (max-width: 640px) {
  .page {
    padding: 40px 18px 32px;
  }

  .profile {
    flex-direction: column;
    text-align: center;
    align-items: center;
    gap: 24px;
    padding-bottom: 40px;
  }

  .profile__photo {
    width: 132px;
    height: 132px;
  }

  .profile__bio {
    max-width: 100%;
  }

  .profile__meta {
    justify-content: center;
  }

  .projects {
    padding-top: 40px;
  }

  .fab {
    right: 18px;
    bottom: 18px;
  }
}
