/* =====================================================================
   A. デザイン設定 — 色・文字・余白の調整は、まずここから。
   B. コンポーネント — ページの共通パーツ。
   C. ページ — ホーム、自分史、フッターのレイアウト。
   D. 画面サイズ — スマートフォンを基準に、広い画面へ展開。
===================================================================== */

/* ┌──────────────────────────────────────────────────────────────┐
   │ A. デザイン設定（ここは自由に編集できます）                  │
   └──────────────────────────────────────────────────────────────┘ */
:root {
  --color-night: #080a12;       /* 暗い背景 */
  --color-night-soft: #111522;  /* 少し明るい暗色 */
  --color-paper: #f1eee7;       /* 明るい背景 */
  --color-ink: #242630;         /* 明るい背景上の文字 */
  --color-text: #f0eee8;        /* 暗い背景上の文字 */
  --color-muted: #b6b7c1;       /* 補助の文字 */
  --color-red: #d34b50;         /* 彼岸花のような赤 */
  --color-blue: #9ec9f0;        /* 空の青 */
  --font-ja: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
  --font-en: "Times New Roman", Georgia, serif;
  --gutter: clamp(22px, 6vw, 76px);
  --content-width: 1080px;
  --ease: cubic-bezier(.2, .72, .22, 1);
}

/* ┌──────────────────────────────────────────────────────────────┐
   │ B. 共通の仕組み                                              │
   └──────────────────────────────────────────────────────────────┘ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  color: var(--color-text);
  background: var(--color-night);
  font-family: var(--font-ja);
  line-height: 2;
  letter-spacing: .055em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.menu-open { overflow: hidden; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--color-blue); outline-offset: 5px; }
::selection { background: var(--color-red); color: #fff; }

.skip-link {
  position: fixed; z-index: 200; left: 12px; top: 10px;
  padding: 8px 14px; color: var(--color-ink); background: var(--color-paper);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }
.page-progress { position: fixed; z-index: 120; inset: 0 auto auto 0; width: 100%; height: 2px; pointer-events: none; }
.page-progress span { display: block; width: 100%; height: 100%; background: var(--color-red); transform: scaleX(0); transform-origin: left center; }
.grain {
  position: fixed; z-index: 100; inset: 0; pointer-events: none; opacity: .055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.4'/%3E%3C/svg%3E");
}
.container { width: min(100% - var(--gutter) * 2, var(--content-width)); margin-inline: auto; }
.eyebrow { margin: 0 0 16px; color: var(--color-muted); font: .68rem/1.4 var(--font-en); letter-spacing: .2em; text-transform: uppercase; }
.section-title { margin: 0; font-size: clamp(1.65rem, 7vw, 3.3rem); font-weight: 400; line-height: 1.58; letter-spacing: .11em; }
.section-title span { display: block; }
.lead { max-width: 38em; margin: 20px 0 0; font-size: .86rem; line-height: 2.25; }
.rule { width: 42px; height: 1px; margin: 24px 0; background: currentColor; opacity: .55; }
.small-link { display: inline-flex; align-items: center; gap: 16px; margin-top: 26px; padding-bottom: 7px; border-bottom: 1px solid currentColor; font-size: .82rem; }
.small-link span:last-child { transition: transform .45s var(--ease); }
.small-link:hover span:last-child { transform: translateX(6px); }
.en { font-family: var(--font-en); letter-spacing: .17em; }
.noscript, .error-message { position: fixed; z-index: 300; inset: auto 12px 12px; padding: 14px; background: #991f2a; color: #fff; font: 14px/1.6 sans-serif; letter-spacing: 0; }

/* スクロールでゆっくり現れる要素。JSが動かない場合は隠しません。 */
.js-ready [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.js-ready [data-reveal].is-visible { opacity: 1; transform: none; }
.js-ready [data-reveal="image"] { clip-path: inset(0 0 100% 0); transition: clip-path 1.15s var(--ease); }
.js-ready [data-reveal="image"].is-visible { clip-path: inset(0); }
.js-ready [data-reveal="heading"] { opacity: 1; transform: none; }
.js-ready [data-reveal="heading"] .title-line { display: block; overflow: hidden; padding-bottom: .1em; }
.js-ready [data-reveal="heading"] .title-line > span { display: block; transform: translateY(112%); transition: transform 1s var(--ease) calc(var(--line) * .13s); }
.js-ready [data-reveal="heading"].is-visible .title-line > span { transform: none; }

/* 写真なしでもレイアウトを確認できる背景。実写真は上に重なります。 */
.image-frame { position: relative; overflow: hidden; background: linear-gradient(145deg, #111a2e 5%, #34283d 53%, #8b4147 100%); isolation: isolate; }
.image-frame::after { position: absolute; z-index: 1; inset: 0; content: ""; background: linear-gradient(180deg, transparent 48%, rgba(4, 6, 13, .48)); pointer-events: none; }
.image-frame img { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.image-frame:hover img { transform: scale(1.035); }
.has-image::before { display: none; }

/* ┌──────────────────────────────────────────────────────────────┐
   │ B. ヘッダーとメニュー                                       │
   └──────────────────────────────────────────────────────────────┘ */
.header {
  position: fixed; z-index: 110; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px var(--gutter); color: #fff;
  background: linear-gradient(180deg, rgba(5, 7, 13, .58), transparent);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: .72rem; letter-spacing: .17em; }
.brand-mark { position: relative; width: 28px; height: 28px; border: 1px solid currentColor; border-radius: 50%; }
.brand-mark::before, .brand-mark::after { position: absolute; content: ""; background: currentColor; }
.brand-mark::before { width: 7px; height: 7px; left: 6px; top: 6px; border-radius: 50%; }
.brand-mark::after { width: 9px; height: 1px; right: -4px; bottom: 5px; transform: rotate(45deg); }
.menu-button { position: relative; display: grid; place-content: center; gap: 6px; width: 44px; height: 44px; padding: 10px; border: 0; color: inherit; background: transparent; cursor: pointer; }
.menu-button span { display: block; width: 23px; height: 1px; background: currentColor; transition: transform .35s var(--ease); }
.menu-button[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
.menu-button[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }
.menu {
  position: fixed; z-index: 105; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 13px;
  padding: 90px var(--gutter); color: var(--color-text); background: rgba(8, 10, 18, .97);
  opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s;
}
.menu.is-open { opacity: 1; visibility: visible; }
.menu a { width: fit-content; padding: 6px 0; font-size: clamp(1.4rem, 7vw, 2.1rem); }
.menu .menu-en { display: block; color: var(--color-muted); font: .62rem/1.4 var(--font-en); letter-spacing: .18em; }

/* ┌──────────────────────────────────────────────────────────────┐
   │ C. ホームページ                                             │
   └──────────────────────────────────────────────────────────────┘ */
.hero { position: relative; display: flex; align-items: flex-end; min-height: 100svh; padding: 150px var(--gutter) 14vh; overflow: hidden; isolation: isolate; background: #070912; }
.hero-backdrop { position: absolute; z-index: -2; inset: 0; background: radial-gradient(ellipse at 76% 40%, #263650 0, #111827 25%, #080a12 67%); }
.hero-backdrop img { width: 100%; height: 100%; object-fit: cover; opacity: .74; }
.hero::before { position: absolute; z-index: -1; inset: 0; content: ""; background: linear-gradient(90deg, rgba(5, 7, 13, .82), rgba(5, 7, 13, .15)), linear-gradient(0deg, rgba(5, 7, 13, .78), transparent 72%); }
.hero-copy { width: min(100%, 820px); }
.hero-eyebrow { color: #c7cad2; }
.hero-title { margin: 0; font-size: clamp(1.35rem, 5.2vw, 3.4rem); font-weight: 400; line-height: 1.55; letter-spacing: .1em; }
.hero-title .title-line > span { white-space: nowrap; }
.hero-title span { display: block; }
.hero .lead { color: #e6e6e8; }
.hero-cue { display: flex; align-items: center; gap: 14px; margin-top: 46px; color: #c4c6ce; font: .62rem/1 var(--font-en); letter-spacing: .2em; }
.hero-cue::before { width: 52px; height: 1px; content: ""; background: var(--color-red); }
.hero-orbit { position: absolute; z-index: -1; right: -95px; top: 17%; width: 240px; aspect-ratio: 1; border: 1px solid rgba(255,255,255,.11); border-radius: 50%; }
.hero-orbit::after { position: absolute; inset: 18%; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; content: ""; }

.home-history { position: relative; isolation: isolate; padding: 88px 0 100px; overflow: hidden; background: #0b0e17; }
.history-backdrop { position: absolute; z-index: -2; inset: 0; background: radial-gradient(ellipse at 12% 95%, rgba(151,42,49,.55), transparent 35%), linear-gradient(155deg, #080a12, #11182a 56%, #130e18); }
.history-backdrop img { width: 100%; height: 100%; object-fit: cover; opacity: .48; }
.home-history::after { position: absolute; z-index: -1; inset: 0; content: ""; background: linear-gradient(90deg, rgba(5,7,13,.88), rgba(5,7,13,.52)), linear-gradient(0deg, rgba(5,7,13,.6), transparent 70%); }
.home-history-head { margin-bottom: 44px; }
.timeline { position: relative; display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.timeline::before { position: absolute; top: 0; bottom: 0; left: 7px; width: 1px; content: ""; background: linear-gradient(180deg, var(--color-red), rgba(255,255,255,.14)); transform: scaleY(var(--timeline-progress, 0)); transform-origin: top; }
.timeline-item { position: relative; padding: 0 0 28px 30px; }
.timeline-item::before { position: absolute; top: 11px; left: 2px; width: 11px; height: 11px; content: ""; border: 1px solid var(--color-red); border-radius: 50%; background: var(--color-night); box-shadow: 0 0 16px rgba(211,75,80,.32); }
.timeline-content { display: grid; grid-template-columns: minmax(84px, 30%) minmax(0, 1fr); align-items: center; gap: 14px; }
.timeline-thumb { width: 100%; aspect-ratio: 4 / 3; background: linear-gradient(145deg, #1a2538, #563943 74%, #9d4549); }
.timeline-period { margin: 0; color: #e78b86; font: .78rem/1.5 var(--font-en); letter-spacing: .14em; }
.timeline-period span { padding-left: 7px; color: rgba(255,255,255,.45); font-size: .64rem; }
.timeline-title { margin: 4px 0 8px; font-size: 1.2rem; font-weight: 400; }
.timeline-text { margin: 0; color: var(--color-muted); font-size: .8rem; line-height: 2.1; }

.chapter { position: relative; display: flex; align-items: center; min-height: 92svh; padding: 130px var(--gutter); overflow: hidden; isolation: isolate; background: #12151d; }
.chapter-backdrop { position: absolute; z-index: -2; inset: 0; background: var(--chapter-fallback); }
.chapter-backdrop img { width: 100%; height: 100%; object-fit: cover; opacity: .72; }
.chapter::after { position: absolute; z-index: -1; inset: 0; content: ""; background: linear-gradient(90deg, rgba(4,7,15,.78), rgba(4,7,15,.07)), linear-gradient(0deg, rgba(4,7,15,.42), transparent 68%); }
.chapter--forest { --chapter-fallback: radial-gradient(ellipse at 76% 20%, #38424b, #14211f 38%, #090c13 82%); }
.chapter--sky { min-height: 85svh; color: #1e2836; background: #a9c9e4; }
.chapter--sky::after { background: linear-gradient(90deg, rgba(226,236,241,.64), rgba(225,237,245,.04)), linear-gradient(0deg, rgba(20,37,56,.18), transparent 60%); }
.chapter--sky .eyebrow, .chapter--sky .lead { color: #26374a; }
.chapter-copy { width: min(100%, 720px); }
.chapter .section-title { font-size: clamp(2rem, 8vw, 4.2rem); }

.works { padding: 105px 0 92px; color: var(--color-ink); background: var(--color-paper); }
.works .eyebrow, .about .eyebrow { color: #747681; }
.works .lead, .about .lead { color: #555762; }
.work-track {
  display: flex; gap: 18px; margin-top: 42px; padding: 0 var(--gutter) 18px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: thin; scrollbar-color: rgba(36,38,48,.35) transparent;
  -webkit-overflow-scrolling: touch;
}
.work-track:focus-visible { outline-offset: -4px; }
.work-card { display: block; }
.work-track .work-card { flex: 0 0 min(80vw, 460px); scroll-snap-align: start; }
.work-image { aspect-ratio: 16 / 10; background: linear-gradient(140deg, #30384c, #9d6665 58%, #d2ac8b); }
.work-card:nth-child(even) .work-image { background: linear-gradient(140deg, #252d40, #5e7380 57%, #d0c0a2); }
.work-card:hover .work-image img { transform: scale(1.035); }
.work-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; margin-top: 13px; }
.work-title { margin: 0; font-size: 1.05rem; font-weight: 400; }
.work-category { color: #747681; font-size: .68rem; }
.work-description { margin: 8px 0 0; color: #555762; font-size: .78rem; line-height: 2; }
.work-arrow { display: inline-block; transition: transform .4s var(--ease); }
.work-card:hover .work-arrow { transform: translateX(5px); }
.gallery-instruction { margin: 12px var(--gutter) 0; color: #666873; font: .62rem/1.7 var(--font-en); letter-spacing: .16em; }
.gallery-instruction::before { display: inline-block; width: 34px; height: 1px; margin: 0 11px 3px 0; content: ""; background: var(--color-red); }

.about { padding: 88px 0 110px; color: var(--color-ink); background: var(--color-paper); }
.about-grid { display: grid; gap: 28px; margin-top: 30px; }
.about-image { width: min(48vw, 190px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #c2b3a7, #343c51 72%); }
.about-copy p { max-width: 42em; margin: 0 0 1em; color: #555762; font-size: .84rem; }
.about-links { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 24px; }
.about-links a { display: inline-flex; align-items: center; gap: 10px; border-bottom: 1px solid #8a8b91; padding-bottom: 5px; font-size: .78rem; }

.closing { position: relative; display: flex; align-items: flex-end; min-height: 65svh; padding: 92px var(--gutter) 52px; overflow: hidden; isolation: isolate; background: linear-gradient(180deg, #6b87a5, #d5c0a4 58%, #252938); }
.closing-backdrop { position: absolute; z-index: -2; inset: 0; background: linear-gradient(180deg, rgba(9,18,33,.12), rgba(9,18,33,.6)); }
.closing-backdrop img { width: 100%; height: 100%; object-fit: cover; }
.closing::after { position: absolute; z-index: -1; inset: 0; content: ""; background: linear-gradient(0deg, rgba(6,9,17,.58), transparent 80%); }
.closing .section-title { font-size: clamp(1.8rem, 7vw, 3.3rem); }

.footer { padding: 22px var(--gutter) 30px; color: #bfc0c6; background: var(--color-night); font: .65rem/1.7 var(--font-en); letter-spacing: .12em; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; width: min(100%, var(--content-width)); margin: auto; }
.footer p { margin: 0; }

/* ┌──────────────────────────────────────────────────────────────┐
   │ C. 自分史ページ                                             │
   └──────────────────────────────────────────────────────────────┘ */
.story-hero { position: relative; display: flex; align-items: flex-end; min-height: 78svh; padding: 150px var(--gutter) 12vh; overflow: hidden; isolation: isolate; background: radial-gradient(ellipse at 78% 36%, #29354a, #111521 43%, #080a12 80%); }
.story-hero::after { position: absolute; z-index: -1; inset: 0; content: ""; background: linear-gradient(0deg, rgba(6,8,14,.66), transparent 80%); }
.story-hero-copy { width: min(100%, 820px); }
.story-title { margin: 0; font-size: clamp(3.4rem, 20vw, 8rem); font-weight: 400; line-height: 1.4; letter-spacing: .18em; }
.story-subtitle { margin: 16px 0 0; color: #dadbe0; font-size: .86rem; }
.story-intro { padding: 86px 0 55px; }
.story-intro-copy { max-width: 43em; }
.story-intro-copy p { margin: 0 0 1.35em; color: #d0d0d4; font-size: .9rem; line-height: 2.35; }
.story-toc { display: grid; gap: 0; margin-top: 42px; border-top: 1px solid rgba(255,255,255,.17); }
.story-toc a { display: grid; grid-template-columns: 42px 1fr auto; align-items: baseline; gap: 12px; padding: 15px 0; border-bottom: 1px solid rgba(255,255,255,.17); }
.story-toc-number { color: var(--color-red); font: .78rem/1 var(--font-en); }
.story-toc-period { color: var(--color-muted); font-size: .68rem; }
.story-toc-title { font-size: .92rem; }
.story-chapter { position: relative; padding: 92px 0 105px; border-top: 1px solid rgba(255,255,255,.1); }
.story-chapter:nth-of-type(even) { background: linear-gradient(130deg, rgba(255,255,255,.025), transparent 46%); }
.story-chapter-head { position: relative; margin-bottom: 42px; }
.story-chapter-number { position: absolute; top: -20px; right: 0; color: transparent; font: clamp(5rem, 25vw, 10rem)/1 var(--font-en); letter-spacing: -.04em; -webkit-text-stroke: 1px rgba(255,255,255,.15); }
.story-period { position: relative; margin: 0 0 10px; color: var(--chapter-accent, var(--color-red)); font-size: .78rem; }
.story-chapter-title { position: relative; margin: 0; max-width: 15em; font-size: clamp(1.7rem, 8vw, 3rem); font-weight: 400; line-height: 1.65; }
.story-chapter-lead { position: relative; max-width: 38em; margin: 18px 0 0; color: #d0d0d4; font-size: .88rem; }
.story-chapter-image { width: 100%; aspect-ratio: 16 / 9; margin: 35px 0 50px; background: linear-gradient(140deg, #161e30, #463341 68%, #96514f); }
.story-body { max-width: 48em; }
.story-block { margin: 0 0 1.25em; }
.story-block--paragraph { color: #e0dfe1; font-size: .9rem; line-height: 2.35; white-space: pre-line; }
.story-block--heading { margin-top: 2.7em; color: #fff; font-size: 1.15rem; font-weight: 400; }
.story-block--quote { margin: 2.4em 0; padding: 24px 0 24px 20px; border-left: 2px solid var(--chapter-accent, var(--color-red)); color: #f4eee7; font-size: clamp(1.15rem, 5vw, 1.65rem); line-height: 1.9; }
.story-block--reflection { margin: 2.5em 0; padding: 18px 20px 20px; border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.035); }
.story-block--reflection strong { display: block; margin-bottom: 9px; color: var(--chapter-accent, var(--color-red)); font-size: .74rem; font-weight: 400; letter-spacing: .1em; }
.story-block--reflection p, .story-block--list li, .story-card p { margin: 0; color: #d0d0d4; font-size: .82rem; line-height: 2.1; white-space: pre-line; }
.story-block--list h3 { margin: 0 0 12px; font-size: .9rem; font-weight: 400; }
.story-block--list ul { display: grid; gap: 9px; margin: 0; padding-left: 1.3em; }
.story-cards { display: grid; gap: 12px; margin: 2em 0; }
.story-card { padding: 17px 19px; border-top: 1px solid var(--chapter-accent, var(--color-red)); background: rgba(255,255,255,.04); }
.story-card small { color: var(--chapter-accent, var(--color-red)); font: .65rem/1.6 var(--font-en); letter-spacing: .14em; }
.story-card h3 { margin: 5px 0 8px; font-size: 1rem; font-weight: 400; }
.story-ending { padding: 100px 0; color: var(--color-ink); background: var(--color-paper); }
.story-ending h2 { margin: 0; font-size: clamp(1.7rem, 7vw, 3rem); font-weight: 400; }
.story-ending p { max-width: 36em; margin: 18px 0 0; color: #555762; font-size: .88rem; }
.story-ending .small-link { color: var(--color-ink); }

/* JavaScriptエラーは、画面にも読める形で出します。 */
.error-message { font-family: sans-serif; }

/* ┌──────────────────────────────────────────────────────────────┐
   │ D. 広い画面では余白とグリッドを増やす                        │
   └──────────────────────────────────────────────────────────────┘ */
@media (min-width: 720px) {
  .hero { padding-bottom: 15vh; }
  .hero-copy { margin-left: max(0px, calc((100vw - var(--content-width)) / 2)); }
  .home-history-head { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 28px; }
  .home-history-head .lead { margin: 0; }
  .timeline-item { padding: 0 0 36px 40px; }
  .timeline-content { grid-template-columns: minmax(145px, .44fr) 1fr; gap: 24px; }
  .chapter { min-height: 100svh; }
  .chapter-copy { margin-left: max(0px, calc((100vw - var(--content-width)) / 2)); }
  .work-track { gap: 26px; padding-inline: max(var(--gutter), calc((100vw - var(--content-width)) / 2)); }
  .work-track .work-card { flex-basis: min(40vw, 490px); }
  .work-track .work-card:nth-child(even) { margin-top: 65px; }
  .about-grid { grid-template-columns: minmax(180px, .4fr) 1fr; align-items: center; gap: 55px; }
  .about-image { width: min(100%, 260px); }
  .closing { min-height: 78svh; padding-bottom: 8vh; }
  .story-hero { min-height: 82svh; }
  .story-intro { padding-top: 120px; }
  .story-toc { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 36px; }
  .story-chapter { padding-block: 130px; }
  .story-chapter-head { display: grid; grid-template-columns: 1fr minmax(180px, .42fr); align-items: end; gap: 28px; }
  .story-chapter-number { position: static; justify-self: end; grid-column: 2; grid-row: 1 / span 3; }
  .story-chapter-image { width: min(100%, 900px); margin-block: 48px 70px; }
  .story-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .js-ready [data-reveal], .js-ready [data-reveal="image"], .js-ready [data-reveal="heading"] .title-line > span { opacity: 1; transform: none; clip-path: none; }
}
