:root { --header-h: 84px; }

.site-header {
  display: grid;
  grid-template-columns: auto minmax(280px, 760px) auto;
  align-items: center;
  justify-content: stretch;
  gap: 18px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.brand-stack {
  display: grid;
  gap: 2px;
  align-items: start;
  flex: 0 0 auto;
  line-height: 1;
}

.brand {
  display: block;
  text-decoration: none;
  line-height: 0;
  white-space: normal;
}

.site-logo {
  display: block;
  width: 178px;
  height: auto;
}

.fanza-webservice-credit {
  display: block;
  width: 135px;
  height: 17px;
  line-height: 0;
  text-decoration: none;
}

.fanza-webservice-credit img {
  display: block;
  width: 135px;
  height: 17px;
}

.header-search {
  position: relative;
  width: 100%;
  min-width: 0;
  justify-self: center;
}

.header-search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: #8e8e99;
  pointer-events: none;
}

.header-search input {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 76px 0 43px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 15px;
  outline: none;
  background: #17171e;
  color: var(--text);
  font-weight: 650;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}

.header-search input::placeholder { color: #7f7f89; }
.header-search input:focus {
  border-color: rgba(255,255,255,.3);
  background: #1b1b23;
  box-shadow: 0 0 0 3px rgba(255,255,255,.045);
}

.header-search button {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,.09);
  color: #ededf1;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.header-search button:hover { background: rgba(255,255,255,.15); }
.site-nav { justify-self: end; }

@media (max-width: 980px) {
  .site-header { grid-template-columns: auto minmax(220px, 1fr) auto; gap: 10px; }
  .site-logo { width: 150px; }
  .header-search input { height: 42px; }
  .nav-link { padding-left: 10px; padding-right: 10px; }
}

@media (max-width: 760px) {
  :root { --header-h: 112px; }

  .site-header {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand nav"
      "search search";
    gap: 5px 8px;
    padding: 4px 10px 7px;
  }

  .brand-stack { grid-area: brand; }
  .site-logo { width: 128px; }
  .site-nav { grid-area: nav; gap: 3px; justify-self: end; }
  .nav-link { padding: 6px 7px; font-size: 12px; }
  .header-search { grid-area: search; }
  .header-search input { height: 38px; padding-left: 38px; padding-right: 64px; border-radius: 13px; font-size: 14px; }
  .header-search-icon { left: 13px; width: 16px; height: 16px; }
  .header-search button { height: 28px; right: 5px; padding: 0 10px; }
}

@media (max-width: 420px) {
  .brand {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
  }
  .site-logo { width: 116px; }
  .nav-link { padding: 6px 6px; font-size: 11px; }
}
