:root {
  --bg: #f8f8fa;
  --bg2: #f0f1f5;
  --surface: #ffffff;
  --surface2: #ecedf1;
  --border: rgba(0, 0, 0, 0.22);
  --text: #000000;
  --muted: #2a2a2a;
  --muted2: #444444;
  --shadow: none;
  --radius: 14px;
  --radius2: 10px;
  --max: 940px;
  --primary-bg: #000000;
  --primary-text: #ffffff;
}

[data-theme="dark"] {
  --bg: #090d16;
  --bg2: #060911;
  --surface: #0d1220;
  --surface2: #161d30;
  --border: rgba(255, 255, 255, 0.2);
  --text: #ffffff;
  --muted: #d0d0d0;
  --muted2: #a0a0a0;
  --primary-bg: #ffffff;
  --primary-text: #000000;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: linear-gradient(180deg, var(--bg), var(--bg2));
}

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

.skip-link {
  position: absolute;
  left: 12px;
  top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  transform: translateY(-160%);
  transition: transform 160ms ease;
  z-index: 50;
}
.skip-link:focus {
  transform: translateY(0);
  outline: none;
}

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

/* ── Header ── */

.site-header {
  padding: 40px 0 24px;
  border-bottom: 1px solid var(--border);
}

.header-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.header-left {
  flex-shrink: 0;
}

.identity {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.contrib-wrap {
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  height: 112px;
}

.contrib-graph {
  display: block;
  height: 130px;
  width: auto;
  margin-top: -18px;
  float: right;
  opacity: 0.85;
  filter: brightness(1.1);
}

[data-theme="dark"] .contrib-graph {
  filter: invert(1) hue-rotate(180deg) brightness(1.3);
}

.headshot {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

.headshot img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.site-header h1 {
  margin: 0;
  font-size: 36px;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.subtitle {
  margin: 4px 0 0;
  font-size: 18px;
  color: var(--muted);
}

/* ── Links row ── */

.links-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.links-row a,
.link-btn {
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  background: transparent;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
  white-space: nowrap;
  text-decoration: none;
}

.email-wrap {
  position: relative;
}

.email-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 8px 10px;
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 30;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.email-popover.show {
  display: flex;
}

.email-addr {
  font-size: 15px;
  color: var(--text);
}

.email-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.email-copy:hover {
  background: var(--surface2);
  color: var(--text);
}

.email-copy.copied {
  color: #22c55e;
}

.cta-btn {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
}

.cta-btn:hover {
  background: #b91c1c !important;
  border-color: #b91c1c !important;
}

.links-row a:hover,
.link-btn:hover {
  background: var(--surface2);
  border-color: var(--text);
}

.links-row a:focus,
.link-btn:focus {
  outline: 2px solid rgba(0, 0, 0, 0.18);
  outline-offset: 2px;
}

[data-theme="dark"] .links-row a:focus,
[data-theme="dark"] .link-btn:focus {
  outline: 2px solid rgba(255, 255, 255, 0.22);
}

/* ── Projects ── */

.section-title {
  margin: 32px 0 16px;
  font-size: 26px;
  letter-spacing: -0.02em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: 160px auto;
}

.thumb {
  position: relative;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.thumb .marker {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.thumb .marker.wip {
  color: var(--text);
}

.card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-body h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}


.card-desc {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.stack {
  font-size: 15px;
  color: var(--muted2);
  line-height: 1.4;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}

.card-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 10px 8px;
  background: transparent;
  transition: background 140ms ease, border-color 140ms ease;
}

.card-actions a:hover {
  background: var(--surface2);
  border-color: var(--text);
}

.card-actions a:focus {
  outline: 2px solid rgba(0, 0, 0, 0.2);
  outline-offset: 3px;
}

[data-theme="dark"] .card-actions a:focus {
  outline: 2px solid rgba(255, 255, 255, 0.25);
}

.card-actions a.primary-link {
  background: var(--primary-bg);
  color: var(--primary-text);
  border-color: var(--primary-bg);
}

.card-actions a.primary-link:hover {
  background: var(--primary-bg);
  border-color: var(--primary-bg);
}

.disabled-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  border: 1px dashed var(--border);
  border-radius: var(--radius2);
  padding: 10px 8px;
  color: var(--muted2);
  text-decoration: line-through;
  cursor: default;
}

/* ── Footer ── */

footer {
  margin-top: 44px;
  color: var(--muted2);
  font-size: 15px;
}

/* ── Responsive ── */

@media (max-width: 640px) {
  .site-header {
    padding-top: 24px;
  }
  .header-grid {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .site-header h1 {
    font-size: 24px;
  }
  .headshot {
    width: 48px;
    height: 48px;
  }
  .contrib-wrap {
    display: none;
  }
  .links-row {
    gap: 6px;
  }
  .links-row a,
  .link-btn {
    padding: 6px 10px;
    font-size: 13px;
  }
}
