:root {
  --bg: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #555555;
  --border: #cccccc;
  --image-bg: #f0f0f0;
  --highlight-purple: #d9c6f0;
  --highlight-purple-text: #1a1a1a;
  --highlight-green: #0f6b3f;
  --highlight-green-text: #ffffff;
  --button-hover-bg: #1a1a1a;
  --button-hover-text: #ffffff;
}

html.dark {
  --bg: #000000;
  --text-primary: #ffffff;
  --text-secondary: #aaaaaa;
  --border: #444444;
  --image-bg: #1a1a1a;
  --highlight-purple-text: #1a1a1a;
  --button-hover-bg: #ffffff;
  --button-hover-text: #1a1a1a;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  transition: background 0.2s ease, color 0.2s ease;
}

.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* Top bar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
}

.name {
  font-weight: 500;
  font-size: 18px;
  margin: 0;
  color: var(--text-primary);
}

.theme-toggle {
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover {
  background: var(--button-hover-bg);
  color: var(--button-hover-text);
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2.5rem;
  align-items: center;
  margin-bottom: 3.5rem;
}

.hero h1 {
  font-size: 26px;
  line-height: 1.5;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--text-primary);
}

.hero p.subtext {
  font-size: 16px;
  line-height: 1.6;
  margin: 0 0 1.5rem;
  color: var(--text-primary);
}

.hero p.links {
  margin: 0 0 1.5rem;
  color: var(--text-secondary);
}

.hero p.links a {
  color: var(--text-primary);
}

.highlight-purple {
  background: var(--highlight-purple);
  color: var(--highlight-purple-text);
  padding: 2px 4px;
  border-radius: 3px;
}

.highlight-green {
  background: var(--highlight-green);
  color: var(--highlight-green-text);
  padding: 2px 4px;
  border-radius: 3px;
}

.hero-image {
  background: var(--image-bg);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

.hero-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

/* Project buttons */
.project-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.project-button {
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 14px;
  color: var(--text-primary);
  text-decoration: none;
  display: inline-block;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.project-button:hover {
  background: var(--button-hover-bg);
  color: var(--button-hover-text);
  transform: translateY(-2px);
}

/* Contact section */
.contact {
  border-top: 0.5px solid var(--border);
  padding-top: 2.5rem;
}

.contact h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 1.25rem;
  color: var(--text-primary);
}

.contact form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 480px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
}

.contact label {
  font-size: 16px;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}

.required-mark {
  color: #c0392b;
}

.contact input,
.contact textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 6px;
  border: 0.5px solid var(--border);
  background: var(--bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 16px;
}

.contact textarea {
  min-height: 120px;
  resize: vertical;
}

.contact button[type="submit"] {
  align-self: flex-start;
  background: var(--text-primary);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  padding: 12px 20px;
  font-size: 16px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.contact button[type="submit"]:hover {
  opacity: 0.85;
}

/* Back link on project pages */
.back-link {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 1.5rem;
}

.back-link:hover {
  color: var(--text-primary);
}

/* Focus visibility for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

/* Mobile */
@media (max-width: 720px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-image {
    order: -1;
  }

  .project-links {
    flex-direction: column;
  }

  .project-button {
    width: 100%;
    text-align: center;
  }
}
