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

/* ── LIGHT (default) ── */
:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --border: #e0e0e0;
  --text: #111111;
  --muted: #888;
  --accent: #5b4ef0;
  --accent-dim: rgba(91, 78, 240, 0.1);
  --nav-bg: rgba(245, 245, 245, 0.88);
  --about-text: #444;
  --contact-intro: #555;
  --radius: 10px;
  --max-w: 900px;
}

/* ── DARK (system preference) ── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0d;
    --surface: #141414;
    --border: #222;
    --text: #e8e8e8;
    --muted: #777;
    --accent: #7c6aff;
    --accent-dim: rgba(124, 106, 255, 0.12);
    --nav-bg: rgba(13, 13, 13, 0.88);
    --about-text: #bbb;
    --contact-intro: #bbb;
  }
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  transition: background 0.3s, color 0.3s;
}

/* ── NAV ── */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

nav {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}

.logo span {
  color: var(--accent);
}

nav ul {
  list-style: none;
  display: flex;
  gap: 32px;
}

nav ul a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
  transition: color 0.2s;
}

nav ul a:hover {
  color: var(--text);
}

/* ── SECTIONS ── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

section {
  padding: 96px 0;
}

section + section {
  border-top: 1px solid var(--border);
}

h2 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 40px;
}

/* ── HERO ── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 60px;
}

.hero-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

.avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  margin-bottom: 24px;
  display: block;
}

.greeting {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 12px;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 16px;
}

.tagline {
  font-size: 1.2rem;
  color: var(--muted);
  margin-bottom: 40px;
}

.btn {
  display: inline-block;
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: opacity 0.2s;
}

.btn:hover {
  opacity: 0.85;
}

/* ── ABOUT ── */
#about p {
  font-size: 1.1rem;
  color: var(--about-text);
  max-width: 620px;
  line-height: 1.8;
}

/* ── SKILLS ── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: border-color 0.2s, transform 0.2s;
}

.skill-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.skill-icon {
  width: 36px;
  height: 36px;
  color: var(--accent);
  margin-bottom: 16px;
}

.skill-icon svg {
  width: 100%;
  height: 100%;
}

.skill-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.skill-card p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ── PROJECTS ── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s;
}

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

.project-top {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 3px 10px;
  border-radius: 4px;
}

.project-card h3 {
  font-size: 1rem;
  font-weight: 600;
}

.project-card p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
}

.project-link {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  align-self: flex-start;
  transition: opacity 0.2s;
}

.project-link:hover {
  opacity: 0.75;
}

/* ── CONTACT ── */
.contact-intro {
  color: var(--contact-intro);
  font-size: 1rem;
  margin-bottom: 40px;
}

.contact-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 60px;
  align-items: start;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 4px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.contact-item svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
}

.contact-item:hover {
  color: var(--accent);
}

/* ── FORM ── */
#contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field input,
.field textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  font-size: 0.9rem;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

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

.field input.invalid,
.field textarea.invalid {
  border-color: #e05252;
}

#submit-btn {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border: none;
}

#submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-spinner svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.form-message {
  font-size: 0.875rem;
  padding: 12px 16px;
  border-radius: var(--radius);
  display: none;
}

.form-message.success {
  display: block;
  background: rgba(52, 199, 89, 0.12);
  color: #2a9d56;
  border: 1px solid rgba(52, 199, 89, 0.3);
}

.form-message.error {
  display: block;
  background: rgba(224, 82, 82, 0.1);
  color: #c94040;
  border: 1px solid rgba(224, 82, 82, 0.25);
}

/* honeypot */
.hp-field {
  display: none;
}

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

  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
}

footer p {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  nav ul {
    gap: 20px;
  }

  nav ul li:nth-child(n+3) {
    display: none;
  }

  .skills-grid,
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

/* ── SCROLL ANIMATION ── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
