@charset "UTF-8";

/*!
Theme Name: Cocoon Child
Description: Cocoon専用の子テーマ
Theme URI: https://wp-cocoon.com/
Author: わいひら
Author URI: https://nelog.jp/
Template:   cocoon-master
Version:    1.1.3
*/

/************************************
** 子テーマ用のスタイルを書く
************************************/
/*必要ならばここにコードを書く*/


/************************************
** レスポンシブデザイン用のメディアクエリ
************************************/
/*1023px以下*/
@media screen and (max-width: 1023px){
  /*必要ならばここにコードを書く*/
}

/*834px以下*/
@media screen and (max-width: 834px){
  /*必要ならばここにコードを書く*/
}

/*480px以下*/
@media screen and (max-width: 480px){
  /*必要ならばここにコードを書く*/
}
table.nomad_table {
  max-width: 900px !important;
  width: 100%;
  margin: 15px auto !important;
  background: #FFF;
  text-align: center !important;
  font-size: 14px !important;
  display: block !important;
  overflow-x: scroll !important;
  overflow-y: hidden !important;
  white-space: nowrap !important;
  -webkit-overflow-scrolling: touch !important;
  color: #333 !important;
  border: none !important;
  border-collapse: collapse !important;
}

table.nomad_table a {
  color: #333 !important;
  text-decoration: none !important;
  transition: .2s;
  padding: 0 !important;
  margin: 0 !important;
  line-height: 1.25em !important;
  font-size: 13px !important;
  display: block !important;
  position: relative !important;
  text-align: center !important;
}

table.nomad_table a:hover {
  opacity: .8;
}

table.nomad_table tr td,
table.nomad_table tr th {
  padding: 1.5em 2.2em !important;
  line-height: 1.25em !important;
  font-size: 14px !important;
  border: none !important;
  position: relative !important;
  text-align: center !important;
  vertical-align: middle !important;
  border-bottom: 1px solid #505050 !important;
}

table.nomad_table tr:first-child td,
table.nomad_table tr:first-child th,
table.nomad_table tr:last-child td,
table.nomad_table tr:last-child th {
  border-bottom: none !important;
}

table.nomad_table tr td {
  font-size: 13px !important;
}

table.nomad_table tr td:first-child {
  position: sticky !important;
  left: 0 !important;
  background: #FFF !important;
  z-index: 2;
}

table.nomad_table tr th:first-child {
  position: sticky !important;
  left: 0 !important;
  z-index: 2;
}

table.nomad_table tr td:nth-child(even) {
  background: #FAFAFA !important;
}

table.nomad_table tr th {
  padding: .8em 2em !important;
  background: #505050 !important;
  color: #fff !important;
  width: 100% !important;
  position: relative !important;
}

table.nomad_table tr th:nth-child(even):after {
  content: "";
  display: block !important;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, .05);
  position: absolute;
}

table.nomad_table tr:nth-child(even) td:nth-child(even):after {
  content: "";
  display: block !important;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, .03);
  position: absolute;
}

table.nomad_table::-webkit-scrollbar {
  width: 10px !important;
  height: 10px !important;
}

table.nomad_table::-webkit-scrollbar-track {
  background: #FAFAFA !important;
}

table.nomad_table::-webkit-scrollbar-thumb {
  border-radius: 5px !important;
  background: #505050 !important;
}

table.nomad_table .table_img {
  display: block;
  max-width: 60px;
  margin: 0 auto 15px auto;
}

@media(max-width:480px) {

  table.nomad_table tr td,
  table.nomad_table tr th {
    padding: 1em !important;
    font-size: 12px !important;
  }

table.nomad_table tr th {
    padding: .8em 2em !important;
    font-size: 13px !important;
  }

table.nomad_table .table_img {
    max-width: 45px;
    margin: 0 auto 10px auto;
  }

table.nomad_table a {
    font-size: 10px !important;
  }

}

/*-------------------------------------------*/
/* サイトをインデックスしない制御 */
/*-------------------------------------------*/
// メタボックスの追加
add_action( 'admin_menu', 'add_noindex_metabox' );
function add_noindex_metabox() {
	add_meta_box( 'custom_noindex', 'インデックス設定', 'create_noindex', array('post', 'page'), 'side' );
}

// 管理画面にフィールドを出力
function create_noindex() {
	$keyname = 'noindex';
	global $post;
	$get_value = get_post_meta( $post->ID, $keyname, true );
	wp_nonce_field( 'action_' . $keyname, 'nonce_' . $keyname );
	$value = 'noindex';
	$checked = '';
	if( $value === $get_value ) $checked = ' checked';
	echo '<label><input type="checkbox" name="' . $keyname . '" value="' . $value . '"' . $checked . '>' . $keyname . '</label>';}

// カスタムフィールドの保存
add_action( 'save_post', 'save_custom_noindex' );
function save_custom_noindex( $post_id ) {
	$keyname = 'noindex';
	if ( isset( $_POST['nonce_' . $keyname] )) {
		if( check_admin_referer( 'action_' . $keyname, 'nonce_' . $keyname ) ) {
			if( isset( $_POST[$keyname] )) {
				update_post_meta( $post_id, $keyname, $_POST[$keyname] );
			} else {
				delete_post_meta( $post_id, $keyname, get_post_meta( $post_id, $keyname, true ) );
			}
		}
	}
}

// <head>タグ内に出力
function my_custom_meta_robots( array $robots ) {
	if ( is_singular() && get_post_meta( get_the_ID(), 'noindex', true ) ) {
		$robots['noindex'] = true; // noindexを有効化
		$robots['nofollow'] = true; // nofollowを有効化
		$robots['max-image-preview'] = false;//デフォルトのrobotsを無効化
	}
	return $robots;
}
add_filter( 'wp_robots', 'my_custom_meta_robots' );