/* ===========================
   Michael MacLean — Personal Site
   =========================== */

:root {
  --bg: #FAFAFA;
  --bg-alt: #F0F0F0;
  --text: #1A1A1A;
  --text-light: #666;
  --accent: #B8703F;
  --accent-hover: #9A5C30;
  --border: #E0E0E0;
  --white: #FFFFFF;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-width: 1200px;
}

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-hover);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ===========================
   Hero
   =========================== */

.hero {
  padding: 120px 0 80px;
  text-align: center;
}

.hero-name {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-light);
  font-weight: 300;
  margin-bottom: 8px;
}

.hero-location {
  font-size: 0.95rem;
  color: var(--text-light);
  margin-bottom: 32px;
}

.hero-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.hero-links a {
  color: var(--text-light);
  transition: color 0.2s;
}

.hero-links a:hover {
  color: var(--text);
}

.hero-email {
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.hero-oso-link {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border: 1.5px solid var(--text-light);
  border-radius: 4px;
}

.hero-oso-link:hover {
  border-color: var(--text);
  color: var(--text);
}

/* ===========================
   Sections
   =========================== */

.section {
  padding: 80px 0;
}

.section:nth-child(even) {
  background: var(--bg-alt);
}

.section-title {
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 40px;
}

/* ===========================
   About
   =========================== */

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: start;
}

.about-image img {
  border-radius: 8px;
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
}

.about-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.about-text p {
  margin-bottom: 20px;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.8;
  text-align: justify;
}

.about-text p:last-child {
  margin-bottom: 0;
}

.about-text strong {
  font-weight: 600;
}

/* ===========================
   OSO
   =========================== */

.oso-content p {
  max-width: 800px;
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 32px;
}

.oso-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--text);
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.2s;
  border: 1.5px solid var(--text);
}

.btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  color: var(--text);
}

.btn-outline:hover {
  background: var(--text);
  color: var(--white);
}

/* ===========================
   CV
   =========================== */

.cv-section {
  margin-bottom: 48px;
}

.cv-section:last-child {
  margin-bottom: 0;
}

.cv-section h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}

.cv-entry {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  line-height: 1.6;
}

.cv-entry:last-child {
  margin-bottom: 0;
}

.cv-year {
  flex-shrink: 0;
  width: 100px;
  color: var(--text-light);
  font-size: 0.9rem;
  font-weight: 500;
}

.cv-detail {
  flex: 1;
}

.cv-detail strong {
  font-weight: 600;
}

.cv-detail em {
  color: var(--text-light);
}

/* ===========================
   Portfolio Gallery
   =========================== */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.gallery-card {
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
}

.gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.1);
}

.gallery-thumb {
  aspect-ratio: 4/3;
  position: relative;
  overflow: hidden;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 20px 20px;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  color: white;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gallery-title {
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.gallery-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gallery-year {
  font-size: 0.85rem;
  opacity: 0.8;
  font-weight: 300;
}

.gallery-badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  padding: 2px 8px;
  border-radius: 3px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ===========================
   Modal
   =========================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  padding: 24px;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--white);
  border-radius: 12px;
  max-width: 800px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s;
}

.modal.active .modal-content {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  background: var(--bg);
  border: none;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  color: var(--text);
  transition: background 0.2s;
}

.modal-close:hover {
  background: var(--border);
}

.modal-body {
  padding: 40px;
}

.modal-gallery {
  margin-bottom: 32px;
}

.modal-image-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-alt);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 0.95rem;
}

.modal-title {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.modal-year {
  font-size: 0.95rem;
  color: var(--text-light);
  margin-bottom: 4px;
}

.modal-team {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 20px;
  font-style: italic;
}

.modal-description {
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 28px;
  color: var(--text);
}

.modal-image-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  border-radius: 8px;
  overflow: hidden;
}

.modal-image-grid img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: opacity 0.2s;
}

.modal-image-grid img:first-child {
  grid-column: 1 / -1;
  aspect-ratio: 16/9;
}

.modal-image-grid img:hover {
  opacity: 0.85;
}

.modal-link {
  display: inline-flex;
}

/* ===========================
   Footer
   =========================== */

.footer {
  padding: 48px 0;
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-name {
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-links a {
  color: var(--text-light);
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--text);
}

.footer-email {
  font-size: 0.85rem;
}

.footer-oso {
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.footer-copyright {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* ===========================
   Project Page Styles
   =========================== */

.project-header {
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}

.project-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.project-header-name {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.project-header-name:hover {
  color: var(--text);
}

.project-header-back {
  color: var(--text-light);
  font-size: 0.9rem;
}

.project-header-back:hover {
  color: var(--text);
}

.project-hero {
  padding: 80px 0 60px;
}

.project-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 32px;
  transition: color 0.2s;
}

.project-back:hover {
  color: var(--text);
}

.project-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 12px;
}

.project-meta {
  display: flex;
  gap: 24px;
  color: var(--text-light);
  font-size: 0.95rem;
}

.project-hero-image {
  width: 100%;
  background: var(--bg-alt);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 60px;
}

.project-hero-image img {
  width: 100%;
  max-height: 600px;
  object-fit: cover;
  border-radius: 8px;
}

.project-body {
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 80px;
}

.project-body h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 16px;
  margin-top: 40px;
}

.project-body p {
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 20px;
}

.project-credits {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.project-credits dt {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 4px;
}

.project-credits dd {
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.project-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin: 40px 0;
}

.project-gallery-item {
  background: var(--bg-alt);
  border-radius: 8px;
  overflow: hidden;
}

.project-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.project-nav {
  display: flex;
  justify-content: space-between;
  padding: 40px 0;
  border-top: 1px solid var(--border);
  margin-top: 60px;
}

.project-nav a {
  color: var(--text-light);
  font-size: 0.9rem;
  transition: color 0.2s;
}

.project-nav a:hover {
  color: var(--text);
}

/* ===========================
   Responsive
   =========================== */

@media (max-width: 768px) {
  .hero {
    padding: 80px 0 60px;
  }

  .hero-name {
    font-size: 2.5rem;
  }

  .hero-links {
    gap: 16px;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .about-image {
    max-width: 300px;
    margin: 0 auto;
  }

  .about-text p {
    text-align: left;
  }

  .section {
    padding: 64px 0;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
  }

  .cv-entry {
    flex-direction: column;
    gap: 4px;
  }

  .cv-year {
    width: auto;
    font-size: 0.85rem;
  }

  .modal-body {
    padding: 24px;
  }

  .modal-title {
    font-size: 1.3rem;
  }

  .footer-inner {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .project-gallery {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .hero-name {
    font-size: 2rem;
  }

  .section-title {
    font-size: 1.5rem;
  }
}
