:root {
  --bg: #0a0a0f;
  --card: #13131c;
  --text: #e8e4dc;
  --muted: #9a9488;
  --brand: #c8a96e;
  --accent: #e8d5a3;
  --highlight: #c8a96e;
  --border: rgba(255, 255, 255, 0.08);
  --input-bg: rgba(255, 255, 255, 0.03);
  --shadow: rgba(0, 0, 0, 0.28);
}

.light {
  --bg: #f7f2e8;
  --card: #fffaf2;
  --text: #2f2a24;
  --muted: #746d63;
  --brand: #b89155;
  --accent: #d8bf8b;
  --highlight: #c8a96e;
  --border: rgba(90, 70, 40, 0.14);
  --input-bg: rgba(184, 145, 85, 0.05);
  --shadow: rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.35s ease, color 0.35s ease;
}

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  transition: background 0.35s ease, border-color 0.35s ease;
}

.site-footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  border-bottom: none;
  margin-top: 0;
  padding: 0.8rem 1rem;
  transition: border-color 0.35s ease;
}

.site-footer p {
  margin: 0;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 1rem;
}

.nav {
  max-width: 980px;
  margin: 0 auto;
  padding: 0.9rem 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.nav a {
  color: var(--text);
  text-decoration: none;
  opacity: 0.95;
  transition: color 0.25s ease, opacity 0.25s ease;
}

.nav a:hover {
  color: var(--brand);
  opacity: 1;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.2rem 1.4rem;
  margin: 1rem 0;
  box-shadow: 0 8px 18px var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.35s ease, border-color 0.35s ease;
}

.card:hover {
  transform: translateY(-2px);
}

.tagline {
  color: var(--muted);
  margin-top: -0.5rem;
}

.section-note {
  color: var(--muted);
  margin-top: -0.2rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.project {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.light .project {
  background: rgba(255, 255, 255, 0.3);
}

.project:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px var(--shadow);
  border-color: var(--highlight);
}

label {
  display: block;
  margin: 0.75rem 0 0.35rem;
  font-weight: 500;
}

input,
textarea {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.7rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

input:focus,
textarea:focus,
.sort-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(198, 222, 241, 0.25);
}

.nav a:focus-visible,
.btn:focus-visible,
.theme-btn:focus-visible,
.sort-select:focus-visible,
input:focus-visible,
textarea:focus-visible,
.project-links a:focus-visible,
#github-container .project a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 8px;
}

.btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0.6rem 0.95rem;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}

.btn:hover {
  border-color: var(--brand);
  background: var(--brand);
  color: #2f3a4a;
  transform: translateY(-1px);
}

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

.muted {
  color: var(--muted);
}

#formMsg,
#projectsMessage {
  margin-top: 0.9rem;
  font-weight: 500;
  min-height: 1.2rem;
}

.project-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
  transition: transform 0.25s ease;
}

.project:hover .project-img {
  transform: scale(1.01);
}

.projects-tools {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 1rem 0;
}

.success-message {
  color: #2e7d32;
  margin-top: 0.9rem;
  font-weight: 600;
}

.error-message {
  color: #c62828;
  margin-top: 0.9rem;
  font-weight: 600;
}

#contact {
  margin-bottom: 0;
}

.filter-btn.active {
  background: var(--brand);
  color: #2f3a4a;
  border-color: var(--brand);
}

.greeting-notice {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 0.8rem 1rem;
  border-radius: 12px;
  box-shadow: 0 6px 16px var(--shadow);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  z-index: 1000;
}

.greeting-notice.show {
  opacity: 1;
  transform: translateY(0);
}

.theme-btn {
  border: none;
  background: transparent;
  outline: none;
  font-size: 1.1rem;
  cursor: pointer;
}

.sort-select {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  height: 42px;
  min-width: 110px;
  padding: 0 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

.sort-select option {
  color: #000;
}

.github-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

#github-container .project {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.2rem;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 10px 22px var(--shadow);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

#github-container .project:hover {
  transform: translateY(-4px);
  border-color: var(--highlight);
  box-shadow: 0 14px 30px var(--shadow);
}

#github-container .project h3 {
  margin: 0 0 0.8rem;
  font-size: 1.05rem;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}

#github-container .project p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.7;
  flex-grow: 1;
}

#github-container .project a,
.project-links a {
  display: inline-block;
  width: fit-content;
  margin-top: auto;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

#github-container .project a:hover,
.project-links a:hover {
  color: var(--highlight);
  border-color: var(--highlight);
}

.project-links {
  margin-top: 0.75rem;
}

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

  .nav {
    flex-wrap: wrap;
  }
}

@media (max-width: 500px) {
  .nav {
    justify-content: center;
  }

  .card {
    padding: 1rem;
  }

  .project-img {
    height: 180px;
  }

  .greeting-notice {
    right: 12px;
    left: 12px;
    top: 12px;
  }
}