/* =========================================================
   Style Photo Studio — 共通：デザイントークン・リセット・部品
   設計書（ニシキ 2026-10-16）§2 トークン / §5 共通コンポーネント
   ========================================================= */
:root {
  /* 色：墨＋白＋アクセント1色 */
  --c-bg: #FFFFFF; --c-surface: #F5F5F3;
  --c-line: #E6E0D8; --c-rule: #E2E2DF;
  --c-ink: #1E1C1A; --c-head: #2E2A26; --c-text: #454240; --c-sub: #6E6A66;
  --c-accent: #8C5B45; --c-accent-tint: #F4EEEA;
  --c-on-dark: #F2F1EE; --c-on-dark-sub: #B9B6B1;
  --c-ok: #2F7D4F; --c-warn: #A86A12; --c-ng: #B3261E;
  --ff: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  --ff-num: "Helvetica Neue", Helvetica, Arial, var(--ff);
  --fs-display: 168px; --fs-h1: 56px; --fs-h2: 40px; --fs-h3: 24px; --fs-lead: 19px;
  --fs-body: 17px; --fs-ui: 16px; --fs-note: 14px; --fs-label: 12px;
  --fw-head: 700; --fw-body: 400; --fw-ui: 600; --fw-num: 300;
  --lh-head: 1.35; --lh-body: 1.85; --ls-label: .16em;
  --container: 1200px; --gutter: 40px; --sec-y: 136px; --sec-y-tight: 72px;
  --header-h: 72px; --tab-h: 64px; --tap: 48px;
  --r-0: 0; --r-s: 4px; --r-m: 8px; --r-sheet: 16px;
  --shadow-card: 0 12px 32px rgba(60, 45, 25, .08);
  --shadow-pop: 0 20px 48px rgba(30, 28, 26, .16);
  --btn-h: 48px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (min-width: 768px) and (max-width: 1199px) {
  :root { --fs-h1: 44px; --fs-h2: 32px; --fs-display: 136px; --gutter: 32px; }
}
@media (max-width: 767px) {
  :root {
    --fs-display: clamp(96px, 32vw, 128px); --fs-h1: clamp(24px, 7.4vw, 30px); --fs-h2: clamp(20px, 6.4vw, 26px);
    --fs-h3: 20px; --fs-lead: 17px; --fs-body: 16px;
    --gutter: 20px; --sec-y: 88px; --sec-y-tight: 48px; --header-h: 56px;
    --btn-h: 52px;
  }
}

/* ---------- リセット ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--c-bg); color: var(--c-text);
  font-family: var(--ff); font-size: var(--fs-body); font-weight: var(--fw-body); line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased; overflow-wrap: anywhere;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4 { color: var(--c-head); font-weight: var(--fw-head); line-height: var(--lh-head); margin: 0; letter-spacing: .01em; }
p { margin: 0; }
a { color: var(--c-ink); font-weight: var(--fw-ui); text-decoration: none; }
a:hover { color: var(--c-accent); text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.line { display: block; }
.num { font-family: var(--ff-num); font-variant-numeric: tabular-nums; }
.note { font-size: var(--fs-note); color: var(--c-sub); line-height: 1.7; }
.label { font-size: var(--fs-label); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--c-sub); font-weight: var(--fw-ui); }
.container { width: 100%; max-width: calc(var(--container) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: var(--btn-h); padding: 0 24px; border-radius: var(--r-s);
  font-size: var(--fs-ui); font-weight: var(--fw-ui); line-height: 1.3; text-align: center;
  border: 1px solid var(--c-ink); background: var(--c-ink); color: #fff; cursor: pointer;
  text-decoration: none; transition: transform .08s ease, background-color .15s ease;
}
.btn:hover { color: #fff; text-decoration: none; background: #34302C; }
.btn:active { transform: translateY(1px) scale(.98); }
.btn-secondary { background: #fff; color: var(--c-ink); }
.btn-secondary:hover { background: var(--c-surface); color: var(--c-ink); }
.btn-light { background: #fff; color: var(--c-ink); border-color: #fff; }
.btn-light:hover { background: var(--c-on-dark); color: var(--c-ink); }
.btn-block { width: 100%; }
.btn-s { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; transform: none; }
.link-btn { background: none; border: 0; padding: 0; min-height: var(--tap); color: var(--c-ink); font-weight: var(--fw-ui); cursor: pointer; display: inline-flex; align-items: center; gap: .35em; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; color: var(--c-accent); }
.link-under { text-decoration: underline; text-underline-offset: 4px; display: inline-flex; align-items: center; min-height: var(--tap); }
.disabled-reason { font-size: var(--fs-note); color: var(--c-sub); margin-top: 8px; }

/* ---------- チップ ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px; border-radius: 6px; margin: 4px 0;
  background: #fff; border: 1px solid var(--c-rule); color: var(--c-ink);
  font-size: var(--fs-ui); font-weight: 400; cursor: pointer; line-height: 1.2; white-space: nowrap;
}
.chip::after { content: ""; position: absolute; inset: -4px 0; } /* タップ領域48px */
.chip[aria-pressed="true"], .chip[aria-checked="true"], .chip.is-on { background: var(--c-ink); color: #fff; border-color: var(--c-ink); font-weight: var(--fw-ui); }
.chip[aria-pressed="true"]::before, .chip[aria-checked="true"]::before, .chip.is-on::before {
  content: ""; width: 12px; height: 7px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg) translate(1px, -2px);
}
.chip .dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .12); flex: none; }
.chip svg { width: 20px; height: 24px; flex: none; }

/* ---------- フォーム ---------- */
.field { display: block; margin: 0 0 24px; }
.field > span, .field-label { display: block; font-size: var(--fs-ui); font-weight: 700; color: var(--c-head); margin-bottom: 8px; }
.input, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea {
  width: 100%; min-height: 52px; padding: 12px 14px; border: 1px solid var(--c-rule); border-radius: var(--r-s);
  background: #fff; color: var(--c-ink); font-size: var(--fs-ui);
}
.field textarea { min-height: 96px; }
.field .hint { display: block; font-size: var(--fs-note); color: var(--c-sub); margin-top: 6px; }
.field-error { display: flex; align-items: center; gap: 6px; color: var(--c-ng); font-size: var(--fs-note); margin-top: 6px; }
.field-error svg { width: 16px; height: 16px; flex: none; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; min-height: var(--tap); cursor: pointer; font-size: var(--fs-ui); color: var(--c-text); line-height: 1.6; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--c-ink); }
.radio-row { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border: 1px solid var(--c-rule); border-radius: var(--r-s); cursor: pointer; background: #fff; }
.radio-row + .radio-row { margin-top: 12px; }
.radio-row input { position: absolute; opacity: 0; pointer-events: none; }
.radio-row .tick { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--c-rule); flex: none; display: grid; place-items: center; }
.radio-row:has(input:checked) { border: 2px solid var(--c-ink); padding: 17px 19px; }
.radio-row:has(input:checked) .tick { background: var(--c-ink); border-color: var(--c-ink); }
.radio-row:has(input:checked) .tick::after { content: ""; width: 10px; height: 6px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.radio-row:has(input:focus-visible) { outline: 2px solid var(--c-accent); outline-offset: 2px; }

/* ---------- カード（最小限）・注意表示 ---------- */
.card { background: #fff; border: 1px solid var(--c-line); border-radius: var(--r-s); box-shadow: var(--shadow-card); padding: 24px; }
.notice { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid var(--c-rule); border-radius: var(--r-s); padding: 14px 16px; font-size: var(--fs-ui); color: var(--c-text); }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 3px; color: var(--c-sub); }
.state-dot { display: inline-flex; align-items: center; gap: 8px; }
.state-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #B9B6B1; flex: none; }
.state-dot[data-state="succeeded"]::before, .state-dot[data-state="paid"]::before { background: var(--c-ok); }
.state-dot[data-state="running"]::before, .state-dot[data-state="queued"]::before, .state-dot[data-state="pending"]::before, .state-dot[data-state="partial"]::before { background: var(--c-warn); }
.state-dot[data-state="failed"]::before, .state-dot[data-state="interrupted"]::before { background: var(--c-ng); }

/* ---------- AI生成イメージ表記（写真の上） ---------- */
.ai-tag {
  position: absolute; right: 10px; bottom: 10px; z-index: 2;
  font-size: var(--fs-label); line-height: 1; letter-spacing: .04em; color: #fff;
  background: rgba(30, 28, 26, .55); padding: 6px 8px; border-radius: 2px; pointer-events: none; white-space: nowrap;
}
.ph { position: relative; display: block; overflow: hidden; background: var(--c-surface); }
.ph > img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- スケルトン ---------- */
.skeleton { position: relative; overflow: hidden; background: var(--c-surface); }
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .7), rgba(255, 255, 255, 0));
  animation: shimmer 2.4s ease-in-out infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- トースト ---------- */
.toast {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + var(--safe-b)); max-width: min(92vw, 480px);
  background: var(--c-ink); color: #fff; font-size: 15px; line-height: 1.6;
  padding: 14px 18px; border-radius: var(--r-s); box-shadow: var(--shadow-pop);
  display: flex; gap: 16px; align-items: center;
}
.toast a, .toast button { color: #fff; text-decoration: underline; background: none; border: 0; font-weight: 600; cursor: pointer; padding: 0; }
@media (min-width: 1024px) { .toast { left: auto; right: 32px; transform: none; bottom: 32px; } }

/* ---------- モーダル（SPは下からのシート・PCは中央560px） ---------- */
.modal { border: 0; padding: 0; background: transparent; max-width: none; max-height: none; width: 100%; height: 100%; margin: 0; }
.modal::backdrop { background: rgba(30, 28, 26, .4); }
.modal[open] { display: flex; align-items: flex-end; justify-content: center; }
.modal-panel {
  position: relative; width: 100%; max-height: 92vh; overflow-y: auto; background: #fff;
  border-radius: var(--r-sheet) var(--r-sheet) 0 0; padding: 28px var(--gutter) calc(24px + var(--safe-b));
}
.modal-panel::before { content: ""; position: absolute; top: 10px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--c-rule); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 6px 0 20px; }
.modal-head h2 { font-size: var(--fs-h3); }
.icon-btn { width: var(--tap); height: var(--tap); display: inline-grid; place-items: center; border: 0; background: none; color: var(--c-ink); cursor: pointer; border-radius: var(--r-s); flex: none; }
.icon-btn:hover { background: var(--c-surface); }
.icon-btn svg { width: 24px; height: 24px; }
@media (min-width: 768px) {
  .modal[open] { align-items: center; }
  .modal-panel { width: 560px; border-radius: var(--r-m); padding: 32px; box-shadow: var(--shadow-pop); }
  .modal-panel::before { display: none; }
}

/* ---------- アイコン ---------- */
.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- 表 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-ui); }
.table th, .table td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--c-rule); vertical-align: top; }
.table th { font-weight: 700; color: var(--c-head); font-size: var(--fs-note); }
.table .r { text-align: right; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* 孤立行（最後の行が1〜3文字だけになる状態）を避ける */
p, li, dd, td, figcaption, .lead { text-wrap: pretty; }
h1, h2, h3, h4, strong, b, summary, .btn, .mini-btn, label { text-wrap: balance; }
