/* Header & Layout Structure */
.sticky-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(245, 244, 237, 0.94);
  backdrop-filter: blur(8px);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: 78px;
  padding: 0 4vw;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
}

.brand {
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 16px;
  font-weight: 800;
  flex-shrink: 0;
  white-space: nowrap;
  min-width: max-content;
}

.brand-mark {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.header-nav {
  display: flex;
  gap: 28px;
}

.header-nav .nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  transition: color 0.2s;
}

.header-nav .nav-link:hover,
.header-nav .nav-link.active {
  color: var(--ink);
  border-bottom: 2px solid var(--ink);
  padding-bottom: 2px;
}

/* Header Search Component */
.header-search {
  display: flex;
  align-items: center;
  border: 1px solid var(--ink);
  background: #fff;
  height: 40px;
  width: 220px;
  max-width: 100%;
  transition: width 0.25s ease;
}

@media (min-width: 1241px) {
  .header-search:focus-within,
  .header-search:has(input:not(:placeholder-shown)) {
    width: 320px;
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: end;
}

.header-search select {
  height: 100%;
  border: none;
  border-right: 1px solid var(--line);
  background: var(--navy-soft);
  padding: 0 10px;
  font: 600 12px "Noto Sans SC", sans-serif;
  color: var(--ink);
  cursor: pointer;
  outline: none;
}

.header-search input {
  height: 100%;
  border: none;
  outline: none;
  padding: 0 12px;
  width: 100%;
  font: 500 13px Manrope, "Noto Sans SC", sans-serif;
  color: var(--ink);
}

.header-search input::placeholder {
  color: #8b98a9;
}

.join-link {
  flex-shrink: 0;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  border: 1px solid var(--lime);
  background: var(--orange-soft);
  padding: 10px 14px;
  line-height: 18px;
  transition: background 0.2s, color 0.2s;
}

.join-link:hover {
  color: var(--ink);
  background: var(--lime);
}

.join-link span {
  margin-left: 5px;
}

.language-selector {
  height: 40px;
  flex-shrink: 0;
  border: 1px solid var(--ink);
  background: #fff;
  color: var(--ink);
  padding: 0 8px;
  font: 600 12px "Noto Sans SC", sans-serif;
  cursor: pointer;
}

/* Detail Header */
.detail-header {
  display: flex;
}

.detail-nav {
  display: flex;
  align-items: center;
  gap: 30px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.detail-nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  padding: 28px 0 25px;
  border-bottom: 3px solid transparent;
}

.detail-nav-link:hover,
.detail-nav-link.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.back-link-btn {
  height: 40px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--ink);
  padding: 0 14px;
  background: #fff;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  flex-shrink: 0;
  white-space: nowrap;
}

.back-link-btn:hover {
  background: var(--orange-soft);
  border-color: var(--ink);
  color: var(--ink);
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

/* Shell Layouts */
.section-shell,
.intro,
.detail-wrap,
footer {
  width: 92vw;
  margin-left: auto;
  margin-right: auto;
}

footer {
  border-top: 1px solid var(--line);
  padding: 25px 0 35px;
  display: flex;
  justify-content: space-between;
  color: #738197;
  font: 10px "DM Mono", "Noto Sans SC", monospace;
  letter-spacing: 0.4px;
}

@media (max-width: 1240px) {
  .site-header:not(.detail-header) {
    height: auto;
    min-height: 78px;
    padding-top: 12px;
    padding-bottom: 12px;
    grid-template-columns: auto 1fr;
    gap: 16px 20px;
    align-items: center;
  }
  .site-header:not(.detail-header) .brand {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }
  .site-header:not(.detail-header) .header-actions {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }
  .site-header:not(.detail-header) .header-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    justify-content: center;
  }
  .header-search {
    width: 200px;
    max-width: 220px;
  }
}

@media (max-width: 900px) {
  .site-header,
  .site-header:not(.detail-header) {
    height: auto;
    min-height: 0;
    padding: 12px 18px;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .site-header:not(.detail-header) .brand {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }
  .site-header:not(.detail-header) .header-actions {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    justify-self: stretch;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
  }
  .site-header:not(.detail-header) .header-search {
    width: 100%;
    max-width: 100%;
    order: 2;
    flex: 1 1 100%;
  }
  .site-header:not(.detail-header) .header-actions > :not(.header-search) {
    order: 1;
  }
  .site-header:not(.detail-header) .header-nav {
    grid-column: 1;
    grid-row: 3;
    width: 100%;
    justify-content: center;
    gap: 16px;
  }
}

@media (max-width: 800px) {
  .detail-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 18px;
    height: auto;
  }
  .detail-nav {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 24px;
    border-top: 1px solid var(--line);
    position: static;
    transform: none;
  }
  .detail-nav-link {
    padding: 10px 0 8px;
    font-size: 12px;
  }
  .detail-actions {
    width: 100%;
    order: 2;
    flex-wrap: wrap;
    gap: 10px;
    margin-left: 0;
  }
  .detail-actions .join-link,
  .detail-actions .back-link-btn {
    flex: 1;
    text-align: center;
    justify-content: center;
  }
  .section-shell,
  .intro,
  .detail-wrap,
  footer {
    margin-left: 20px;
    margin-right: 20px;
  }
  footer {
    padding: 20px 0 28px;
  }
}
