/* ============================================================
   Design System — shawnhuda.com
   ============================================================ */

:root {
  --blue:       #4A90D9;
  --blue-light: #EBF4FF;
  --blue-dark:  #2d6fad;
  --text:       #1a1a1a;
  --text-muted: #6b7280;
  --border:     #e5e7eb;
  --bg:         #ffffff;
  --bg-subtle:  #f9fafb;
  --font:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius:     8px;
  --max-w:      880px;
  --max-w-wide: 1000px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography ── */
h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
h3 { font-size: 1.15rem; font-weight: 600; }
p  { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* ── Layout ── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.container--wide {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Nav ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.nav-logo:hover { color: var(--blue); text-decoration: none; }
.nav-links {
  display: flex;
  list-style: none;
  gap: 0.25rem;
}
.nav-links a {
  display: block;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--blue);
  background: var(--blue-light);
  text-decoration: none;
}
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.2s;
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--blue); }

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  border: none;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:hover { background: var(--blue-dark); color: #fff; text-decoration: none; }
.btn-outline {
  background: transparent;
  color: var(--blue);
  border: 2px solid var(--blue);
}
.btn-outline:hover { background: var(--blue-light); text-decoration: none; }

/* ── Page sections ── */
.page-section {
  padding: 4rem 0;
}
.page-section + .page-section {
  border-top: 1px solid var(--border);
}
.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 0.5rem;
}

/* ── Status badge ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #ecfdf5;
  color: #065f46;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
}
.status-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Home page ── */
.home-hero {
  padding: 5rem 0 3.5rem;
}
.home-hero-inner {
  display: flex;
  align-items: flex-start;
  gap: 3rem;
}
.home-photo {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  flex-shrink: 0;
  border: 3px solid var(--blue-light);
}
.home-text h1 { margin-bottom: 0.75rem; }
.home-text .tagline {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.home-text .status-badge { margin-bottom: 1.5rem; }
.home-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.home-socials a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.35rem 0.75rem;
  border-radius: 100px;
  text-decoration: none;
  transition: all 0.15s;
}
.home-socials a:hover {
  color: var(--blue);
  border-color: var(--blue);
  background: var(--blue-light);
}
.home-bio {
  padding: 3.5rem 0;
}
.home-bio p {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 600px;
}
/* ── Resume page ── */
.resume-header {
  padding: 3.5rem 0 2rem;
  border-bottom: 2px solid var(--text);
}
.resume-header h1 { font-size: 2.2rem; margin-bottom: 0.25rem; }
.resume-download-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}
.resume-section { margin-bottom: 2.5rem; }
.resume-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  margin-bottom: 1.25rem;
}
.resume-summary p { font-size: 1rem; line-height: 1.7; }
.resume-competencies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.competency-tag {
  background: var(--blue-light);
  color: var(--blue-dark);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.25rem 0.65rem;
  border-radius: 100px;
}
.resume-job { margin-bottom: 2rem; }
.resume-job-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.1rem;
}
.resume-job-company { font-weight: 700; font-size: 1rem; }
.resume-job-dates { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; }
.resume-role { margin-bottom: 0.75rem; }
.resume-role-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.resume-role-title { font-weight: 600; font-size: 0.95rem; }
.resume-role-dates { font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; }
.resume-role-desc { font-size: 0.88rem; color: var(--text-muted); font-style: italic; margin: 0.15rem 0 0.5rem; }
.resume-bullets { padding-left: 1.25rem; margin: 0; }
.resume-bullets li {
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 0.4rem;
  color: var(--text);
}
.resume-edu-item, .resume-leadership-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 1rem;
}
.resume-edu-school, .resume-leadership-org { font-weight: 600; }
.resume-edu-detail, .resume-leadership-detail { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ── Writing page ── */
.writing-hero { padding: 3.5rem 0 2rem; }
.writing-hero h1 { margin-bottom: 0.5rem; }
.writing-hero .tagline { color: var(--text-muted); font-size: 1.05rem; }
.substack-card, .cyoa-card {
  display: block;
  background: var(--blue-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  text-decoration: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 3rem;
}
.substack-card:hover, .cyoa-card:hover {
  border-color: var(--blue);
  box-shadow: 0 4px 12px rgba(74,144,217,0.15);
  text-decoration: none;
  color: var(--text);
}
.substack-card .card-label, .cyoa-card .card-label { color: var(--blue); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 0.4rem; }
.substack-card h2 { margin-bottom: 0.4rem; font-size: 1.4rem; }
.substack-card p { color: var(--text-muted); margin: 0; }
.substack-card .ext-link, .cyoa-card .ext-link { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--blue); font-weight: 600; font-size: 0.9rem; margin-top: 0.75rem; }

.cyoa-section { padding: 3rem 0; }

.cyoa-card {
  width: 100%;
  appearance: none;
  font-family: var(--font);
}
.cyoa-card h3 { margin-bottom: 0.4rem; font-size: 1.4rem; }
.cyoa-card p { color: var(--text-muted); margin: 0; }

/* CYOA reader */
.cyoa-reader {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.cyoa-toolbar {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.cyoa-toolbar .page-indicator { margin-left: auto; font-weight: 600; }
.cyoa-close {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
}
.cyoa-content { padding: 2rem 2.5rem; min-height: 240px; }
.cyoa-body { font-size: 1rem; line-height: 1.75; white-space: pre-wrap; }
.cyoa-box-placeholder {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #fff7ed;
  border: 1px dashed #f59e0b;
  color: #92400e;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius);
  margin: 0 0.1rem;
  vertical-align: middle;
}
.cyoa-actions { padding: 1.25rem 2.5rem 2rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.6rem; }
.cyoa-choice {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
  color: var(--text);
}
.cyoa-choice:hover {
  border-color: var(--blue);
  background: var(--blue-light);
  color: var(--blue);
}
.cyoa-nav-btn {
  align-self: flex-start;
}

/* ── Old Projects page ── */
.projects-hero { padding: 3.5rem 0 2rem; }
.projects-hero h1 { margin-bottom: 0.5rem; }
.projects-hero .tagline { color: var(--text-muted); font-size: 1.05rem; }
.project-cards { padding: 2rem 0 5rem; display: flex; flex-direction: column; gap: 1.5rem; }
.project-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s;
}
.project-card:hover {
  border-color: var(--blue);
  box-shadow: 0 4px 12px rgba(74,144,217,0.1);
  text-decoration: none;
  color: var(--text);
  transform: translateY(-2px);
}
.project-card-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}
.project-card-body h2 { font-size: 1.2rem; margin-bottom: 0.3rem; }
.project-card-body p { color: var(--text-muted); font-size: 0.9rem; margin: 0; }
.project-card-body .tag {
  display: inline-block;
  background: var(--blue-light);
  color: var(--blue-dark);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  margin-bottom: 0.4rem;
}

/* ── Contact page ── */
.contact-hero { padding: 3.5rem 0 2rem; }
.contact-hero h1 { margin-bottom: 0.5rem; }
.contact-hero .tagline { color: var(--text-muted); font-size: 1.05rem; margin-bottom: 2rem; }
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 560px;
  padding-bottom: 5rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group label { font-size: 0.85rem; font-weight: 600; }
.form-group input,
.form-group textarea,
.form-group select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(74,144,217,0.15);
}
.form-group textarea { resize: vertical; min-height: 130px; }
.form-note { font-size: 0.8rem; color: var(--text-muted); margin-top: -0.5rem; }
.form-success {
  display: none;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  color: #065f46;
  font-size: 0.9rem;
}
.mailto-fallback { font-size: 0.85rem; color: var(--text-muted); margin-top: 1rem; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .nav-toggle { display: flex; }
  .nav-inner { flex-wrap: wrap; height: auto; padding-top: 0.9rem; padding-bottom: 0.9rem; }
  .nav-links {
    display: none;
    width: 100%;
    background: var(--bg);
    border-top: 1px solid var(--border);
    flex-direction: column;
    padding: 0.75rem 0 1rem;
    margin-top: 0.75rem;
    gap: 0.1rem;
  }
  .nav-links.open { display: flex; }

  .home-hero-inner { flex-direction: column; gap: 1.5rem; align-items: center; text-align: center; }
  .home-photo { width: 150px; height: 150px; }
  .home-socials { justify-content: center; }

  .resume-job-header, .resume-role-header, .resume-edu-item, .resume-leadership-item {
    flex-direction: column;
  }

  .cyoa-content { padding: 1.25rem; }
  .cyoa-actions { padding: 1rem 1.25rem 1.5rem; }

  .project-card { flex-direction: column; gap: 1rem; }
}
