/* ===== Design Tokens ===== */
:root {
  --bg: #F7F8FA;
  --bg-alt: #FFFFFF;
  --ink: #14161A;
  --ink-soft: #565B66;
  --line: #E4E7EC;
  --accent: #4338CA;
  --accent-soft: #EEF0FF;
  --teal: #0D9488;
  --teal-soft: #E6F7F5;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20,22,26,0.04), 0 8px 24px rgba(20,22,26,0.06);
  --font-display: 'JetBrains Mono', ui-monospace, monospace;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
  --bg: #0F1115;
  --bg-alt: #171A21;
  --ink: #EDEEF1;
  --ink-soft: #9AA0AC;
  --line: #262B34;
  --accent: #818CF8;
  --accent-soft: #1E2138;
  --teal: #2DD4BF;
  --teal-soft: #12302C;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.35);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

.section {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
  letter-spacing: -0.02em;
}

.section-title .num {
  color: var(--accent);
  font-size: 0.95rem;
  opacity: 0.7;
}

/* ===== Nav ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 28px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.nav-links a:hover { color: var(--ink); }

.theme-toggle {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-alt);
  cursor: pointer;
  position: relative;
  padding: 2px;
}

.theme-toggle .dot {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 0.25s ease;
}

[data-theme="dark"] .theme-toggle .dot { transform: translateX(18px); }

/* ===== Hero ===== */
.hero {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 24px 28px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: center;
}

.eyebrow {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 0.88rem;
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 8px;
}

.hero .role {
  font-size: 1.1rem;
  color: var(--ink-soft);
  margin-bottom: 20px;
}

.hero .role .muted { color: var(--ink-soft); }

.hero-cta { display: flex; gap: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.94rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

/* ---- signature element: code window ---- */
.code-window {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.code-header .dot { width: 10px; height: 10px; border-radius: 50%; }
.code-header .dot.red { background: #FF5F56; }
.code-header .dot.yellow { background: #FFBD2E; }
.code-header .dot.green { background: #27C93F; }

.code-title {
  margin-left: 8px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.code-body {
  font-family: var(--font-display);
  font-size: 0.86rem;
  padding: 22px;
  color: var(--ink);
  white-space: pre-wrap;
  min-height: 220px;
}

.cursor {
  display: inline-block;
  color: var(--accent);
  animation: blink 1s step-start infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* ===== About ===== */
.about-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 48px;
}

.about-text { color: var(--ink-soft); font-size: 1.02rem; }

.about-meta { list-style: none; display: flex; flex-direction: column; gap: 14px; }

.about-meta li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 10px;
  font-size: 0.94rem;
}

.meta-label { color: var(--ink-soft); font-family: var(--font-display); font-size: 0.82rem; }

.about-meta a { color: var(--accent); font-weight: 600; }

/* ===== Skills ===== */
.skills-grid { display: flex; flex-wrap: wrap; gap: 12px; }

.skill-pill {
  font-family: var(--font-display);
  font-size: 0.85rem;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.skill-pill:hover { border-color: var(--accent); }

/* ===== Projects ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.project-card {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.project-index {
  font-family: var(--font-display);
  color: var(--teal);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.project-card h3 { font-size: 1.12rem; margin-bottom: 10px; letter-spacing: -0.01em; }

.project-card p { color: var(--ink-soft); font-size: 0.92rem; margin-bottom: 16px; }

.project-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

.project-tags span {
  font-family: var(--font-display);
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--teal-soft);
  color: var(--teal);
}

.project-link { font-weight: 600; font-size: 0.9rem; color: var(--accent); }

/* ===== Contact ===== */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 560px;
}

.form-row { display: flex; flex-direction: column; gap: 8px; }

.form-row label {
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.form-row input,
.form-row textarea {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease;
  resize: vertical;
}

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

.contact-form .btn { align-self: flex-start; }

.alert {
  max-width: 560px;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.alert-success {
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid var(--teal);
}

.alert-error {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FCA5A5;
}

.alert-error ul { margin: 8px 0 0 18px; }

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 40px 24px 60px;
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-family: var(--font-display);
}

/* ===== Accessibility ===== */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ===== Responsive ===== */
@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; padding-top: 32px; }
  .about-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}
