/* ==========================================================================
   Design tokens
   ========================================================================== */

:root {
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-text-muted: #5a5a5a;
  --color-border: #e2e2e2;
  --color-focus: #1a1a1a;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";

  --content-max-width: 42rem;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
}

/* ==========================================================================
   Reset
   ========================================================================== */

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

body {
  margin: 0;
}

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

/* ==========================================================================
   Base / layout
   ========================================================================== */

body {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
}

/* ==========================================================================
   Header
   ========================================================================== */

header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin: 0 0 var(--space-3);
}

.header-body {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.avatar {
  flex-shrink: 0;
  border-radius: 0.75rem;
}

header .tagline {
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-1);
}

header .contact {
  list-style: none;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: 0;
  padding: 0;
}

header .contact li {
  margin-bottom: 0.25rem;
}

header .contact li:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Sections
   ========================================================================== */

section {
  margin-top: var(--space-5);
}

section h2 {
  font-size: 1.125rem;
  font-weight: 700;
  padding-bottom: var(--space-1);
  margin: 0 0 var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

section p {
  margin: 0 0 var(--space-2);
  text-align: justify;
}

section ul {
  margin: var(--space-1) 0 0;
  padding-left: 1.25rem;
}

section li {
  margin-bottom: var(--space-1);
  text-align: justify;
}

/* ==========================================================================
   Experience / education entries
   ========================================================================== */

.entry {
  margin-bottom: var(--space-4);
}

.entry:last-child {
  margin-bottom: 0;
}

.entry-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 1rem;
}

.meta {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-1);
}

/* ==========================================================================
   Skills
   ========================================================================== */

.skills-group {
  margin-top: var(--space-3);
}

.skills-group:first-of-type {
  margin-top: 0;
}

.skills-group h3 {
  margin: 0 0 var(--space-1);
}

.skills-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
}

.skills-list li {
  margin-bottom: 0;
  font-size: 0.875rem;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.25rem 0.875rem;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn-row {
  margin-top: var(--space-5);
  text-align: center;
}

.btn {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  border: 1px solid var(--color-text);
  border-radius: 0.375rem;
  background: none;
  color: var(--color-text);
  text-decoration: none;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

.btn:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.pdf-status {
  margin-top: var(--space-2);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  text-align: center;
}

.pdf-status:empty {
  display: none;
}

/* ==========================================================================
   Project cards
   ========================================================================== */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.project-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: var(--space-3);
}

.project-card h3 a {
  text-decoration: none;
}

.project-card h3 a:hover {
  text-decoration: underline;
}

.project-card p {
  margin: 0;
  font-size: 0.9375rem;
  flex-grow: 1;
}

.project-tag {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.125rem 0.625rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */

footer {
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* ==========================================================================
   Links / accessibility
   ========================================================================== */

a {
  color: var(--color-text);
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

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

@media (max-width: 600px) {
  body {
    padding: 2rem 1.25rem;
  }

  header h1 {
    font-size: 1.625rem;
  }

  .header-body {
    gap: var(--space-2);
  }

  .avatar {
    width: 88px;
    height: 88px;
  }
}

/* ==========================================================================
   Print (manual Ctrl+P / browser print, independent of the Download PDF
   button below, which generates its own PDF via js/pdf.js instead)
   ========================================================================== */

@media print {
  body {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .no-print {
    display: none !important;
  }

  .entry,
  .entry-header,
  .skills-group,
  .project-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  h2,
  h3 {
    break-after: avoid;
    page-break-after: avoid;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }
}
