/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --text-primary: #1a1a1a;
  --text-secondary: #333333;
  --background: #ffffff;
  --accent: #0066cc;
  --border: #e5e5e5;
  --spacing-unit: 1rem;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--background);
}

/* Navigation */
nav {
  padding: 2rem calc(var(--spacing-unit) * 2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background-color: var(--background);
  z-index: 100;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

nav a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

nav a:hover {
  color: var(--accent);
}

nav a.active {
  color: var(--accent);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem calc(var(--spacing-unit) * 2);
}

/* Typography */
h1 {
  font-size: 3rem;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 1rem;
}

h2 {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1rem;
  margin-top: 2rem;
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

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

a:hover {
  text-decoration: underline;
}

/* Hero Section */
.hero {
  padding: 4rem 0;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero h1 {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.5rem;
  color: var(--text-secondary);
  max-width: 600px;
}

/* CV Header */
.cv-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.cv-header h1 {
  margin-bottom: 0.25rem;
}

.cv-header .cv-location {
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.cv-header .contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.cv-header .contact-links a {
  font-size: 0.95rem;
  color: var(--accent);
}

/* CV Sections */
.cv-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.cv-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.cv-item {
  margin-bottom: 2rem;
}

.cv-item h3 {
  margin-bottom: 0.25rem;
}

.cv-item-meta {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.cv-item-meta > span:not(:last-child)::after {
  content: "|";
  margin-left: 0.5rem;
  color: var(--text-primary);
}

.cv-item-date {
  color: var(--text-primary);
  font-size: 0.9rem;
}

.cv-item ul {
  margin-left: 1.5rem;
  color: var(--text-secondary);
}

.cv-location {
  color: var(--text-primary);
}

/* CV Subsections */
.cv-subsection-heading {
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.cv-subsection-heading strong {
  font-weight: 600;
}

.cv-item-description + .cv-subsection-heading {
  margin-top: 0.75rem;
}

.cv-subsection-list {
  margin-bottom: 1rem;
  margin-top: 0.25rem;
}

/* Skills Section */
.skill-category {
  margin-bottom: 1.5rem;
}

.skill-category p:first-child {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.skill-category p:first-child strong {
  font-weight: 600;
}

.skill-category p:last-child {
  margin-bottom: 0;
}

/* Portfolio Grid */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.portfolio-item {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.portfolio-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.portfolio-item-image {
  width: 100%;
  height: 200px;
  background-color: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.portfolio-item-content {
  padding: 1.5rem;
}

.portfolio-item-content h3 {
  margin-top: 0;
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem calc(var(--spacing-unit) * 2);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
  nav ul {
    gap: 1rem;
  }

  .container {
    padding: 1.5rem var(--spacing-unit);
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero p {
    font-size: 1.2rem;
  }

  h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }

  h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
  }

  p {
    margin-bottom: 0.75rem;
  }

  .cv-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
  }

  .cv-header h1 {
    margin-bottom: 0.25rem;
  }

  .cv-header .cv-location {
    margin-bottom: 0.5rem;
  }

  .cv-header .contact-links {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    align-items: flex-start;
  }

  .cv-header .contact-links a {
    font-size: 0.95rem;
  }

  .cv-section {
    margin-bottom: 2rem;
    margin-top: 2rem;
    padding-bottom: 1.5rem;
  }

  .cv-section:first-of-type {
    margin-top: 0;
  }

  .cv-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
  }

  .cv-item {
    margin-bottom: 1.5rem;
  }

  .cv-item:last-child {
    margin-bottom: 0;
  }

  .cv-item h3 {
    margin-bottom: 0.25rem;
  }

  .cv-item-meta {
    flex-wrap: wrap;
    gap: 0.25rem;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }

  .cv-item-meta > span:not(:last-child)::after {
    content: none;
  }

  .cv-item-date {
    font-size: 0.85rem;
    flex-basis: 100%;
  }

  .cv-item-description {
    margin-bottom: 0.75rem;
  }

  .cv-subsection-heading {
    font-size: 1rem;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
  }

  .cv-subsection-list {
    margin-bottom: 1rem;
    margin-left: 1.25rem;
  }

  .cv-subsection-list li {
    margin-bottom: 0.25rem;
  }

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

/* Print Styles - Optimised for 2-page CV */
@media print {
  /* Page setup */
  @page {
    size: A4;
    margin: 1.5cm 1.5cm 1.5cm 1.5cm;
  }

  /* Reset print defaults */
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Hide navigation and footer */
  nav,
  footer {
    display: none !important;
  }

  /* Body and container adjustments */
  body {
    font-size: 9pt;
    line-height: 1.4;
    color: #1a1a1a;
    background: white;
  }

  .container {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  /* Typography - matching web hierarchy */
  h1 {
    font-size: 20pt;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 3pt;
    line-height: 1.2;
    page-break-after: avoid;
    color: #1a1a1a;
  }

  h2 {
    font-size: 14pt;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 6pt;
    line-height: 1.3;
    page-break-after: avoid;
    border-bottom: none;
    padding-bottom: 0;
    color: #1a1a1a;
  }

  h3 {
    font-size: 11pt;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 2pt;
    line-height: 1.4;
    page-break-after: avoid;
    color: #1a1a1a;
  }

  p {
    margin-bottom: 0;
    font-size: 9pt;
    line-height: 1.35;
    color: #333;
  }

  /* CV Header */
  .cv-header {
    margin-bottom: 8pt;
    padding-bottom: 0;
    border-bottom: none;
  }

  .cv-header h1 {
    margin-bottom: 2pt;
  }

  .cv-header .cv-location {
    font-size: 9pt;
    margin-bottom: 4pt;
  }

  .cv-header .contact-links {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    gap: 10pt;
  }

  .cv-header .contact-links a {
    font-size: 9pt;
    color: #0066cc;
    text-decoration: none;
  }

  /* CV sections - no borders, better spacing */
  .cv-section {
    margin-bottom: 14pt;
    padding-bottom: 0;
    border-bottom: none;
    page-break-inside: auto;
  }

  .cv-section:last-child {
    margin-bottom: 0;
  }

  .cv-section h2 {
    margin-top: 0;
    margin-bottom: 6pt;
  }

  .cv-section p {
    margin-bottom: 4pt;
  }

  .cv-section p:last-child {
    margin-bottom: 0;
  }

  /* CV items - more space between different roles */
  .cv-item {
    margin-bottom: 12pt;
    page-break-inside: auto;
  }

  .cv-item:last-child {
    margin-bottom: 0;
  }

  .cv-item h3 {
    margin-bottom: 2pt;
    page-break-after: avoid;
  }

  .cv-item-meta {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 4pt;
    align-items: baseline;
    margin-bottom: 5pt;
    font-size: 9pt;
    color: #1a1a1a;
    page-break-after: avoid;
  }

  .cv-item-meta > span:not(:last-child)::after {
    content: "|";
    margin-left: 4pt;
    color: #1a1a1a;
  }

  .cv-item-date {
    font-size: 9pt;
    color: #1a1a1a;
    flex-basis: auto;
  }

  /* CV item description paragraph */
  .cv-item-description {
    margin-bottom: 8pt;
  }

  /* Subsection headings */
  .cv-subsection-heading {
    font-weight: 500;
    margin-top: 8pt;
    margin-bottom: 2pt;
    color: #1a1a1a;
    font-size: 9pt;
  }

  .cv-subsection-heading strong {
    font-weight: 500;
  }

  .cv-item-description + .cv-subsection-heading {
    margin-top: 6pt;
  }

  /* Subsection lists */
  .cv-subsection-list {
    margin-left: 12pt;
    margin-top: 2pt;
    margin-bottom: 8pt;
  }

  .cv-subsection-list li {
    margin-bottom: 2pt;
    font-size: 9pt;
    line-height: 1.4;
    color: #333;
  }

  .cv-subsection-list li:last-child {
    margin-bottom: 0;
  }

  .cv-item > .cv-subsection-list:last-child {
    margin-bottom: 0;
  }

  /* Print link URLs after link text */
  a[href^="http"]::after {
    content: "";
  }

  /* Ensure no widows/orphans */
  p, h2, h3 {
    orphans: 2;
    widows: 2;
  }

  /* Keep job title with company/meta */
  .cv-item h3 + .cv-item-meta {
    page-break-before: avoid;
  }

  .cv-item-meta + p {
    page-break-before: avoid;
  }

  /* Location text styling */
  .cv-location {
    color: #1a1a1a;
  }

  /* Skills Section */
  .skill-category {
    margin-bottom: 6pt;
  }

  .skill-category p:first-child {
    font-weight: 600;
    margin-bottom: 2pt;
    color: #1a1a1a;
    font-size: 9pt;
  }

  .skill-category p:first-child strong {
    font-weight: 600;
  }

  .skill-category p:last-child {
    margin-bottom: 0;
  }
}
