/* ---------- Design tokens ---------- */
:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --border: #e7e5e4;
  --text: #1c1917;
  --text-muted: #6b6863;
  --accent: #5b47e0;
  --accent-ink: #ffffff;
  --accent-soft: #efeafd;
  --code-bg: #1c1917;
  --code-text: #f5f4f2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.04), 0 8px 24px rgba(28, 25, 23, 0.05);
  --maxw: 960px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131211;
    --surface: #1b1a18;
    --border: #2e2b28;
    --text: #f2f0ed;
    --text-muted: #9c988f;
    --accent: #a496ff;
    --accent-ink: #16142b;
    --accent-soft: #241f3d;
    --code-bg: #0e0d0c;
    --code-text: #f2f0ed;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  --bg: #131211;
  --surface: #1b1a18;
  --border: #2e2b28;
  --text: #f2f0ed;
  --text-muted: #9c988f;
  --accent: #a496ff;
  --accent-ink: #16142b;
  --accent-soft: #241f3d;
  --code-bg: #0e0d0c;
  --code-text: #f2f0ed;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { color-scheme: light dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

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

.site-nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-links a:hover { color: var(--text); background: var(--surface); }

.nav-links a.active {
  color: var(--accent-ink);
  background: var(--accent);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.theme-toggle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 8px;
  flex: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover { color: var(--text); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

/* ---------- Hero / headers ---------- */
.hero {
  padding: 96px 0 64px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
}

h1 {
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
  font-weight: 650;
}

.lede {
  font-size: 16.5px;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 0 32px;
}

.page-header {
  padding: 72px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}

.page-header h1 { font-size: clamp(28px, 4vw, 38px); margin-bottom: 10px; }
.page-header p { color: var(--text-muted); font-size: 16px; max-width: 560px; margin: 0; }

/* ---------- Buttons ---------- */
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
  font-family: inherit;
}

.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }

/* ---------- Sections / cards ---------- */
section { padding: 8px 0 64px; }

.section-title {
  font-size: 13px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 20px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

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

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
}

.feature-card .index {
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 12px;
}

.feature-card h3 { font-size: 16px; margin: 0 0 8px; letter-spacing: -0.01em; }
.feature-card p { font-size: 14.5px; color: var(--text-muted); margin: 0; }

/* ---------- Contact card ---------- */
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
}

.contact-card .index {
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 12px;
}

.contact-card h3 { font-size: 16px; margin: 0 0 6px; letter-spacing: -0.01em; }
.contact-card > p { font-size: 14.5px; color: var(--text-muted); margin: 0 0 20px; max-width: 520px; }

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 480px;
}

.contact-form label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: -6px;
}

.contact-form input,
.contact-form textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14.5px;
  color: var(--text);
  font-family: inherit;
  resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.contact-form textarea { min-height: 96px; }

.contact-form .contact-submit-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
}

.contact-status {
  font-size: 13.5px;
  color: var(--text-muted);
}

.contact-status.is-error { color: #c0392b; }
.contact-status.is-ok { color: #1a8a4a; }

/* ---------- Skill cards ---------- */
.skill-list { display: flex; flex-direction: column; gap: 14px; }

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.skill-card-head {
  padding: 22px 24px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  cursor: pointer;
}

.skill-card-title { display: flex; flex-direction: column; gap: 8px; }

.skill-card-title h3 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.skill-card-title p {
  margin: 0;
  font-size: 14.5px;
  color: var(--text-muted);
  max-width: 560px;
  white-space: pre-line;
}

.tag {
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 999px;
}

.skill-card-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}

.chev {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.skill-card.open .chev { transform: rotate(180deg); }

.skill-card-body {
  display: none;
  border-top: 1px solid var(--border);
  padding: 20px 24px 24px;
}

.skill-card.open .skill-card-body { display: block; }

.code-block {
  position: relative;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 10px;
  padding: 18px 20px;
  overflow-x: auto;
}

.code-block pre {
  margin: 0;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- Favorites ---------- */
.fav-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

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

.fav-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fav-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.fav-card .tag { align-self: flex-start; }

.fav-card h3 { margin: 0; font-size: 16px; letter-spacing: -0.01em; }

.fav-card p { margin: 0; font-size: 14.5px; color: var(--text-muted); }

.fav-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.fav-link:hover { text-decoration: underline; }

/* ---------- Empty state ---------- */
.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 14.5px;
}

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 40px;
}

footer .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

footer a { color: var(--text-muted); text-decoration: none; }
footer a:hover { color: var(--text); }
