/* base.css — トークン（tokens.css）＋リセット・書体・グリッド・面の色・共通部品
 * 共通部品の接頭辞は h-（部品）と t-（文字の型）。使い方は docs/INTERFACES.md の 3 章。
 * ここはセクション担当は直さない。足りない部品は foundation に頼む（INTERFACES 8 章）。
 */
@import url("tokens.css");

/* ==================================================================
 * 1. リセット
 * ================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; border-spacing: 0; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
[hidden] { display: none !important; }

/* Lenis 1.1 の推奨 CSS（lenis/dist/lenis.css と同じ内容を内蔵） */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ==================================================================
 * 2. ページ全体
 * ================================================================== */
html { background: var(--c-forest-950); }
body {
  min-height: 100svh;
  background: var(--c-forest-950);          /* KV の絵が出る前・最暗部 */
  color: var(--c-halo);
  font-family: var(--ff-jp-body);
  font-weight: 400;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;                          /* 横スクロールを出さない（sticky を壊さない clip） */
}
::selection { background: var(--c-cream-200); color: var(--c-ink-900); }
:focus-visible { outline: 1px solid var(--c-ghost-500); outline-offset: 3px; }
main { display: block; position: relative; }

/* ==================================================================
 * 3. 面の色（セクションの根に data-surface を付ける）
 *    セクションの中では生の色ではなく、ここで決まる意味の変数を使う：
 *    --bg / --fg（主な文字）/ --fg-sub（副次）/ --fg-faint（注記）/ --rule-c（細い罫線）/ --rule-strong（締めの罫線）
 *    --dot（光の点）/ --btn-bg / --btn-fg / --ph-bg（画像の下地）/ --link-hover
 * ================================================================== */
[data-surface] { background: var(--bg); color: var(--fg); }
[data-surface="clear"],
[data-surface="forest"],
[data-surface="night"] {
  --fg: var(--c-halo);
  --fg-body: var(--c-paper-100);
  --fg-sub: var(--c-mist-200);
  --fg-faint: var(--c-sage-300);
  --rule-c: var(--c-rule-dark);
  --rule-strong: rgba(237, 236, 230, 0.6);
  --dot: var(--c-ghost-300);
  --btn-bg: var(--c-paper-100);
  --btn-fg: var(--c-ink-900);
  --btn-dot: var(--c-ghost-500);
  --ph-bg: var(--c-olive-700);
  --ph-fg: var(--c-sage-300);
  --link-hover: var(--c-ghost-300);
}
[data-surface="clear"] { --bg: transparent; }          /* KV・コンセプト：背面の固定キャンバスを見せる */
[data-surface="forest"] { --bg: var(--c-forest-800); } /* 香り（JS で 950 へ沈める） */
[data-surface="night"] { --bg: var(--c-forest-950); }  /* フッター */
[data-surface="paper"],
[data-surface="paper-50"] {
  --fg: var(--c-ink-900);
  --fg-body: var(--c-ink-900);
  --fg-sub: var(--c-ink-700);
  --fg-faint: var(--c-ink-500);
  --rule-c: var(--c-rule);
  --rule-strong: var(--c-ink-900);
  --dot: var(--c-ghost-500);
  --btn-bg: var(--c-ink-900);
  --btn-fg: var(--c-paper-100);
  --btn-dot: var(--c-ghost-300);
  --ph-bg: var(--c-cream-200);
  --ph-fg: var(--c-ink-500);
  --link-hover: var(--c-ghost-700);
}
[data-surface="paper"] { --bg: var(--c-paper-100); }     /* 特長・成分・購入 */
[data-surface="paper-50"] { --bg: var(--c-paper-50); }   /* 使い方・FAQ */

/* ==================================================================
 * 4. セクションの箱・グリッド
 * ================================================================== */
.h-section { position: relative; z-index: var(--z-content); }
.h-pad { padding-block: var(--section-pad); }            /* SP 96 / PC 160 */
.h-pad--wide { padding-block: var(--section-pad-wide); } /* SP 96 / PC 200 */

.h-container {
  width: 100%;
  padding-inline: var(--grid-margin);
}
.h-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
  column-gap: var(--grid-gutter);
}
/* SP で外余白を越えて端まで敷く（森の窓・香りの写真・購入の写真） */
@media (max-width: 767.98px) {
  .h-bleed-sp { margin-inline: calc(var(--grid-margin) * -1); }
}

/* 表示の出し分け（ブレークポイントは 768。KV の素材だけは縦横比で選ぶ＝JS 側） */
@media (max-width: 767.98px) { .h-pc { display: none !important; } }
@media (min-width: 768px) { .h-sp { display: none !important; } }

.h-vh {                       /* 見た目は消して読み上げには残す */
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ==================================================================
 * 5. 文字の型（t-）— DESIGN 1-3 のトークンをそのまま当てる
 * ================================================================== */
.t-wordmark { font-family: var(--ff-en); font-weight: 300; font-size: var(--fs-wordmark); line-height: var(--lh-wordmark); letter-spacing: var(--ls-wordmark); text-transform: uppercase; }
.t-display  { font-family: var(--ff-jp-display); font-weight: 500; font-size: var(--fs-display); line-height: var(--lh-display); letter-spacing: var(--ls-display); font-feature-settings: "palt" 1, "kern" 1; word-break: auto-phrase; line-break: strict; }
.t-h2       { font-family: var(--ff-jp-display); font-weight: 500; font-size: var(--fs-h2); line-height: var(--lh-h2); letter-spacing: var(--ls-h2); font-feature-settings: "palt" 1, "kern" 1; word-break: auto-phrase; line-break: strict; }
.t-h3       { font-family: var(--ff-jp-display); font-weight: 600; font-size: var(--fs-h3); line-height: var(--lh-h3); letter-spacing: var(--ls-h3); font-feature-settings: "palt" 1, "kern" 1; word-break: auto-phrase; line-break: strict; }
.t-lead     { font-family: var(--ff-jp-body); font-weight: 400; font-size: var(--fs-lead); line-height: var(--lh-lead); letter-spacing: var(--ls-lead); }
.t-body     { font-family: var(--ff-jp-body); font-weight: 400; font-size: var(--fs-body); line-height: var(--lh-body); letter-spacing: var(--ls-body); }
.t-small    { font-family: var(--ff-jp-body); font-weight: 400; font-size: var(--fs-small); line-height: var(--lh-small); letter-spacing: var(--ls-small); }
.t-num      { font-family: var(--ff-en-serif); font-weight: 400; font-size: calc(var(--fs-num) * 1.15); line-height: var(--lh-num); letter-spacing: var(--ls-num); font-variant-numeric: lining-nums tabular-nums; }   /* 2026-10-14 DM Mono → 欧文の明朝（字面が小さいので 1.15 倍） */
.t-price    { font-family: var(--ff-en-serif); font-weight: 400; font-size: calc(var(--fs-price) * 1.1); line-height: var(--lh-price); letter-spacing: var(--ls-price); font-variant-numeric: lining-nums tabular-nums; }   /* 2026-10-14 大きい価格も欧文の明朝。小さい価格は DM Mono のまま */
.t-label    { font-family: var(--ff-mono); font-weight: 400; font-size: var(--fs-label); line-height: var(--lh-label); letter-spacing: var(--ls-label); text-transform: uppercase; }
.t-en-sub   { font-family: var(--ff-en); font-weight: 400; font-size: var(--fs-en-sub); line-height: var(--lh-en-sub); letter-spacing: var(--ls-en-sub); text-transform: uppercase; }
.t-en       { font-family: var(--ff-en); }
/* 暗い地の h3 は 500：明るい字は暗い地で太って見える（香りの小見出しの 600 が、上の 40px の語より重く見えた） */
:is([data-surface="clear"], [data-surface="forest"], [data-surface="night"]) .t-h3 { font-weight: 500; }
/* 本文：等幅のまま、約物の空きと和欧間を整え、最後の行に1〜2字だけ残るのを避ける（Chromium系のみ） */
.t-body, .t-lead, .t-small { text-spacing-trim: normal; text-autospace: normal; line-break: strict; text-wrap: pretty; }
.t-measure  { max-width: var(--measure); }
.t-sub      { color: var(--fg-sub); }
.t-faint    { color: var(--fg-faint); }
.num        { font-family: var(--ff-mono); font-weight: 400; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; } /* 和文の中の数字 */
.t-h2 .num, .t-h3 .num, .t-display .num { font-weight: 300; }

/* ==================================================================
 * 6. 共通部品（h-）
 * ================================================================== */

/* 6-1. リングの印（ラベル B の「大きな円＋右下の小さな円」）。<svg class="h-ring"><use href="#i-ring"/></svg> */
.h-ring { width: 1em; height: 1em; flex: none; color: inherit; overflow: visible; }

/* 6-2. 光の点（直径 6px。選択中・現在地・購入ボタンの頭） */
.h-dot {
  display: inline-block; flex: none;
  width: var(--dot-size); height: var(--dot-size); border-radius: 50%;
  background: var(--dot-color, var(--dot, var(--c-ghost-500)));
  transition: scale var(--dur-2) var(--ease-out);
}

/* 6-3. 小見出し「01 — CONCEPT」（リングの印＋DM Mono 大文字） */
.h-eyebrow {
  display: flex; align-items: center; gap: 10px;
  color: var(--fg-faint);
  font-family: var(--ff-mono); font-weight: 400; font-size: var(--fs-label);
  line-height: var(--lh-label); letter-spacing: var(--ls-label); text-transform: uppercase;
}
.h-eyebrow .h-ring { width: 12px; height: 12px; }

/* 6-4. ボタン（カプセル）。塗りは面ごとの --btn-bg / --btn-fg。左に光の点を置ける */
.h-btn {
  --btn-h: 48px;
  --btn-px: 28px;
  --btn-fs: 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--btn-h); padding: 0 var(--btn-px);
  border-radius: var(--radius-btn);
  background: var(--btn-bg); color: var(--btn-fg);
  font-family: var(--ff-ja); font-weight: 500; font-size: var(--btn-fs); letter-spacing: 0.1em; line-height: 1;
  white-space: nowrap;
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}
.h-btn .h-dot { --dot-color: var(--btn-dot); }
.h-btn--xs { --btn-h: 32px; --btn-px: 14px; --btn-fs: 12px; }
.h-btn--sm { --btn-h: 40px; --btn-px: 22px; --btn-fs: 13px; }
.h-btn--lg { --btn-h: 56px; --btn-px: 32px; --btn-fs: 15px; }
.h-btn--block { display: flex; width: 100%; }
.h-btn--line { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px var(--rule-strong); }
@media (hover: hover) and (pointer: fine) {
  .h-btn:hover { background: color-mix(in srgb, var(--btn-bg), #fff 6%); }
  .h-btn--line:hover { background: transparent; }
  .h-btn:hover .h-dot { scale: 1.6; }
}

/* 6-5. 下線が左から伸びるリンク（ナビ・フッター） */
.h-link { position: relative; display: inline-block; transition: color var(--dur-2) var(--ease-out); }
.h-link::after {
  content: ""; position: absolute; left: 0; bottom: -3px; height: 1px; width: 100%;
  background: var(--link-line, var(--c-ghost-500));
  transform: scaleX(0); transform-origin: left center;
  transition: transform var(--dur-2) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .h-link:hover::after { transform: scaleX(1); }
}

/* 6-6. 罫線
 *   .h-ruled          上下に締めの罫線（ラベル B の表の上下と同じ形）
 *   .h-rows > * + *   行の間に細い罫線
 *   .mk-line          drawLines / revealFramed で描く線（色は面に合わせる。強い線は .is-strong）
 */
.h-ruled { border-block: var(--rule-w) solid var(--rule-strong); }
.h-rows > * + * { border-top: var(--rule-w) solid var(--rule-c); }
.mk-line { --mk-line-color: var(--rule-c); }
.mk-line.is-strong { --mk-line-color: var(--rule-strong); }

/* 6-7. 露出スケール（−2 … +2。大目盛り 5・小目盛り 4 本ずつ）
 *   <div class="h-scale" style="--p: .5"> … --p は 0..1（光の点の位置。JS が書く）
 *   中身は src/shell.html の「部品のひな形」をコピーする（INTERFACES 3 章）
 */
.h-scale {
  --p: 0.5;
  position: relative;
  width: var(--scale-w);
  padding-top: 12px;                         /* 光の点の分 */
  color: var(--scale-color, var(--fg-faint));
}
.h-scale__ticks { width: 100%; height: 12px; overflow: visible; }
.h-scale__dot {
  position: absolute; top: 0; left: calc(var(--p) * 100%);
  width: var(--dot-size); height: var(--dot-size); border-radius: 50%;
  background: var(--dot-color, var(--dot, var(--c-ghost-500))); translate: -50% 0;
}
/* 点が飛ばずに滑る（FAQ の開閉など、--p を時々書き換えるスケール。MOTION-PLAN 3-7）。
 * スクロールに張り付けて --p を毎フレーム書くスケール（コンセプト・香り）には付けない（遅れて追ってしまう）。
 * parts.js の scale() は既定で付ける（glide: false で外す）。HTML に書くスケールは class="h-scale h-scale--glide" */
.h-scale--glide .h-scale__dot { transition: left 0.5s var(--ease-focus); }
.h-scale__nums {
  display: flex; justify-content: space-between; margin-top: 6px;
  font-family: var(--ff-mono); font-size: 10px; line-height: 1; letter-spacing: 0;
}
.h-scale__nums > span { width: 0; display: flex; justify-content: center; white-space: nowrap; }

/* 6-8. 画像の下地とプレースホルダ（レンダが届くまで SHOTLIST の番号を出す）
 *   <div class="h-ph" data-shot="F01" style="aspect-ratio: 4 / 5"></div>
 */
.h-media { position: relative; background: var(--ph-bg); overflow: hidden; }
.h-media > img, .h-media > picture > img { width: 100%; height: 100%; object-fit: cover; }
.h-ph {
  position: relative; display: grid; place-items: center;
  background: var(--ph-bg); color: var(--ph-fg);
  font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
}
.h-ph::after { content: attr(data-shot); }

/* 6-9. ファインダーの角（森の窓の四隅 12px）。::before だけを使う（::after は .h-ph の番号と共用できるように空けておく） */
.h-corners { position: relative; }
.h-corners::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  --c: var(--corner-color, var(--c-rule));
  background:
    linear-gradient(var(--c), var(--c)) left top / 12px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) left top / 1px 12px no-repeat,
    linear-gradient(var(--c), var(--c)) right top / 12px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) right top / 1px 12px no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / 12px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / 1px 12px no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / 12px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / 1px 12px no-repeat;
}

/* ==================================================================
 * 7. 動きを減らす設定
 * ================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .mk-reveal { --mk-p: 1 !important; }
}
/* ?reduced（main.js が html に .is-reduced を付ける）でも、CSS の動きを止める */
.is-reduced .h-scale--glide .h-scale__dot { transition: none; }

/* ==================================================================
 * 8. 1 行ずつの露光・現像（kit の exposeLines。js/parts.js の bodyLines / headLines）の色を LP のトークンに合わせる
 *    露光（暗い地）のにじみ = --c-halo、現像（紙の地）の出始め = --c-cream-300（MOTION-PLAN 2-5）
 * ================================================================== */
.mk-xl.is-dark { --mk-xl-glow-color: var(--c-halo); }
.mk-xl.is-paper { --mk-xl-from: var(--c-cream-300); }

/* ==================================================================
 * 追記（purchase-footer-global）：紙の面の粒子／和文の改行
 * ================================================================== */
/* 紙の地と写真にフィルムの粒子。ヘッダー・購入バーより下。暗い地は multiply では見えないのでセクション側で overlay */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 5; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E") 0 0 / 160px;
  opacity: .05; mix-blend-mode: multiply;
}
[data-surface="forest"]:not(.kv)::after, [data-surface="night"]:not(.kv)::after {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E") 0 0 / 160px;
  opacity: .06; mix-blend-mode: overlay;
}
:lang(ja) :is(p, .t-body, .t-lead) { word-break: auto-phrase; text-wrap: pretty; }
:is(h2, h3, .t-h2, .t-h3) { text-wrap: balance; }
.ing .ing__lead.t-lead { max-width: 31em; }
/* 2 文目は分けずに次の行へ送る（「最小限のもの。」で 1 行目を終える） */
.ing .ing__lead-tail { display: block; }
/* PC：右の列（約 500px）に「…最小限のもの。」の 28 字を 1 行で収めるため、字間だけ .06em → .02em に詰める */
.ing .ing__lead.t-lead { letter-spacing: .02em; }   /* SP も同じ（1 行目「…洗うための成分。」が 342px に収まる） */
