/* ============================================================
   灯火 — TOKA COFFEE ROASTERS / Warm Craft 3D Site Template (EMBER)
   規律: アクセントはテラコッタ1色。緑・青は使わない。
   blob マスク・縦書き・重なりは各1ページ1回のシグネチャ使用。
   KILN 区間はトークン(--bg/--ink/--accent等)を JS が補間する。
   ============================================================ */

:root {
  --bg: #F6F1E7;
  --surface: #EFE6D6;
  --ink: #2B2118;
  --ink-muted: #6B5B4A;
  --line: #D8C9B4;
  --accent: #A9502B;

  /* KILN ダークテーマの色は main.js の THEME_KILN が正
     （JS がスクロールに応じて --bg 等へ補間して書き込む） */

  --font-ja: "Shippori Mincho", "Hiragino Mincho ProN", serif;
  --font-en: "Fraunces", Georgia, serif;

  --fs-display: clamp(2.6rem, 6.5vw + 1rem, 5.5rem);
  --fs-h2: clamp(1.8rem, 3.2vw + 0.6rem, 3rem);
  --fs-h3: clamp(1.25rem, 1.2vw + 0.9rem, 1.6rem);
  --fs-body: clamp(0.95rem, 0.25vw + 0.85rem, 1.0625rem);
  --fs-label: 0.75rem;

  --pad-x: clamp(20px, 5vw, 64px);
  --content-max: 1280px;
  --radius: 20px;

  /* モーション: power4.out 相当を基準イージングにする（linear は使わない） */
  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ja);
  font-size: var(--fs-body);
  line-height: 2.0;
  letter-spacing: 0.04em;
  overflow-x: hidden;
  transition: none; /* KILN 補間は JS 駆動のため CSS transition は切る */
}
::selection { background: var(--accent); color: var(--bg); }
/* height:auto が無いと width/height 属性の値がそのまま効き、写真が縦に伸びる */
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.skip-link {
  position: fixed; top: -56px; left: 16px; z-index: 100;
  padding: 10px 22px; background: var(--ink); color: var(--bg);
  text-decoration: none; font-size: 0.875rem; border-radius: 999px;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 16px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---- WebGL canvas ---- */
#gl { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; }
.no-webgl #gl { display: none; }
main { position: relative; z-index: 1; }

/* ---- セクションラベル ---- */
.sec-label {
  font-family: var(--font-en);
  font-weight: 500; font-size: var(--fs-label);
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 32px;
}

/* ---- Header ---- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px var(--pad-x);
  /* 写真・テーマ遷移の上でも判読できる半透明地。トークン連動で KILN の闇にも追従 */
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: baseline; gap: 12px; text-decoration: none; }
.logo-ja { font-family: var(--font-ja); font-weight: 600; font-size: 1.375rem; letter-spacing: 0.2em; }
.logo-en {
  font-family: var(--font-en); font-weight: 500;
  font-size: 0.6875rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-muted);
}
.site-header nav { display: flex; gap: clamp(14px, 2vw, 32px); align-items: center; }
.site-header nav a {
  font-size: 0.875rem; letter-spacing: 0.1em; text-decoration: none;
  transition: color 0.3s var(--ease);
}
.site-header nav a:hover { color: var(--accent); }
.nav-cta {
  border: 1px solid var(--accent); color: var(--accent);
  padding: 8px 20px; border-radius: 999px;
  transition: color 0.3s var(--ease), background-color 0.3s var(--ease);
}
.nav-cta:hover { background: var(--accent); color: var(--bg); }

/* ============================================================
   S1 HERO — 100vh / 呼吸する豆塊（3D は右側）
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex; align-items: center;
  padding: 0 var(--pad-x);
}
/* ── 見出しスクリム（品質仕様 A: テキスト可読性）──────────────
   豆塊は右側の「背景」、見出しが常に主役。紙色を左から流し込み、
   3D が見出しの右端（"hand." のあたり）へ食い込むのを断つ。 */
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(96deg,
    color-mix(in srgb, var(--bg) 96%, transparent) 0%,
    color-mix(in srgb, var(--bg) 90%, transparent) 31%,
    color-mix(in srgb, var(--bg) 46%, transparent) 46%,
    transparent 60%);
}
.hero-inner { position: relative; z-index: 1; max-width: var(--content-max); margin: 0 auto; width: 100%; }
.hero-label {
  font-family: var(--font-en); font-weight: 500;
  font-size: var(--fs-label); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-muted); margin-bottom: 24px;
}
.display {
  font-family: var(--font-en); font-weight: 300;
  font-size: var(--fs-display); line-height: 1.15;
  letter-spacing: -0.01em;
  max-width: 8em;
}
.js .display .dsp-en { opacity: 0; }
.hero-copy { margin-top: 32px; font-size: var(--fs-h3); line-height: 1.9; }
.js .hero-copy { opacity: 0; }

/* ============================================================
   S2 HANDS — 320vh / 生豆→焙煎豆モーフ + 工程キャプション
   ============================================================ */
.hands { height: 320vh; position: relative; }
.hands-sticky {
  position: sticky; top: 0; height: 100vh;
  display: flex; align-items: center;
  padding: 0 var(--pad-x);
}
/* 工程キャプションも 3D の上に載るため、左からスクリムを流す */
.hands-sticky::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(96deg,
    color-mix(in srgb, var(--bg) 94%, transparent) 0%,
    color-mix(in srgb, var(--bg) 88%, transparent) 32%,
    color-mix(in srgb, var(--bg) 50%, transparent) 50%,
    transparent 70%);
}
.hands-captions { position: relative; z-index: 1; width: min(24em, 82vw); min-height: 12em; display: flex; align-items: center; }
.hand-cap { position: absolute; top: 50%; transform: translateY(-50%); }
.js .hand-cap { opacity: 0; }
/* JS 無効時は 3 段を縦に並べて全文可読にする */
html:not(.js) .hands-captions { display: block; }
html:not(.js) .hand-cap { position: static; transform: none; margin-bottom: 3em; }
.cap-no {
  font-family: var(--font-en); font-weight: 500;
  font-size: var(--fs-label); letter-spacing: 0.14em;
  color: var(--accent); margin-bottom: 16px;
}
.hand-cap h2 { font-size: var(--fs-h2); font-weight: 500; line-height: 1.35; letter-spacing: 0.04em; }

/* ============================================================
   S3 PHILOSOPHY — 縦書き（1ページ1回のシグネチャ）
   ============================================================ */
/* 120vh → 88vh: 中央寄せの残余で「1画面まるごと空白」が生まれていたため詰めた */
.philosophy {
  min-height: 88vh;
  display: flex; align-items: center; justify-content: center;
  gap: clamp(40px, 8vw, 128px);
  padding: clamp(96px, 14vh, 160px) var(--pad-x);
}
.ph-vertical {
  writing-mode: vertical-rl;
  font-size: var(--fs-h2); font-weight: 500;
  letter-spacing: 0.28em; line-height: 2;
  height: 12em;
}
.ph-body { max-width: 24em; color: var(--ink-muted); }

/* ============================================================
   S4 COLLECTION — 260vh / 横スクロール
   ============================================================ */
.collection { height: 260vh; position: relative; }
.col-sticky {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  overflow: hidden;
  padding: 0 0 0 var(--pad-x);
}
.col-track { display: flex; gap: clamp(24px, 3vw, 48px); width: max-content; align-items: center; will-change: transform; }
.col-card { width: min(480px, 78vw); }
.col-card img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--radius);
}
/* シグネチャ blob マスク（1枚のみ） */
.col-blob img { border-radius: 58% 42% 55% 45% / 48% 52% 48% 52%; }
.col-card figcaption {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 16px; padding: 0 8px;
}
/* 品名は和文見出し書体、価格は欧文 Fraunces。1行の中で役割ごとに書体を分ける */
.col-name { font-family: var(--font-ja); font-size: var(--fs-h3); font-weight: 500; }
.col-price { font-family: var(--font-en); font-weight: 500; color: var(--accent); }

/* 写真の暖色トーン統一（全写真共通・2層） */
.col-card, .studio-photo, .studio-sub, .maker-photo { position: relative; }
.col-card img, .studio-photo img, .studio-sub img, .maker-photo img {
  filter: sepia(0.28) saturate(0.82) brightness(1.03) contrast(0.95) hue-rotate(-6deg);
}
.col-card::after, .studio-photo::after, .studio-sub::after, .maker-photo::after {
  content: ""; position: absolute; inset: 0;
  background: #B96A43; opacity: 0.14;
  mix-blend-mode: color; pointer-events: none;
  border-radius: var(--radius);
}
.col-card::after { inset: 0 0 3.4em 0; } /* キャプションを避ける */
.col-blob::after { border-radius: 58% 42% 55% 45% / 48% 52% 48% 52%; }

/* ============================================================
   S5 KILN — 140vh / 温度カウント + テーマ遷移
   ============================================================ */
.kiln { height: 140vh; position: relative; }
.kiln-sticky {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: 0 var(--pad-x);
}
/* 温度と本文の背後だけ地色を敷き、浮遊する豆粒に文字が食われないようにする */
.kiln-sticky::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(64% 46% at 50% 56%,
    color-mix(in srgb, var(--bg) 90%, transparent) 0%,
    color-mix(in srgb, var(--bg) 66%, transparent) 46%,
    transparent 78%);
}
.kiln-sticky > * { position: relative; z-index: 1; }
.kiln-temp {
  font-family: var(--font-en); font-weight: 300;
  font-size: clamp(5rem, 16vw, 14rem); line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.kiln-unit { font-size: 0.35em; margin-left: 0.1em; }
.kiln-copy { margin-top: 24px; max-width: 28em; color: var(--ink); }

/* ============================================================
   S6 STUDIO — マスク展開 + 重なり（シグネチャ）
   ============================================================ */
.studio { padding: clamp(96px, 14vh, 160px) var(--pad-x); }
.studio-inner {
  max-width: var(--content-max); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(24px, 4vw, 64px); align-items: start;
}
.studio-photo img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; border-radius: var(--radius); }
.js .studio-photo { clip-path: inset(10% 10% 10% 10% round var(--radius)); }
/* 重なりシグネチャは十分な幅があるときだけ。狭い画面では本文が写真に乗って読めなくなる */
.studio-text { margin-top: 64px; }
@media (min-width: 1100px) { .studio-text { margin-left: -40px; } }
.studio-text h2 { font-size: var(--fs-h2); font-weight: 500; line-height: 1.35; letter-spacing: 0.04em; margin-bottom: 24px; }
.studio-text p { color: var(--ink-muted); max-width: 26em; }
.studio-sub { margin-top: 40px; max-width: 320px; }
.studio-sub img { border-radius: var(--radius); }

/* ============================================================
   S7 MAKERS — 緩い縦パララックス
   ============================================================ */
.makers { padding: clamp(96px, 14vh, 160px) var(--pad-x); }
.makers > .sec-label, .makers-list { max-width: var(--content-max); margin-left: auto; margin-right: auto; }
.makers-list { list-style: none; display: flex; flex-direction: column; gap: clamp(64px, 10vh, 104px); }
.maker {
  display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: clamp(24px, 4vw, 64px); align-items: center;
}
.maker:nth-child(even) { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.maker:nth-child(even) .maker-photo { order: 2; }
.maker-photo { overflow: hidden; border-radius: var(--radius); aspect-ratio: 16 / 11; }
.maker-photo img { width: 100%; height: 120%; object-fit: cover; will-change: transform; }
.maker-text h3 { font-size: var(--fs-h3); font-weight: 600; letter-spacing: 0.08em; }
.maker-role {
  font-family: var(--font-en); font-weight: 500;
  font-size: var(--fs-label); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); margin: 8px 0 16px;
}
.maker-text p:last-child { color: var(--ink-muted); }

/* ============================================================
   S8 CLASSES
   ============================================================ */
.classes { padding: clamp(96px, 14vh, 160px) var(--pad-x); }
.classes > * { max-width: var(--content-max); margin-left: auto; margin-right: auto; }
.classes-title { font-size: var(--fs-h2); font-weight: 500; line-height: 1.35; letter-spacing: 0.04em; margin-bottom: 48px; }
.classes-grid {
  list-style: none;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}
/* --surface と --bg の明度差が小さいため、罫線で面を立てる */
.class-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 32px;
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease);
}
.class-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.class-card h3 { font-size: var(--fs-h3); font-weight: 600; margin-bottom: 8px; }
.class-price { font-family: var(--font-ja); color: var(--ink-muted); margin-bottom: 16px; }
.class-price .fr { font-family: var(--font-en); font-weight: 500; font-size: 1.5rem; color: var(--accent); }
.class-card p:last-child { color: var(--ink-muted); font-size: 0.9375rem; line-height: 1.9; }

/* ============================================================
   S9 OUTRO / CTA
   ============================================================ */
.cta {
  position: relative;
  min-height: 110vh;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: 0 var(--pad-x);
}
/* リングに集まる豆粒がコピーに重なるため、文字ブロックの背後に地色を敷く */
.cta::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(52% 34% at 50% 52%,
    color-mix(in srgb, var(--bg) 92%, transparent) 0%,
    color-mix(in srgb, var(--bg) 72%, transparent) 52%,
    transparent 82%);
}
.cta > * { position: relative; z-index: 1; }
.cta h2 { font-size: var(--fs-display); font-weight: 500; letter-spacing: 0.1em; margin-bottom: 24px; }
.cta-copy { color: var(--ink-muted); margin-bottom: 40px; }
.btn {
  display: inline-block;
  font-family: var(--font-ja); font-weight: 600;
  font-size: 1.0625rem; letter-spacing: 0.1em;
  color: var(--bg); background: var(--accent);
  text-decoration: none;
  padding: 18px 48px; border-radius: 999px;
  transition: transform 0.3s var(--ease); /* opacity は GSAP リビールと競合するため除外 */
}
.btn:hover, .btn:focus-visible { transform: translateY(-2px); }

/* ---- Footer ---- */
.site-footer {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 24px var(--pad-x);
  border-top: 1px solid var(--line);
  font-size: 0.8125rem; color: var(--ink-muted);
}
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

/* ============================================================
   Responsive
   ============================================================ */
/* ---- モバイルドロワー（≤860px のみ表示） ---- */
.mnav { display: none; position: relative; }
.mnav summary {
  list-style: none; cursor: pointer;
  font-size: 0.875rem; letter-spacing: 0.1em;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 18px;
}
.mnav summary::-webkit-details-marker { display: none; }
.mnav[open] summary { border-color: var(--accent); color: var(--accent); }
.mnav-panel {
  position: absolute; right: 0; top: calc(100% + 10px);
  min-width: 180px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.mnav-panel a {
  text-decoration: none; font-size: 0.9375rem; letter-spacing: 0.1em;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  transition: color 0.3s var(--ease);
}
.mnav-panel a:last-child { border-bottom: none; }
.mnav-panel a:hover { color: var(--accent); }

@media (max-width: 860px) {
  .site-header nav { display: none; }
  .mnav { display: block; }
  .philosophy { flex-direction: column; }
  /* 縦書きシグネチャはデスクトップ限定。モバイルは横書きへ戻す */
  .ph-vertical { writing-mode: horizontal-tb; height: auto; min-height: 0; letter-spacing: 0.12em; }
  .studio-inner { grid-template-columns: 1fr; }
  .studio-text { margin-left: 0; margin-top: 24px; }
  .maker, .maker:nth-child(even) { grid-template-columns: 1fr; }
  .maker:nth-child(even) .maker-photo { order: 0; }
}

/* ============================================================
   Reduced Motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  #gl { opacity: 0.45; }
}

/* ──────────────────────────────────────────────────────────────
   和文タイポグラフィ調整
   1. palt        … 句読点・括弧まわりの余分なアキを詰める
   2. auto-phrase … 文節単位で折り返す（「書」「く。」のような分断を防ぐ）
   3. balance     … 見出しの行長を揃え、1文字だけ落ちる行を作らない
   4. strict      … 禁則処理を厳密にし、行頭に 。 、 」 が来ないようにする
   auto-phrase / balance / pretty は非対応ブラウザでは無視されるだけで、
   崩れることはない（プログレッシブ・エンハンスメント）。
   ────────────────────────────────────────────────────────────── */
body {
  font-feature-settings: "palt" 1;
  font-kerning: normal;
  line-break: strict;
  word-break: normal;
}
h1, h2, h3, h4, h5, .kicker, dt {
  word-break: auto-phrase;
  text-wrap: balance;
}
p, li, dd, td, .note, .desc, .caption,
.lede, .lead, .statement, blockquote, figcaption {
  word-break: auto-phrase;
  text-wrap: pretty;
}
/* 手動改行は広い画面でのみ効かせ、狭い画面では自動折り返しに任せる */
@media (max-width: 640px) {
  h1 br, h2 br, h3 br,
  .lede br, .lead br, .statement br { display: none; }
  /* 例外: 欧文 h1 は <span>Warmth,</span><br><span>roasted…</span> と
     語間に空白が無いため、br を消すと "Warmth,roasted" と繋がってしまう */
  .display br { display: inline; }
}


/* ── 書体設計（見出し＝個性 / 本文＝可読性） ──────────────────────
   見出し: 欧文 Fraunces / 和文 Shippori Mincho
           （Klee One は教科書体調で、焙煎所の静謐なトーンに合わないため 2026-08-05 に外した。
             縦書きの決め台詞「一杯の美は、沈黙のなかにある。」もここで書体が決まる）
   本文  : BIZ UDPMincho（Google Fonts の和文で palt が効く数少ない書体。
           読点のあとのアキが締まり、Mac / Windows で見え方が揃う）
   欧文は先頭に置いた書体から取り、和文だけが差し替わる。 */
h1, h2, h3, h4, .lede, .lead, .kicker, .statement, blockquote {
  font-family: "Fraunces", "Shippori Mincho", serif;
}
p, li, dd, td, .note, .desc, .caption, figcaption, small {
  font-family: "BIZ UDPMincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
}


/* ── 本文書体の取りこぼし防止（2026-08-05 に対象を縮小）──
   旧版は html body :is(p, li, dd, td, .note, …) で詳細度 (0,3,4) を持たせていたため、
   シグネチャの .kiln-temp（230°C）や .col-name などサイト固有のタイポ指定を
   問答無用で潰し、Fraunces の数字が本文明朝に化けていた。
   → class を持たない「素の本文」だけに絞る。class 付き要素は上の
     `p, li, dd, td, …` ルール（詳細度 0,0,1）で明朝が当たり、
     サイト固有の指定があればそちらが正しく勝つ。 */
/* dd / td はここから外す。数値表示（.num dd / .metric dd）は dd 自身に class が付かないため、
   :not([class]) を抜けてこの規則に捕まり、巨大数字が本文書体に化けていた。 */
html body :is(p, li, figcaption):not([class]):not(code):not(pre) {
  font-family: "BIZ UDPMincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
}
