/* =========================
   Reset / Base
========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* grid density */
  --grid-cols: 8;         /* 旧: メディアクエリ用に残す */
  --grid-columns: 8;      /* 新: gallery.js が上書きする */
  --grid-gap: 0px;        /* gallery.js が上書きする */

  --header-h: 60px;

  /* ===== News Grid Overlay Knobs =====
     Scope: /news (Grid)
     Goal : overlay layout tunable by knobs
  */

  /* hover zoom */
  --news-card-zoom: 1.06;

  /* overlay band */
  --news-grid-ov-bg: rgba(255,255,255,0.55);
  --news-grid-ov-blur: 2px;

  /* overlay padding */
  --news-grid-ov-pad-t: 14px;
  --news-grid-ov-pad-r: 12px;
  --news-grid-ov-pad-b: 26px;  /* keep date clear */
  --news-grid-ov-pad-l: 12px;

  /* overlay min height */
  --news-grid-ov-min-h: 64px;

  /* title typography */
  --news-grid-title-size: 13px;
  --news-grid-title-weight: 600;
  --news-grid-title-lh: 1.2;
  --news-grid-title-tracking: 0.01em;

  /* title spacing */
  --news-grid-title-mt: 0px;
  --news-grid-title-mb: 0px;
  --news-grid-title-pt: 0px;
  --news-grid-title-pb: 0px;

  /* date typography */
  --news-grid-date-size: 11px;
  --news-grid-date-lh: 1.1;
  --news-grid-date-opacity: 0.85;
  --news-grid-date-tracking: 0.0em;

  /* date placement */
  --news-grid-date-right: 4px;
  --news-grid-date-bottom: 4px;

  /* date chip */
  --news-grid-date-chip-bg: rgba(255,255,255,0.85);
  --news-grid-date-chip-pad-y: 2px;
  --news-grid-date-chip-pad-x: 4px;
  --news-grid-date-chip-radius: 999px;

  /* no-thumb fallback */
  --news-fallback-logo-scale: 0.58;

  /* News List thumb fit: cover / contain */
  --news-list-thumb-fit: cover;

  /* ===== /News Grid Overlay Knobs ===== */

  --text: #333;
  --bg: #fff;
  --border: #eee;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: var(--text);
}

ul {
  list-style: none;
}

/* ===== Header Layout & Controls ===== */
/* ===== Header Layout & Controls ===== */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 1000;

  display: flex;
  align-items: center;
  justify-content: space-between;

  /* =========================
     Header knobs（ここだけ触ればOK）
  ========================= */
  --header-padding-x: 24px;
  --header-bg-alpha: 0.95;
  --header-blur: 6px;

  /* 左：Contact */
  --header-left-font-size: 12px;
  --header-left-font-weight: 400;
  --header-left-color: var(--text);

  /* 右：View controls（間隔を個別に） */
  --header-gap-list-grid: 10px;   /* ★ List ↔ Grid */
  --header-gap-grid-menu: 26px;   /* ★ Grid ↔ Hamburger */

  --header-view-font-size: 13px;
  --header-view-font-weight: 400;
  --header-view-color: #666;

  --header-view-active-color: #000;
  --header-view-active-weight: 550;

  --header-view-padding-y: 5px;
  --header-view-padding-x: 10px;

  padding: 0 var(--header-padding-x);
  box-sizing: border-box;

  background: rgba(255, 255, 255, var(--header-bg-alpha));
  backdrop-filter: blur(var(--header-blur));
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);

  /* ★重要：クリックが下のカードに奪われるのを防ぐ */
  pointer-events: auto;
}

/* ★重要：header配下も必ずクリック可能にする（pointer-events事故の保険） */
header * {
  pointer-events: auto;
}
/* ===== /Header Layout & Controls ===== */

/* 左：Contact */
.contact-link {
  position: relative;
  z-index: 2;
  font-size: var(--header-left-font-size);
  font-weight: var(--header-left-font-weight);
  color: var(--header-left-color);
}
.contact-link a {
  display: block;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
  color: inherit;
}

/* 右：View controls（gapは使わず、個別marginで制御） */
.view-controls {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0; /* ★一括gapは使わない */
}

/* List / Grid */
.view-button,
.view-btn {
  font-size: var(--header-view-font-size);
  font-weight: var(--header-view-font-weight);
  color: var(--header-view-color);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--header-view-padding-y) var(--header-view-padding-x);
  line-height: 1;
}

.view-button.active,
.view-btn.active {
  color: var(--header-view-active-color);
  font-weight: var(--header-view-active-weight);
}

/* ★個別間隔ノブの“受け口” */
#list-view, #btn-news-list { margin-right: var(--header-gap-list-grid); }
#grid-view, #btn-news-grid { margin-right: var(--header-gap-grid-menu); }

/* ハンバーガー（既存の見た目は別ブロック .hamburger が担当） */
#menu-toggle.hamburger { margin: 0; }

/* 中央：Logo（左右の幅に影響されず常にheader中央） */
.logo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  pointer-events: none;
}
.logo-link { display: block; pointer-events: auto; }
.logo-img { display: block; height: 28px; width: auto; }
/* ===== /Header Layout & Controls ===== */

/* =========================
   Hamburger
========================= */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 20px;
  height: 16px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.hamburger span {
  width: 100%;
  height: 1.5px;
  background-color: var(--text);
  transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

/* =========================
   Side menu (Unified Knobs Control)
========================= */

/* --- サイドメニュー全体の基本設定 --- */
#side-menu {
  position: fixed;
  top: var(--header-h);
  right: 0;
  width: 300px;
  height: calc(100vh - var(--header-h));
  background: rgba(255, 255, 255, 0.93);
  z-index: 1100;

  /* ★ right で逃がさず transform で逃がす */
  transform: translateX(100%);
  transition: transform 0.3s ease;

  overflow-y: auto;
  box-shadow: 50px 10px 20px rgba(0, 0, 0, 0.1);

  /* ==============================================
     調整ノブ：ここを書き換えるだけで見た目をコントロールする
  ============================================== */

  --menu-section-gap: 30px;
  --menu-gap-after-news: 18px;
  --menu-gap-after-contact: 26px;

  --menu-padding: 20px;

  --menu-h2-size: 14px;
  --menu-h2-gap: 10px;

  --menu-h2-weight: 500;
  --menu-contact-h2-weight: var(--menu-h2-weight);
  --menu-works-h2-weight:   var(--menu-h2-weight);

  --menu-h3-size: 14px;
  --menu-h3-gap: 10px;
  --menu-h3-weight: 400;

  --top-link-font-size: 14px;
  --top-link-line-height: 1.2;
  --top-link-font-weight: 500;
  --top-link-padding-y: 4px;    /* Bio - News 行間 */
  --top-link-padding-x: 0px;
  --top-link-color: rgba(0, 0, 0, 0.78);
  --top-link-hover-color: #111;

  --works-item-padding-y: 0px;
  --works-item-padding-x: 0px;

  --works-parent-font-size: 14px;
  --works-parent-line-height: 1.5;
  --works-parent-font-weight: 400;
  --works-parent-color: var(--text);

  --works-parent-block-gap: 3px;
  --works-parent-last-gap: var(--works-parent-block-gap);
  --works-parent-to-child-gap: 3px;

  --works-parent-toggle-size: 15px;
  --works-parent-toggle-color: rgba(0,0,0,0.6);

  --works-parent-prefix: '・';
  --works-parent-prefix-gap: 6px;
  --works-parent-prefix-color: rgba(0,0,0,0.35);
  --works-parent-prefix-size: 12px;
  --works-parent-prefix-weight: 400;
  --works-parent-prefix-y: 0px;

  --works-child-font-size: 12px;
  --works-child-line-height: 1.0;
  --works-child-font-weight: 400;

  --works-child-indent: 30px;
  --works-child-item-gap: 4px;
  --works-child-end-gap: 12px;

  --sort-block-padding-y: 0px;
  --sort-block-padding-x: 0px;

  --sort-label-font-size: 12px;
  --sort-label-line-height: 1.2;
  --sort-label-letter-spacing: 0.02em;
  --sort-label-font-weight: 400;
  --sort-label-color: rgba(0,0,0,0.55);
  --sort-label-margin-bottom: 10px;

  --sort-item-font-size: 13px;
  --sort-item-line-height: 1.2;
  --sort-item-padding-y: 2px;
  --sort-item-padding-x: 0px;
  --sort-item-color: rgba(0,0,0,0.72);
  --sort-item-hover-color: #111;
  --sort-item-active-color: #111;
  --sort-item-active-weight: 700;

  --sort-item-gap-x: 14px;
  --sort-item-gap-y: 6px;

  --sort-arrow-font-size: 18px;
  --sort-arrow-padding-y: 0px;
  --sort-arrow-padding-x: 6px;
  --sort-arrow-color: rgba(0,0,0,0.65);
  --sort-arrow-hover-color: #111;
  --sort-arrow-active-color: #111;

  --sort-direction-gap-y: 10px;
}

#side-menu.active {
  transform: translateX(0);
}
#side-menu .menu-container { padding: var(--menu-padding); }

#side-menu .menu-container > .menu-section { margin-bottom: var(--menu-section-gap); }
#side-menu .menu-container > .menu-section:first-child { margin-bottom: var(--menu-gap-after-news); }

.menu-section h2 {
  font-size: var(--menu-h2-size);
  margin: 0 0 var(--menu-h2-gap) 0;
  font-weight: var(--menu-h2-weight);
  line-height: 1.2;
}

#side-menu .menu-container > .menu-section:nth-of-type(2) h2 {
  font-weight: var(--menu-contact-h2-weight);
}

#side-menu .menu-section.works-menu h2 {
  font-weight: var(--menu-works-h2-weight);
}

#side-menu .menu-container > .menu-section:first-child ul li a {
  display: block;
  font-size: var(--top-link-font-size);
  line-height: var(--top-link-line-height);
  font-weight: var(--top-link-font-weight);
  padding: var(--top-link-padding-y) var(--top-link-padding-x);
  color: var(--top-link-color);
  text-decoration: none;
}

#side-menu .menu-container > .menu-section:first-child ul li a:hover {
  color: var(--top-link-hover-color);
  opacity: 0.75;
}

#side-menu .menu-section.works-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
#side-menu .menu-section.works-menu li {
  list-style: none;
  padding: 0;
}
#side-menu .menu-section.works-menu li::marker {
  content: "";
}

#side-menu .menu-section.works-menu li.category-item {
  margin-bottom: var(--works-parent-block-gap);
}
#side-menu .menu-section.works-menu li.category-item:last-child {
  margin-bottom: var(--works-parent-last-gap);
}

#side-menu .menu-section.works-menu .category-title {
  font-size: var(--works-parent-font-size);
  line-height: var(--works-parent-line-height);
  color: var(--works-parent-color);

  padding: var(--works-item-padding-y) var(--works-item-padding-x);

  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0px;

  text-decoration: none;
}

#side-menu .menu-section.works-menu .category-title::before {
  content: var(--works-parent-prefix);
  display: inline-block;

  margin-right: var(--works-parent-prefix-gap);
  color: var(--works-parent-prefix-color);

  font-size: var(--works-parent-prefix-size);
  font-weight: var(--works-parent-prefix-weight);

  transform: translateY(var(--works-parent-prefix-y));
}

#side-menu .menu-section.works-menu .category-title::after {
  content: "+";
  font-size: var(--works-parent-toggle-size);
  color: var(--works-parent-toggle-color);
  margin-left: auto;
}

#side-menu .menu-section.works-menu .category-title.category-all::after {
  content: none;
}

#side-menu .menu-section.works-menu .subcategory-list {
  display: none;
  padding-left: var(--works-child-indent);
  margin-top: var(--works-parent-to-child-gap);
}
#side-menu .menu-section.works-menu .subcategory-list.visible {
  display: block;
}

#side-menu .menu-section.works-menu .subcategory-list li {
  margin-bottom: var(--works-child-item-gap);
}
#side-menu .menu-section.works-menu .subcategory-list li:last-child {
  margin-bottom: var(--works-child-end-gap);
}

#side-menu .menu-section.works-menu .subcategory-list a {
  font-size: var(--works-child-font-size);
  line-height: var(--works-child-line-height);
  color: var(--works-child-color);

  padding: var(--works-item-padding-y) var(--works-item-padding-x);

  text-decoration: none;
  display: inline-block;
}
#side-menu .menu-section.works-menu .subcategory-list a:hover {
  color: var(--works-child-hover-color);
}

#side-menu .menu-section.sort-options {
  padding: var(--sort-block-padding-y) var(--sort-block-padding-x);
}

#side-menu .menu-section.sort-options h3 {
  font-size: var(--sort-label-font-size);
  line-height: var(--sort-label-line-height);
  letter-spacing: var(--sort-label-letter-spacing);
  font-weight: var(--sort-label-font-weight);
  color: var(--sort-label-color);
  margin: 0 0 var(--sort-label-margin-bottom) 0;
}

#side-menu .sort-options ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sort-item-gap-y) var(--sort-item-gap-x);
  margin: 0;
  padding: 0;
  list-style: none;
}

#side-menu .sort-options ul li { margin: 0; }

#side-menu .sort-options ul li a {
  display: inline-block;
  font-size: var(--sort-item-font-size);
  line-height: var(--sort-item-line-height);
  padding: var(--sort-item-padding-y) var(--sort-item-padding-x);
  color: var(--sort-item-color);
  text-decoration: none;
}

#side-menu .sort-options ul li a:hover {
  color: var(--sort-item-hover-color);
  opacity: 0.8;
}

#side-menu .sort-options a.active {
  color: var(--sort-item-active-color);
  font-weight: var(--sort-item-active-weight);
}

#side-menu .sort-direction { margin-top: var(--sort-direction-gap-y); }

#side-menu .sort-direction a {
  font-size: var(--sort-arrow-font-size);
  padding: var(--sort-arrow-padding-y) var(--sort-arrow-padding-x);
  color: var(--sort-arrow-color);
  text-decoration: none;
  display: inline-block;
}

#side-menu .sort-direction a:hover {
  color: var(--sort-arrow-hover-color);
  opacity: 0.85;
}

#side-menu .sort-direction a.active { color: var(--sort-arrow-active-color); }

/* =========================
   Gallery container (Grid / List)
========================= */

#gallery-container {
  width: 100%;
  margin-top: var(--header-h, 60px);
  padding: 0;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
}

/* ===== Grid view ===== */
#gallery-container.grid-view {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns, 4), minmax(0, 1fr));
  gap: var(--grid-gap, 0px);
}

#gallery-container.grid-view .gallery-item {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #ffffff 0%, #f6f6f6 50%, #e8e8e8 100%);
}

#gallery-container.grid-view .gallery-item img.thumb-img {
  position: absolute;
  inset: 50px;
  width: calc(100% - 100px);
  height: calc(100% - 100px);
  object-fit: contain;
  object-position: center;

  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);

  transform: scale(1);
  transition: transform 0.22s ease;
}

#gallery-container.grid-view .gallery-item.is-featured::before {
  content: "💥";
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  font-size: 18px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
  pointer-events: none;
}

#gallery-container.grid-view .gallery-item.is-new::after {
  content: "NEW";
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.08em;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,0.72);
  color: #fff;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
  pointer-events: none;
}

#gallery-container.grid-view .gallery-item:hover img.thumb-img { transform: scale(1.03); }
#gallery-container.grid-view .item-info { display: none; }

/* ===== List view ===== */
#gallery-container.list-view {
  display: flex;
  flex-direction: column;
  gap: 0;
}

#gallery-container.list-view .gallery-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: auto;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

#gallery-container.list-view .gallery-item img.thumb-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex: 0 0 auto;
}

#gallery-container.list-view .item-info {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  padding: 0;
}

#gallery-container.list-view .item-info h3,
#gallery-container.list-view .item-info p {
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#gallery-container.list-view .item-info h3 {
  font-size: 14px;
  font-weight: 600;
}

#gallery-container.list-view .item-info p {
  font-size: 12px;
  opacity: 0.8;
}

/* =========================
   Detail overlay (existing)
========================= */

#detail-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;

  background-color: rgba(255, 255, 255, 0.98);
  z-index: 900;
  display: flex;
  justify-content: center;
  align-items: flex-start;

  overflow-y: auto;
  padding: 80px 0 40px;
  box-sizing: border-box;
}

.detail-container {
  position: relative;
  top: auto;
  left: auto;
  transform: none;

  margin: 0 auto;
  width: min(1100px, calc(100% - 40px));
  height: auto;
  box-sizing: border-box;
}

.close-button {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  z-index: 201;
}

#detail-content {
  margin-top: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  column-gap: 20px;
  row-gap: 12px;
  align-items: stretch;
}

#detail-overlay .detail-images { display: contents; }

#detail-overlay img.detail-main {
  display: block;
  width: 100%;
  height: auto !important;
  max-height: 82vh;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.7));
  grid-column: 1;
  grid-row: 1;
}

#detail-overlay .detail-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  grid-column: 1;
  grid-row: 2;
}

#detail-overlay img.detail-thumb {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  object-fit: cover;
  cursor: pointer;
  border-radius: 2px;
  opacity: 0.9;
}

#detail-overlay img.detail-thumb:hover { opacity: 1; }

#detail-overlay .detail-info {
  margin: 0;
  max-width: 320px;
  grid-column: 2;
  grid-row: 1;

  display: flex;
  flex-direction: column;
  height: 100%;
}

#detail-overlay .detail-info h2 {
  font-size: 20px;
  line-height: 1.25;
  margin: 0 0 10px;
}

#detail-overlay [data-role="detail-tags"]  {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 10px 0 0 0;
  padding: 0;
}

#detail-overlay .detail-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 4px 6px;
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 777px;

  background: rgba(0,0,0,0.02);
  color: #333;
  text-decoration: none;

  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.01em;
  opacity: 1;
}

#detail-overlay .detail-tag:hover {
  background: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.26);
  color: #111;
}

#detail-overlay .detail-tag:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.15);
}

#detail-overlay .detail-meta {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.55;
}

#detail-overlay .detail-meta-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  column-gap: 10px;
}

#detail-overlay .detail-meta-label {
  opacity: 0.7;
  white-space: nowrap;
}

#detail-overlay .detail-meta-value { word-break: break-word; }

#detail-overlay .detail-info p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.6;
}

#detail-overlay .related-works {
  margin-top: auto;
  padding-top: 20px;
}

#detail-overlay .related-works h3,
#detail-overlay .related-works h4 {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.0em;
  opacity: 0.7;
  font-weight: 200;
  line-height: 1.2;
}

#detail-overlay .related-grid {
  display: grid;
  grid-template-columns: repeat(4, 71px);
  gap: 12px;
}

#detail-overlay .related-item {
  display: block;
  width: 71px;
  height: 71px;
  overflow: hidden;
  border-radius: 6px;
}

#detail-overlay .related-item img {
  display: block;
  width: 71px;
  height: 71px;
  object-fit: contain;
  object-position: center;
}

/* ===== Detail Overlay Controls ===== */
#detail-overlay .detail-navigation {
  position: fixed;
  inset: 0;
  z-index: 901;
  pointer-events: none;
}

#detail-overlay .nav-button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #111;
  opacity: 0.55;
}
#detail-overlay .nav-button:hover { opacity: 0.95; }
#detail-overlay .nav-button:focus { outline: none; }

#detail-overlay #prev-work,
#detail-overlay #next-work {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 902;
}
#detail-overlay #prev-work { left: 12px; }
#detail-overlay #next-work { right: 12px; }

#detail-overlay #close-detail {
  display: none;
  position: fixed;
  top: calc(var(--header-h) + 12px);
  left: 12px;

  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;

  opacity: 0.75;
  cursor: pointer;
  z-index: 903;
}

#detail-overlay #close-detail::before { content: none; }
#detail-overlay #close-detail:hover { opacity: 1; }

#detail-overlay .nav-button svg {
  width: 20px;
  height: 20px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

@media screen and (max-width: 820px) {
  #detail-content { grid-template-columns: 1fr; }
  #detail-overlay .detail-info { max-width: none; }
}

/* =========================
   Safety: hidden must hide
========================= */
.hidden { display: none !important; }
#detail-overlay.hidden { display: none !important; }

/* =========================
   Responsive: grid density
========================= */
@media screen and (max-width: 1199px) {
  :root { --grid-cols: 4; --grid-columns: 4; }
}
@media screen and (max-width: 899px) {
  :root { --grid-cols: 3; --grid-columns: 3; }
}
@media screen and (max-width: 599px) {
  :root { --grid-cols: 2; --grid-columns: 2; }
}

/* ===== Footer Copyright ===== */
#site-copyright {
  position: fixed;
  right: 14px;
  bottom: 14px;
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0em;
  opacity: 0.55;
  z-index: 9999;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

/* =====================================================================
   Bio Page OVERRIDE (final / single source of truth)
   Goal (now): Make layout NEVER overflow horizontally.
   - Keep the existing List "top area" (thumb + title + role + body line drop)
   - Do NOT chase visual polish yet; just make it safe/stable.
   - Switch by: #bio-page[data-bio-view]
===================================================================== */

/* Hide both, then show via #bio-page attribute */
body.bio-page #bio-page .bio[data-bio-view="grid"],
body.bio-page #bio-page .bio[data-bio-view="list"]{
  display: none;
}

body.bio-page #bio-page[data-bio-view="grid"] .bio[data-bio-view="grid"]{
  display: block;
}
body.bio-page #bio-page[data-bio-view="list"] .bio[data-bio-view="list"]{
  display: block;
}

/* ---------------------------------------------------------------------
   NO-OVERFLOW SAFETY (Grid + List 共通)
   - ここが本体：どの要素が固定幅でも、横にはみ出さない
--------------------------------------------------------------------- */

/* Bio page root: keep content below fixed header, and never overflow */
body.bio-page #bio-page{
  max-width: 100%;
  box-sizing: border-box;

  /* header is fixed. keep content below it */
  padding-top: var(--header-h);
}

  /* ===== Bio Grid (profile page) =====
     Scope: only when Grid view is active
     Goal: simple typography-driven profile layout (Swiss/German-ish)
  */
  body.bio-page #bio-page[data-bio-view="grid"] .bio-grid #bio-grid-root{
    /* page padding */
    padding: 24px;
    box-sizing: border-box;

    /* centered readable width */
    max-width: 1040px;
    margin: 0 auto;

    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 20px 28px;
    align-items: start;
  }

  body.bio-page #bio-page[data-bio-view="grid"] .bio-grid #bio-grid-root .bio__media{
    min-width: 0;
  }

  body.bio-page #bio-page[data-bio-view="grid"] .bio-grid #bio-grid-root .bio__photo{
    display: block;
    width: 100%;
    height: auto;
    max-height: 76vh;
    object-fit: contain;
  }

  /* right column text */
  body.bio-page #bio-page[data-bio-view="grid"] .bio-grid #bio-grid-root .bio__body{
    min-width: 0;
  }

  body.bio-page #bio-page[data-bio-view="grid"] .bio-grid #bio-grid-root .bio__name{
    margin: 0 0 10px;
    font-size: 19px;
    line-height: 1.2;
    font-weight: 500;
    letter-spacing: 0.01em;
  }

  body.bio-page #bio-page[data-bio-view="grid"] .bio-grid #bio-grid-root .bio__role{
    margin: 0 0 18px;
    font-size: 12px;
    line-height: 1.5;
    opacity: 0.72;
  }

  body.bio-page #bio-page[data-bio-view="grid"] .bio-grid #bio-grid-root .bio__text p{
    margin: 0 0 16px;
    font-size: 13px;
    line-height: 1.75;
  }

  body.bio-page #bio-page[data-bio-view="grid"] .bio-grid #bio-grid-root .bio__cv{
    margin: 0 0 16px;
  }

  body.bio-page #bio-page[data-bio-view="grid"] .bio-grid #bio-grid-root .bio__cv-row{
    column-gap: 12px;
    padding: 3px 0;
  }

  body.bio-page #bio-page[data-bio-view="grid"] .bio-grid #bio-grid-root .bio__cv-row dt{
    font-size: 12px;
    line-height: 1.5;
    opacity: 0.72;
  }

  body.bio-page #bio-page[data-bio-view="grid"] .bio-grid #bio-grid-root .bio__cv-row dd{
    font-size: 12px;
    line-height: 1.5;
  }

  body.bio-page #bio-page[data-bio-view="grid"] .bio-grid #bio-grid-root .bio__links a{
    font-size: 12px;
    line-height: 1.5;
    text-decoration: underline;
    text-underline-offset: 2px;
    opacity: 0.82;
  }
  body.bio-page #bio-page[data-bio-view="grid"] .bio-grid #bio-grid-root .bio__links a:hover{
    opacity: 1;
  }

  /* responsive: stack */
  @media screen and (max-width: 820px){
    body.bio-page #bio-page[data-bio-view="grid"] .bio-grid #bio-grid-root{
      grid-template-columns: 1fr;
      padding: 20px;
      gap: 16px;
    }
    body.bio-page #bio-page[data-bio-view="grid"] .bio-grid #bio-grid-root .bio__photo{
      max-height: none;
    }
  }
  /* ===== /Bio Grid (profile page) ===== */

/* ---------------------------------------------------------------------
   List view: keep the "top area" you already have
--------------------------------------------------------------------- */

/* List row: thumb + title/role line + body line below */
body.bio-page #bio-page[data-bio-view="list"] .bio-list-row{
  display: flex;
  flex-wrap: wrap;                    /* allow body to drop below */
  align-items: center;
  gap: 12px;

  margin: 0;
  padding: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

body.bio-page #bio-page[data-bio-view="list"] .bio-list-row img.thumb-img{
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex: 0 0 auto;
}

/* Title + role line: match Works List (row / baseline / ellipsis) */
body.bio-page #bio-page[data-bio-view="list"] .bio-list-info.item-info{
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  padding: 0;
  flex: 1 1 auto;
}

body.bio-page #bio-page[data-bio-view="list"] .bio-list-info.item-info h3,
body.bio-page #bio-page[data-bio-view="list"] .bio-list-info.item-info p{
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.bio-page #bio-page[data-bio-view="list"] .bio-list-info.item-info h3{
  font-size: 14px;
  font-weight: 600;
}

body.bio-page #bio-page[data-bio-view="list"] .bio-list-info.item-info p.bio__role{
  font-size: 12px;
  opacity: 0.8;
}

/* Body text: visible. Keep it simple/safe first (no horizontal overflow). */
body.bio-page #bio-page[data-bio-view="list"] .bio-list-text{
  flex: 0 0 100%;
  min-width: 0;
  margin-top: 12px;
  margin-left: 60px;                  /* 48px thumb + 12px gap */
}

body.bio-page #bio-page[data-bio-view="list"] .bio-list-text p{
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.6;

  /* Start Works-like: 1-line ellipsis (later you can expand to multi-line) */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* List 2行目以降用：サムネ領域(48) + gap(12) */
body.bio-page #bio-page[data-bio-view="list"] .bio-list-spacer{
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
}

/* 強弱なし行は p だけ（Works listの p 相当） */
body.bio-page #bio-page[data-bio-view="list"] .bio-line-plain{
  font-size: 12px;
  opacity: 0.8;
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== /Bio Page OVERRIDE ===== */

/* ===== News Detail OVERRIDE =====
   Scope: /news/<id>/ (detail pages)
   Goal : press-release-ish layout with auto portrait/landscape/square blocks
*/

body.news-detail-page #news-detail.news-detail-wrap{
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 16px;
  box-sizing: border-box;
}

body.news-detail-page #news-detail .news-kicker{
  opacity: .75;
  font-size: 12px;
  margin-bottom: 10px;
}

body.news-detail-page #news-detail .news-headline{
  margin: 0 0 14px;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 500;
}

body.news-detail-page #news-detail .news-body{
  line-height: 1.75;
  font-size: 13px;
}

body.news-detail-page #news-detail .news-body p{
  margin: 0 0 14px;
}

body.news-detail-page #news-detail .news-links{
  margin-top: 16px;
  font-size: 12px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

body.news-detail-page #news-detail .news-back{
  margin-top: 22px;
  opacity: .8;
}

body.news-detail-page #news-detail .news-blocks{
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

body.news-detail-page #news-detail .news-block{
  display: grid;
  gap: 14px;
  align-items: start;
}

body.news-detail-page #news-detail .news-block__media img{
  width: 100%;
  height: auto;
  display: block;

  /* 安全柵：縦に伸びすぎてページを壊さない */
  max-height: 72vh;

  /* 比率維持。横長想定なら cover が一番「記事っぽい」 */
  object-fit: cover;
  object-position: 50% 50%;
}

/* hero only: cap height to avoid huge square images */
body.news-detail-page #news-detail .news-blocks > .news-block:first-child .news-block__media img{
  width: 100%;
  height: var(--news-detail-hero-h, 520px);
  object-fit: cover;
  object-position: 50% 50%;
}

/* landscape: image top */
body.news-detail-page #news-detail .news-block.is-landscape{
  grid-template-columns: 1fr;
}

/* portrait/square: left image, right text */
body.news-detail-page #news-detail .news-block.is-portrait,
body.news-detail-page #news-detail .news-block.is-square{
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  column-gap: 22px;
}

@media (max-width: 820px){
  body.news-detail-page #news-detail .news-block.is-portrait,
  body.news-detail-page #news-detail .news-block.is-square{
    grid-template-columns: 1fr;
  }
}

body.news-detail-page #news-detail .news-caption{
  font-size: 12px;
  opacity: 0.8;
  margin: 0 0 10px;
  line-height: 1.4;
}

body.news-detail-page #news-detail .news-block-body p{
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.75;
}

/* ===== /News Detail OVERRIDE ===== */

/* ===== News Page OVERRIDE: Grid overlay =====
   Scope: /news/ (Grid)
   Goal : edge-to-edge image, hover zoom-in, overlay date+title, fallback logo when no image
*/

/* Grid columns override for News only
   - 980px付近（= 900〜1199px）を 6列にする
*/
@media screen and (min-width: 900px) and (max-width: 1199px){
  body.news-page{
    --grid-cols: 6;
    --grid-columns: 6;
  }
}

/* Card frame */
body.news-page #gallery-container.grid-view .gallery-item{
  position: relative;
  overflow: hidden;            /* zoom stays inside card */
  background: #fff;            /* fallback behind logo */
}

/* Make image edge-to-edge */
body.news-page #gallery-container.grid-view .gallery-item img.thumb-img{
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover !important;
  object-position: 50% 50%;
  transform: scale(1);
  transition: transform 220ms ease;
}

/* Hover zoom (inside card) */
body.news-page #gallery-container.grid-view .gallery-item:hover img.thumb-img{
  transform: scale(var(--news-card-zoom, 1.06));
}

/* ===== News no-thumb (fallback logo) : Grid ===== */
body.news-page #gallery-container.grid-view .gallery-item.no-thumb{
  display: grid;
  place-items: center;
  overflow: hidden; /* hover zoom等の事故防止 */
}

body.news-page #gallery-container.grid-view .gallery-item.no-thumb::before{
  content: "";
  width: calc(100% * var(--news-fallback-logo-scale, 0.58));
  max-width: var(--news-fallback-logo-max-w, 140px);
  aspect-ratio: 3 / 1;
  background-image: url("/news/_fallback/logo_adesignerinc.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.85;
}
/* ===== /News no-thumb (fallback logo) : Grid ===== */

body.news-page #gallery-container.grid-view .gallery-item.no-thumb:hover::before{
  transform: scale(var(--news-card-zoom, 1.06));
  transition: transform 220ms ease;
}

/* Overlay band */
body.news-page #gallery-container.grid-view .gallery-item .item-info{
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;

  min-height: var(--news-grid-ov-min-h, 68px);

  padding:
    var(--news-grid-ov-pad-t, 14px)
    var(--news-grid-ov-pad-r, 12px)
    var(--news-grid-ov-pad-b, 12px)
    var(--news-grid-ov-pad-l, 12px);
  box-sizing: border-box;

  background: var(--news-grid-ov-bg, rgba(255,255,255,0.55));
  color: #111;

  backdrop-filter: blur(var(--news-grid-ov-blur, 2px));
}

/* Title */
body.news-page #gallery-container.grid-view .gallery-item .item-info h3{
  margin-top: var(--news-grid-title-mt, 0px);
  margin-bottom: var(--news-grid-title-mb, 0px);
  padding-top: var(--news-grid-title-pt, 0px);
  padding-bottom: var(--news-grid-title-pb, 0px);

  font-size: var(--news-grid-title-size, 14px);
  line-height: var(--news-grid-title-lh, 1.25);
  font-weight: var(--news-grid-title-weight, 600);
  letter-spacing: var(--news-grid-title-tracking, 0.02em);

  text-align: center;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Date (first p) */
body.news-page #gallery-container.grid-view .gallery-item .item-info p{
  position: absolute;
  right: var(--news-grid-date-right, 12px);
  bottom: var(--news-grid-date-bottom, 12px);
  transform: translate(var(--news-grid-date-nudge-x, 0px), var(--news-grid-date-nudge-y, 0px));

  margin: 0;

  font-size: var(--news-grid-date-size, 11px);
  line-height: var(--news-grid-date-lh, 1.1);
  letter-spacing: var(--news-grid-date-tracking, 0.08em);
  opacity: var(--news-grid-date-opacity, 0.9);

  background: var(--news-grid-date-chip-bg, rgba(255,255,255,0.0));
  padding: var(--news-grid-date-chip-pad-y, 0px) var(--news-grid-date-chip-pad-x, 0px);
  border-radius: var(--news-grid-date-chip-radius, 0px);

  white-space: nowrap;
}

/* Summary off in grid */
body.news-page #gallery-container.grid-view .gallery-item .item-info p:nth-of-type(2){
  display: none;
}

/* ===== /News Page OVERRIDE: Grid (edge-to-edge) ===== */

/* ===== News Page OVERRIDE: List =====
   Scope: /news (List)
   Goal : Works Listをベースに、Newsは「縦積み（title/date/summary）」で読みやすくする
*/

body.news-page #gallery-container.list-view .gallery-item{
  display: flex;
  align-items: center;
  gap: 12px;
  height: auto;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

body.news-page #gallery-container.grid-view .gallery-item img.thumb-img{
  /* Newsでは Works の “内側100px抜きabsolute” を潰して、カード全面に敷く */
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;

  display: block;
  width: 100% !important;
  height: 100% !important;

  object-fit: cover !important;
  object-position: 50% 50% !important;

  transform: scale(1);
  transition: transform 220ms ease;
}

/* ===== News no-thumb (fallback logo) : List ===== */
body.news-page #gallery-container.list-view .gallery-item.no-thumb{
  display: flex;           /* Works List と同じ骨格 */
  align-items: center;
}

body.news-page #gallery-container.list-view .gallery-item.no-thumb::before{
  content: "";
  width: 48px;
  height: 48px;
  background-image: url("/news/_fallback/logo_adesignerinc.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.85;
  flex: 0 0 auto;
}
/* ===== /News no-thumb (fallback logo) : List ===== */

/* info: 縦積み */
body.news-page #gallery-container.list-view .gallery-item .item-info{
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  padding: 0;
}

/* title */
body.news-page #gallery-container.list-view .gallery-item .item-info h3{
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  font-size: 14px;
  font-weight: 600;
}

/* Works Listに倣って：title 1行のみ */
body.news-page #gallery-container.list-view .gallery-item .item-info p{
  display: block;
}

body.news-page #gallery-container.list-view .gallery-item .item-info p:nth-of-type(2){
  display: none;
}

body.news-page{
  --grid-columns: 6;
}

body.news-page #gallery-container.grid-view .gallery-item img.thumb-img{
  box-shadow: none !important;
}

/* ===== /News Page OVERRIDE: List ===== */
