/* Base and CSS Variables */
:root {
  --bg: #E4E1DB;
  --text: #0d131b;
  --brand: #A95C68;
  --accent: #8B7355;
  --light: #F5F3F0;
  --border: #D4C4B0;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #E4E1DB;
    --text: #0d131b;
    --brand: #A95C68;
    --accent: #8B7355;
    --light: #F5F3F0;
    --border: #D4C4B0;
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: Georgia, "Times New Roman", Times, serif;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background Gradient */
.background-gradient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--light) 0%, var(--bg) 100%);
  z-index: -1;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  background: rgba(244, 243, 240, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.brand-name {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--brand);
  text-decoration: none;
  transition: color 0.3s ease;
}

.brand-name:hover {
  color: var(--accent);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
  position: relative;
}

.nav-link:hover {
  color: var(--brand);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--brand);
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

.nav-cta {
  background: var(--brand);
  color: white !important;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: background 0.3s ease;
}

.nav-cta:hover {
  background: var(--accent);
}

.nav-cta::after {
  display: none;
}

.nav-icons {
  display: flex;
  list-style: none;
  gap: 1rem;
}

.icon-link {
  color: var(--brand);
  transition: color 0.3s ease;
}

.icon-link:hover {
  color: var(--accent);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Hero Section */
.hero {
  padding: 4rem 0;
  min-height: 80vh;
  display: flex;
  align-items: center;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.hero-intro h1 {
  font-size: 3rem;
  color: #000000;
  font-weight: normal;
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.intro-lead {
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.cta-group {
  margin-top: 2rem;
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--brand);
  color: white;
}

.btn-primary:hover {
  background: var(--accent);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--accent);
  color: white;
}

.btn-secondary:hover {
  background: var(--brand);
  transform: translateY(-2px);
}

.hero-media {
  display: flex;
  justify-content: center;
}

.hero-photo {
  width: 350px;
  height: 450px;
  border-radius: 20px;
  object-fit: cover;
  border: 4px solid var(--brand);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Sections */
.preview-section {
  padding: 4rem 0;
  border-bottom: 1px solid var(--border);
}

.preview-section:last-child {
  border-bottom: none;
}

.preview-section h2 {
  font-size: 2.5rem;
  color: var(--brand);
  margin-bottom: 3rem;
  text-align: center;
}

/* Project Categories */
.project-category {
  margin-bottom: 4rem;
}

/* Sailing to the Stars Slideshow Styles */
.sailing-content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
  margin-bottom: 24px;
}

.sailing-content-grid .sailing-text {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
}

.sailing-text {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.project-links {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
  margin-bottom: 16px;
  align-items: center;
  justify-content: center;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
  height: 36px;
  box-sizing: border-box;
  white-space: nowrap;
  flex-shrink: 0;
}

.project-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Responsive design for project links */
@media (max-width: 768px) {
  .project-links {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .project-link {
    font-size: 12px;
    padding: 6px 10px;
    height: 32px;
  }
}

@media (max-width: 480px) {
  .project-links {
    flex-direction: column;
    gap: 8px;
  }
  
  .project-link {
    justify-content: center;
    width: 100%;
    font-size: 13px;
    padding: 8px 12px;
    height: 36px;
  }
}

.sailing-slideshow {
  display: flex;
  justify-content: center;
  align-items: center;
}

.slideshow-container {
  position: relative;
  width: 100%;
  max-width: 500px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  padding: 3px;
}

.slideshow-container img {
  width: 100%;
  height: 400px;
  object-fit: cover;
  display: block;
  transition: opacity 0.5s ease;
  border-radius: 8px;
}


.slideshow-controls {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 16px;
  pointer-events: none;
}

.slide-btn {
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  pointer-events: all;
  transition: background 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-btn:hover {
  background: rgba(0, 0, 0, 0.8);
}

.slideshow-indicators {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}

.indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background 0.3s ease;
}

.indicator.active {
  background: white;
}

/* Responsive design for slideshow */
@media (max-width: 768px) {
  .sailing-content-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .slideshow-container {
    max-width: 100%;
  }
  
  .slideshow-container img {
    height: 350px;
  }
}

.category-title {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 1rem;
  text-align: left;
}

.category-description {
  font-size: 1.1rem;
  color: var(--text);
  text-align: left;
  margin-bottom: 3rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
}

.project-item {
  background: var(--light);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.project-item h4 {
  font-size: 1.5rem;
  color: var(--brand);
  margin-bottom: 1rem;
}

.project-item p {
  color: var(--text);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* CAD Viewer */
.cad-viewer-container {
  margin: 2rem 0;
  border-radius: 8px;
  overflow: hidden;
  background: #f8f9fa;
  border: 1px solid var(--border);
}

.cad-viewer-container > div:first-child, #cmg-viewer, #cmg-details-viewer {
  width: 100%;
  height: 400px;
  background: #f8f9fa;
  border: 1px solid color-mix(in oklab, var(--text) 10%, transparent);
  border-radius: 8px;
}

.viewer-controls {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--light);
  border-top: 1px solid var(--border);
}

.viewer-controls button {
  background: var(--brand);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  transition: background 0.3s ease;
}

.viewer-controls button:hover {
  background: var(--accent);
}

/* Project Details */
.project-details {
  margin-top: 1.5rem;
}

.project-details h4 {
  font-size: 1.2rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.project-details ul {
  margin-left: 1.5rem;
  color: var(--text);
}

.project-details li {
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

/* Project Details Toggle */
.project-details-toggle {
  text-align: center;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Compact Outcomes Section */
.outcomes-compact {
  max-width: 600px;
  margin: 0 auto;
}

.outcomes-compact p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Project Slideshow Styles */
.project-slideshow {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 16px;
}

.project-slideshow-container {
  position: relative;
  width: 100%;
  max-width: 500px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 2px solid #A95C68;
  padding: 2px;
  background: #ffffff;
  min-height: 350px;
}

.project-slideshow-container img {
  width: 100%;
  height: 350px;
  object-fit: contain;
  display: block;
  transition: opacity 0.5s ease;
  border-radius: 8px;
  background: #f8f9fa;
  min-height: 350px;
}

.slideshow-caption {
  text-align: center;
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

/* Photo Modal/Lightbox */
.photo-modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
}

.photo-modal-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  text-align: center;
}

.photo-modal-content img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
}

.photo-modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
}

.photo-modal-close:hover {
  color: #ccc;
}

.photo-modal-caption {
  color: white;
  font-size: 18px;
  margin-top: 20px;
  font-weight: 500;
}

.photo-modal-controls {
  margin-top: 20px;
  display: flex;
  gap: 20px;
  justify-content: center;
}

.modal-nav-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid white;
  padding: 10px 20px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
}

.modal-nav-btn:hover {
  background: white;
  color: black;
}

/* Sailing to the Stars slideshow pink ring */
.sailing-slideshow-container {
  border: 3px solid #A95C68;
  padding: 3px;
  border-radius: 12px;
}

/* CMG 3D viewer labeled box */
.cmg-viewer-container {
  margin: 2rem 0;
  border-radius: 8px;
  overflow: hidden;
  background: #f8f9fa;
  border: 1px solid color-mix(in oklab, var(--text) 10%, transparent);
  padding: 20px;
}

.cmg-viewer-label {
  font-size: 20px;
  font-weight: 600;
  color: #A95C68;
  margin-bottom: 16px;
  text-align: center;
  padding-bottom: 12px;
  border-bottom: 2px solid #A95C68;
}

/* Skills Section */
.skills-section {
  margin: 2rem 0;
  padding: 24px;
  background: color-mix(in oklab, var(--brand) 8%, var(--bg-elev));
  border-radius: 12px;
  border: 1px solid color-mix(in oklab, var(--text) 10%, transparent);
}

.skills-section h3 {
  margin: 0 0 20px;
  color: var(--text);
  font-size: 22px;
  font-weight: 600;
  text-align: center;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.skill-category {
  background: var(--bg-elev);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid color-mix(in oklab, var(--text) 8%, transparent);
  text-align: center;
}

.skill-category h4 {
  margin: 0 0 8px;
  color: #A95C68;
  font-size: 16px;
  font-weight: 600;
}

.skill-category p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  
  .skills-section {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.project-slideshow-controls {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 12px;
  pointer-events: none;
}

.project-slide-btn {
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 16px;
  cursor: pointer;
  pointer-events: all;
  transition: background 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-slide-btn:hover {
  background: rgba(0, 0, 0, 0.8);
}

.project-slideshow-indicators {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.project-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background 0.3s ease;
}

.project-indicator.active {
  background: white;
}

.cmg-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background 0.3s ease;
}

.cmg-indicator.active {
  background: white;
}

.drawings-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background 0.3s ease;
}

.drawings-indicator.active {
  background: white;
}

/* CMG Content Grid Layout */
.cmg-content-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: start;
}

.cmg-slideshow-section {
  min-width: 0; /* Prevents grid overflow */
}

.cmg-table-of-contents {
  background: #f8f9fa;
  border: 1px solid color-mix(in oklab, var(--text) 10%, transparent);
  border-radius: 8px;
  padding: 20px;
  position: sticky;
  top: 100px;
  max-height: 80vh;
  overflow-y: auto;
}

.cmg-table-of-contents h4 {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
}

.toc-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.toc-item {
  padding: 8px 12px;
  background: white;
  border: 1px solid color-mix(in oklab, var(--text) 5%, transparent);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  display: block;
}

.toc-item:hover {
  background: #A95C68;
  color: white;
  border-color: #A95C68;
  transform: translateX(4px);
}

.toc-item.active {
  background: #A95C68;
  color: white;
  border-color: #A95C68;
  font-weight: 600;
}

/* Project Visuals Grid Layout */
.project-visuals-grid {
  display: grid;
  grid-template-columns: 1fr 450px;
  gap: 24px;
  align-items: start;
}

.project-slideshow-section {
  min-width: 0; /* Prevents grid overflow */
}

.project-table-of-contents {
  background: #f8f9fa;
  border: 1px solid color-mix(in oklab, var(--text) 10%, transparent);
  border-radius: 8px;
  padding: 20px;
  position: sticky;
  top: 100px;
  height: 400px;
  overflow-y: auto;
}

.project-table-of-contents h4 {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
}

/* Responsive design for project visuals */
@media (max-width: 768px) {
  .project-visuals-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .project-table-of-contents {
    position: static;
    height: 400px;
  }
  
  .toc-list {
    grid-template-columns: 1fr;
  }
}

.project-details-toggle .btn {
  height: 36px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.project-details-content {
  background: var(--light);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  margin: 2rem 0;
}

.project-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.project-detail-section {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.project-detail-section h4 {
  color: var(--brand);
  font-size: 1.3rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--brand);
  padding-bottom: 0.5rem;
}

.project-detail-section p {
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.project-detail-section ul {
  margin-left: 1.5rem;
  color: var(--text);
}

.project-detail-section li {
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.project-detail-section strong {
  color: var(--brand);
}

/* Identity Bar */
.identity-bar {
  background: var(--brand);
  color: white;
  padding: 1.5rem;
  border-radius: 8px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 500;
  margin-top: 3rem;
}

/* Footer */
.site-footer {
  background: var(--light);
  padding: 2rem 0;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--text);
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  
  .nav-right {
    flex-direction: column;
    gap: 1rem;
  }
  
  .nav-links {
    gap: 1rem;
  }
  
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .hero-intro h1 {
    font-size: 2.5rem;
  }
  
  .project-grid {
    grid-template-columns: 1fr;
  }
  
  .container {
    padding: 0 1rem;
  }
  
  .preview-section {
    padding: 2rem 0;
  }
  
  .hero {
    padding: 2rem 0;
    min-height: auto;
  }
  
  .project-details-grid {
    grid-template-columns: 1fr;
  }
}
