/* --- amekusa Portfolio Style (Merged) --- */

html {
      scroll-behavior: smooth;
    }

    :root {
      --bg-color: #f5f0e8;
      --text-color: #1c1a17;
      --accent-green: #3a5a2e;
      --accent-hover: #4e753f;
      --card-bg: rgba(255, 255, 255, 0.55);
      --font-serif: 'Noto Serif JP', "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "MS PMincho", "Noto Serif CJK JP", serif;
      --font-sans: 'Noto Sans JP', "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", "Noto Sans CJK JP", sans-serif;
      --washi-line: rgba(58, 90, 46, 0.05);
    }

    @media (prefers-color-scheme: dark) {
      :root {
        --bg-color: #18160f;
        --text-color: #e8e2d8;
        --card-bg: rgba(38, 34, 26, 0.65);
        --washi-line: rgba(160, 180, 140, 0.04);
      }
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    body {
      background-color: var(--bg-color);
      color: var(--text-color);
      font-family: var(--font-sans);
      line-height: 1.9;
      background-image:
        repeating-linear-gradient(0deg, transparent, transparent 39px, var(--washi-line) 39px, var(--washi-line) 40px),
        repeating-linear-gradient(90deg, transparent, transparent 39px, var(--washi-line) 39px, var(--washi-line) 40px);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      /* .containerをmax-width内で中央配置、stickyも正常動作 */
      align-items: stretch;
      padding: 3rem 1.5rem;
    }

    .container {
      max-width: 750px;
      width: 100%;
      margin: 0 auto;
      background: var(--card-bg);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border-radius: 12px;
      padding: 3.5rem 3rem;
      box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.06);
      border: 1px solid rgba(255, 255, 255, 0.1);
      position: relative;
      animation: fadeIn 0.8s ease-out;
    }

    /* モバイル: サイドバーを通常フロー（縦並び）で表示 */
    .sidebar {
      margin-bottom: 2.5rem;
    }

    @media (max-width: 600px) {
      body {
        padding: 1.5rem 1rem;
      }

      .container {
        padding: 2rem 1.5rem;
      }
    }

    @keyframes fadeIn {
      from {
        opacity: 0;
        transform: translateY(15px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    header {
      text-align: center;
      margin-bottom: 3.5rem;
    }

    .hero-gif {
      width: 70px;
      margin-bottom: 1.5rem;
      mask-image: radial-gradient(circle, black 40%, rgba(0, 0, 0, 0) 100%);
      -webkit-mask-image: radial-gradient(circle, black 40%, rgba(0, 0, 0, 0) 100%);
    }

    h1 {
      font-family: var(--font-serif);
      font-size: 2.2rem;
      letter-spacing: 0.25em;
      font-weight: 300;
      margin-bottom: 0.5rem;
    }

    .subtitle {
      font-size: 0.95rem;
      letter-spacing: 0.15em;
      color: var(--accent-green);
      opacity: 0.8;
    }

    .tagline {
      margin-top: 0.6rem;
      font-family: var(--font-serif);
      font-size: 0.85rem;
      line-height: 1.6;
      letter-spacing: 0.06em;
      color: var(--text-color);
      opacity: 0.85;
    }

/* ==============================
   トップページ導入文（.intro-text）
   header 内、subtitle の下に配置
   ============================== */
.intro-text {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  font-family: var(--font-serif);
  font-size: 0.92rem;
  line-height: 2;
  letter-spacing: 0.02em;
  color: #4a4640; /* 墨に近い、少し柔らかいグレーブラウン */
  text-align: left;
}
 
/* サイドバーが狭い画面では行間・余白を少し詰める */
@media (max-width: 768px) {
  .intro-text {
    font-size: 0.88rem;
    line-height: 1.85;
    margin-top: 1rem;
    padding-top: 0.85rem;
  }
}

    /* セクションタイトル表示 */
    .essay-list-section h2,
    #photography h2,
    #profile h2,
    #links h2,
    #youtube h2,
    #bbs h2,
    #github h2 {
      font-family: var(--font-serif);
      font-size: 1.4rem;
      font-weight: 400;
      margin-bottom: 2rem;
      padding-bottom: 0.5rem;
      border-bottom: 1px solid rgba(58, 90, 46, 0.15);
      letter-spacing: 0.1em;
    }

    .section-caption {
      font-size: 0.9rem;
      opacity: 0.8;
      margin-top: -1rem;
      margin-bottom: 1.5rem;
      line-height: 1.7;
    }

    .profile-summary {
      font-size: 0.92rem;
      line-height: 1.85;
      margin-bottom: 1.5rem;
    }

    .profile-summary > p {
      margin-bottom: 0.9rem;
    }

    .profile-dl {
      display: grid;
      gap: 0.5rem;
      padding: 0.9rem 1.1rem;
      background: rgba(58, 90, 46, 0.04);
      border-left: 2px solid var(--accent-green);
      border-radius: 0 6px 6px 0;
    }

    .profile-dl div {
      display: flex;
      flex-wrap: wrap;
      gap: 0.4rem 0.8rem;
      font-size: 0.88rem;
    }

    .profile-dl dt {
      font-family: var(--font-serif);
      font-weight: 600;
      color: var(--accent-green);
      min-width: 5.5em;
    }

    .profile-dl dd {
      flex: 1;
      min-width: 200px;
      opacity: 0.9;
    }

    .essay-list {
      list-style: none;
    }

    /* カテゴリグループ */
    .essay-category-group {
      margin-bottom: 3rem;
    }

    .essay-category-label {
      font-size: 0.75rem;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      opacity: 0.45;
      font-weight: 400;
      margin-bottom: 1rem;
      padding-bottom: 0.4rem;
      border-bottom: 1px solid rgba(58, 90, 46, 0.12);
    }

    .essay-item {
      margin-bottom: 1.6rem;
      position: relative;
      transition: transform 0.2s;
    }

    .essay-item:hover {
      transform: translateX(4px);
    }

    .essay-date {
      font-size: 0.85rem;
      opacity: 0.6;
      margin-bottom: 0.2rem;
      display: block;
      letter-spacing: 0.05em;
    }

    .essay-title {
      font-family: var(--font-serif);
      font-size: 1.25rem;
      font-weight: 400;
      color: var(--text-color);
      text-decoration: none;
      transition: color 0.2s;
      line-height: 1.5;
    }

    .essay-title:hover {
      color: var(--accent-green);
    }

    .essay-summary {
      font-size: 0.86rem;
      line-height: 1.65;
      opacity: 0.72;
      margin-top: 0.25rem;
    }

    /* エッセイ詳細表示 */
    .essay-detail-section {
      animation: fadeIn 0.5s ease-out;
    }

    .back-btn {
      display: inline-flex;
      align-items: center;
      text-decoration: none;
      color: var(--accent-green);
      font-size: 0.9rem;
      margin-bottom: 2.5rem;
      transition: color 0.2s, transform 0.2s;
    }

    .back-btn:hover {
      color: var(--accent-hover);
      transform: translateX(-4px);
    }

    /* Markdownレンダリング用スタイル */
    .essay-content {
      font-size: 1.05rem;
      line-height: 2.1;
      font-weight: 300;
    }

    .essay-content h1 {
      font-family: var(--font-serif);
      font-size: 1.9rem;
      font-weight: 400;
      margin-bottom: 0.8rem;
      text-align: left;
      line-height: 1.4;
      letter-spacing: 0.05em;
    }

    /* テンプレートの "YYYY.MM.DD ・ プロジェクト名" 記述用 */
    .essay-content h1+p {
      font-size: 0.9rem;
      opacity: 0.65;
      margin-bottom: 3.5rem;
      letter-spacing: 0.05em;
    }

    .essay-content h2 {
      font-family: var(--font-serif);
      font-size: 1.35rem;
      font-weight: 400;
      margin-top: 3.5rem;
      margin-bottom: 1.2rem;
      color: var(--accent-green);
      border-left: 2px solid var(--accent-green);
      padding-left: 0.8rem;
      letter-spacing: 0.05em;
    }

    .essay-content p {
      margin-bottom: 1.8rem;
      text-align: justify;
    }

    .essay-content hr {
      border: none;
      border-top: 1px solid rgba(58, 90, 46, 0.15);
      margin: 3.5rem 0 2rem 0;
    }

    /* ソースコードのリンク（脚注的扱い） */
    .essay-content hr+p {
      font-size: 0.85rem;
      opacity: 0.7;
    }

    .essay-content a {
      color: var(--accent-green);
      text-decoration: underline;
      text-underline-offset: 4px;
      transition: color 0.2s;
    }

    .essay-content a:hover {
      color: var(--accent-hover);
    }

    /* ローディング表示 */
    .loading {
      text-align: center;
      padding: 3rem 0;
      font-size: 1rem;
      opacity: 0.7;
      letter-spacing: 0.1em;
    }

    #rain-canvas {
      position: fixed;
      top: 0;
      left: 0;
      z-index: -1;
      pointer-events: none;
    }

    footer {
      margin-top: 4rem;
      text-align: center;
      font-size: 0.8rem;
    }

    footer p {
      opacity: 0.5;
    }

    footer .footer-sub-links {
      opacity: 0.7;
      margin-bottom: 0.5rem;
    }

    footer .footer-sub-links a {
      color: var(--text-color);
      text-decoration: none;
      border-bottom: 1px dotted rgba(58, 90, 46, 0.35);
      transition: color 0.2s;
    }

    footer .footer-sub-links a:hover {
      color: var(--accent-green);
    }

    .visitor-counter {
      margin: 0.5rem 0 1.5rem;
      font-family: var(--font-sans);
      font-size: 0.8rem;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.5rem;
      padding: 0.35rem 0.85rem;
      background: var(--card-bg);
      border: 1px solid rgba(58, 90, 46, 0.12);
      border-radius: 6px;
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
      transition: border-color 0.3s ease, box-shadow 0.3s ease;
    }

    .visitor-counter:hover {
      border-color: rgba(58, 90, 46, 0.3);
      box-shadow: 0 4px 12px rgba(58, 90, 46, 0.06);
    }

    @media (prefers-color-scheme: dark) {
      .visitor-counter {
        border-color: rgba(160, 180, 140, 0.15);
      }

      .visitor-counter:hover {
        border-color: rgba(160, 180, 140, 0.3);
        box-shadow: 0 4px 12px rgba(160, 180, 140, 0.06);
      }
    }

    .visitor-counter .counter-label {
      color: var(--accent-green);
      font-weight: 500;
      letter-spacing: 0.05em;
      opacity: 0.85;
    }

    .visitor-counter .counter-value {
      font-weight: 600;
      color: var(--text-color);
      letter-spacing: 0.05em;
      font-variant-numeric: tabular-nums;
    }

    .archive-link {
      display: inline-block;
      margin-top: 1rem;
      color: var(--text-color);
      text-decoration: none;
      border-bottom: 1px dashed var(--text-color);
      font-size: 0.85rem;
      opacity: 0.7;
      transition: opacity 0.2s;
    }

    .archive-link:hover {
      opacity: 1;
    }

    .archive-link-wrap {
      margin-top: 2rem;
      text-align: right;
    }

    /* カテゴリバッジ */
    .essay-category-badge {
      display: inline-block;
      font-size: 0.7rem;
      padding: 0.1em 0.55em;
      border-radius: 3px;
      border: 1px solid rgba(58, 90, 46, 0.25);
      color: var(--accent-green);
      letter-spacing: 0.06em;
      margin-left: 0.5em;
      vertical-align: middle;
      opacity: 0.85;
    }

    /* Photography, Profile, Links Section Styling */
    #photography,
    #profile,
    #links {
      margin-top: 4.5rem;
      animation: fadeIn 0.8s ease-out;
    }

    .photo-grid {
      display: grid;
      grid-template-columns: 2fr 1fr;
      grid-template-rows: 170px 170px;
      gap: 0.75rem;
      margin-bottom: 1.5rem;
    }

    .photo-item {
      background: #c8c0b0;
      border-radius: 4px;
      overflow: hidden;
      position: relative;
    }

    .photo-item:first-child {
      grid-row: 1 / 3;
    }

    .photo-item img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      transition: transform 0.6s ease, filter 0.6s ease;
      filter: saturate(0.85);
    }

    .photo-item:hover img {
      transform: scale(1.03);
      filter: saturate(1.05);
    }

    .section-description {
      font-size: 0.9rem;
      opacity: 0.8;
      text-align: right;
    }

    .section-description a {
      color: var(--accent-green);
      text-decoration: none;
      font-weight: 400;
      transition: color 0.2s;
    }

    .section-description a:hover {
      color: var(--accent-hover);
    }

    .profile-content {
      margin-bottom: 1.5rem;
      font-size: 0.95rem;
    }

    .profile-content strong {
      font-weight: 400;
      color: var(--accent-green);
    }

    .profile-content a {
      color: var(--text-color);
      text-decoration: underline;
      text-underline-offset: 4px;
      transition: color 0.2s;
    }

    .profile-content a:hover {
      color: var(--accent-green);
    }

    .linkedin-link {
      display: inline-block;
      background: transparent;
      color: var(--accent-green) !important;
      padding: 0.6rem 1.2rem;
      border-radius: 4px;
      border: 1px solid rgba(58, 90, 46, 0.25);
      text-decoration: none !important;
      font-size: 0.85rem;
      letter-spacing: 0.05em;
      transition: all 0.2s ease;
    }

    .linkedin-link:hover {
      background: var(--accent-green);
      color: #fff !important;
      border-color: var(--accent-green);
    }

    .links-list {
      list-style: none;
      padding: 0;
    }

    .links-list li {
      font-size: 0.95rem;
      padding: 0.8rem 0;
      border-bottom: 1px solid rgba(58, 90, 46, 0.08);
    }

    .links-list li:last-child {
      border-bottom: none;
    }

    .links-list li strong {
      font-weight: 400;
    }

    .links-list li a {
      color: var(--accent-green);
      text-decoration: none;
      font-size: 0.9rem;
      transition: color 0.2s;
      margin-left: 0.25em;
    }

    .links-list li a:hover {
      color: var(--accent-hover);
    }

    .links-list li p {
      margin: 0.2rem 0 0;
      font-size: 0.85rem;
      opacity: 0.7;
    }

    @media (max-width: 600px) {
      .photo-grid {
        grid-template-columns: 1fr;
        grid-template-rows: 200px 140px 140px;
      }

      .photo-item:first-child {
        grid-row: auto;
      }

      #photography,
      #profile,
      #links,
      #youtube,
      #bbs,
      #github {
        margin-top: 3rem;
      }
    }

    /* グローバルナビゲーション */
    .global-nav {
      display: flex;
      justify-content: center;
      gap: 3rem;
      margin-bottom: 3.5rem;
      padding-bottom: 1.2rem;
      border-bottom: 1px solid rgba(58, 90, 46, 0.08);
    }

    .nav-item {
      font-family: var(--font-serif);
      font-size: 1rem;
      font-weight: 400;
      color: var(--text-color);
      text-decoration: none;
      opacity: 0.6;
      transition: opacity 0.3s, color 0.3s;
      position: relative;
      letter-spacing: 0.1em;
    }

    .nav-item:hover,
    .nav-item.active {
      opacity: 1;
      color: var(--accent-green);
    }

    .nav-item::after {
      content: '';
      position: absolute;
      width: 0;
      height: 1px;
      bottom: -6px;
      left: 0;
      background-color: var(--accent-green);
      transition: width 0.3s ease;
    }

    .nav-item:hover::after,
    .nav-item.active::after {
      width: 100%;
    }

    @media (max-width: 600px) {
      .global-nav {
        gap: 1.5rem;
        margin-bottom: 2.5rem;
      }

      .nav-item {
        font-size: 0.9rem;
      }
    }

    /* PC表示時の2カラムレイアウト設定 */
    @media (min-width: 900px) {
      .container {
        max-width: 1000px;
        display: flex;
        gap: 4.5rem;
        padding: 4rem 3.5rem;
      }

      .sidebar {
        width: 240px;
        flex-shrink: 0;
        position: sticky;
        top: 3rem;
        height: fit-content;
        text-align: left;
        margin-bottom: 0;
      }

      .main-content {
        flex-grow: 1;
        min-width: 0;
      }

      header {
        text-align: left;
        margin-bottom: 3rem;
      }

      .hero-gif {
        margin-left: 0;
      }

      h1 {
        font-size: 2rem;
        letter-spacing: 0.2em;
        margin-bottom: 0.75rem;
      }

      .global-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
        border-bottom: none;
        padding-bottom: 0;
        margin-bottom: 0;
      }

      .nav-item {
        font-size: 1.05rem;
      }

      /* 右側コンテンツの調整 */
      #photography,
      #profile,
      #links,
      #youtube,
      #bbs,
      #github {
        margin-top: 4rem;
      }

      #notes {
        margin-top: 0;
      }
    }

/* Photo ページ（app-page）用: 19枚対応の均等グリッド */
.app-page .photo-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto;
}
.app-page .photo-item {
    aspect-ratio: 3/2;
    cursor: zoom-in;
}
.app-page .photo-item:first-child {
    grid-row: auto;
}

/* app-page (Linksなど) ではコンテナがPCでも横並び(flex)にならないよう縦配置に固定 */
.app-page .container {
    display: block;
    max-width: 750px;
}

/* Lightbox Modal */
.photo-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.photo-lightbox.active {
    display: flex;
}

.photo-lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    user-select: none;
}

.photo-lightbox-close,
.photo-lightbox-prev,
.photo-lightbox-next {
    position: absolute;
    background: rgba(30, 30, 30, 0.6);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
    transition: background-color 0.2s ease, transform 0.2s ease;
    z-index: 10001;
    user-select: none;
}

.photo-lightbox-close:hover,
.photo-lightbox-prev:hover,
.photo-lightbox-next:hover {
    background: rgba(60, 60, 60, 0.8);
    border-color: rgba(255, 255, 255, 0.4);
}

.photo-lightbox-close {
    top: 24px;
    right: 24px;
    font-size: 22px;
}

.photo-lightbox-prev {
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
}

.photo-lightbox-prev:hover {
    transform: translateY(-50%) scale(1.08);
}

.photo-lightbox-next {
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
}

.photo-lightbox-next:hover {
    transform: translateY(-50%) scale(1.08);
}

@media (max-width: 600px) {
    .photo-lightbox {
        padding: 10px;
    }
    .photo-lightbox-img {
        max-width: 95vw;
        max-height: 80vh;
    }
    .photo-lightbox-close {
        top: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    .photo-lightbox-prev,
    .photo-lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    .photo-lightbox-prev {
        left: 12px;
    }
    .photo-lightbox-next {
        right: 12px;
    }
}
