/* Minimal, modern theme for portfolio site */
:root {
  --bg: #050505;
  --fg: #f9f9f9;
  --muted: #a0a0a0;
  --accent: #ffffff;
  --card: #121212;
  --border: #222222;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  --hero-image: url('https://images.unsplash.com/photo-1489515217757-5fd1be406fef?auto=format&fit=crop&w=1600&q=80');
  --font-body: 'Open Sans', system-ui, -apple-system, sans-serif;
  --font-heading: 'Open Sans', system-ui, -apple-system, sans-serif;
}

[data-theme="light"] {
  --bg: #fdfdfd;
  --fg: #111111;
  --muted: #666666;
  --accent: #000000;
  --card: #ffffff;
  --border: #eaeaea;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  letter-spacing: 0.01em;
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.side {
  width: 260px;
  padding: 40px 32px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 50;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.brand {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 1.3rem;
  display: block;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  color: var(--fg);
  margin-bottom: 12px;
  line-height: 1.3;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-nav a {
  padding: 8px 0;
  border: none;
  background: transparent;
  transition: all 0.2s ease;
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.2;
  position: relative;
  display: inline-block;
  width: fit-content;
  color: var(--muted);
}

.side-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0px;
  width: 0%;
  height: 2px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.side-nav a.active {
  color: var(--accent);
  font-weight: 600;
}

.side-nav a.active::after {
  width: 100%;
}

.side-nav a:hover {
  color: var(--fg);
  transform: translateX(4px);
}

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

.side-nav a:focus {
  outline: none;
}

.theme-toggle {
  appearance: none;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 0;
  cursor: pointer;
  font-family: inherit;
  width: fit-content;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
}

.theme-toggle:hover {
  color: var(--fg);
  border-color: var(--muted);
}

.theme-toggle svg { width: 18px; height: 18px; display: block; }

.main {
  flex: 1;
  min-height: 100vh;
  position: relative;
  width: 100%;
}

.hero-full {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px;
}

.hero-full::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(180deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.2)), var(--hero-image);
  background-size: cover;
  background-position: center;
  z-index: 0;
  transition: all 0.3s ease;
}

[data-theme="light"] .hero-full::before {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.1)), var(--hero-image);
  filter: contrast(1.05) brightness(1.02);
}

.hero-title {
  position: relative;
  z-index: 1;
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  color: #fff;
  line-height: 1.1;
  text-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.panel {
  padding: 64px 8%;
  max-width: 1200px;
  margin: 0 auto;
}

.panel .hero-title { display: none !important; }

.gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: start;
}

.folders {
  display: grid;
  gap: 40px;
}

.folder-block {
  border: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow);
  max-width: 650px;
  width: 100%;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.folder-block:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .folder-block:hover {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
}

.folder-block:nth-child(odd) { margin-left: 0; margin-right: auto; }
.folder-block:nth-child(even) { margin-left: auto; margin-right: 0; }

.folder-summary {
  position: relative;
  cursor: pointer;
  padding: 0;
  margin: 0;
  list-style: none;
}

.folder-summary figure {
  margin: 0;
  position: relative;
  width: 100%;
}

.folder-summary img {
  width: 100%;
  display: block;
  object-fit: cover;
  max-height: 380px;
}

.folder-block .folder-title {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 6;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  letter-spacing: 0.01em;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  pointer-events: none;
  background: transparent;
}

.folder-summary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, 0.1) 100%);
}

.folder-block details[open] > .folder-summary figure {
  display: none;
}

[data-theme="light"] .folder-summary::after {
  background: linear-gradient(180deg, rgba(0,0,0, 0.3) 0%, rgba(0,0,0, 0) 35%, rgba(0,0,0, 0.05) 100%);
}

.folder-block details {
  padding: 0;
  border: none;
}

.folder-block summary {
  list-style: none;
}

.folder-block summary::-webkit-details-marker { display: none; }

.folder-carousel {
  position: relative;
  background: var(--card);
  padding: 0;
}

.folder-mobile-strip {
  display: none;
}

.carousel-main {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  transition: transform 0.3s ease-out;
}

.carousel-slide {
  min-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
}

.carousel-slide img {
  width: 100%;
  height: auto;
  max-height: 450px;
  object-fit: contain;
  display: block;
}

.carousel-counter {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 0;
  z-index: 3;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 0;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 2;
  backdrop-filter: blur(4px);
}

.carousel-nav:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: translateY(-50%) scale(1.05);
}

.carousel-nav.prev { left: 16px; }
.carousel-nav.next { right: 16px; }

.carousel-thumbs {
  display: flex;
  gap: 10px;
  padding: 16px;
  overflow-x: auto;
  background: var(--card);
}
.carousel-thumbs::-webkit-scrollbar { height: 6px; }
.carousel-thumbs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 0; }

.carousel-thumb {
  min-width: 70px;
  height: 50px;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.5;
  transition: all 0.2s ease;
  border-radius: 0;
  overflow: hidden;
}

.carousel-thumb:hover,
.carousel-thumb.active {
  opacity: 1;
  border-color: var(--accent);
}

.carousel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.contact-card {
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  max-width: 650px;
  margin: 0 auto;
}

iframe.form-frame {
  width: 100%;
  min-height: 85vh;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-page="home"] .hero-full::before {
  position: fixed;
  inset: 0;
  z-index: 0;
}

body[data-page="home"] .side {
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-right: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
  position: relative;
  z-index: 6;
}

body[data-theme="light"][data-page="home"] .side {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
}

body[data-page="home"] .main {
  position: relative;
  z-index: 2;
}

body[data-page="home"] .hero-title {
  position: relative;
  z-index: 2;
}

/* =======================================
   MOBILE & TABLET RESPONSIVE DESIGN
   ======================================= */

@media (max-width: 960px) {
  .page { flex-direction: column; }
  
  /* Make the sidebar a sticky top navigation bar */
  .side { 
    position: sticky; 
    top: 0;
    width: 100%; 
    height: auto; 
    border-right: none; 
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 100;
    background: color-mix(in srgb, var(--bg) 95%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  
  .brand { 
    font-size: 1.1rem; 
    margin: 0; 
    flex-shrink: 0; 
  }
  
  .side-nav {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: center;
    flex: 1;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Hide scrollbar for a cleaner look */
    scrollbar-width: none; 
  }
  .side-nav::-webkit-scrollbar { display: none; }
  
  .side-nav a { 
    padding: 4px 0; 
    font-size: 0.95rem; 
    white-space: nowrap; 
  }
  
  .theme-toggle { 
    padding: 8px 12px; 
    margin-top: 0; 
    flex-shrink: 0; 
  }
  
  /* Ensure correct stacking on homepage */
  body[data-page="home"] .side {
    position: sticky; /* Keep it sticky over the fixed hero background */
    z-index: 100;
  }
  
  .panel { padding: 40px 24px; }
  
  .folder-block { 
    max-width: 100%; 
    margin-left: 0 !important; 
    margin-right: 0 !important; 
  }
}

@media (max-width: 720px) {
  .hero-title { font-size: clamp(2rem, 8vw, 3rem); }
  
  .side { padding: 12px 16px; gap: 12px; }
  .side-nav { gap: 16px; }
  .side-nav a { font-size: 0.9rem; }
  .brand { font-size: 1rem; }
  
  .panel { padding: 32px 16px; }
  .folder-title { font-size: 1.1rem; padding: 16px 20px; top: 0; left: 0; }
  
  /* Swap out interactive carousel for vertical strip on small screens */
  .folder-carousel { display: none; }
  .folder-mobile-strip {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 60px 16px 24px; /* Give room for absolute title at the top */
    background: transparent;
  }
  .folder-mobile-strip .mobile-photo {
    border-radius: 0;
    overflow: hidden;
    background: var(--bg);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }
  .folder-mobile-strip img {
    width: 100%;
    height: auto;
    display: block;
  }
  
  .folder-block details[open] > .folder-summary figure { display: none !important; }
  
  /* Simplify block styling on mobile */
  .folder-block {
    margin: 0;
    border: none;
    background: transparent;
    box-shadow: none;
  }
  .folder-block:hover { transform: none; box-shadow: none; }
}

@media (max-width: 540px) {
  .hero-full { min-height: 70vh; }
  /* When the screen is very small, we might want to hide the brand text slightly or wrap it */
  .brand { display: none !important; }
  .side { justify-content: flex-start; }
}

@media (max-width: 420px) {
  iframe.form-frame { min-height: calc(100vh - 120px); }
}
