/*
  Intarsia Portfolio - Main CSS
  ===================================
  Table of Contents:
  1. Global Styles
     - body, h1, p, img
  2. Back Navigation Styling
     - .back, .back a, .back a:hover
  3. Gallery Styling
     - .gallery, .gallery a
     - .gallery-caption
     - .gallery-img, .gallery-img:hover
     - .gallery-thumb
     - .gallery-link
     - .gallery-title
  4. Article Thumbnails
     - .article-thumb
  5. Intro Text Styling
     - .intro-text
  6. Filter Controls (Search & Dropdowns)
     - .filter-group
     - .filter-group > div
  7. Responsive Design
     - @media (max-width: 600px)
     - @media (min-width: 1200px)
  8. Mobile Filter Toggle
     - .filter-toggle
     - .filter-group.collapsed
*/

/* === Global Styles === */
body {
  font-family: sans-serif;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  padding: 1em;
  line-height: 1.6;
  background-color: #fff;
  color: #222;
}

h1 {
  font-size: 1.8em;
  color: #2c3e50;
}

p {
  margin: 0.5em 0;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1em auto;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* === Back Navigation Styling === */
.back {
  margin: 1em 0;
  font-size: 0.9rem;
  text-align: left;
}

.back a {
  text-decoration: none;
  color: #3498db;
  transition: color 0.2s ease;
}

.back a:hover {
  text-decoration: underline;
  color: #2a7ab9;
}

/* === Gallery Styling === */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

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

.gallery-caption {
  margin-top: 0.5rem;
  text-align: center;
  font-weight: bold;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  padding: 0 0.5rem;
  max-width: 100%;
}

.gallery-img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  background-color: #f8f8f8;
  display: block;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.gallery-img:hover {
  transform: scale(1.03);
}

.gallery-thumb {
  width: 100px;
  height: auto;
  max-width: 100%;
  border: 1px solid #ccc;
  border-radius: 8px;
  object-fit: cover;
}

.gallery-link {
  display: block;
  margin-bottom: 15px;
  text-decoration: none;
  color: inherit;
}

.gallery-title {
  font-size: 1.1em;
}

/* === For display of total number in portfolio === */
.gallery-count {
  font-style: italic;
  color: #666;
  margin-bottom: 1rem;
}

/* === Article Thumbnails === */
.article-thumb {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem auto;
}

/* === Intro Text Styling === */
.intro-text {
  text-align: center;
  margin-bottom: 2rem;
}

/* === Filter Controls (Search & Dropdowns) === */
.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 1rem;
  background-color: #fefefe;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: max-height 0.3s ease, opacity 0.3s ease;
  overflow: hidden;
}

.filter-group.collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0;
  pointer-events: none;
}

.filter-group > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.5em 1em;
  background-color: #fafafa;
}

/* === Mobile Filter Toggle === */
.filter-toggle {
  display: none;
  background: #2c3e50;
  color: #fff;
  padding: 0.5em 1em;
  border: none;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 1rem;
  cursor: pointer;
}

/* === For "Tap image to see full size" === */
.image-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1rem;
}
.tap-note {
  font-size: 0.9em;
  color: #666;
  margin-top: 0.5rem;
}

/* === For displaying google map to library === */

.map-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 ratio */
  height: 0;
  overflow: hidden;
  margin-bottom: 1em;
}

.map-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* === Email contact === */
.contact-line {
  font-size: 1rem;
  color: #444;
  text-align: center;
  margin-top: 2rem;
}
#email a {
  color: #0077cc;
  text-decoration: none;
}
#email a:hover {
  text-decoration: underline;
}


/* === Responsive Design === */
@media (max-width: 600px) {
  .filter-toggle {
    display: block;
  }

  .filter-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    justify-items: center;
  }

  .filter-group > div {
    width: 100%;
    max-width: none;
    align-items: stretch;
  }
}

@media (min-width: 1200px) {
  .article-thumb {
    max-width: 600px;
  }
}
