/* Global Settings & Variables */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap');

:root {
  /* Colors */
  --bg-color: #ffffff;
  --text-color: #333333;
  /* Dark Grey as requested */
  --text-lighter: #555555;
  --accent-color: #1a1a1a;
  --link-color: #008080;
  /* Teal for content links */
  --hover-color: #006666;
  /* Darker teal for hover */
  --border-color: #eeeeee;

  /* Sidebar */
  --sidebar-width: 260px;
  --sidebar-bg: #f9f9f9;

  /* Typography */
  --font-primary: 'Inter',
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  --font-size-base: 14px;
  --line-height-base: 1.8;
  /* Increased line space */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-bold: 600;
  --video-max-height: 60vh;
  /* Central control for max video height */

  /* Spacing */
  --spacing-unit: 1.5rem;
  --site-max-width: 1400px;
  /* Wider for gallery feel */

  /* Transition */
  --transition-speed: 0.3s;
}

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

body {
  font-family: var(--font-primary);
  background-color: var(--bg-color);
  color: var(--text-color);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
  display: flex;
  min-height: 100vh;
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color var(--transition-speed);
}

a:hover {
  color: var(--hover-color);
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --------------------------
   Sidebar Navigation
   -------------------------- */
.site-header {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background-color: var(--sidebar-bg);
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  z-index: 1000;
  overflow-y: auto;
  justify-content: space-between;
  /* Space between nav and bottom elements */
}

/* Nav List */
.site-branding {
  margin-bottom: 2rem;
}

.site-branding a {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 0.5rem;
  color: var(--accent-color);
}

.site-logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 50%;
  /* Optional: if the logo should be round */
}

.site-name {
  font-weight: var(--font-weight-bold);
  font-size: 1.3rem;
  /* Increased from 1.1rem */
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.site-header nav {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.site-header nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-top: 1rem;
}

.site-header nav a {
  font-size: 1rem;
  font-weight: var(--font-weight-normal);
  color: var(--text-lighter);
  display: block;
  letter-spacing: 0.02em;
}

.site-header nav a:hover,
.site-header nav a.active {
  color: var(--accent-color);
  font-weight: var(--font-weight-bold);
}

/* Social Links in Sidebar */
.sidebar-socials {
  margin-top: auto;
  /* Push to bottom */
  padding-top: 2rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.sidebar-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  opacity: 0.6;
  transition: opacity var(--transition-speed);
  color: var(--text-color);
  /* Maintain dark color */
}

.sidebar-socials a:hover {
  opacity: 1;
  color: var(--accent-color);
}

.sidebar-socials svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

/* --------------------------
   Main Content Area
   -------------------------- */
.site-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  /* Offset by sidebar width */
  padding: 4rem 5%;
  max-width: 1200px;
  width: 100%;
}

/* Page Headers */
.page-header {
  margin-bottom: 3rem;
}

.page-header h1 {
  font-size: 2.2rem;
  font-weight: var(--font-weight-light);
  color: var(--accent-color);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

/* Project Grid */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2.5rem;
}

.project-card {
  transition: opacity var(--transition-speed), transform var(--transition-speed);
}

.project-card:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

.media-grid.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.project-card img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 2px;
  background-color: #f4f4f4;
  margin-bottom: 1rem;
}

.project-card .card-info h2 {
  font-size: 1.1rem;
  font-weight: var(--font-weight-bold);
  margin-bottom: 0.2rem;
  color: var(--text-color);
}

.project-card .date {
  font-size: 0.85rem;
  color: #888;
}

/* Content Pages */
.page-content {
  max-width: 800px;
  /* Optimal reading width */
}

/* Images (Desktop Default) */
.page-content img {
  width: 70%;
  margin: 20px auto;
  display: block;
}

/* Videos (Smart Sizing) */
.page-content video {
  width: auto;
  height: auto;
  max-width: 70%;
  max-height: var(--video-max-height);
  /* Uses variable defined in root */
  margin: 20px auto;
  display: block;
}

/* Exceptions */
.project-card img {
  width: 100%;
  margin: 0 0 1rem 0;
}

.content-block {
  margin-bottom: 2.5rem;
}

/* Photo Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  /* 150px min for smaller thumbnails */
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.media-grid img {
  width: 100% !important;
  /* Override 70% rule */
  height: 100%;
  object-fit: cover;
  aspect-ratio: 1/1;
  /* Square grid items looks nice for photogrids, or auto */
  margin: 0 !important;
}

.media-grid.portrait img {
  aspect-ratio: 3/4;
  /* Taller for portrait photos */
}

.content-block.text {
  font-size: 1.1rem;
  color: var(--text-color);
}

.content-block p {
  margin-bottom: 1.5rem;
}

/* Footer (Original footer hidden/minimal as items moved) */
.site-footer {
  display: none;
  /* We moved content to sidebar */
}

/* Back to Top */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 45px;
  height: 45px;
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 900;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  transform: translateY(-3px);
}

/* --------------------------
   Mobile Responsive
   -------------------------- */
.nav-toggle {
  display: none;
}

@media (max-width: 900px) {

  /* Layout Reset */
  body {
    flex-direction: column;
  }

  .site-main {
    margin-left: 0;
    padding: 5rem 1.5rem 3rem;
    /* Top padding for fixed header bar */
    width: 100%;
  }

  /* Header becomes Mobile Bar */
  .site-header {
    width: 100%;
    height: 60px;
    /* Slim bar */
    padding: 0 1.5rem;
    flex-direction: row;
    align-items: center;
    border-bottom: 1px solid #ddd;
    border-right: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    justify-content: space-between;
    /* Space between toggle and branding */
    overflow: visible;
    /* Inherited overflow-y: auto clips the fixed nav */
  }

  .site-branding {
    margin-bottom: 0;
    /* No margin on mobile */
    order: 2;
    /* Move to right */
  }

  .site-branding a {
    flex-direction: row;
    align-items: center;
    /* Fix vertical alignment */
    text-align: right;
    /* Or left, depending on preference */
  }

  .site-logo {
    width: 40px;
    height: 40px;
  }

  .site-name {
    /* display: none; */
    font-size: 1.1rem;
    /* Increased from 0.9rem */
    /* Smaller on mobile */
  }

  /* Nav List */
  /* Hide nav and socials initially */
  .site-header nav {
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    height: calc(100vh - 60px);
    background: #fff;
    padding: 2rem;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    z-index: 999;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  /* Open State */
  .site-header.nav-open nav {
    transform: translateX(0);
  }

  /* Reset content images/videos to full width on mobile */
  .page-content img {
    width: 100%;
  }

  .page-content video {
    width: 100%;
    max-width: 100%;
    max-height: 80vh;
    /* Allow taller on mobile or reset? User didn't specify, but 100% width usually implies auto height */
  }

  /* Toggle Button */
  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
    margin-right: auto;
    /* Align left */
  }

  .nav-toggle .bar {
    width: 100%;
    height: 2px;
    background-color: var(--accent-color);
    transition: all 0.3s;
  }

  /* Hamburger Animation */
  .nav-toggle.active .bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 6px);
  }

  .nav-toggle.active .bar:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.active .bar:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -6px);
  }

  /* Formatting for nav inside mobile menu */
  .site-header nav ul {
    margin-top: 0;
    gap: 2rem;
    text-align: center;
  }

  .site-header nav a {
    font-size: 1.3rem;
    /* Larger touch targets */
  }

  .sidebar-socials {
    justify-content: center;
    padding-bottom: 2rem;
  }

  /* Prevent scrolling when menu open */
  body.no-scroll {
    overflow: hidden;
  }
}

/* Photo Grid Pointer */
.media-grid img {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.media-grid img:hover {
  transform: scale(1.02);
}

/* Lightbox Styles */
#lightbox {
  position: fixed;
  z-index: 10000;
  /* High z-index */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#lightbox.active {
  display: flex;
  opacity: 1;
}

#lightbox img {
  max-width: 90%;
  max-height: 90%;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  border: 2px solid #fff;
  object-fit: contain;
}

#lightbox .close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10001;

  user-select: none;
}

/* Carousel Styles */
.media-carousel {
  display: flex;
  overflow-x: auto;
  gap: 1rem;
  scroll-snap-type: x mandatory;
  padding-bottom: 1rem;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 2.5rem;
}

.media-carousel img {
  height: 400px;
  /* Fixed height for consistency */
  width: auto;
  max-width: 90vw;
  /* Ensure they don't overflow viewport width on mobile */
  object-fit: contain;
  /* or cover, depending on desired look. User said photo grid images, assumed portraits/landscapes mixed. Contain is safer for art. */
  flex-shrink: 0;
  scroll-snap-align: center;
  border-radius: 4px;
  border: 3px solid #ddd;
  cursor: pointer;
  transition: transform 0.2s ease;
  margin: 0 !important;
  /* Override global margins */
}

.media-carousel img:hover {
  transform: scale(1.02);
}

/* Custom Scrollbar for Carousel */
.media-carousel::-webkit-scrollbar {
  height: 8px;
}

.media-carousel::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.media-carousel::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

.media-carousel::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

/* Ode Pages Video Override */
/* Ode Pages Video Override */
.ode-page .page-content video {
  max-width: 70%;
  width: 70%;
  margin: 20px auto;
  display: block;
}

.ode-page .content-block.text {
  text-align: center;
}

/* Contact Form */
.contact-form {
  max-width: 600px;
  margin: 0;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: var(--font-weight-bold);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-color);
}

.btn-submit {
  background-color: var(--accent-color);
  color: #fff;
  border: none;
  padding: 1rem 2rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s;
}

.btn-submit:hover {
  background-color: #333;
}