/* =========================================================
   Detail pages — Proposal B "Folio Grid"
   ヒーロー＋パンくず：ギャラリーと同じデザイン（文字だけ変える）
   以降：トップ案B（home-folio.css の「開いた誌面」）と同じ言語
     - カードにしない：枠・白い紙の面・下紙・影は使わない
     - 生成り地に列を直接組み、天罫（墨1px）と列間の縦の折り線、余白で区切る
     - 写真は枠なし。hover は浮かせない（下線・矢印だけ）
   トークン・ヘッダー・フッターは site.css を参照（編集しない）
   ========================================================= */

html,
body { background: var(--ink); }       /* 黒で始まり黒で閉じる（トップと同じ） */

/* ---------- page tokens ---------- */
.paper-detail {
  --sy: clamp(3.5rem, 5.6vw, 5rem);     /* セクション上下 */
  --fold-gap: 3rem;                     /* 折り線を挟む列間（トップと同じ） */
  max-width: none;
  margin-inline: 0;
  color: var(--text);
  background: var(--kinari);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.85;
}

.paper-detail p,
.paper-detail li,
.paper-detail h2,
.paper-detail h3 {
  word-break: auto-phrase;
  text-wrap: pretty;
}

.paper-detail h2,
.paper-detail h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--mincho);
  font-weight: 500;
  letter-spacing: -.01em;
}

.paper-detail h2 { font-size: clamp(1.75rem, 2.8vw, 2.5rem); line-height: 1.38; }
.paper-detail h3 { font-size: 1.375rem; line-height: 1.45; }

/* ヒーロー＋パンくずは page-hero.css（下層4ページ共通） */

/* =========================================================
   共通部品
   ========================================================= */
.fg-sec {
  padding: var(--sy) var(--wrap);
  scroll-margin-top: var(--header-h);
}

.fg-sec + .fg-sec { padding-top: 0; }

.fg-label {
  margin: 0 0 1.25rem;
  color: var(--ink);
  font-family: var(--bodoni);
  font-size: .75rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: .24em;
}

/* 頭組み：h2 6列 / 説明 5列（下揃え） */
.fg-head {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--cg);
  align-items: end;
  margin-bottom: 2.25rem;
}

.fg-head__title { grid-column: 1 / 7; }

.fg-head__text {
  grid-column: 8 / 13;
  margin: 0;
  padding-bottom: .3rem;
  font-size: .9375rem;
  line-height: 1.9;
}

.fg-head__link { grid-column: 8 / 13; justify-self: end; margin-bottom: .45rem; }

/* 番号：既存の「01 / COMPETITION」を3つの span に分け（文字は不変）、
   「01」を見出し行の右上に Bodoni 40px、英字は見出しの上のラベルに。「 / 」は読み上げ用に残し視覚的に隠す */
.fg-use,
.fg-step {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: subgrid;
  row-gap: 0;
}

.fg-use > *,
.fg-step > * { grid-column: 1; }
.fg-num { display: contents; }

.fg-num__en {
  grid-column: 1;
  align-self: end;
  color: var(--sub);
  font-family: var(--bodoni);
  font-size: .75rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: .2em;
}

.fg-num__n {
  grid-column: 2;
  align-self: start;
  padding-left: .75rem;
  color: var(--ink);
  font-family: var(--bodoni);
  font-size: 2.5rem;
  font-weight: 500;
  font-variant-numeric: lining-nums;
  line-height: .8;
}

.fg-num__sep {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* 写真：枠なし。比率は全ページ 16:9。比率の違う写真は中央を基準に切り取る（--pos で個別に指定も可） */
.fg-ph {
  position: relative;
  margin: 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #e8e6df;
}

.fg-ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--pos, 50% 50%);
}

/* 誌面：天罫（墨1px）＋列間の中央に縦の折り線。箱にしない */
.fg-folio {
  display: grid;
  column-gap: var(--fold-gap);
  padding-top: 1.5rem;
  border-top: 1px solid var(--ink);
}

.fg-folio > * { position: relative; min-width: 0; }

.fg-folio > * + *::before {
  position: absolute;
  z-index: 1;
  top: -1.5rem;
  bottom: 0;
  left: calc(var(--fold-gap) / -2);
  width: 1px;
  background: var(--fold-v) 0 0 / 1px 19px repeat-y;
  content: "";
  pointer-events: none;
}

/* 箇条書き：2列×2行の罫線グリッド */
.fg-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem var(--cg);
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.fg-list li {
  position: relative;
  padding-left: 1.1rem;
  font-size: .9375rem;
  line-height: 1.65;
}

.fg-list li::before {
  position: absolute;
  top: .8rem;
  left: 0;
  width: .45rem;
  height: 1px;
  background: var(--ink);
  content: "";
}

/* 下線リンク（トップの列リンクと同じ：hover で下線が2pxに、矢印が進む） */
.fg-link {
  display: inline-flex;
  align-items: center;
  gap: 1.25rem;
  padding-bottom: .3rem;
  color: var(--ink);
  background: linear-gradient(var(--ink), var(--ink)) 0 100% / 100% 1px no-repeat;
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.6;
  transition: background-size .25s ease;
}

.fg-link span { transition: transform .25s ease; }
.fg-link:hover,
.fg-link:focus-visible { background-size: 100% 2px; }
.fg-link:hover span,
.fg-link:focus-visible span { transform: translateX(.25rem); }

/* =========================================================
   導入＋写真（見開き：文章5列 / 写真6列）
   ========================================================= */
.fg-intro {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: auto 1fr;
  column-gap: var(--cg);
}

.fg-intro__head { grid-column: 1 / 6; grid-row: 1; }

.fg-intro__text {
  grid-column: 1 / 6;
  grid-row: 2;
  align-self: end;
  max-width: 34rem;
  margin: 2rem 0 0;
  font-size: .9375rem;
  line-height: 1.95;
}

.fg-intro__photo { grid-column: 7 / 13; grid-row: 1 / 3; }

/* =========================================================
   用途・プロセス（4項目）：開いた4列。subgrid で英字・h3・本文の行を揃える
   ========================================================= */
.fg-uses__list,
.fg-process__list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: auto auto 1fr;
}

.fg-use,
.fg-step { grid-row: span 3; }

.fg-use .fg-num__n,
.fg-step .fg-num__n { grid-row: 1 / 3; }
.fg-use h3,
.fg-step h3 { margin: .7rem 0 .6rem; }
.fg-use p,
.fg-step p { grid-column: 1 / -1; margin: 0; font-size: .9375rem; line-height: 1.85; }

/* 「共用部・<br>ショールーム」：1行に収まる幅では改行しない（2列以下で <br> を活かす） */
@media (min-width: 1101px), (max-width: 600px) { .fg-use h3 br { display: none; } }

/* =========================================================
   特徴：写真5／文章7。天罫から吊り、間に縦の折り線
   ========================================================= */
.fg-feature__body {
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: start;
}

.fg-feature__body .fg-feature__copy { max-width: 40rem; }
.fg-feature__copy > p:not(.fg-label) { margin: 1.1rem 0 0; font-size: .9375rem; line-height: 1.9; }

/* =========================================================
   事例（建築模型）：開いた3列、写真16:9、キャプションは写真の直下（罫なし）
   ========================================================= */
.fg-works__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.fg-work { margin: 0; }

.fg-work figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: .9rem;
  color: var(--ink);
  font-size: .9375rem;
  font-weight: 500;
  line-height: 1.5;
}

.fg-work figcaption span {
  color: var(--sub);
  font-family: var(--bodoni);
  font-size: .75rem;
  letter-spacing: .2em;
}

/* =========================================================
   相談：墨地の全幅帯。フッター（site.css の border-top）と1pxの線でつながる
   ========================================================= */
.fg-contact {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--cg);
  align-items: end;
  padding: 5.5rem var(--wrap) 5rem;
  color: var(--kinari);
  background: var(--ink);
  scroll-margin-top: var(--header-h);
}

.fg-contact__heading { grid-column: 1 / 7; }
.fg-contact .fg-label { margin-bottom: 1.5rem; color: rgba(243, 241, 234, .72); }

.paper-detail .fg-contact h2 {
  color: var(--kinari);
  font-size: clamp(1.875rem, 3.35vw, 3rem);
  line-height: 1.3;
}

.fg-contact__action { grid-column: 8 / 13; padding-bottom: .25rem; }

.fg-contact__action > p {
  margin: 0;
  color: var(--on-ink);
  font-size: .9375rem;
  line-height: 1.9;
}

.fg-cta {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  width: min(20rem, 100%);
  margin-top: 1.75rem;
  padding: .9rem 1.25rem;
  color: var(--ink);
  border: 1px solid var(--kinari);
  background: var(--kinari);
  font-size: .9375rem;
  font-weight: 500;
  line-height: 1.6;
  transition: color .25s ease, background .25s ease;
}

.fg-cta span { transition: transform .25s ease; }
.fg-cta:hover,
.fg-cta:focus-visible { color: var(--kinari); background: transparent; }
.fg-cta:hover span { transform: translateX(.25rem); }
.fg-cta:focus-visible { outline: 2px solid var(--kinari); outline-offset: 3px; }

.fg-subs {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 2rem;
  margin-top: 1.25rem;
}

.fg-sublink {
  padding: .35rem 0;
  color: var(--kinari);
  font-size: .875rem;
  line-height: 1.6;
  text-decoration: underline;
  text-decoration-color: rgba(243, 241, 234, .5);
  text-underline-offset: .3em;
}

.fg-sublink:hover,
.fg-sublink:focus-visible { text-decoration-color: var(--kinari); }
.fg-sublink:focus-visible { outline: 2px solid var(--kinari); outline-offset: 3px; }

/* =========================================================
   写真つきの一覧（商品3段・ワークショップ特徴2段）：
   トップBの .folio-rows と同じ「縦に積んで写真と文章を左右交互」
   段ごとに 写真:文章の幅（7:5 / 6:6 / 5:7）・写真比率・番号の大きさを変える
   写真と文章の境目に縦の折り線、段の間に水平の折り線、頭に天罫だけ
   ========================================================= */
.fg-product,
.fg-page { display: grid; }

.fg-page .fg-feature__copy { display: contents; }
.fg-product p,
.fg-page .fg-feature__copy > p:not(.fg-label) { margin: .75rem 0 0; font-size: .9375rem; line-height: 1.85; }
.fg-product h3 { margin-top: .5rem; font-size: clamp(1.375rem, 1.9vw, 1.625rem); }

@media (min-width: 721px) {
  .fg-products__list,
  .fg-spread {
    --row-gap: 4rem;
    --col-gap: 4rem;
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--row-gap);
  }

  .fg-product,
  .fg-page {
    --photo: 7;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    grid-template-rows: auto minmax(1.5rem, 1fr) auto auto auto;
    column-gap: var(--col-gap);
  }
  .fg-product:nth-child(2) { --photo: 6; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); }
  .fg-product:nth-child(3) { --photo: 5; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .fg-page:nth-child(1) { --photo: 6; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); }
  .fg-page:nth-child(2) { --photo: 5; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }

  /* 写真：左・右・左 */
  .fg-product > .fg-ph,
  .fg-page > .fg-ph { grid-column: 1; grid-row: 1 / -1; align-self: start; }
  .fg-product:nth-child(2) > .fg-ph,
  .fg-page:nth-child(2) > .fg-ph { grid-column: 2; }

  /* 文章：番号（ラベル）は上端、見出し・本文は下端 */
  .fg-product > :not(.fg-ph),
  .fg-product .fg-num__en,
  .fg-product .fg-num__n { grid-column: 2; }
  .fg-product:nth-child(2) > :not(.fg-ph),
  .fg-product:nth-child(2) .fg-num__en,
  .fg-product:nth-child(2) .fg-num__n { grid-column: 1; }
  .fg-product .fg-num__n { grid-row: 1; justify-self: start; padding-left: 0; line-height: .8; }
  .fg-product .fg-num__en { grid-row: 3; }
  .fg-product h3 { grid-row: 4; }
  .fg-product p { grid-row: 5; max-width: 28rem; }
  .fg-product .fg-num__n { font-size: clamp(3.75rem, 5.6vw, 5rem); }
  .fg-product:nth-child(1) h3 { font-size: clamp(1.75rem, 2.5vw, 2.25rem); }

  .fg-page .fg-feature__copy > * { grid-column: 2; }
  .fg-page:nth-child(2) .fg-feature__copy > * { grid-column: 1; }
  .fg-page .fg-label { grid-row: 1; margin: 0; }
  .fg-page h2 { grid-row: 3; }
  .fg-page .fg-feature__copy > p:not(.fg-label) { grid-row: 4; max-width: 32rem; }
  .fg-page .fg-list { grid-row: 5; }

  /* 縦の折り線：写真と文章の境目 */
  .fg-products__list > *::after,
  .fg-spread > *::after {
    position: absolute;
    z-index: 1;
    top: 0;
    bottom: 0;
    left: calc((100% - var(--col-gap)) * var(--photo) / 12 + var(--col-gap) / 2);
    width: 1px;
    background: var(--fold-v) 0 0 / 1px 19px repeat-y;
    content: "";
    pointer-events: none;
  }
  .fg-product:nth-child(2)::after,
  .fg-page:nth-child(2)::after { left: calc((100% - var(--col-gap)) * (12 - var(--photo)) / 12 + var(--col-gap) / 2); }

  /* 水平の折り線：段と段の間（.fg-folio の縦線を置き換える） */
  .fg-products__list > * + *::before,
  .fg-spread > * + *::before {
    top: calc(var(--row-gap) / -2);
    right: 0;
    bottom: auto;
    left: 0;
    width: auto;
    height: 1px;
    background: var(--fold) 0 0 / 19px 1px repeat-x;
  }
}

@media (min-width: 721px) and (max-width: 1100px) {
  .fg-products__list,
  .fg-spread { --row-gap: 3rem; --col-gap: 2.5rem; }
  .fg-product:nth-child(3) { --photo: 6; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); }
  .fg-page:nth-child(2) { --photo: 6; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); }
}

/* スマホ：写真上・文章下の1列。写真は全幅（中央）で 16:9 */
@media (max-width: 720px) {
  .fg-products__list,
  .fg-spread { grid-template-columns: minmax(0, 1fr); row-gap: 2.75rem; }

  .fg-product { grid-template-columns: minmax(0, 1fr) auto; }
  .fg-product > .fg-ph { grid-column: 1 / -1; grid-row: 1; }
  .fg-product .fg-num__en { grid-column: 1; grid-row: 2; align-self: end; margin-top: 1.125rem; }
  .fg-product .fg-num__n { grid-column: 2; grid-row: 2 / 4; padding: 1rem 0 0 .5rem; font-size: 2.75rem; }
  .fg-product h3 { grid-column: 1; grid-row: 3; font-size: 1.375rem; }
  .fg-product:nth-child(1) h3 { font-size: 1.625rem; }
  .fg-product p { grid-column: 1 / -1; grid-row: 4; }

  .fg-page { display: block; }
  .fg-page .fg-label { margin: 1.25rem 0 .9rem; }
  .fg-page .fg-list { grid-template-columns: minmax(0, 1fr); }

  .fg-products__list > * + *::before,
  .fg-spread > * + *::before {
    top: -1.375rem;
    right: 0;
    bottom: auto;
    left: 0;
    width: auto;
    height: 1px;
    background: var(--fold) 0 0 / 19px 1px repeat-x;
  }
}

/* ---------- reveal：0.5秒のフェードのみ ---------- */
.js .paper-detail .reveal {
  opacity: 0;
  transform: none;
  transition: opacity .5s ease;
}
.js .paper-detail .reveal.is-visible { opacity: 1; }

/* =========================================================
   ≤1100：用途・プロセスを2×2（行の間は水平の折り線、列の間は縦の折り線）
   ========================================================= */
@media (max-width: 1100px) {
  .fg-list { grid-template-columns: minmax(0, 1fr); }
  .fg-uses__list,
  .fg-process__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto auto 1fr var(--fold-gap) auto auto 1fr;
  }
  .fg-use:nth-child(n+3),
  .fg-step:nth-child(n+3) { grid-row: 5 / span 3; }
  .fg-use:nth-child(3)::before,
  .fg-step:nth-child(3)::before { content: none; }
  .fg-use:nth-child(4)::before,
  .fg-step:nth-child(4)::before { top: calc(var(--fold-gap) / -2); }
  .fg-use:nth-child(n+3)::after,
  .fg-step:nth-child(n+3)::after {
    position: absolute;
    top: calc(var(--fold-gap) / -2);
    right: 0;
    left: 0;
    height: 1px;
    background: var(--fold) 0 0 / 19px 1px repeat-x;
    content: "";
  }
  .fg-use:nth-child(3)::after,
  .fg-step:nth-child(3)::after { right: calc(var(--fold-gap) / -2); }
  .fg-use:nth-child(4)::after,
  .fg-step:nth-child(4)::after { left: calc(var(--fold-gap) / -2); }
}

/* =========================================================
   ≤900：タブレット
   ========================================================= */
@media (max-width: 900px) {
  .fg-head { margin-bottom: 2rem; }
  .fg-head__title { grid-column: 1 / -1; }
  .fg-head__text { grid-column: 1 / -1; max-width: 40rem; margin-top: 1rem; padding: 0; }
  .fg-head__link { grid-column: 1 / -1; justify-self: start; margin: 1.25rem 0 0; }

  .fg-contact { padding-block: 4.5rem 4rem; }
  .fg-contact__heading { grid-column: 1 / -1; }
  .fg-contact__action { grid-column: 1 / -1; max-width: 34rem; margin-top: 2rem; }
}

/* =========================================================
   ≤700：スマートフォン（ヒーローはギャラリーのSP値）
   ========================================================= */
@media (max-width: 700px) {
  .fg-intro { display: block; }
  .fg-intro__text { max-width: none; margin-top: 1.25rem; }
  .fg-intro__photo { margin-top: 2rem; }

  /* 特徴：写真上・文章下 */
  .fg-feature__body { grid-template-columns: minmax(0, 1fr); row-gap: 1.5rem; }
  .fg-feature__body .fg-list { grid-template-columns: minmax(0, 1fr); }
  .fg-feature__body > * + *::before { content: none; }
}

/* =========================================================
   ≤600：スマートフォン（カラム間16。トップの home-paper.css と同じ）
   ========================================================= */
@media (max-width: 600px) {
  :root { --cg: 1rem; }

  .paper-detail { --sy: 3.5rem; --fold-gap: 2rem; }
  .paper-detail h2 { font-size: 1.75rem; }
  .paper-detail h3 { font-size: 1.25rem; }
  .fg-label { margin-bottom: 1rem; }
  .fg-folio { padding-top: 1.25rem; }
  .fg-folio > * + *::before { top: -1.25rem; }
  .fg-num__n { font-size: 2rem; }

  /* 用途・プロセス：1列の索引に。項目の間は水平の折り線（2×2 では1行7〜9字になり孤立改行が出るため） */
  .fg-uses__list,
  .fg-process__list { --fold-gap: 1.25rem; grid-template-columns: minmax(0, 1fr); grid-template-rows: none; row-gap: var(--fold-gap); }
  .fg-use p,
  .fg-step p { padding-bottom: .15rem; line-height: 1.75; }
  .fg-head { margin-bottom: 1.5rem; }
  .fg-head__text { margin-top: .75rem; }
  .fg-use,
  .fg-step,
  .fg-use:nth-child(n+3),
  .fg-step:nth-child(n+3) { grid-row: auto; grid-template-rows: auto auto auto; }
  .fg-use h3,
  .fg-step h3 { margin: .3rem 0 .3rem; }
  .fg-use .fg-num__n,
  .fg-step .fg-num__n { line-height: .85; }
  .fg-uses__list > .fg-use::after,
  .fg-process__list > .fg-step::after { content: none; }
  .fg-uses__list > * + *::before,
  .fg-process__list > * + *::before,
  .fg-use:nth-child(4)::before,
  .fg-step:nth-child(4)::before {
    top: calc(var(--fold-gap) / -2);
    right: 0;
    bottom: auto;
    left: 0;
    width: auto;
    height: 1px;
    background: var(--fold) 0 0 / 19px 1px repeat-x;
    content: "";
  }


  /* 事例：全幅の1列（写真は中央）。項目の間は水平の折り線 */
  .fg-works__grid { grid-template-columns: minmax(0, 1fr); row-gap: var(--fold-gap); }
  .fg-works__grid > * + *::before {
    top: calc(var(--fold-gap) / -2);
    right: 0;
    bottom: auto;
    left: 0;
    width: auto;
    height: 1px;
    background: var(--fold) 0 0 / 19px 1px repeat-x;
  }
  .fg-work figcaption { margin-top: .65rem; font-size: .875rem; }

  .fg-contact { padding-block: 3.5rem 3.25rem; }
  .fg-contact .fg-label { margin-bottom: 1.125rem; }
  .fg-contact__action { margin-top: 1.5rem; }
  .fg-cta { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .js .paper-detail .reveal { opacity: 1; transition: none; }
}
