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

:root {
  --brown-dark: #3a2510;
  --brown-nav: #593C1F;
  --brown-mid: #8B6914;
  --tan: #D2B48C;
  --sand-light: #FFF8F0;
  --sand-warm: #F5E6D3;
  --text-dark: #2c1810;
  --text-light: #f5f0eb;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  --radius: 6px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-dark);
  background-color: var(--sand-light);
  line-height: 1.6;
}

a {
  color: var(--brown-nav);
  text-decoration-color: var(--tan);
  text-underline-offset: 2px;
}

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

img {
  max-width: 100%;
  height: auto;
}

/* ===== Layout ===== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===== Site Header / Banner ===== */
.site-header {
  background: var(--brown-dark);
  text-align: center;
}

.site-banner {
  display: block;
}

.banner-img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
}

/* ===== Hero Header (homepage) ===== */
.site-header--hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 1400px;
  margin: 0 auto;
}

.site-header--hero .hero-bg {
  width: 100%;
  display: block;
  object-fit: cover;
  object-position: center 30%;
  max-height: clamp(280px, 50vw, 700px);
  min-height: 280px;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  text-align: center;
  padding: 3rem 1.5rem;
  width: 100%;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 2rem;
}

.hero-title {
  color: white;
  font-size: 3rem;
  font-weight: 800;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6), 0 1px 3px rgba(0, 0, 0, 0.4);
  margin-bottom: 0.25rem;
  letter-spacing: 0.01em;
}

.hero-tagline {
  color: white;
  font-size: 1.3rem;
  font-style: italic;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 0, 0, 0.6);
  margin: 0;
}

/* ===== Navigation ===== */
.site-nav {
  background: var(--brown-nav);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  align-items: center;
  gap: 0.5rem;
}

.nav-toggle-icon {
  display: inline-block;
  width: 1.2em;
  height: 2px;
  background: currentColor;
  position: relative;
  vertical-align: middle;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: "";
  display: block;
  width: 100%;
  height: 2px;
  background: currentColor;
  position: absolute;
  left: 0;
}

.nav-toggle-icon::before { top: -6px; }
.nav-toggle-icon::after { top: 6px; }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav li {
  margin: 0;
}

.site-nav a {
  display: block;
  color: var(--text-light);
  text-decoration: none;
  padding: 0.9rem 1.25rem;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.site-nav a:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
}

.site-nav a.active {
  background-color: var(--tan);
  color: var(--brown-dark);
}

.external-icon {
  font-size: 0.75em;
  opacity: 0.7;
}

/* ===== Sub Navigation (Gen2Mask) ===== */
.subnav {
  background: var(--sand-warm);
  border-bottom: 2px solid var(--tan);
}

.subnav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 1100px;
}

.subnav li {
  margin: 0;
}

.subnav a {
  display: block;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--brown-nav);
  text-decoration: none;
  transition: background-color 0.2s;
}

.subnav a:hover {
  background-color: var(--tan);
}

.subnav a.active {
  background-color: var(--tan);
  font-weight: 700;
}

.gen2mask-page {
  max-width: 900px;
  margin: 0 auto;
}

.gen2mask-page .rightfloatimage {
  float: right;
  margin: 5px;
  width: 20%;
}

.gen2mask-page table {
  border-spacing: 1em;
}

.gen2mask-page tbody td,
.gen2mask-page th {
  font-size: 1rem;
}

.gen2mask-page .pdf_div {
  width: 100%;
  border: 2px solid black;
  border-radius: 15px;
  margin: 5px;
  aspect-ratio: 16/9;
}

.gen2mask-page .contents_list {
  columns: 2;
  -webkit-columns: 2;
  -moz-columns: 2;
}

.gen2mask-footer {
  text-align: center;
  padding: 1.5rem 0;
  margin-top: 2rem;
  border-top: 1px solid var(--tan);
  color: #888;
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .subnav ul {
    justify-content: flex-start;
  }

  .subnav a {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }

  .gen2mask-page .rightfloatimage {
    float: none;
    display: block;
    width: 60%;
    margin: 1rem auto;
  }
}

/* ===== Main Content ===== */
main.container {
  padding-top: 2rem;
  padding-bottom: 3rem;
}

h1 {
  font-size: 2rem;
  color: var(--brown-dark);
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.4rem;
  color: var(--brown-nav);
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
  max-width: 75ch;
}

main ul, main ol {
  padding-left: 2rem;
  margin-bottom: 1rem;
}

main li {
  margin-bottom: 0.25rem;
}

/* ===== Build Guides Page ===== */
.build-guides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.build-card {
  display: block;
  background: white;
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text-dark);
  transition: transform 0.2s, box-shadow 0.2s;
  text-align: center;
}

.build-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  color: var(--text-dark);
}

.build-card-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0;
  margin: -1.75rem -1.5rem 1rem -1.5rem;
  width: calc(100% + 3rem);
}

.build-card-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.build-card h2 {
  font-size: 1.2rem;
  margin-bottom: 0.4rem;
  color: var(--brown-nav);
}

.build-card p {
  font-size: 0.9rem;
  color: #666;
  margin: 0;
  max-width: none;
}

/* ===== Homepage ===== */
.intro {
  font-size: 1.15rem;
  max-width: 65ch;
  margin: 0 auto 2rem;
  text-align: center;
}

/* ===== Video Embeds ===== */
.video-embed {
  margin: 1.5rem auto;
  max-width: 700px;
}

.video-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

.video-wrapper--native {
  position: relative;
  padding-bottom: 0;
  height: auto;
}

.video-wrapper--native video {
  width: 100%;
  max-height: 80vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  object-fit: contain;
}

.video-embed figcaption {
  text-align: center;
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.5rem;
  font-style: italic;
}

/* ===== Gallery Listing Page ===== */
.gallery-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  list-style: none;
  padding: 0;
}

.gallery-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

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

.gallery-card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.gallery-card-body {
  padding: 1rem 1.25rem;
}

.gallery-card h2 {
  font-size: 1.15rem;
  margin-bottom: 0.25rem;
}

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

/* ===== Gallery Detail Page ===== */
.gallery-hero {
  margin: 0 -1.5rem 1.5rem;
  overflow: hidden;
  border-radius: var(--radius);
}

.gallery-hero img {
  width: 100%;
  max-height: 450px;
  object-fit: cover;
  display: block;
}

.gallery-page h1 {
  text-align: center;
}

.gallery-description {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  max-width: 75ch;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

.gallery-content {
  text-align: center;
  max-width: 75ch;
  margin: 0 auto 2rem;
}

.gallery-content p {
  max-width: none;
}

.gallery-videos {
  margin-bottom: 2.5rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.gallery-item {
  display: block;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none;
  background: var(--brown-dark);
  transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s;
}

.gallery-item:hover img {
  opacity: 0.85;
}

.gallery-item-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 0.75rem 0.5rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: white;
  font-size: 0.8rem;
  font-weight: 500;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--brown-dark);
  color: var(--sand-warm);
  text-align: center;
  padding: 1.5rem 0;
  margin-top: 3rem;
  font-size: 0.9rem;
}

.site-footer a {
  color: var(--tan);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav ul {
    display: none;
    flex-direction: column;
  }

  .nav-toggle[aria-expanded="true"] + ul {
    display: flex;
  }

  .site-nav a {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .hero-overlay {
    padding: 1.5rem 1rem;
  }

  .hero-title {
    font-size: 1.8rem;
  }

  .hero-tagline {
    font-size: 1rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
  }

  .gallery-item-title {
    font-size: 0.7rem;
    padding: 1.5rem 0.5rem 0.4rem;
  }

  .gallery-hero {
    margin: 0 -1.5rem 1rem;
  }
}
