/* リセット & ベーススタイル */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* CSSカスタムプロパティ */
:root {
  --color-primary: #36393d;
  --color-secondary: #919191;
  --color-tertiary: #ccc;
}

html {
  font-family: YakuHanJP, "Noto Sans", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  line-height: 1.15;
  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: #f5f5f5;
  color: var(--color-primary);
  line-height: 1.6;
  font-size: 1rem;
  word-wrap: break-word;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  overflow-x: hidden;
  width: 100%;
}

html.menu-open,
body.menu-open {
  overflow: hidden;
}

a {
  color: #5289db;
  text-decoration: none;
  background-color: transparent;
}

a:hover {
  color: #3072d4;
  text-decoration: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 400;
}

h1 a,
h1 a:hover,
h2 a,
h2 a:hover,
h3 a,
h3 a:hover,
h4 a,
h4 a:hover,
h5 a,
h5 a:hover,
h6 a,
h6 a:hover {
  color: var(--color-primary);
  text-decoration: none;
}

img {
  border-style: none;
  max-width: 100%;
  display: block;
}


a img {
  display: block;
}

/* プロフィールフロートボタン */
.profile-float {
  position: fixed;
  bottom: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  right: 20px;
  right: calc(20px + env(safe-area-inset-right));
  z-index: 1000;
  opacity: 0.8;
  transition: opacity 0.3s ease, transform 0.3s ease;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-float:hover {
  opacity: 1;
  transform: translateY(-2px);
}

.profile-float img {
  width: 45px;
  height: 45px;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.profile-float:hover img {
  transform: scale(1.1);
}

@media (max-width: 768px) {
  .profile-float {
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
  }

  .profile-float img {
    width: 45px;
    height: 45px;
  }

  .processing-wrap {
    padding-bottom: 100%;
    padding-top: 0;
    margin-bottom: 20px;
  }

  .processing-wrap:last-child {
    margin-bottom: 0;
  }
}

/* サイトコンテンツ */
.site-content {
  flex: 1 0 auto;
  padding-top: 220px;
}

/* フッター */
.site-footer {
  padding: 2em 0;
  margin-top: 5em;
  text-align: center;
}

.site-footer .l-container {
  text-align: center;
}

.site-footer .copyright {
  text-align: center;
  color: var(--color-primary);
  font-size: 0.9em;
  margin: 0;
  padding-bottom: 2em;
}

/* フッタープロフィールリンク */
.footer-profile-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.0em;
  transition: transform 0.3s ease;
}

.footer-profile-link:hover {
  transform: scale(1.1);
}

.footer-profile-link img {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

/* フロートボタン制御 */
.profile-float.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ロゴスタイル */
.header-title img {
  height: 3.0rem;
  width: auto;
  transform-origin: left top;
  will-change: transform;
  transition: transform 0.5s ease;
}

.header-title img:hover {
  transform: scale(1.05);
}


.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  margin: 0;
  padding: 5em 0;
  padding-top: calc(5em + env(safe-area-inset-top));
  padding-bottom: 5em;
  padding-left: 0;
  padding-right: 0;
}

/* JSで制御するため.scrolledクラスによるスタイル変更は削除 */

.header.hidden {
  opacity: 0;
  backdrop-filter: none;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.header.showing {
  opacity: 1;
  backdrop-filter: none;
  transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.header-wrapper {
  display: flex;
  align-items: left;
  flex-direction: column;
  margin: 0;
  padding: 0 20px;
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .header {
    padding: 5em 0;
  }
  
  .header-wrapper {
    flex-direction: row;
    padding: 0 2%;
  }
  
  .header-box-nav {
    width: 80%;
  }

  .header-box-title {
    width: 20%;
  }
}

.header-title {
  margin: 0;
  font-size: 1.5rem;
}

.header-title a {
  color: var(--color-primary);
  text-decoration: none;
  display: inline-block;
  width: auto;
  height: auto;
}

.header-title a:hover {
  color: var(--color-primary);
}

/* エントリーフッター */
.entry-footer {
  margin-top: 2em;
  padding-top: 0em;
}

/* プロジェクトメタ情報 */
.project-meta {
  margin-top: 0;
  margin-bottom: 2em;
  display: flex;
  align-items: center;
  gap: 1em;
}

.project-date {
  font-size: 0.9rem;

  color: var(--color-primary);
}


.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
}

.project-tag {
  color: var(--color-secondary);
  padding: 0.3em 0em 0.3em 0.8em;
  font-size: 0.9rem;
  font-weight: 400;
  text-decoration: none;
  transition: color 0.2s ease;
}

.project-tag:hover {
  color: var(--color-primary);
  text-decoration: none;
}

/* ナビゲーション */
.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 1.2rem;
  text-align: center;
}

.nav li {
  margin: 0.4em 0.8em;
  display: inline-block;
}

@media (min-width: 768px) {
  .nav ul {
    text-align: right;
  }
  .nav li {
    margin: 0 0 0.4em 1em;
  }
}

.nav li a {
  color: var(--color-secondary);
}

.nav li a:hover,
.nav li a.active {
  color: var(--color-primary);
  text-decoration: none;
}

/* ハンバーガーメニュー */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 20px 0 0;
  z-index: 1001;
  position: absolute;
  top: 0;
  right: 0;
}

.menu-toggle span {
  display: block;
  width: 25px;
  height: 3px;
  background-color: var(--color-primary);
  margin: 5px 0;
  transition: 0.3s;
}

@media (max-width: 767px) {
  .menu-toggle {
    display: block;
  }

  .header-wrapper {
    position: relative;
    margin: 0;
    padding: 0 20px;
    justify-content: flex-start;
  }

  .header-box-title {
    width: auto;
    position: relative;
    z-index: 1001;
  }

  .header-box-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #fff;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    box-sizing: border-box;
  }

  .header-box-nav.active {
    opacity: 1;
    visibility: visible;
  }

  .nav ul {
    text-align: right;
    padding: 0 20px;
    margin: 0;
    list-style: none;
  }

  .nav li {
    display: block;
    margin: 0;
    padding: 0;
  }

  .nav li a {
    display: block;
    padding: 12px 0;
    font-size: 1.2rem;
    font-weight: 500;
  }

  .menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
  }

  .menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
  }


  .l-container.full-image {
    margin: 0 auto 20px auto;
    padding: 0 20px 0 20px;
  }

  .l-container.full-image img,
  .l-container.full-image iframe {
    margin: 0 auto 20px auto;
  }

  .l-container.full-image img:last-child,
  .l-container.full-image iframe:last-child {
    margin-bottom: 0;
  }

  .video-wrap {
    padding-bottom: 56.25%;
    padding-top: 0;
    margin-bottom: 20px;
  }

  .video-wrap:last-child {
    margin-bottom: 0;
  }

  .entry-header {
    margin-top: 1em;
    margin-bottom: 2.0em;
  }

  .entry-content {
    margin-top: 20px;
  }

  #project-media {
    margin-top: 20px;
  }

  .image2column-wrap {
    grid-template-columns: 1fr;
    gap: 0;
    margin-bottom: 20px;
  }

  .sketchfab-wrap {
    padding-bottom: 100%;
    padding-top: 0;
    margin-bottom: 20px;
  }

  .sketchfab-wrap iframe {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
  }

  .html-wrap {
    padding-bottom: 100%;
    padding-top: 0;
    margin-bottom: 20px;
  }

  .html-wrap:last-child {
    margin-bottom: 0;
  }


  .l-container.full-image .video-wrap {
    margin-bottom: 20px;
  }

  #project-media img {
    margin-bottom: 20px;
  }

  #project-media a img {
    margin-bottom: 20px;
  }

  #project-media-full a {
    margin-bottom: 20px;
  }

  #project-media-full a:last-child {
    margin-bottom: 0;
  }

  .image2column-wrap {
    grid-template-columns: 1fr;
    gap: 0;
    margin-bottom: 20px;
  }

  .image2column-wrap:last-child {
    margin-bottom: 0;
  }
}


/* トップ投稿コンテナ */
.top-post-container {
  max-width: 100%;
  padding: 0;
}

/* インデックス投稿ラッパー */
.index-post-wrapper {
  display: grid;
  gap: 20px;
  padding: 0 20px;
  box-sizing: border-box;
  grid-template-columns: 1fr;
  width: 100%;
  max-width: 100%;
}

@media (min-width: 768px) {
  .index-post-wrapper {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0 10px;
  }
}

@media (min-width: 1024px) {
  .index-post-wrapper {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
}

@media (min-width: 1440px) {
  .index-post-wrapper {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }
}

/* 投稿アイテム */
.index-post {
  overflow: hidden;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

.post-inner {
  overflow: hidden;
}

.post-content-anchor {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: #fff;
  padding: 0;
}

.post-photo-thumb {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.post-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-content-anchor:hover .post-photo-thumb img {
  opacity: 0.75;
}

/* タイトルとタグは非表示 */
.post-title,
.post-tags {
  display: none;
}

/* アクセシビリティ用 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* コンテナスタイル */
.l-container,
.l-container-mini {
  width: 100%;
  max-width: 1320px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
  box-sizing: border-box;
}

/* ノートパソコン向け：ウィンドウの高さを考慮した最大幅 */
@media (min-height: 600px) and (max-height: 900px) {

  .l-container,
  .l-container-mini {
    max-width: min(1320px, calc(100vh * 1.2));
  }
}

@media (min-width: 768px) {

  .l-container,
  .l-container-mini {
    width: calc(100% - 40px);
  }
}

@media (min-width: 1320px) {

  .l-container,
  .l-container-mini {
    width: min(1320px, calc(100vh * 1.2));
  }
}

/* l-container固有のスタイル */
@media (min-width: 1320px) {
  .l-container {
    padding-left: 20px;
    padding-right: 20px;
  }
}

/* works.html用のスタイル */
.permalink-post {
  margin: 0;
}

/* フルサイズ画像コンテナ */
.l-container.full-image {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
  box-sizing: border-box;
}

/* ノートパソコン向け：ウィンドウの高さを考慮した最大幅 */
@media (min-height: 600px) and (max-height: 900px) {
  .l-container.full-image {
    max-width: min(1320px, calc(100vh * 1.2));
  }
}

.l-container.full-image img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  padding: 0;
}

.l-container.full-image img:last-child {
  margin-bottom: 0;
}

.l-container.full-image iframe {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  display: block;
}

.l-container.full-image iframe:last-child {
  margin-bottom: 0;
}

.l-container.full-image .video-wrap {
  margin-bottom: 10px;
  max-width: 100%;
}

.l-container.full-image .video-wrap:last-child {
  margin-bottom: 0;
}

@media (min-width: 768px) {
  .l-container.full-image {
    width: calc(100% - 40px);
    max-width: min(1320px, calc(100vh * 1.2));
    padding-left: 20px;
    padding-right: 20px;
    margin: 0 auto;
  }

  .l-container.full-image img,
  .l-container.full-image iframe,
  .l-container.full-image .video-wrap {
    max-width: 100%;
  }
}

@media (min-width: 1320px) {
  .l-container.full-image {
    width: min(1320px, calc(100vh * 1.2));
  }
}

/* エントリーヘッダー */
.entry-header {
  margin-bottom: 20px;
  margin-top: 20px;
}

.entry-title {
  font-size: 1.5rem;
}

@media (min-width: 768px) {
  .entry-title {
    font-size: 2rem;
  }
}

.entry-title a {
  color: var(--color-primary);
  text-decoration: none;
}

.entry-title a:hover {
  color: var(--color-primary);
}

/* エントリーコンテンツ */
.entry-content {
  line-height: 1.6;
  word-wrap: break-word;
  margin-top: 20px;
}

.entry-content>*:first-child {
  margin-top: 0;
}

@media (min-width: 768px) {
  .entry-content {
    font-size: 1.2rem;
  }
}

.entry-content p {
  margin: 2.0em 0;
  text-align: left;
  white-space: pre-wrap;
}

.entry-content p:first-child {
  margin-top: 0;
}

.entry-content p:last-child {
  margin-bottom: 0;
}

.entry-content img,
.entry-content video {
  width: 100%;
  height: auto;
}

.entry-content iframe {
  max-width: 100%;
}

.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
  margin: 1em 0 1em;
  line-height: 1.3;
}

.entry-content h1 {
  font-size: 1.5rem;
}

@media (min-width: 992px) {
  .entry-content h1 {
    font-size: 1.7rem;
  }
}

.entry-content h2 {
  font-size: 1.4rem;
}

@media (min-width: 992px) {
  .entry-content h2 {
    font-size: 1.6rem;
  }
}



/* アスペクト比ラッパー共通 */
.video-wrap,
.processing-wrap,
.html-wrap,
.sketchfab-wrap {
  position: relative;
  overflow: hidden;
  width: 100%;
  margin-bottom: 20px;
}

/* ビデオラッパー */
.video-wrap {
  padding-bottom: 56.25%;
  padding-top: 0;
  height: 0;
  background: #f5f5f5;
  border: none;
}

.video-wrap:last-child,
.processing-wrap:last-child,
.sketchfab-wrap:last-child,
.html-wrap:last-child,
.image2column-wrap:last-child {
  margin-bottom: 0;
}

@media (min-width: 768px) {
  .video-wrap {
    max-width: 1320px;
  }
}

.video-wrap embed,
.video-wrap iframe,
.video-wrap object,
.processing-wrap embed,
.processing-wrap iframe,
.processing-wrap object,
.html-wrap embed,
.html-wrap iframe,
.html-wrap object,
.sketchfab-wrap embed,
.sketchfab-wrap iframe,
.sketchfab-wrap object {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Processingラッパー */
.processing-wrap iframe {
  border: none;
}

@media (min-width: 769px) {
  .processing-wrap {
    padding-bottom: 75%;
    /* 4:3 アスペクト比 */
  }

  .html-wrap {
    padding-bottom: 75%;
    /* 4:3 アスペクト比 */
    padding-top: 0;
    height: 0;
    max-width: 1320px;
  }

  .sketchfab-wrap {
    padding-bottom: 75%;
    /* 4:3 アスペクト比 */
    padding-top: 0;
    height: 0;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    margin-bottom: 20px;
  }
}

/* 2カラム画像ラッパー */
.image2column-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
  width: 100%;
}

.image2column-wrap img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  margin-bottom: 0;
}

/* 画像リンク用スタイル */
.image2column-wrap a,
#project-media-full a {
  display: block;
  text-decoration: none;
  border: none;
  width: 100%;
  margin-bottom: 20px;
}

.image2column-wrap a:last-child,
#project-media-full a:last-child {
  margin-bottom: 0;
}

.image2column-wrap a img,
#project-media-full a img {
  width: 100%;
  height: auto;
  margin-bottom: 0;
}

#project-media .image2column-wrap img,
#project-media .image2column-wrap a img {
  margin-bottom: 0;
}

/* image2column の直後に別コンテンツがある場合のみ余白を付与 */
.page-permalink #project-media .image2column-wrap+* {
  margin-top: 20px;
}

@media (max-width: 767px) {
  .page-permalink #project-media .image2column-wrap+* {
    margin-top: 20px;
  }
}

/* セクション */
.section {
  margin-top: 0;
  margin-bottom: 4em;
}

/* 後方互換性のため、古いIDもサポート */
#project-media {
  width: 100%;
  padding: 0;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  #project-media {
    padding: 0;
  }
}

#project-media img,
#project-media a img {
  margin-bottom: 20px;
}

#project-media img:last-child {
  margin-bottom: 0;
}

#project-media a:last-child img {
  margin-bottom: 0;
}

#project-media iframe {
  width: 100%;
  max-width: 100%;
  margin-bottom: 20px;
  border: none;
}

#project-media iframe:last-child {
  margin-bottom: 0;
}

#project-media p {
  margin-bottom: 20px;
  line-height: 1.6;
}

#project-media p:last-child {
  margin-bottom: 0;
}

@media (min-width: 768px) {

  #project-media img,
  #project-media a img,
  #project-media iframe,
  #project-media p {
    margin-bottom: 20px;
  }
}

#project-media p a {
  color: inherit;
  text-decoration: underline;
  transition: opacity 0.2s;
}

#project-media p a:hover {
  opacity: 0.7;
}


/* 段階的読み込みインジケーター */
.loading-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  width: 100%;
}

.loading-dots {
  display: flex;
  gap: 8px;
}

.loading-dots span {
  width: 10px;
  height: 10px;
  background-color: var(--color-primary);
  border-radius: 50%;
  opacity: 0.4;
  animation: loadingDot 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0s;
}

@keyframes loadingDot {

  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.4;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Flickr写真のPC表示向け調整 */
@media (min-width: 768px) {

  /* Flickr写真（staticflickr.com）を含む画像の高さを制限 */
  .l-container.full-image img[src*="staticflickr.com"],
  .l-container.full-image a img[src*="staticflickr.com"],
  #project-media img[src*="staticflickr.com"],
  #project-media a img[src*="staticflickr.com"] {
    max-height: 80vh;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    margin-left: auto;
    margin-right: auto;
  }
}

/* スクロールセンチネル */
#scroll-sentinel {
  width: 100%;
  visibility: hidden;
}

/* Lazy Loading Optimization CSS - Integrated from lazy-loading.css */

/* Hidden elements for performance optimization - higher specificity */
.index-post-wrapper .index-post[data-hidden="true"] {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  left: -9999px !important;
  top: -9999px !important;
  /* content-visibility for additional optimization */
  content-visibility: hidden;
}

/* Debug: make sure hidden elements are really hidden */
.index-post-wrapper .index-post[data-hidden="true"] * {
  display: none !important;
}

/* Loading indicator */
.loading-indicator {
  text-align: center;
  padding: 2em 0;
}

.loading-dots {
  display: inline-flex;
  gap: 0.5em;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-primary, #333);
  animation: loading-bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes loading-bounce {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Enhanced scroll sentinel */
#scroll-sentinel {
  height: 1px;
  width: 100%;
  pointer-events: none;
}