/* ==========================================================================
   1. VARIABLES & ROOT STYLES
   ========================================================================== */

:root {
  /* Colors */
  --color-bg: #fafafa;
  --color-bg-alt: #fff;
  --color-text-base: #333;
  --color-text-heading: #1a1a1a;
  --color-text-muted: #666;
  --color-text-subtle: #888;
  --color-accent: #cc0000;
  --color-border: #ddd;
  --color-border-light: #eee;
  --color-tag-bg: #f0f0f0;

  /* Typography */
  --font-primary: "Lexend", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --line-height-base: 1.7;

  /* Transitions & Shadows */
  --transition-fast: all 0.2s ease-in-out;
  --box-shadow-hover: 0 10px 20px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   2. GLOBAL RESETS & BASE STYLES
   ========================================================================== */

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

html {
  overflow-y: scroll;
}

body {
  font-family: var(--font-primary);
  line-height: var(--line-height-base);
  color: var(--color-text-base);
  background: var(--color-bg);
  font-weight: 300;
  font-size: 0.9rem;
}

/* ==========================================================================
   3. LAYOUT
   ========================================================================== */

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 60px 20px;
}

/* ==========================================================================
   4. TYPOGRAPHY
   ========================================================================== */

h1, .project-header h2, .project-content h3, .project-content h4 {
  font-weight: 500;
  color: var(--color-text-heading);
}

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

.project-header h2 {
    font-weight: 400; /* As specified */
}

.section-title {
  font-size: 0.95rem;
  margin-bottom: 15px;
  margin-top: 40px;
}

.bio {
  font-size: 0.9rem;
  margin-bottom: 50px;
  color: #444;
}

.bio p {
  margin-bottom: 1.2em;
}

.source {
  color: var(--color-text-subtle);
  font-size: 0.8rem;
  display: block;
  margin-top: 4px;
  font-style: italic;
}

/* ==========================================================================
   5. GENERAL & REUSABLE COMPONENTS
   ========================================================================== */

.bio a,
.featured-list a,
.contact-links a,
.project-content a,
.back-link,
.project-content p > strong > a {
  text-decoration: none;
  color: var(--color-text-base);
  border-bottom: 1px solid var(--color-border);
  transition: var(--transition-fast);
}

.bio a:hover,
.featured-list a:hover,
.contact-links a:hover,
.project-content a:hover,
.back-link:hover,
.project-content p > strong > a:hover {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.contact-links a {
  font-weight: 400;
}

.contact-links .separator {
  margin: 0 8px;
  color: var(--color-text-subtle);
}

/* Special button-like link in project content */
.project-content p > strong > a {
    display: inline-block;
    margin-right: 1.5em;
    font-size: 0.9rem;
    font-weight: 500;
    color: #222;
    border-bottom-width: 2px;
    padding-bottom: 3px;
}

/* --- Featured List (e.g., on homepage) --- */
.featured-list {
  list-style: none;
  margin-bottom: 50px;
}

.featured-list li {
  margin-bottom: 20px;
  padding-left: 20px;
  position: relative;
  line-height: 1.6;
}

.featured-list li:before {
  content: "→";
  position: absolute;
  left: 0;
  top: 2px;
  color: var(--color-text-muted);
}

/* ==========================================================================
   6. PAGE-SPECIFIC COMPONENTS
   ========================================================================== */

/* --- View Switcher (Portfolio Page) --- */
.view-switcher {
  display: flex;
  gap: 15px;
  margin-bottom: 40px;
}

.view-switcher a {
  text-decoration: none;
  color: var(--color-text-subtle);
  font-size: 0.9rem;
  padding: 5px 4px;
  transition: var(--transition-fast);
  border-bottom: 2px solid transparent;
}

.view-switcher a.active {
  color: var(--color-text-heading);
  font-weight: 500;
  border-bottom-color: var(--color-text-base);
}

.view-switcher a:not(.active):hover {
  color: var(--color-text-base);
  border-bottom-color: #ccc;
}

/* --- Projects Grid --- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 30px;
  padding-top: 10px;
}

.project-item-link {
    text-decoration: none;
    color: inherit;
    display: flex; /* Ensures the link fills the container */
}

.project-item {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border-light);
  overflow: hidden;
  transition: box-shadow 0.2s ease-in-out;
  display: flex;
  flex-direction: column;
  width: 100%; /* Ensures item fills link wrapper */
}

.project-item:hover {
  box-shadow: var(--box-shadow-hover);
}

.project-item:hover .project-title {
  color: var(--color-accent);
}

.project-image img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background-color: var(--color-tag-bg);
}

.project-info {
  padding: 20px;
}

.project-title {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: #222; /* Specific color */
  transition: color 0.2s ease-in-out;
}

.project-description {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

.project-date {
  font-size: 0.75rem;
  color: #999;
  margin-bottom: 15px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto; /* Pushes tags to the bottom */
}

.tag {
  background-color: var(--color-tag-bg);
  color: var(--color-text-muted);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 400;
}

.project-header {
  margin-bottom: 40px;
}

.project-content p {
  margin-bottom: 1.5em;
}

.project-content h3 {
  font-size: 1.4rem;
  margin-top: 2.5em;
  margin-bottom: 1em;
}

.project-content h4 {
  font-size: 1.1rem;
  margin-top: 2em;
  margin-bottom: 0.8em;
}

.project-content ul,
.project-content ol {
  margin-left: 20px;
  margin-bottom: 1.5em;
}

.project-content li {
  margin-bottom: 0.75em;
}

.project-content img,
.project-content figure,
.video-responsive-wrapper {
    margin: 40px auto;
}

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

.project-content .shadow {
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

/* Image width utilities */
.project-content .img-full { max-width: 100%; }
.project-content .img-three-quarters { max-width: 80%; }
.project-content .img-half { max-width: 60%; }
.project-content .img-quarter { max-width: 35%; }


/* Figure element for images with captions */
.project-content figure {
  max-width: 550px;
  width: 90%;
  margin-top: 2.5em;
  margin-bottom: 2.5em;
}

.project-content figure img {
  margin: 0; /* Override default margin for images inside a figure */
}

.project-content .image-row {
  display: flex;
  gap: 40px; /* The space between images. Adjust as needed. */
  margin: 40px auto;
}

/* UPDATED styles for the images inside the row */
.project-content .image-row img {
  margin: 0;
  /* This is the key: each image is 50% width MINUS half the gap */
  width: calc(50% - 20px); 
  height: auto; /* Maintain aspect ratio */
}


figcaption {
  margin-top: 0.75em;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 200;
  /* font-style: italic; */
  color: var(--color-text-muted);
}

/* Responsive video wrapper */
.video-responsive-wrapper {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
}

.video-responsive-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}


/* --- Info Page Footer --- */
.info-footer {
  margin-top: 80px;
}

.info-footer hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin-bottom: 25px;
}

.info-footer .contact-links {
  text-align: center;
  font-size: 0.85rem;
}

/* --- Utility --- */
.loading-message {
    padding: 40px 0;
    text-align: center;
    color: var(--color-text-subtle);
}

/* ==========================================================================
   7. MEDIA QUERIES
   ========================================================================== */

@media (max-width: 768px) {
  .container {
    padding: 40px 20px;
  }

  h1 {
    font-size: 1.6rem;
  }

  .bio {
    font-size: 0.85rem;
  }

  .projects-grid {
    grid-template-columns: 1fr; /* Single column on small screens */
  }

  /* Make utility image widths full-width on mobile for readability */
  .project-content .img-half,
  .project-content .img-quarter {
    max-width: 100%;
  }

  .project-content .img-half,
  .project-content .img-quarter {
    max-width: 100%;
  }

  /* ADD THIS RULE to stack your image row on mobile */
  .project-content .image-row {
    flex-direction: column; /* Change the flex direction from row to column */
    align-items: center;    /* Center the images now that they are in a column */
  }
}

@media (min-width: 1600px) {
  /* Scale up base font size on very large screens */
  html {
    font-size: 16px; /* Affects all 'rem' units */
  }

  h1 {
    font-size: 2.5rem;
  }

  .view-switcher a {
    font-size: 1rem;
  }
}

.project-figure {
  margin: 2em 0; /* Adds some space above and below the figure */
  width: 100%;
}

.project-figure img {
  width: 100%;
  height: auto; /* Maintains aspect ratio */
  display: block; /* Removes any bottom spacing */
}

.project-figure figcaption {
  margin-top: 0.75em;
  font-size: 0.9em;
  color: #666;
  text-align: center;
}

