/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  --bg: #FAFBFC;
  --bg-about: #FAFBFC;
  --bg-skills: #FAFBFC;
  --bg-projects: #FAFBFC;
  --bg-experience: #FAFBFC;
  --bg-contact: #FAFBFC;
  --surface: #FFFFFF;
  --ink: #14181F;
  --muted: #5B6472;
  --line: #E3E7EC;
  --accent: #1E5AA8;
  --accent-dim: #E8F0FB;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;

  --content-width: 1100px;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6rem;
}

/* ==========================================================================
   Reset
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
ul, ol, dl { margin: 0; padding: 0; }
h1, h2, h3, p { margin: 0; }

.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: var(--space-1) var(--space-2);
  z-index: 100;
}
.skip-link:focus {
  left: var(--space-2);
  top: var(--space-2);
}

/* ==========================================================================
   Header / Nav
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(250, 251, 252, 0.9);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.nav {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-2) var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  text-decoration: none;
}
.nav-links {
  list-style: none;
  display: flex;
  gap: var(--space-3);
}
.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: color 0.15s ease;
}
.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--accent);
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  padding: var(--space-6) 0 var(--space-5);
}
.hero-eyebrow {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: var(--space-2);
}
.hero-name {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4.25rem);
  font-weight: 600;
  line-height: 1.05;
  max-width: 16ch;
}
.hero-tagline {
  margin-top: var(--space-3);
  max-width: 46ch;
  font-size: 1.1875rem;
  color: var(--muted);
}
.hero-links {
  margin-top: var(--space-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Entrance animation: one deliberate reveal, respects reduced motion */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  animation: reveal-in 0.6s ease forwards;
  animation-delay: calc(var(--delay, 0) * 0.12s);
}
@keyframes reveal-in {
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
  .link-btn:hover, .link-btn:active,
  .project-link-btn:hover, .project-link-btn:active,
  .project-readme-toggle:hover, .project-readme-toggle:active {
    transform: none;
  }
}

/* ==========================================================================
   Buttons / Links
   ========================================================================== */
.link-btn {
  display: inline-block;
  padding: 0.6em 1.2em;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--ink);
  background: var(--surface);
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.link-btn:hover,
.link-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(20, 24, 31, 0.08);
}
.link-btn:active {
  transform: scale(0.98);
  transition-duration: 0.05s;
}
.link-btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.link-btn-primary:hover,
.link-btn-primary:focus-visible {
  background: var(--accent);
  color: var(--accent-dim);
  opacity: 0.92;
  box-shadow: 0 4px 14px rgba(30, 90, 168, 0.35);
}
.link-btn-cta {
  margin-left: auto;
  padding: 0.6em 1.6em;
  font-size: 1.0625rem;
  font-weight: 700;
}

/* ==========================================================================
   Sections (shared)
   ========================================================================== */
.section {
  padding: var(--space-5) 0;
  border-top: 1px solid var(--line);
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 600;
  margin-bottom: var(--space-2);
}
.section-subtitle {
  color: var(--muted);
  max-width: 60ch;
  margin-bottom: var(--space-4);
}

/* ==========================================================================
   About
   ========================================================================== */
.about-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: var(--space-5);
  align-items: start;
}
.about-bio {
  max-width: 60ch;
}
.about-facts {
  display: grid;
  gap: var(--space-3);
}
.about-fact dt {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin-bottom: 0.25em;
}
.about-fact dd {
  margin: 0;
  font-weight: 600;
}

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

/* ==========================================================================
   Skills
   ========================================================================== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}
.skill-group-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-2);
}
.skill-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.skill-list li {
  padding: 0.4em 0.75em;
  background: var(--accent-dim);
  border-radius: 6px;
  font-size: 0.9375rem;
  width: fit-content;
}

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

/* ==========================================================================
   Projects
   ========================================================================== */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.project-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}
.project-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3);
}
.project-card-heading {
  display: flex;
  flex-direction: column;
  gap: 0.35em;
}
.project-name {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
}
.project-subtitle {
  color: var(--muted);
  font-size: 0.9375rem;
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
}
.project-tag {
  font-size: 0.8125rem;
  padding: 0.25em 0.65em;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 999px;
  font-weight: 500;
}
.project-links {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}
.project-links a {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.project-link-btn {
  display: inline-block;
  padding: 0.4em 0.9em;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.project-link-btn:hover,
.project-link-btn:focus-visible {
  border-color: var(--line);
  background: var(--surface);
  transform: scale(1.06);
  box-shadow: 0 3px 10px rgba(20, 24, 31, 0.08);
}
.project-link-btn:active {
  transform: scale(0.98);
  transition-duration: 0.05s;
}

.project-readme-toggle {
  width: calc(100% - var(--space-3) * 2);
  margin: 0 var(--space-3) var(--space-3);
  text-align: left;
  padding: 0.7em 1em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.project-readme-toggle:hover,
.project-readme-toggle:focus-visible {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--muted);
  transform: scale(1.015);
  box-shadow: 0 4px 12px rgba(20, 24, 31, 0.08);
}
.project-readme-toggle:active {
  transform: scale(0.995);
  transition-duration: 0.05s;
}
.project-readme-toggle .chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4em;
  height: 1.4em;
  border-radius: 50%;
  background: var(--bg);
  font-size: 1.1em;
  line-height: 1;
  transition: transform 0.2s ease, background 0.15s ease;
}
.project-readme-toggle:hover .chevron,
.project-readme-toggle:focus-visible .chevron {
  background: var(--line);
}
.project-readme-toggle[aria-expanded="true"] .chevron {
  transform: rotate(90deg);
}

.project-readme {
  border-top: 1px solid var(--line);
  padding: var(--space-3);
  font-size: 0.9375rem;
}
.project-readme[hidden] { display: none; }

/* Rendered README typography */
.project-readme h1,
.project-readme h2,
.project-readme h3 {
  font-family: var(--font-display);
  margin: 1em 0 0.5em;
}
.project-readme h1:first-child,
.project-readme h2:first-child,
.project-readme h3:first-child {
  margin-top: 0;
}
.project-readme p { margin: 0.75em 0; }
.project-readme ul, .project-readme ol {
  margin: 0.75em 0;
  padding-left: 1.5em;
}
.project-readme img {
  border-radius: 6px;
  margin: 0.75em 0;
  border: 1px solid var(--line);
}
.project-readme code {
  font-family: var(--font-mono);
  background: var(--accent-dim);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.875em;
}
.project-readme pre {
  background: var(--ink);
  color: #fff;
  padding: var(--space-2);
  border-radius: 6px;
  overflow-x: auto;
}
.project-readme pre code {
  background: none;
  padding: 0;
  color: inherit;
}
.project-readme a { color: var(--accent); }

.project-skeleton {
  height: 3em;
  background: linear-gradient(90deg, var(--accent-dim) 25%, var(--surface) 50%, var(--accent-dim) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.4s ease infinite;
}
@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .project-skeleton { animation: none; }
}

.project-fallback-note {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 0.75em;
}

/* ==========================================================================
   Timeline
   ========================================================================== */
.timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.timeline-item {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: var(--space-3);
}
.timeline-marker {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 500;
  font-size: 0.875rem;
  padding-top: 0.2em;
}
.timeline-title {
  font-family: var(--font-display);
  font-size: 1.1875rem;
  font-weight: 600;
}
.timeline-meta {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0.2em 0 0.5em;
}

/* ==========================================================================
   Contact
   ========================================================================== */
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  padding: var(--space-4) 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* ==========================================================================
   Focus states (accessibility)
   ========================================================================== */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 600px) {
  .nav-links { gap: var(--space-2); }
  .nav-links a { font-size: 0.875rem; }
  .hero { padding: var(--space-5) 0 var(--space-4); }
  .project-card-header { flex-direction: column; align-items: flex-start; }
}
