/* =========================================================
   Keith Emanzi — Data Scientist & Analyst
   Design tokens
   ========================================================= */

:root {
  /* type */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, monospace;

  /* layout */
  --sidebar-w: 280px;
  --content-max: 760px;
  --radius-sm: 3px;
  --radius-md: 6px;

  /* motion */
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* Dark theme (default) */
:root,
[data-theme="dark"] {
  --bg: #0b0b0c;
  --bg-raised: #141416;
  --bg-sidebar: #0e0e10;
  --border: #232326;
  --text: #f2efe9;
  --text-muted: #93938f;
  --text-faint: #5c5c5c;
  --accent: #e5484d;
  --accent-strong: #ff6b62;
  --accent-soft: rgba(229, 72, 77, 0.12);
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

/* Light theme */
[data-theme="light"] {
  --bg: #f7f5f0;
  --bg-raised: #ffffff;
  --bg-sidebar: #efece4;
  --border: #e1ddd2;
  --text: #18181a;
  --text-muted: #5f5d57;
  --text-faint: #a19d92;
  --accent: #c62f2f;
  --accent-strong: #a41f1f;
  --accent-soft: rgba(198, 47, 47, 0.09);
  --shadow: 0 12px 28px rgba(30, 20, 10, 0.08);
}

/* =========================================================
   Reset & base
   ========================================================= */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}

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

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

ul { list-style: none; margin: 0; padding: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

p { margin: 0; }

button {
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  z-index: 999;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

/* =========================================================
   Sidebar (left "header")
   ========================================================= */

.nav-toggle-input { display: none; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 34px 28px 26px;
  overflow-y: auto;
  z-index: 40;
}

.sidebar-top { position: relative; }

.brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
}
.brand-dot { color: var(--accent); }

.role {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}

.nav-toggle-btn {
  display: none;
  position: absolute;
  top: -6px;
  right: -4px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.nav-toggle-btn span {
  width: 18px;
  height: 1.5px;
  background: var(--text);
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}

.sidebar-nav { margin-top: 38px; }
.sidebar-nav ul { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: block;
  padding: 8px 10px;
  margin-left: -10px;
  font-size: 0.98rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color .15s var(--ease), background-color .15s var(--ease);
}
.sidebar-nav a:hover { color: var(--text); }
.sidebar-nav a.active {
  color: var(--text);
  background: var(--accent-soft);
  position: relative;
}
.sidebar-nav a.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.sidebar-tools {
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tool-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tool-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.lang-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.lang-btn {
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  transition: color .15s var(--ease), background-color .15s var(--ease);
}
.lang-btn + .lang-btn { border-left: 1px solid var(--border); }
.lang-btn.active { background: var(--accent); color: #fff; }
.lang-btn:not(.active):hover { color: var(--text); }

.theme-toggle {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--border);
  position: relative;
  padding: 0;
}
.theme-toggle-dot {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform .2s var(--ease);
}
[data-theme="light"] .theme-toggle-dot { transform: translateX(18px); }

.sidebar-bottom {
  margin-top: auto;
  padding-top: 26px;
}
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3ecf8e;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.15);
}
.sidebar-email {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  word-break: break-all;
  transition: color .15s var(--ease);
}
.sidebar-email:hover { color: var(--accent); }

.sidebar-socials {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-socials a {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color .15s var(--ease);
}
.sidebar-socials a:hover { color: var(--accent); }

.nav-scrim { display: none; }

.mobile-bar { display: none; }

/* =========================================================
   Content
   ========================================================= */

.content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.section {
  padding: 88px 56px;
  border-bottom: 1px solid var(--border);
}
.section:last-of-type { border-bottom: none; }
.section-inner { max-width: var(--content-max); }
.section-inner.wide { max-width: 920px; }

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

/* Hero */
.hero { padding-top: 108px; padding-bottom: 76px; }
.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  max-width: 14ch;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
}
.hero-sub {
  margin-top: 22px;
  max-width: 52ch;
  font-size: 1.08rem;
  color: var(--text-muted);
}
.hero-ctas {
  margin-top: 34px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  transition: transform .15s var(--ease), background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); transform: translateY(-1px); }
.btn-ghost { border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* Stats */
.stats {
  margin-top: 64px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  max-width: 640px;
}
.stat-num {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  color: var(--accent);
}
.stat-label {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 18ch;
}

/* Section headings */
.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  max-width: 22ch;
  margin-bottom: 46px;
}

/* Skill / service cards */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.skill-card {
  background: var(--bg);
  padding: 30px 26px;
}
.skill-card h3 { font-size: 1.08rem; margin-bottom: 10px; }
.skill-card p { color: var(--text-muted); font-size: 0.92rem; }

/* Project list (home preview + projects page) */
.project-list {
  display: flex;
  flex-direction: column;
}
.project-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 0;
  border-top: 1px solid var(--border);
  transition: padding-left .18s var(--ease);
}
.project-list a.project-row:hover { padding-left: 10px; }
.project-list a.project-row:hover .project-title { color: var(--accent); }
.project-row:last-child { border-bottom: 1px solid var(--border); }

.project-title {
  font-family: var(--font-display);
  font-size: 1.18rem;
  transition: color .15s var(--ease);
}
.project-tags {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  white-space: nowrap;
}
.project-desc {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.93rem;
  max-width: 60ch;
}
.project-link {
  margin-top: 12px;
  display: inline-block;
  font-size: 0.85rem;
  color: var(--accent);
}

.section-cta-row {
  margin-top: 40px;
}

/* Home — about preview */
.about-preview blockquote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  line-height: 1.5;
  max-width: 30ch;
  margin: 0;
  color: var(--text);
}
.about-preview blockquote::before { content: "\201C"; color: var(--accent); }
.about-preview blockquote::after { content: "\201D"; color: var(--accent); }
.about-preview .btn { margin-top: 30px; }

/* Contact CTA band */
.cta-band {
  background: var(--bg-raised);
}
.cta-band .section-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.cta-band h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
.cta-band p { color: var(--text-muted); margin-top: 8px; max-width: 44ch; }

/* Footer */
.site-footer {
  padding: 40px 56px 56px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.brand-mini {
  font-family: var(--font-display);
  color: var(--text-muted);
  font-size: 0.95rem;
}
.footer-fine {
  font-size: 0.8rem;
  color: var(--text-faint);
}

/* =========================================================
   About page
   ========================================================= */

.page-header { padding-top: 96px; padding-bottom: 56px; }
.page-header h1 { font-size: clamp(2.1rem, 4.4vw, 3rem); }
.page-header p { margin-top: 18px; color: var(--text-muted); max-width: 60ch; font-size: 1.02rem; }

.skills-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.skills-tags span {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.timeline {
  display: flex;
  flex-direction: column;
}
.timeline-item {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 24px;
  padding: 26px 0;
  border-top: 1px solid var(--border);
}
.timeline:last-child .timeline-item:last-child,
.timeline .timeline-item:last-child { border-bottom: 1px solid var(--border); }
.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  padding-top: 3px;
}
.timeline-role { font-size: 1.02rem; margin-bottom: 8px; }
.timeline-desc { color: var(--text-muted); font-size: 0.93rem; max-width: 58ch; }

/* =========================================================
   Contact page
   ========================================================= */

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 64px;
}
.contact-direct-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  display: block;
  margin-bottom: 16px;
}
.contact-direct a.big-email {
  font-family: var(--font-display);
  font-size: 1.4rem;
  display: inline-block;
  margin-bottom: 22px;
  word-break: break-word;
}
.contact-direct a.big-email:hover { color: var(--accent); }
.contact-direct ul { display: flex; flex-direction: column; gap: 8px; }
.contact-direct a { color: var(--text-muted); font-size: 0.95rem; }
.contact-direct a:hover { color: var(--accent); }

.form-field { margin-bottom: 20px; }
.form-field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.form-field input,
.form-field textarea {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color .15s var(--ease);
}
.form-field input:focus,
.form-field textarea:focus { border-color: var(--accent); }
.form-field textarea { resize: vertical; min-height: 120px; }

.form-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}
.form-note.success { background: rgba(62, 207, 142, 0.12); color: #3ecf8e; }
.form-note.error { background: var(--accent-soft); color: var(--accent-strong); }

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 980px) {
  .contact-grid { grid-template-columns: 1fr; gap: 44px; }
  .skills-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    inset: 0 0 auto 0;
    height: 60px;
    padding: 0 20px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    z-index: 50;
  }
  .mobile-bar .brand { font-size: 1.15rem; }

  .sidebar {
    top: 60px;
    height: calc(100% - 60px);
    width: 260px;
    transform: translateX(-100%);
    transition: transform .25s var(--ease);
    box-shadow: var(--shadow);
    z-index: 45;
  }
  .sidebar-top { display: none; }
  .nav-toggle-input:checked ~ .sidebar { transform: translateX(0); }

  .nav-toggle-btn {
    display: flex;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
  }
  .nav-toggle-input:checked ~ .mobile-bar .nav-toggle-btn span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .nav-toggle-input:checked ~ .mobile-bar .nav-toggle-btn span:nth-child(2) { opacity: 0; }
  .nav-toggle-input:checked ~ .mobile-bar .nav-toggle-btn span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

  .nav-scrim {
    display: none;
    position: fixed;
    inset: 60px 0 0 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 42;
  }
  .nav-toggle-input:checked ~ .nav-scrim { display: block; }

  .content { margin-left: 0; padding-top: 60px; }
}

@media (max-width: 720px) {
  .section { padding: 56px 26px; }
  .hero { padding-top: 84px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .timeline-item { grid-template-columns: 1fr; gap: 8px; }
  .site-footer { padding: 32px 26px 40px; }
  .cta-band .section-inner { flex-direction: column; align-items: flex-start; }
}

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