/* =========================================
   1. Variables & Reset
   ========================================= */
:root {
  /* Colors */
  --color-green: #cde4b7;
  --color-yellow: #fdf5b2;
  --color-beige: #f8f3ec;
  --color-light-brown: #e6e0d4;
  --color-brown: #6d4c41;
  --color-dark-brown: #8b5a2b;
  --color-gray: #f0f0f0;
  --color-text: #333;
  --color-text-light: #555;
  --color-white: #ffffff;
  --color-black: #000000;

  /* Fonts */
  --font-title: "Sacramento", cursive;
  --font-body: "Noto Sans KR", sans-serif;
  --font-poppins: "Poppins", sans-serif;
  --font-fredoka: "Fredoka One", cursive;

  /* Spacing */
  --spacing-section: 4rem 5%;
  --header-height: 60px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  scroll-behavior: smooth;
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s ease;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

button {
  cursor: pointer;
  font-family: inherit;
}

/* =========================================
   2. Header & Navigation
   ========================================= */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--header-height);
  padding: 0 14%;
  background: rgba(255, 255, 255, 0.6);
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  backdrop-filter: blur(5px);
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.logo {
  font-family: var(--font-title);
  font-size: 2rem;
  white-space: nowrap;
  color: var(--color-text);
}

.main-nav ul {
  display: flex;
  gap: 1.5rem;
}

.main-nav a {
  font-size: 1rem;
  color: #444;
  font-weight: 500;
}

.main-nav a:hover {
  color: var(--color-dark-brown);
}

/* Mobile Nav Toggle */
.mobile-nav-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1100;
}

.mobile-nav-toggle span {
  display: block;
  width: 25px;
  height: 3px;
  background-color: var(--color-text);
  margin: 5px 0;
  transition: all 0.3s ease;
}

/* Mobile Nav Overlay */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  z-index: 1050;
  transition: right 0.4s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}

.mobile-nav-overlay.active {
  right: 0;
}

.mobile-nav-content {
  text-align: center;
}

.mobile-nav-content ul {
  flex-direction: column;
  gap: 2rem;
}

.mobile-nav-content a {
  font-family: var(--font-title);
  font-size: 2.5rem;
  color: var(--color-text);
  display: block;
}

.mobile-nav-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: none;
  font-size: 3rem;
  cursor: pointer;
  color: var(--color-text);
}

/* =========================================
   3. Hero Section
   ========================================= */
.hero-section {
  position: relative;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--color-white);
  padding-top: var(--header-height);
}

.video-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
}

.video-background video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  padding: 0 20px;
}

/* =========================================
   4. Sections (Common)
   ========================================= */
.section {
  padding: var(--spacing-section);
  text-align: center;
}

.section-header h2 {
  font-size: 2rem;
  margin-bottom: 2rem;
  line-height: 1.4;
}

.divider-img {
  display: block;
  margin: 2rem auto;
  height: auto;
}
.divider-img.small {
  width: 130px;
}
.divider-img.medium {
  width: 210px;
}

/* =========================================
   5. Artwork Section
   ========================================= */
#artwork {
  background: linear-gradient(
    to bottom,
    var(--color-yellow),
    var(--color-beige)
  );
}

.gallery .grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 2rem 0;
}

.gallery .item {
  position: relative;
  padding-top: 100%; /* 1:1 Aspect Ratio */
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.gallery .item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.gallery .item img:hover {
  transform: scale(1.05);
  filter: brightness(0.9);
}

/* Iframe Menu (Year Menu) */
.iframe-wrapper {
  margin: 3rem 0;
}

.iframe-menu {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.iframe-menu button {
  background: rgba(255, 255, 255, 0.6);
  border: 2px solid var(--color-light-brown);
  padding: 0.6rem 1.5rem;
  border-radius: 30px;
  font-weight: 600;
  color: var(--color-text);
  transition: all 0.3s ease;
}

.iframe-menu button:hover,
.iframe-menu button.active {
  background: var(--color-green);
  color: var(--color-white);
  border-color: var(--color-green);
}

/* Year Gallery (Inline) */
.year-gallery-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(5px);
  border-radius: 15px;
  min-height: 500px;
}

.year-gallery-track-wrapper {
  width: 100%;
  overflow: hidden;
  padding: 0 60px; /* Space for arrows */
}

.year-gallery-track {
  display: flex;
  gap: 60px;
  align-items: center;
  width: max-content;
  /* Transform handled by JS */
}

.year-gallery-item {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: auto;
  height: 450px;
  cursor: pointer;
  padding-bottom: 20px;
}

.year-gallery-item img {
  height: 300px;
  width: auto;
  display: block;
  max-width: 100%;
  object-fit: contain;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.year-caption {
  font-size: 14px;
  color: #555;
  text-align: center;
  margin-top: 15px;
  max-width: 250px;
  line-height: 1.4;
}

.nav-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  font-size: 1.5rem;
  transition: background 0.3s;
}

.nav-button:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

.nav-button.left {
  left: 10px;
}
.nav-button.right {
  right: 10px;
}

.iframe-container {
  width: 100%;
  display: flex;
  justify-content: center;
}

.iframe-box {
  width: 100%;
  height: 500px;
  border: none;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(5px);
}

/* =========================================
   6. Artist Section
   ========================================= */
#artist {
  background: linear-gradient(
    to bottom,
    var(--color-beige),
    var(--color-light-brown)
  );
  position: relative;
}

/* 배경 이미지 제거 */
#artist::before {
  content: none;
}

/* 콘텐츠가 배경 위에 오도록 z-index 조정 */
.artist-container,
.timeline-group {
  position: relative;
  z-index: 1;
}

.artist-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 3rem;
  margin-bottom: 4rem;
}

.artist-image img {
  width: 280px;
  height: 280px;
  object-fit: cover;
  border-radius: 50%;
  border: 6px solid var(--color-light-brown);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.artist-bio {
  max-width: 500px;
  text-align: left;
}

.artist-name {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 1rem;
}

.artist-name h2 {
  font-family: var(--font-title);
  font-size: 2.5rem;
  margin: 0;
  color: var(--color-brown);
}

.artist-icon {
  width: 50px;
  height: auto;
}

.artist-quote {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--color-dark-brown);
  margin-bottom: 1rem;
}

.contact-btn {
  background: var(--color-brown);
  color: var(--color-white);
  border: none;
  padding: 0.8rem 2rem;
  border-radius: 5px;
  font-weight: bold;
  margin-top: 1.5rem;
  transition: background 0.3s ease;
}

.contact-btn:hover {
  background: var(--color-dark-brown);
}

/* Timelines */
.timeline-group {
  display: flex;
  flex-direction: column;
  gap: 3rem;
  max-width: 800px;
  margin: 0 auto;
}

.timeline {
  text-align: left;
  background: rgba(255, 255, 255, 0.5);
  padding: 2rem;
  border-radius: 10px;
}

.timeline h3 {
  color: var(--color-dark-brown);
  border-bottom: 2px solid var(--color-brown);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  display: inline-block;
}

.timeline ul li {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  display: flex;
  align-items: flex-start; /* Align top for multi-line text */
}

.timeline ul li span {
  font-weight: bold;
  margin-right: 10px;
  color: var(--color-brown);
  flex: 0 0 110px; /* Fixed width for date column */
  white-space: nowrap; /* Prevent date from wrapping */
}

/* Add bullet for lists without dates (Teaching) */
#teachingCareerList li::before {
  content: "•";
  margin-right: 10px;
  color: var(--color-brown);
  font-weight: bold;
}

/* Specific fix for Education section text wrapping */
#educationList li {
  letter-spacing: -0.08em; /* Even tighter spacing */
  font-size: 0.9rem; /* Even smaller font */
}

.toggle-btn {
  background: var(--color-brown);
  color: var(--color-white);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  margin-top: 1rem;
  transition: background 0.3s;
}

.toggle-btn:hover {
  background: var(--color-dark-brown);
}

.cert-iframe-container {
  height: 0;
  overflow: hidden;
  transition: height 0.5s ease;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
}

.cert-gallery-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  padding: 2rem;
}

.cert-gallery-grid img {
  width: 160px; /* Smaller width */
  height: 220px; /* Smaller fixed height */
  object-fit: contain; /* Show full image without cropping */
  background-color: rgba(
    255,
    255,
    255,
    0.5
  ); /* Subtle background for different aspect ratios */
  border-radius: 5px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer; /* Indicate clickable */
}

.cert-gallery-grid img:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* =========================================
   Image Modal (Lightbox)
   ========================================= */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  cursor: zoom-out; /* Click anywhere to close */
}

.image-modal.active {
  opacity: 1;
  visibility: visible;
}

.image-modal img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transform: scale(0.9);
  transition: transform 0.3s ease;
  cursor: default; /* Prevent closing when clicking image itself if desired, but user wants easy close */
  cursor: zoom-out;
}

.image-modal.active img {
  transform: scale(1);
}

/* =========================================
   7. Atelier Section
   ========================================= */
#atelier {
  background: linear-gradient(
    to bottom,
    var(--color-light-brown),
    var(--color-green)
  );
  padding-top: 0; /* Hero image handles top spacing */
}

.atelier-hero {
  position: relative;
  height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.atelier-bg-img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.atelier-hero:hover .atelier-bg-img {
  transform: scale(1.05);
}

.atelier-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
}

.atelier-title {
  position: relative;
  z-index: 10;
  color: var(--color-white);
  font-family: var(--font-fredoka);
  font-size: 4rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.info-box {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  min-height: 250px;
  border-radius: 8px;
  transition: shadow 0.3s;
}
.info-box:hover {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}
.bg-pastel-1 {
  background-color: #ffeff7;
}
.bg-pastel-2 {
  background-color: #e1eefb;
}

.image-box {
  position: relative;
  height: 300px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.image-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.overlay-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  color: white;
  transition: opacity 0.3s ease;
  padding: 1rem;
  text-align: center;
}

.hover-reveal {
  background: rgba(0, 0, 0, 0.7);
}

/* Shop List */
.shop-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  background: #fff;
}

.shop-item img {
  width: 100%;
  height: auto;
  display: block;
}

.item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  text-align: center;
  font-size: 0.9rem;
}

.shop-item:hover .item-overlay {
  opacity: 1;
}

.shop-detail-container {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease;
  position: relative;
  margin-top: 20px;
  background: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
}

.shop-detail-content {
  padding: 40px;
  text-align: center;
}

/* Shop Detail Styles (Merged from detailx.html) */
.detail-header {
  margin-bottom: 2rem;
}
.detail-title {
  font-size: 2.5rem;
  font-weight: 300;
  margin-bottom: 1rem;
  color: #333;
}
.detail-desc {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 2rem;
  line-height: 1.6;
}
.detail-img {
  width: 100%;
  max-width: 600px; /* Limit max width */
  max-height: 400px; /* Limit max height */
  height: auto;
  object-fit: cover; /* Maintain aspect ratio */
  border-radius: 8px;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.detail-img:hover {
  transform: scale(1.02);
}
.detail-keywords {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 2rem;
}
.keyword-tag {
  padding: 0.5rem 1rem;
  background: var(--color-beige);
  color: var(--color-dark-brown);
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
}
.detail-highlight {
  color: var(--color-dark-brown);
  font-weight: bold;
}

.shop-detail-iframe {
  width: 100%;
  height: 600px;
  border: none;
}

.close-detail-btn {
  position: relative; /* Changed from absolute to relative */
  bottom: auto; /* Reset bottom */
  left: auto; /* Reset left */
  transform: none; /* Reset transform */
  margin: 2rem auto 0; /* Add margin top and center horizontally */
  display: block; /* Ensure block display for margin auto to work */
  background: var(--color-brown);
  color: white;
  border: none;
  padding: 0.5rem 1.5rem;
  border-radius: 4px;
  /* display: none;  Controlled by JS - removed here to avoid conflict, JS sets display: block/none */
  z-index: 10;
}

/* =========================================
   8. Contact Section
   ========================================= */
.contact-section {
  padding: 4rem 5%;
  background: var(--color-white);
}

.contact-container {
  display: flex;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.contact-info-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-box {
  padding: 1.5rem;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #f9f9f9;
}

.contact-details h1 {
  color: var(--color-brown);
  margin-bottom: 0.5rem;
}

.sns-icons {
  display: flex;
  gap: 15px;
}

.sns-icons img {
  width: 40px;
  height: 40px;
  transition: transform 0.2s;
}

.sns-icons img:hover {
  transform: scale(1.1);
}

.qr-code img {
  width: 100%;
  max-width: 150px; /* Limit QR code size */
  height: auto;
  margin-top: 1rem;
  display: block;
}

.contact-map {
  flex: 2;
  min-height: 400px;
  border-radius: 8px;
  overflow: hidden;
}

.copyright {
  text-align: center;
  margin-top: 3rem;
  color: #888;
  font-size: 0.9rem;
}

/* =========================================
   9. Modals (Fullscreen)
   ========================================= */
.fullscreen-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  display: none; /* Flex when active */
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.modal-content {
  position: relative;
  max-width: 90%;
  max-height: 80%;
}

.modal-main-image {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 4px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.close-button {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 2rem;
  cursor: pointer;
}

.modal-prev,
.modal-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: white;
  font-size: 3rem;
  padding: 0 1rem;
  cursor: pointer;
}
.modal-prev {
  left: -60px;
}
.modal-next {
  right: -60px;
}

.modal-thumbnails {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  overflow-x: auto;
  max-width: 90%;
  padding-bottom: 10px;
}

.modal-thumbnail {
  width: 60px;
  height: 60px;
  object-fit: cover;
  opacity: 0.5;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.modal-thumbnail.active,
.modal-thumbnail:hover {
  opacity: 1;
  border-color: var(--color-green);
}

/* =========================================
   10. Responsive Design
   ========================================= */
@media (max-width: 768px) {
  .main-header {
    padding: 0 5%;
  }

  /* Hide Desktop Nav */
  .desktop-nav {
    display: none;
  }

  /* Show Mobile Toggle */
  .mobile-nav-toggle {
    display: block;
  }

  /* Hero Section */
  .hero-content h1 {
    font-size: 2rem; /* Smaller title */
  }

  .hero-content p {
    font-size: 1rem;
    padding: 0 1rem;
  }

  /* Gallery */
  .gallery .grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns for mobile */
    gap: 5px;
  }

  /* Artist Section */
  .artist-container {
    flex-direction: column;
    text-align: center;
    gap: 2rem;
  }

  .artist-bio {
    text-align: center;
    padding: 0 1rem;
  }

  .artist-name {
    justify-content: center;
    flex-direction: column;
    gap: 0.5rem;
  }

  .artist-name h2 {
    font-size: 2rem;
  }

  /* Atelier Section */
  .atelier-hero {
    height: 30vh; /* Shorter hero */
  }

  .atelier-title {
    font-size: 2.5rem;
  }

  .atelier-intro {
    padding: 2rem 1rem;
  }

  .grid.grid-cols-3 {
    grid-template-columns: 1fr; /* Stack vertically */
  }

  /* Use Tailwind classes override or specific selector if needed */
  #atelier .grid {
    grid-template-columns: 1fr;
  }

  /* Shop List */
  .shop-list {
    grid-template-columns: 1fr;
    padding: 0 1rem;
  }

  /* Contact Section */
  .contact-container {
    flex-direction: column;
  }

  .contact-map {
    height: 300px;
  }

  .contact-info-wrapper {
    order: 2; /* Map first? No, keep info first usually or map first. Let's keep default order but stack */
  }
}

@media (max-width: 480px) {
  .gallery .grid {
    grid-template-columns: 1fr; /* 1 column for very small screens if needed, but 2 is usually fine. Let's stick to 2 or 1. 1 might be better for details. */
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-content h1 {
    font-size: 1.8rem;
  }
}
