/* 
  ========================================
  Typography Imports
  ========================================
*/
@import url('https://fonts.googleapis.com/css2?family=David+Libre:wght@400;700&display=swap');
@import url('https://fonts.cdnfonts.com/css/inter');
@import url('https://fonts.cdnfonts.com/css/rubik');

/* 
  ========================================
  Design System Variables
  ========================================
*/
:root {
  /* Color Palette */
  --color-primary-accent: #FFAD6F;
  --color-nav-active: #8D3D00;
  --color-nav-default: #FFFFFF;
  --color-bg: #FFFFFF;
  --color-card-bg: #D9D9D9;
  --color-text: #000000;

  /* Typography */
  --font-primary: 'rubik', 'David Libre', serif;

  /* Layout Constraints (Based on 1440px desktop design) */
  --header-height: 95px;

  --card-width: 401px;
  --card-height: 406px;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.35s ease;
}

/* 
  ========================================
  Base Reset
  ========================================
*/
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  color: var(--color-text);
  font-family: var(--font-primary);
  font-weight: 900;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  background-image: url('../projects/BG.png');
  background-size: 5cm 5cm;
  background-repeat: repeat;
}


/* 
  ========================================
  Layout - Wrapper & Header
  ========================================
*/
.page-wrapper {
  width: 100%;
  max-width: 1440px;
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

.navbar {
  width: 102%;
  height: var(--header-height);
  background-color: var(--color-primary-accent);
  border-style: solid;
  border-width: 1px;
  border-color: black;
  display: flex;
  align-items: center;
  padding: 0 5%;
  /* Fluid padding, approx 82px on 1440px */
}

.navbar nav {
  display: flex;
  gap: 2vw;
  /* Approx 22px */
}

.nav-link {
  font-size: clamp(24px, 3vw, 44px);
  line-height: 1;
  text-decoration: none;
  color: var(--color-nav-default);
  font-weight: 400;
  transition: opacity var(--transition-fast);
}

.nav-link:hover {
  opacity: 0.85;
}

.nav-link.active {
  color: var(--color-nav-active);
  font-weight: 700;
}

/* 
  ========================================
  Hero Section
  ========================================
*/
.hero {
  display: flex;
  flex-direction: column;
}

.hero-header {
  padding: 50px 5% 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.portrait-container {
  border: 2px solid black;
  padding: 20px;
  width: 400px;
  max-width: 30vw;
  flex-shrink: 0;
}

.portrait-container svg {
  position: relative;
  height: 100%;
  width: auto;
  max-width: 100%;
}

@keyframes drawPath {
  to {
    stroke-dashoffset: 0;
  }
}

.hero-title {
  color: var(--color-primary-accent);
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
  font-weight: 700;
  font-size: clamp(50px, 6vw, 80px);
  line-height: 1;
  margin: 0;
}

.hero-subtitle {
  font-weight: 700;
  color: var(--color-bg);
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
  font-size: clamp(25px, 3vw, 51px);
  line-height: 1;
  margin-top: 22px;
}

#swap-text {
  display: inline-block;
  transition: opacity 0.3s ease;
}

/* 
  ========================================
  Cards Grid
  ========================================
*/
.cards-container {
  padding: 54px 5% 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2vw;
  /* Approx 29px */
}

.card {
  position: relative;
  width: 100%;
  aspect-ratio: 401 / 406;
  background-color: var(--color-card-bg);
  cursor: pointer;
  overflow: hidden;
  text-decoration: none;
  display: block;
  border: 1px solid black;
  transition: border-width 0.2s ease;
}

.card:hover,
.card:focus-visible {
  border-width: 2px;
}

/* Card Image Preview (Revealed on Hover) */
.card-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity var(--transition-normal);
  z-index: 1;
}

/* Subtle overlay to ensure text is readable */
.card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.45);
  opacity: 0;
  transition: opacity var(--transition-normal);
  z-index: 2;
}

.card:hover .card-media,
.card:focus-visible .card-media {
  opacity: 1;
}

.card:hover .card-overlay,
.card:focus-visible .card-overlay {
  opacity: 1;
}

/* Card Typography */
.card-content {
  position: relative;
  z-index: 3;
  padding: 12% 12% 0;
}

.card-title {
  font-size: clamp(28px, 3.5vw, 49px);
  line-height: 1.1;
  font-weight: 700;
  color: var(--color-primary-accent);
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

/* 
  ========================================
  Responsive Fallbacks (Mobile / Tablet)
  ========================================
*/
@media (max-width: 768px) {
  .navbar {
    padding: 0 20px;
  }

  .navbar nav {
    gap: 15px;
    flex-wrap: wrap;
  }

  .hero-header {
    padding: 40px 20px 0;
  }

  .cards-container {
    padding: 40px 20px 0;
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .card {
    border-width: 2px;
  }

  /* On mobile devices, since hover isn't reliable, 
       we reveal the images by default with a permanent overlay. */
  .card-media {
    opacity: 0.8;
  }

  .card-overlay {
    opacity: 1;
    background: rgba(255, 255, 255, 0.6);
  }
}

/* 
  ========================================
  About Section
  ========================================
*/
.about-section {
  padding: 5px 5% 60px;
  display: flex;
  justify-content: flex-start;
}

.about-container {
  /* Layout handled by flex-direction applied via html/media-queries */
}

.portrait-container {
  height: 400px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.portrait-container svg {
  width: 100%;
  height: 100%;
}

.section-title {
  font-weight: 700;
  font-size: clamp(50px, 6vw, 80px);
  line-height: 1;
  margin-bottom: 40px;
  color: var(--color-primary-accent);
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

.about-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.about-text {
  text-wrap: pretty;
  font-size: clamp(15px, 2vw, 22px);
  line-height: 1.2;
  font-weight: 400;
}

.about-text strong {
  font-weight: 700;
}

.highlight-text {
  font-size: clamp(22px, 2.2vw, 28px);
  margin-top: 10px;
  color: var(--color-nav-active);
  font-weight: 700;
}

/* 
  ========================================
  Project Pages Layout
  ========================================
*/
.page-title {
  padding: 40px 5% 20px;
  font-weight: 700;
  font-size: clamp(60px, 8vw, 120px);
  line-height: 1;
  color: var(--color-primary-accent);
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

.project-list {
  padding: 40px 5% 80px;
  display: flex;
  flex-direction: column;
}

.project-row {
  padding: 50px;
  display: flex;
  gap: 40px;
  align-items: stretch;
}

/* Alternate rows layout (Image on left, then Image on right) */
.project-row:nth-child(even) {
  flex-direction: row-reverse;
}

.project-media {
  flex: 1;
  background: var(--color-card-bg);
  position: relative;
  overflow: hidden;
  display: flex;
  transition: border-width 0.2s ease;
}

.project-row:hover .project-media {
  border-width: 2px;
}

.project-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* Show in original proportion */
  transition: opacity 0.3s ease;
}

.project-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.project-title {
  direction: ltr;
  text-align: left;
  font-size: clamp(32px, 4vw, 50px);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 10px;
  color: var(--color-primary-accent);
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

.project-desc {
  direction: ltr;
  font-size: clamp(18px, 1.8vw, 22px);
  line-height: 1.6;
  text-wrap: pretty;
  font-weight: 400;
}

.mobile-project-cover {
  display: none !important;
  /* Hidden on desktop */
}

@media (max-width: 768px) {

  .project-row,
  .project-row:nth-child(even) {
    flex-direction: column-reverse;
    /* Text on top, media below */
  }

  .project-media {
    width: 100%;
  }

  .project-list {
    gap: 20px;
  }

  .retro-window {
    margin: 20px auto 30px;
  }

  .about-container {
    flex-direction: column-reverse !important;
    /* Portrait on top, text below */
  }

  .portrait-container {
    height: auto;
    width: 280px;
    /* Fixed width on mobile */
    max-width: 70vw;
    aspect-ratio: 1 / 1;
    /* Make it a square */
    overflow: hidden;
    margin: 0 auto;
    /* Center it */
    padding: 5px;
  }

  /* Ensure at least 2 images per row in mobile galleries */
  .project-media .gallery-grid {
    gap: 8px;
    padding: 8px;
  }

  .project-media .gallery-item {
    height: clamp(50px, 18vw, 95px);
  }

  .mobile-project-cover {
    display: flex !important;
    margin-bottom: 5px !important;
    /* Keep it close to the actual project box */
  }
}

/* 
  ========================================
  Project Tags
  ========================================
*/
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 5px;
}

.tag {
  background: var(--color-card-bg);
  color: var(--color-text);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: clamp(14px, 1.4vw, 16px);
  font-family: system-ui, -apple-system, sans-serif;
  /* Cleaner font for tags */
  font-weight: 500;
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.tag:hover {
  background: var(--color-primary-accent);
  border-color: var(--color-primary-accent);
  color: var(--color-nav-default);
}

/* 
  ========================================
  Gallery Grid (Beehive)
  ========================================
*/
.gallery-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: left;
  gap: 10px;
  width: 100%;
  height: 100%;
  padding: 10px;
  background-color: var(--color-bg);
  overflow-y: auto;
  align-content: start;
}

.gallery-item {
  position: relative;
  height: clamp(120px, 18vh, 200px);
  flex: 0 1 auto;
  /* Maintain natural aspect ratio */
  overflow: hidden;
  border: 1px solid black;
  cursor: pointer;
  transition: border-width 0.2s ease;
}



.gallery-item:hover {
  border-width: 2px;
  z-index: 2;
}

.gallery-item img,
.gallery-item video {
  width: auto;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
  /* Preserves natural proportion because width is auto */
  transition: opacity var(--transition-fast);
}

/* Modal Styles */
.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal.open {
  opacity: 1;
  visibility: visible;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 30px;
  background: transparent;
  border: none;
  color: white;
  font-size: 40px;
  cursor: pointer;
  transition: color var(--transition-fast);
  z-index: 10000;
}

.modal-close:hover {
  color: var(--color-primary-accent);
}

.modal-content {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content img,
.modal-content video {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
}

/* 
  ========================================
  3D Sculpture Container
  ========================================
*/
#sculpture-container {
  width: 100%;
  height: 100%;
  min-height: 400px;
  background: var(--color-card-bg);
  /* Match the project media background */
  overflow: hidden;
  cursor: grab;
  position: relative;
  display: flex;
  justify-content: center;
}

#sculpture-container:active {
  cursor: grabbing;
}

/* 
  ========================================
  Index 2 - Works Grid
  ========================================
*/
.works-grid {
  padding: 20px 5% 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: left;
  gap: 10px;
}

.main-gallery {
  padding: 20px 5% 0;
}

.work-item {
  position: relative;
  height: clamp(200px, 35vh, 300px);
  flex: 0 1 auto;
  /* Don't stretch artificially, keep natural proportions */
  cursor: pointer;
  overflow: visible;
  text-decoration: none;
}

.work-item-inner {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid black;
  box-shadow: #777777 2px 2px;


  transition: border-width 0.2s ease, box-shadow 0.2s ease;
  background-color: var(--color-card-bg);
}

.work-item:hover {
  z-index: 10;
}

.work-item:hover .work-item-inner {
  border-width: 1px;
}

.work-item img {
  width: auto;
  height: 100%;
  max-width: 100vw;
  /* ensure it never overflows screen horizontally */
  object-fit: cover;
  display: block;
  transition: opacity 0.3s ease;
}

/* Social Icons */
.social-icon img {
  width: 24px;
  height: 24px;
  filter: brightness(0) invert(1);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.social-icon:hover img {
  opacity: 0.8;
  transform: scale(1.1);
}


/* Label under the image */
.work-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--color-primary-accent);
  border-top: 2px solid black;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  opacity: 0;
  transform: translateY(100%);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.work-item:hover .work-info {
  opacity: 1;
  transform: translateY(0);
}

.work-title {
  color: #ffffff;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
  font-family: var(--font-primary);
  font-size: clamp(20px, 2.5vw, 24px);
  line-height: 1.1;
  font-weight: 700;
}

/* 
  ========================================
  Buttons
  ========================================
*/

.nav-logo {
  font-family: var(--font-primary);
  font-weight: 900;
  font-size: clamp(24px, 3.5vw, 45px);
  text-decoration: none;
  color: white;
}

.launch-btn {
  display: inline-block;
  margin-top: 20px;
  padding: 12px 28px;
  background-color: var(--color-primary-accent);
  color: var(--color-nav-default);
  text-decoration: none;
  font-weight: 700;
  font-size: 20px;
  border-radius: 30px;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.launch-btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

/* 
  ========================================
  Index 2 - Responsive (Mobile)
  ========================================
*/
@media (max-width: 768px) {
  .works-grid {
    padding: 40px 20px 0;
    justify-content: center;
    gap: 16px;
  }

  .work-item {
    height: 300px;
    flex: 0 1 auto;
    max-width: 100%;
    /* stacked layout with original proportions */
  }

  .work-item-inner {
    border-width: 2px;
  }

  /* On mobile, display the label permanently */
  .work-info {
    opacity: 1;
    transform: translateY(0);
  }

  .work-title {
    font-size: 20px;
  }
}

/* 
  ========================================
  Retro Window Wrapper
  ========================================
*/
.retro-window {
  background: var(--color-bg);
  border: 2px solid #000000;
  box-shadow: 10px 10px 0px #000000;
  display: flex;
  flex-direction: column;
  margin: 40px auto 50px;
  width: 100%;
  max-width: calc(100% - 10px);
  /* prevent horizontal scroll from shadow */
  position: relative;
}

.retro-window-header {
  background: var(--color-primary-accent);
  border-bottom: 2px solid #000000;
  height: 41px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  /* RTL support via dir=ltr */
  padding: 0 16px;
  gap: 7px;
  flex-shrink: 0;
}

.retro-btn {
  width: 20px;
  height: 20px;
  background: #FFFFFF;
  border: 2px solid #000000;
  box-sizing: border-box;
}

.retro-window-scroll-wrapper {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 700px;
  /* limits height for scroll */
  scrollbar-width: 15px;
  /* Firefox fallback */
  scrollbar-color: var(--color-primary-accent) #FFFFFF;
}

/* Custom WebKit Scrollbar matching mockup */
.retro-window-scroll-wrapper::-webkit-scrollbar {
  width: 15px;
}

.retro-window-scroll-wrapper::-webkit-scrollbar-track {
  background: #FFFFFF;
  border-left: 2px solid #000000;
}

.retro-window-scroll-wrapper::-webkit-scrollbar-thumb {
  background: var(--color-primary-accent);
  border-left: 2px solid #000000;
  border-top: 2px solid #000000;
  border-bottom: 2px solid #000000;
}

.retro-window-content {
  padding-bottom: 20px;
}



/* Footer */
.site-footer {
  background-color: var(--color-primary-accent, #FFAD6F);
  border: 2px solid #000;
  padding: 20px 40px;
  margin: 40px 0 0 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.site-footer-social {
  display: flex;
  gap: 15px;
  align-items: center;
}

.site-footer-social a {
  display: block;
}

.site-footer-social img {
  width: 32px;
  height: 32px;
  transition: transform 0.2s;
}

.site-footer-social img:hover {
  transform: scale(1.1);
}

.site-footer-content {
  color: #D9D9D9;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.site-footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.site-footer-links a {
  color: #ffffff;
  font-weight: bold;
  text-decoration: underline;
  font-size: 18px;
}

.site-footer-copy {
  font-size: 14px;
  color: #ffffff;
  font-weight: 600;
}