/*
Theme Name: Pismo
Theme URI:
Author: Grok (生成)
Author URI:
Description: 魚の図鑑をテーマにしたレスポンシブWordPressテーマ。
Version: 1.0
*/

/* =========================================
   リセット・基本設定
========================================= */
* {
    box-sizing: border-box;
}

#page-wrapper {
    min-height: 100vh;     /* ← 高さぴったりではなく最低限 */
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* 新しいブラウザは100dvhが優先される */
@supports (height: 100dvh) {
  #page-wrapper {
    min-height: 100dvh;
  }
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

body {
    font-family: "Hiragino Kaku Gothic ProN",
                 "Hiragino Kaku Gothic Pro",
                 "ヒラギノ角ゴ Pro W3",
                 "Hiragino Kaku Gothic W3",
                 sans-serif;
    overflow-x: hidden;   /* 横スクロール禁止だけ残す */
    overflow-y: auto;     /* ← 縦スクロールは許可 */
    border: none; 
    background: transparent; /* Safariでの背景重複を防止 */
    background-size: cover;
    overflow-x: hidden; 
}

/* =========================================
   固定背景
========================================= */

/* 背景のスタイル */
canvas,
.bubbles {
    position: fixed;   /* 絶対位置から固定位置に変更 */
    top: 0;
    left: 0;
    width: 100vw;      /* 100%から100vwに変更 */
    height: 100vh;     /* 100%から100vhに変更 */
    max-width: 100%;   /* 安全策 */
    max-height: 100%;
    overflow: hidden;  /* 内部のはみ出しを防止 */
}
@supports (height: 100dvh) {
  canvas,
  .bubbles {
    height: 100dvh;
  }
}

.bubble {
    position: absolute;
    bottom: -20px;
    left: 50%;                /* 左端基準ではなく中央基準 */
    transform: translateX(-50%); 
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    will-change: transform, opacity;
    -webkit-animation: floatUp linear forwards;
            animation: floatUp linear forwards;
}

@-webkit-keyframes floatUp {
    from { -webkit-transform: translateY(0) scale(1) translateZ(0);
           opacity: 1; }
    to   { -webkit-transform: translateY(-110vh) scale(0.7) translateZ(0);
           opacity: 0; }
}

@keyframes floatUp {
    from { transform: translateY(0) scale(1) translateZ(0);
           opacity: 1; }
    to   { transform: translateY(-110vh) scale(0.7) translateZ(0);
           opacity: 0; }
}

/* =========================================
   サムネイルアニメーション
========================================= */

@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-40px); }
    to { opacity: 1; transform: none; }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: none; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: none; }
}

@keyframes fadeInUp2 {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-40px); }
    to { opacity: 1; transform: none; }
}

/* =========================================
   ローディングオーバーレイ
========================================= */
#loading {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    pointer-events: none;
}

#loading .loading-bg {
    position: absolute;
    inset: 0;
    background: #00bfff;    
}

#loading #loading-logo {
    position: relative;
    max-width: 200px;
    opacity: 1;       /* 最初から100%表示 */
    transform: none;  /* 位置ずれなし */
    animation: fadeInUp2 0.4s;
    animation-fill-mode: forwards;
}

/* 表示時のアニメーション */
#loading.is-enter .loading-bg {
    transform: translateX(0);
}

#loading.is-enter #loading-logo {
    opacity: 1;           
    transform: none; 
}

#loading.is-leave #loading-logo {
    animation: slideOutLeft 0.6s ease forwards;
}

#loading.is-leave .loading-bg {
    animation: slideOutLeft 0.6s ease 0.2s forwards;
}

#loading .loading-bg {
    background: transparent; /* 透過にする */
}

/* ローディング用キーフレーム */
@keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes logoInLeft {
    from { opacity: 0; transform: translateX(-40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

@keyframes slideOutLeft {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(-100%); opacity: 0; }
}

/* =========================================
   ヘッダー（固定）
========================================= */
#site-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;    
    z-index: 2000;
    opacity: 1; /* 常に表示 */
	padding-top: 80px;
}

#site-header .custom-logo {
    max-width: 370px;
    height: auto;
    padding-top: 30px;
}

#catchphrase {
    margin-top: 6px;
    font-size: 20px;
    color: #fff;
    text-align: center;
}

.header-inner {
    text-align: center;
}

/* =========================================
   フッター（固定）
========================================= */
#site-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    height: auto;  
    padding: 20px 0;
    font-size: 14px;
    color: #fff;
    z-index: 2000;
    opacity: 1;
}

/* =========================================
   コンテンツ
========================================= */
#content {
    width: 90%;
    margin: 0 auto;
    padding-top: 30px;  
    padding-bottom: 30px;   
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
    flex-grow: 1; 
    padding-left: 45px;
}

#site-header,
#content,
#site-footer {
    flex-shrink: 0;    
}

/* =========================================
   サムネイルコンテナ
========================================= */
#thumbnails {
    display: grid;
    grid-template-columns: repeat(6, 1fr); /* 初期は5カラム */
    grid-auto-rows: 10px;                    /* 高さはアイテムに合わせる */
    gap: 1px;                             /* アイテム間の隙間 */
    width: 100%;
    grid-auto-flow: dense;    
}

.thumbnail-wrap {
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0;
    filter: brightness(100%);
    transform: scale(0.85) translateX(var(--rand-x, 0));
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.25, 1.3, 0.5, 1);
}
.thumbnail-wrap:hover{
	filter: brightness(120%);
}
.thumbnail-wrap.is-visible {
    opacity: 1;
    transform: translateY(0);
	transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.25, 1.3, 0.5, 1);
}

.thumbnail-wrap.item-large {
    grid-column: span 2;
    display: flex;
    align-items: center;
}

.thumbnail-wrap.align-left   { justify-content: left !important; }
.thumbnail-wrap.align-center { justify-content: center !important; }

.thumbnail-wrap img {
    display: block;
    height: auto;
    margin: 0 !important;                 
    object-fit: cover;
}

.thumbnail-wrap:hover {
    transform: translateY(-3px);
}

/* =========================================
   モーダル
========================================= */
#modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    align-items: center;
    justify-content: center;
    padding: 40px;
    z-index: 2500;   
    animation: fadeInUp2 0.4s;
    animation-fill-mode: forwards;
}

#modal-content {
    position: relative;
    width: min(1000px, 92%);
    max-height: 82vh;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    padding: 40px;
}

#modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 22px;
    line-height: 1;
    background: transparent;
    border: none;
    cursor: pointer;
}

#modal-left,
#modal-right {
    width: 50%;
    padding: 10px;
}

#modal-fish-img {
    width: 100%;
    height: auto;
}

#modal-fish-name {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px;
}

#modal-description {
    font-size: 14px;
    line-height: 1.7;
    color: #333;
    max-height: 20vh;
    overflow-y: auto;
    overflow-x: hidden;
    white-space: pre-line;
    word-break: break-word;
}

/* 関連商品表示 */
#modal-related {
    margin-top: 10px;
}

#modal-related-label {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

#modal-related-img {
    max-height: 15vh;
    height: auto;
    width: auto;
    display: block;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
}

/* =========================================
   スライドボタン（左右ページ切替）
========================================= */
#slide-prev,
#slide-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    padding: 10px 14px;
    cursor: pointer;
    border-radius: 50%;
    z-index: 10000;
    transition: background 0.3s ease;
}

#slide-prev:hover,
#slide-next:hover {
    background: rgba(0, 0, 0, 0.7);
}

#slide-prev:disabled,
#slide-next:disabled {
    opacity: 0.35;
    cursor: default;
}

#slide-prev { left: 10px; }
#slide-next { right: 10px; }

/* =========================================
   レスポンシブ
========================================= */

@media (max-width: 1119px) {
    #thumbnails {
        grid-template-columns: repeat(4, 1fr);
    }
    #content {
       padding-left: 55px;
    }


}

@media (max-width: 1024px) {
    #catchphrase {       
        font-size: 18px;     
    }
      


    #modal-content {
        max-height: 60vh;
        padding: 35px;
    }

    #modal-description {
        max-height: 23vh;
    }

    #modal-fish-name,
    #modal-related-label {
        font-size: 20px;
        text-align: left;
    }

    #modal-left {
        text-align: center;
    }

    #modal-left img {
        width: auto;
        max-width: 100%;
    }
}

@media (max-width: 768px) {

    #loading #loading-logo {        
        max-width: 160px ;
    }

    #site-header .custom-logo {
        width: 90%;        
    }

    #site-footer { 
        padding: 5px 0;     
    }

    #content {
       padding-left: 0px;
    }

    #modal-content {
        flex-direction: column;
        max-height: 90vh;
        padding: 15px;
        padding-top: 20px;
    }

    #modal-left,
    #modal-right {
        width: 100%;
    }

    #modal-description {
        max-height: 15vh;
    }

    #modal-fish-name,
    #modal-related-label {
        font-size: 18px;
    }

    #thumbnails {
        grid-template-columns: repeat(3, 1fr);
    }

    .thumbnail-wrap { 
        justify-content: center !important; }
}

@media (max-width: 560px) {
    #site-header .custom-logo {
        width: 70%;       
        padding-top: 20px; 
    }

    #catchphrase {
        font-size: 16px;
    }

    #modal-left img {
        width: 100%;
    }

    #content {             
        padding-top: 20px;
        padding-bottom: 0px;
    }
}

@font-face {
  font-family: 'SmartFont';
  src:url(./smartfont.otf);
  font-weight: normal;
  font-style: normal;
}
.menu{
	position: fixed;
	z-index: 2001;
	width: 95%;
	margin: 0 auto;
	left: 2.5%;
	top: 38px;
}
.menu-logo{
	position: absolute;
	margin-top: -20px;
}
.menu-list{
	width: 100%;
	justify-content: center;
    height: 50px;
    margin: 0 auto 60px;
    background-color: #1397e9;
    display: flex;
    align-items: center;
    border-radius: 30px;
}
.menu-list li{
	list-style: none;
}
.menu-list li a{
	color: #fff;
	font-size: 14px;
	display: inline-block;
	padding: 5px 15px;
	font-family: "SmartFont", san-serif !important;
	text-decoration: none;
}
.menu-list li a span{
	position: relative;
}
.menu-list li a span:after{
	content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--link);
    transition: width .3s 
cubic-bezier(.39, .575, .565, 1);
	background: #fff;
}
.menu-list li a:hover span:after{
	width: 100%;
}
.g-nav{
	display: none;
}
.menu-trigger{
	display: none;
}

@media (max-width: 768px) {
	.menu{
		width: 100%;
		left: 0;
		top: 48px;
	}
	.menu-list{
		border-radius: 0;
		height: 34px;
	}
	.pc-menu li{
		display: none;
	}
	.menu-logo{
		left: 50%;
		transform: translateX(-50%);
		margin-top: -30px;
	}
	#site-header{
		padding-top: 100px;
	}
	
	.menu-trigger {	
		position: absolute;
        display: inline-block;
        transition: all .4s;
        box-sizing: border-box;
        cursor: pointer;
        width: 34px;
        height: 34px;
        left: 10px;
        top: 0;
	}
	.menu-trigger span {
		display: inline-block;
		transition: all .4s;
		box-sizing: border-box;
		cursor: pointer;
		float: right;
		position: absolute;
		background: #fff;
		width: 24px;
		height: 2px;
		left: 0;
		right: 0;
		margin: auto;

	}
	.menu-trigger span:nth-of-type(1) {
		top: 8px;
	}
	.menu-trigger span:nth-of-type(2) {
		top: 0;
		bottom: 0;
	}
	.menu-trigger span:nth-of-type(3) {
		bottom: 8px;
	}
	.g-nav {
		display: block;
		position: fixed;
		top: 0;   
		right: 100%;
		background: #e9e5e1;
		width: 100%;
		height: 100%;
		z-index: 3000;
		transition: 0.5s all;
	}
	.g-nav.show{
		right: 0;
		transition: 0.5s all;
	}
	.g-nav .menu-trigger{
		right: 10px;
		top: 10px;
		left: auto;
	}
	.g-nav .menu-trigger span{
		background: #333;
	}
	.g-nav .list {
		padding: 100px 20px 0;
	}
	.g-nav .list li{
		list-style: none;
	}
	.g-nav .list li a {
		display: block;
		font-family: "SmartFont", san-serif !important;
		text-decoration: none;
		padding: 15px 0;
		color: #333;
	}
	.g-nav .menu-trigger span:nth-of-type(1) {
		-webkit-transform: translateY(8px) rotate(-45deg);
		transform: translateY(8px) rotate(-45deg);
	}

	.g-nav .menu-trigger span:nth-of-type(2) {
		opacity: 0;
	}
	.g-nav .menu-trigger span:nth-of-type(3) {
		-webkit-transform: translateY(-8px) rotate(45deg);
		transform: translateY(-8px) rotate(45deg);
	}
	.menu-trigger.active span:nth-of-type(1) {
		-webkit-transform: translateY(8px) rotate(-45deg);
		transform: translateY(8px) rotate(-45deg);
	}

	.menu-trigger.active span:nth-of-type(2) {
		opacity: 0;
	}
	.menu-trigger.active span:nth-of-type(3) {
		-webkit-transform: translateY(-8px) rotate(45deg);
		transform: translateY(-8px) rotate(45deg);
	}
}