@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){
  /*必要ならばここにコードを書く*/
}
/* SNSシェアボタン */
.button-caption {
 display: none; /* キャプション非表示 */
}

.sns-share-buttons a {
 border-radius: 50%; /* 丸くする */
 margin: 10px; /* ボタンの回りに余白をつける */
}

#main .sns-share a {
 width: 40px; /* ボタンの幅 */
 height: 40px; /* ボタンの高さ */
}

.sns-share-buttons {
 justify-content: center; /* 中央寄せ */
}





<!-- クリティカルCSSをインライン化 -->
<style>
  /* ページ上部で必要な最低限のCSS */
</style>

<!-- 非クリティカルCSSを遅延読み込み -->
<link rel="preload" href="/styles/main.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="/styles/main.css"></noscript>


<script src="/scripts/main.js" defer></script>

<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">


<link rel="preload" as="image" href="/images/hero.jpg">

<link rel="preload" href="styles/non-critical.css" as="style" onload="this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="styles/non-critical.css"></noscript>

// functions.php
function remove_unused_styles() {
  wp_dequeue_style('wp-block-library'); // Gutenberg CSS
  wp_dequeue_style('classic-theme-styles'); // WordPress標準スタイル
  wp_dequeue_style('contact-form-7'); // Contact Form 7 のCSS（必要ページのみ読み込みに変更）
}
add_action('wp_enqueue_scripts', 'remove_unused_styles', 100);



<link rel="preload" href="/styles/main.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="/styles/main.css"></noscript>



function cocoon_remove_unused_styles() {
  // ブロックエディタCSS（フロント不要）
  wp_dequeue_style('wp-block-library');
  // クラシックテーマスタイル
  wp_dequeue_style('classic-theme-styles');
  // Contact Form 7 を全ページで読み込まない
  if (!is_page('contact')) {
    wp_dequeue_style('contact-form-7');
  }
}
add_action('wp_enqueue_scripts', 'cocoon_remove_unused_styles', 100);


<link rel="preload" as="image" href="https://example.com/wp-content/uploads/hero.jpg">





