* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Body - Centered and Responsive */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #333;
  background: #fff;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
}

/* ==================== HEADER LAYOUT ==================== */

/* Header with Flexbox Layout */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1em 0;
  margin-bottom: 2em;
  border-bottom: 1px solid #e0e0e0;
  gap: 1em;
}

/* Profile Photo - Left Side */
.header-left {
  flex-shrink: 0;
}

.profile-photo {
  width: 80px;
  height: 80px;
  border-radius: 20%;
  object-fit: cover;
  object-position: center 5%;
  border: 2px solid #ddd;

  /* Image quality improvements */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;

  /* Shadow */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Name - Center */
.header-center {
  flex-grow: 1;
}

.header-center h1 {
  font-size: 1.8em;
  font-weight: normal;
  margin: 0;
  color: #000;
}

.header-center h1 a {
  color: #000;
  text-decoration: none;
}

.header-center h1 a:hover {
  color: #0066cc;
}

/* Navigation - Right Side */
.header-right {
  display: flex;
  gap: 1.5em;
  flex-shrink: 0;
}

.header-right a {
  color: #0066cc;
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}

.header-right a:hover {
  text-decoration: underline;
}

/* ==================== MAIN CONTENT ==================== */

main {
  margin-bottom: 3em;
}

/* ==================== TYPOGRAPHY ==================== */

h2 {
  font-size: 1.5em;
  font-weight: 600;
  margin: 1.5em 0 0.8em 0;
  color: #000;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 0.3em;
}

h3 {
  font-size: 1.2em;
  font-weight: 600;
  margin: 1.2em 0 0.5em 0;
  color: #000;
}

h4 {
  font-size: 1em;
  font-weight: 600;
  margin: 1em 0 0.5em 0;
  color: #333;
}

p {
  margin: 0.8em 0;
  line-height: 1.7;
}

/* ==================== LINKS ==================== */

a {
  color: #0000ff;
  text-decoration: none;
  text-decoration: underline;
}

.intro-links {
  text-align: center;
  margin: 1.5em 0;
}

/* ==================== LISTS ==================== */

ul,
ol {
  margin: 1em 0 1em 2em;
  line-height: 1.7;
}

li {
  margin: 0.4em 0;
}

/* ==================== CODE ==================== */

code {
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: "Monaco", "Courier New", monospace;
  font-size: 0.9em;
  color: #d73a49;
}

pre {
  background: #f6f8fa;
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1em 0;
  border: 1px solid #e1e4e8;
}

pre code {
  background: none;
  padding: 0;
  color: #333;
}

/* ==================== TABLES ==================== */

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5em 0;
  font-size: 0.95em;
}

th,
td {
  border: 1px solid #ddd;
  padding: 10px 15px;
  text-align: left;
}

th {
  background: #f6f8fa;
  font-weight: 600;
}

tr:hover {
  background: #f9f9f9;
}

/* ==================== OTHER ELEMENTS ==================== */

/* Horizontal Rule */
hr {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 2em 0;
}

/* Blockquote */
blockquote {
  border-left: 4px solid #ddd;
  padding-left: 1em;
  margin: 1em 0;
  color: #666;
  font-style: italic;
}

/* ==================== FOOTER ==================== */

footer {
  margin-top: 4em;
  padding-top: 1.5em;
  border-top: 1px solid #e0e0e0;
  font-size: 0.9em;
  color: #666;
  text-align: center;
}

footer p {
  margin: 0.5em 0;
}

footer a {
  color: #0066cc;
  margin: 0 0.3em;
}

/* ==================== PROJECT ITEMS ==================== */

.project-item {
  margin: 2em 0;
  padding-bottom: 1.5em;
  border-bottom: 1px solid #f0f0f0;
}

.project-item:last-child {
  border-bottom: none;
}

.project-item h3 {
  margin-top: 0;
}

.project-item p {
  margin: 0.5em 0;
  color: #666;
}

.project-tags {
  font-size: 0.9em;
  color: #888;
  margin-top: 0.5em;
}

/* ==================== ARTICLE ==================== */

article {
  max-width: 100%;
}

/* ==================== RESPONSIVE DESIGN ==================== */

/* Tablets and small laptops */
@media (max-width: 900px) {
  body {
    max-width: 700px;
    padding: 20px 15px;
  }

  .profile-photo {
    width: 100px;
    height: 100px;
  }

  .header-right {
    gap: 1em;
  }
}

/* Mobile phones */
@media (max-width: 600px) {
  body {
    padding: 15px 10px;
    font-size: 15px;
  }

  /* Stack header on mobile */
  .site-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.8em;
  }

  .profile-photo {
    width: 100px;
    height: 100px;
  }

  .header-center h1 {
    font-size: 1.5em;
  }

  .header-right {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1em;
  }

  h2 {
    font-size: 1.3em;
  }

  h3 {
    font-size: 1.1em;
  }

  /* Better code blocks on mobile */
  pre {
    padding: 12px;
    font-size: 0.85em;
  }

  /* Better tables on mobile */
  table {
    font-size: 0.85em;
  }

  th,
  td {
    padding: 8px 10px;
  }

  footer {
    margin-top: 3em;
    font-size: 0.85em;
  }
}

/* Very small phones */
@media (max-width: 400px) {
  body {
    padding: 15px 10px;
    font-size: 14px;
  }

  .profile-photo {
    width: 80px;
    height: 80px;
  }

  .header-center h1 {
    font-size: 1.4em;
  }

  .header-right {
    gap: 0.8em;
    font-size: 0.9em;
  }

  table {
    font-size: 0.75em;
  }
}

/* ==================== PRINT STYLES ==================== */

@media print {
  body {
    max-width: 100%;
    padding: 0;
    font-size: 12pt;
    color: #000;
  }

  .site-header nav,
  footer {
    display: none;
  }

  .profile-photo {
    width: 1in;
    height: 1in;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  pre {
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }

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