/* Nearia 共通デザイン基盤 v1 (nearia-ops/design/nearia.css)
 * 各サービスはこのファイルをそのまま自分のリポジトリに写して使う(CSPで外部読み込みができないため)。
 * サービスごとの個性は :root の --brand* と --font-display、背景などを上書きして出す。
 * 決まりごとの説明は docs/design-system.md。 */

:root {
  /* 文字 */
  --font-sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "BIZ UDPGothic", "Yu Gothic UI", Meiryo, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", "BIZ UDPMincho", serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --font-display: var(--font-sans);
  --fs-xs: 0.75rem;   /* 12 注記 */
  --fs-sm: 0.875rem;  /* 14 補足 */
  --fs-md: 1rem;      /* 16 本文(これより小さくしない) */
  --fs-lg: 1.125rem;  /* 18 */
  --fs-xl: 1.375rem;  /* 22 見出し小 */
  --fs-2xl: 1.75rem;  /* 28 見出し */
  --fs-3xl: 2.25rem;  /* 36 ヒーロー */
  --lh-body: 1.75;    /* 日本語の本文は広めに */
  --lh-tight: 1.35;

  /* 余白 (4px グリッド) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --gutter: 16px;          /* スマホの左右余白 */
  --measure: 640px;        /* 読み物・フォームの最大幅 */
  --wide: 1080px;          /* 一覧ページの最大幅 */

  /* 角丸・影 */
  --r-sm: 8px; --r-md: 12px; --r-lg: 20px; --r-pill: 999px;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .06), 0 1px 1px rgb(0 0 0 / .04);
  --shadow-2: 0 6px 24px rgb(0 0 0 / .10);

  /* 色: 中立色(少し暖かいグレー) */
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f0eee9;
  --ink: #1c1b19;
  --ink-2: #57544e;   /* 補足文字。白地で 7:1 以上 */
  --ink-3: #75716a;   /* 注記。白地で 4.5:1 以上 */
  --line: #e3e0d9;
  --line-strong: #c9c5bc;
  --ok: #1f7a4d; --ok-soft: #e3f3ea;
  --warn: #8a5a00; --warn-soft: #fff3d6;
  --danger: #b42318; --danger-soft: #fdecea;
  --focus: #2563eb;

  /* ブランド色(サービスごとに上書き) */
  --brand: #3b5bdb;
  --brand-ink: #ffffff;      /* ブランド色の上の文字 */
  --brand-soft: #e8ecfd;     /* 薄い背景 */
  --brand-strong: #2f49b0;   /* ホバー・文字リンク */

  --tap: 48px;               /* 押せる部品の最小の高さ */
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

/* ダークモード: サービスが --dark を使うときだけ。data-theme="light" なら常に明るい */
@media (prefers-color-scheme: dark) {
  :root[data-dark="auto"]:not([data-theme="light"]) {
    --bg: #131312; --surface: #1c1c1a; --surface-2: #262623;
    --ink: #f3f1ec; --ink-2: #c3bfb6; --ink-3: #9d998f;
    --line: #2f2e2a; --line-strong: #45433e;
    --ok-soft: #14301f; --warn-soft: #33270b; --danger-soft: #3a1512;
    --ok: #5fd19a; --warn: #f0b842; --danger: #ff8a7a;
    --shadow-1: none; --shadow-2: 0 8px 28px rgb(0 0 0 / .5);
    color-scheme: dark;
  }
}

/* ---------- 下地 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-sans); font-size: var(--fs-md); line-height: var(--lh-body);
  font-feature-settings: "palt" 0; -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere; line-break: strict;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: var(--lh-tight); margin: 0 0 var(--s3); font-feature-settings: "palt" 1; letter-spacing: .01em; }
h1 { font-size: var(--fs-2xl); } h2 { font-size: var(--fs-xl); } h3 { font-size: var(--fs-lg); }
p { margin: 0 0 var(--s4); }
a { color: var(--brand-strong); text-underline-offset: .2em; }
img, svg { max-width: 100%; height: auto; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--brand-soft); color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--s2); top: -100px; background: var(--surface); color: var(--ink); padding: var(--s2) var(--s4); border-radius: var(--r-sm); z-index: 100; }
.skip:focus { top: var(--s2); }

/* ---------- 配置 ---------- */
.n-wrap { width: 100%; max-width: var(--measure); margin-inline: auto; padding-inline: var(--gutter); }
.n-wrap--wide { max-width: var(--wide); }
.n-stack > * + * { margin-top: var(--s4); }
.n-row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.n-spacer { flex: 1; }

/* ---------- ヘッダー ---------- */
.n-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.n-header__in { display: flex; align-items: center; gap: var(--s3); min-height: 56px; }
.n-logo { display: inline-flex; align-items: center; gap: var(--s2); font-family: var(--font-display); font-weight: 800; font-size: var(--fs-lg); color: var(--ink); text-decoration: none; letter-spacing: .02em; }
.n-logo__mark { width: 28px; height: 28px; border-radius: var(--r-sm); background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 15px; }

/* ---------- ボタン ---------- */
.n-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); padding: 0 var(--s5); border-radius: var(--r-md);
  border: 1px solid transparent; background: var(--brand); color: var(--brand-ink);
  font: inherit; font-weight: 700; letter-spacing: .02em; text-decoration: none; cursor: pointer;
  transition: background .15s var(--ease), transform .1s var(--ease), box-shadow .15s var(--ease);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.n-btn:hover { background: var(--brand-strong); }
.n-btn:active { transform: translateY(1px); }
.n-btn[disabled], .n-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.n-btn--block { width: 100%; }
.n-btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.n-btn--secondary:hover { background: var(--surface-2); }
.n-btn--ghost { background: transparent; color: var(--ink-2); padding: 0 var(--s3); }
.n-btn--ghost:hover { background: var(--surface-2); color: var(--ink); }
.n-btn--danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.n-btn--sm { min-height: 36px; padding: 0 var(--s3); font-size: var(--fs-sm); border-radius: var(--r-sm); }
.n-btn.is-loading { color: transparent !important; position: relative; pointer-events: none; }
.n-btn.is-loading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--brand-ink); border-right-color: transparent; animation: n-spin .7s linear infinite; }
.n-btn--secondary.is-loading::after, .n-btn--ghost.is-loading::after { border-color: var(--ink-2); border-right-color: transparent; }
@keyframes n-spin { to { transform: rotate(360deg); } }

/* ---------- カード ---------- */
.n-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); box-shadow: var(--shadow-1); }
.n-card--flat { box-shadow: none; }
.n-card--tight { padding: var(--s4); }

/* ---------- 入力 ---------- */
.n-field { display: block; margin-bottom: var(--s5); }
.n-label { display: block; font-weight: 700; font-size: var(--fs-sm); margin-bottom: var(--s2); color: var(--ink); }
.n-label small, .n-opt { font-weight: 400; color: var(--ink-3); margin-left: var(--s1); }
.n-hint { display: block; font-size: var(--fs-sm); color: var(--ink-3); margin-top: var(--s2); line-height: 1.6; }
.n-input, .n-select, .n-textarea {
  width: 100%; min-height: var(--tap); padding: var(--s3) var(--s4);
  font: inherit; font-size: max(16px, 1rem); /* iOS の拡大を防ぐ */
  color: var(--ink); background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--r-md);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease); appearance: none; -webkit-appearance: none;
}
.n-textarea { min-height: 112px; resize: vertical; line-height: 1.7; }
.n-select { background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: var(--s7); }
.n-input::placeholder, .n-textarea::placeholder { color: var(--ink-3); }
.n-input:focus, .n-select:focus, .n-textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
.n-input[aria-invalid="true"], .n-textarea[aria-invalid="true"] { border-color: var(--danger); }
.n-pw { position: relative; }
.n-pw .n-input { padding-right: 84px; }
.n-pw__toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.n-count { float: right; font-size: var(--fs-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- チップ(選択できるタグ) ---------- */
.n-chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.n-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 var(--s4);
  border-radius: var(--r-pill); border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-size: var(--fs-sm); cursor: pointer; transition: all .15s var(--ease);
}
.n-chip:hover { border-color: var(--brand); }
.n-chip[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); font-weight: 700; }
.n-chip[aria-pressed="true"]::before { content: "✓"; }
.n-chip[disabled] { opacity: .4; cursor: not-allowed; }
.n-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); font-size: var(--fs-xs); font-weight: 600; }
.n-tag--brand { background: var(--brand-soft); color: var(--brand-strong); }

/* ---------- お知らせ・状態 ---------- */
.n-alert { display: flex; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r-md); font-size: var(--fs-sm); line-height: 1.6; background: var(--surface-2); color: var(--ink); }
.n-alert--error { background: var(--danger-soft); color: var(--danger); }
.n-alert--ok { background: var(--ok-soft); color: var(--ok); }
.n-alert--warn { background: var(--warn-soft); color: var(--warn); }
.n-alert:empty { display: none; }
.n-empty { text-align: center; padding: var(--s7) var(--s5); color: var(--ink-2); }
.n-empty__icon { font-size: 40px; line-height: 1; margin-bottom: var(--s3); }
.n-empty h3 { color: var(--ink); }
.n-skel { background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 50%, var(--surface)) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: n-shimmer 1.4s infinite; border-radius: var(--r-sm); min-height: 14px; }
@keyframes n-shimmer { to { background-position: -200% 0; } }

/* ---------- トースト ---------- */
.n-toast { position: fixed; left: 50%; bottom: calc(var(--s5) + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: var(--bg); padding: var(--s3) var(--s5); border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 600; box-shadow: var(--shadow-2); transition: all .25s var(--ease); pointer-events: none; z-index: 50; width: max-content; max-width: calc(100% - 32px); text-align: center; }
.n-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- タブ・下部ナビ ---------- */
.n-tabs { display: flex; gap: var(--s1); padding: var(--s1); background: var(--surface-2); border-radius: var(--r-md); }
.n-tabs button, .n-tabs a { flex: 1; min-height: 40px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-2); font: inherit; font-weight: 700; font-size: var(--fs-sm); cursor: pointer; text-decoration: none; display: grid; place-items: center; }
.n-tabs [aria-selected="true"], .n-tabs [aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.n-bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.n-bottomnav button, .n-bottomnav a { flex: 1; min-height: 58px; border: 0; background: none; color: var(--ink-3); font: inherit; font-size: 11px; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; text-decoration: none; position: relative; }
.n-bottomnav .ico { font-size: 22px; line-height: 1; }
.n-bottomnav [aria-current="page"] { color: var(--brand-strong); }
.n-dot { position: absolute; top: 8px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

/* ---------- ステップ表示 ---------- */
.n-steps { display: flex; gap: 6px; margin-bottom: var(--s5); }
.n-steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.n-steps i.on { background: var(--brand); }

/* ---------- フッター ---------- */
.n-footer { margin-top: var(--s8); padding: var(--s6) 0 calc(var(--s6) + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--ink-3); font-size: var(--fs-sm); }
.n-footer a { color: var(--ink-2); }
.n-footer__links { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin-bottom: var(--s3); }

@media (min-width: 768px) {
  :root { --gutter: 24px; }
  h1 { font-size: var(--fs-3xl); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---- v2 (2026-11-05): 押した感触・余白・見出し・控えめな動き ---- */
h1, h2, h3 { font-weight: 800; letter-spacing: .02em; text-wrap: balance; }
h1 { line-height: 1.3; margin-bottom: var(--s4); }
p { text-wrap: pretty; }
.n-btn { transition: background-color .15s var(--ease), transform .08s var(--ease), box-shadow .15s var(--ease); box-shadow: 0 1px 0 rgb(0 0 0 / .06), 0 2px 6px -2px color-mix(in srgb, var(--brand) 45%, transparent); -webkit-tap-highlight-color: transparent; user-select: none; }
.n-btn:active { transform: translateY(1px) scale(.97); box-shadow: none; }
.n-btn--secondary, .n-btn--ghost, .n-btn--danger { box-shadow: none; }
.n-chip:active, .n-tabs button:active { transform: scale(.96); }
/* 送信中は押せない(連打防止)。JS は is-loading か disabled を付ける */
.n-btn.is-loading, form[aria-busy="true"] button[type="submit"] { pointer-events: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 2px; }
/* ふわっと出す。.n-rise を付けた要素だけ。順番は --i で遅らせる */
@keyframes n-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.n-rise { animation: n-rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes n-pop { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
.n-pop { animation: n-pop .35s var(--ease); }
.n-hero-art { display: block; width: 100%; height: auto; }
@media (prefers-reduced-motion: reduce) { .n-rise, .n-pop { animation: none; } }
