/* kondate — 見た目は 25h デザインマスタの生成物を引く。**写さない**。
   tokens.css は `python3 03_works/systems/design/tokens-to-css.py --write` が置く (手で書かない)。
   役の名前 (--washi / --sumi / --ruri …) はマスタのものをそのまま使い、別名も再宣言もしない
   — 立てるとマスタが値を変えても製品に届かない。昼夜の切替も tokens.css が持つ。

   用途 = app (手の中の道具)。梯子の基点は tokens.css の既定 (--ladder: tool) のまま。
   規律の出どころ = 03_works/systems/design/uses/app.md。 */
@import url("tokens.css");
@import url("fonts.css");

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  /* OS 既定の灰色フラッシュを消し、応答は :active の沈み込みで返す (静かな触感) */
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--washi);
  color: var(--sumi);
  font-family: var(--gothic);
  font-size: var(--fs-body);
  line-height: var(--lh-tool);
  letter-spacing: var(--ls-tool);
  line-break: strict;
  text-wrap: pretty;
  /* 下タブの高さ + safe-area ぶんだけ下を空ける (帯の下に文章を隠さない) */
  padding-bottom: calc(var(--row) + 24px + env(safe-area-inset-bottom));
}

:where(h1, h2, h3) { font-weight: 500; line-height: var(--lh-tight); margin: 0; }

button { font: inherit; color: inherit; letter-spacing: inherit; }

:where(a) { color: var(--ruri); text-underline-offset: 2px; }

:focus-visible {
  outline: var(--sw-voice) solid var(--ruri);
  outline-offset: var(--sw-voice);
  border-radius: var(--r-site-sm);
}

/* ── app-frame (上端の額縁) — 左揃え・罫なし・貼りつかない ───────────────── */
.app-frame {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 1.1rem 1rem 0.4rem;
  max-width: var(--measure-tool);
}
.app-frame .name { font-size: var(--step-title); font-weight: 500; }
.app-frame .where { font-size: var(--step-sub); color: var(--muted); }

main { padding: 0 1rem; max-width: var(--measure-tool); }

/* ── 今日 — 断定 1 件を組版で置く (箱を持たない。飛ばないのに箱は嘘の合図) ── */
.today-date { font-size: var(--step-sub); color: var(--muted); margin: 0.8rem 0 0.2rem; }
.today-main { font-size: var(--step-title); font-weight: 500; display: flex; align-items: center; gap: 0.6rem; }
/* 写真だけの枠は、格子の行頭と同じ一片で出す (寸法の 2 段目を作らない) */
.today-main .thumb-today { width: 56px; height: 56px; }
.today-sides { font-size: var(--step-sub); color: var(--muted); margin-top: 0.3rem; }
.today-actions { margin-top: 1.4rem; }

/* ── 部品 ───────────────────────────────────────────────── */
.button-quiet {
  background: var(--surface);
  border: var(--sw-hairline) solid var(--sumi);
  border-radius: var(--r-app-sm);
  padding: 10px 18px;
  min-height: var(--row);
  cursor: pointer;
}
.button-ghost {
  background: transparent;
  border: var(--sw-hairline) solid var(--line);
  color: var(--muted);
  border-radius: var(--r-app-sm);
  padding: 10px 18px;
  min-height: var(--row);
  cursor: pointer;
}
.button-ghost:hover, .button-ghost:focus-visible { border-color: var(--ruri); color: var(--ruri); }
.button-ghost.dashed { border-style: dashed; }
.button-quiet:active, .button-ghost:active { transform: scale(var(--press-scale)); opacity: var(--op-press); }

.icon-button {
  background: transparent;
  border: none;
  color: var(--muted);
  min-width: var(--row);
  min-height: var(--row);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-button:hover, .icon-button:focus-visible { color: var(--ruri); }
.icon-button svg { width: 22px; height: 22px; }

.badge {
  border: var(--sw-hairline) solid var(--hairline);
  color: var(--muted);
  border-radius: var(--r-site-md);
  padding: 0.14rem 0.5rem;
  font-size: var(--step-min);
  white-space: nowrap;
}

.field-label { display: block; color: var(--sumi); font-size: var(--step-body); margin-bottom: 0.3rem; }
.field-help { color: var(--muted); font-size: var(--step-support); margin: 0.35rem 0 0; }

.input {
  width: 100%;
  background: var(--surface);
  border: var(--sw-hairline) solid var(--line);
  border-radius: var(--r-app-sm);
  color: var(--sumi);
  height: var(--row);
  padding: 0 0.7rem;
  font: inherit;
}
.input:focus { border-color: var(--ruri); }

.hint-band {
  background: transparent;
  color: var(--muted);
  font-size: var(--step-support);
  margin: 1rem 0;
}

/* row-list — その場で済む段は罫の行リスト (箱にしない) */
.row-list { list-style: none; margin: 0; padding: 0; }
.row-list > li { border-bottom: var(--sw-hairline) solid var(--hairline); }
.group-heading {
  color: var(--muted);
  font-size: var(--step-support);
  font-weight: 400;
  margin: 1.4rem 0 0.3rem;
}
.row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  min-height: var(--row);
  padding: 0.5rem 0;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
}
.row .dow { color: var(--muted); font-size: var(--step-sub); flex: 0 0 3.2em; }
.row .body { flex: 1 1 auto; min-width: 0; overflow-wrap: break-word; }
.row .thumb {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: var(--r-site-md);
  object-fit: cover;
  background: var(--washi-panel);
}
/* 眠らせる = 消さずに沈める。文字は muted へ (濃度で薄めない) */
.dormant .dow, .dormant .body { color: var(--muted); }

.segmented {
  display: inline-flex;
  gap: 2px;
  background: var(--washi-panel);
  border-radius: 999px;
  padding: 4px; /* spacing.half-step */
  margin: 0.6rem 0 0.2rem;
}
.segmented button {
  background: transparent;
  border: none;
  color: var(--sumi);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  min-height: 36px;
  cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ruri); }

.empty-box {
  background: transparent;
  border: var(--sw-hairline) dashed var(--hairline);
  border-radius: var(--r-app-sm);
  padding: 1.6rem 1.2rem;
  margin: 1rem 0;
}
.empty-box p { margin: 0 0 0.4rem; }
.empty-box p + p { color: var(--muted); font-size: var(--step-sub); }
.empty-box .button-ghost { margin-top: 0.9rem; }

/* undo — 起点の跡に 1 行。toast にしない (跡は必ず残す) */
.undo-trace {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--muted);
  font-size: var(--step-sub);
  margin: 0.6rem 0;
}

/* ── sheet / dialog — native <dialog> を保つ (焦点・Esc・背後の inert は OS の作法) ── */
dialog { border: none; padding: 0; color: var(--sumi); background: var(--surface); }
dialog::backdrop { background: var(--scrim); }

.sheet {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: 100%;
  max-height: 60vh;
  border-radius: var(--r-app-md) var(--r-app-md) 0 0;
  box-shadow: var(--sheet-shadow);
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  overflow-y: auto;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.8rem; }
.sheet-head h2 { font-size: var(--step-title); }

.dialog {
  max-width: 22rem;
  border-radius: var(--r-app-md);
  box-shadow: var(--shadow);
  padding: 1.2rem 1.3rem;
  margin: auto;
}
.dialog h2 { font-size: var(--step-title); margin-bottom: 0.6rem; }
.dialog .buttons { display: flex; gap: 0.6rem; margin-top: 1.2rem; }

.sheet-form { display: flex; align-items: flex-end; gap: 0.5rem; }
.sheet-form .grow { flex: 1 1 auto; }

/* ── bottom-nav — fixed bottom + safe-area、現在地だけ瑠璃 ─────────────── */
.bottom-nav {
  position: fixed;
  inset: auto 0 0 0;
  display: flex;
  background: var(--washi);
  border-top: var(--sw-hairline) solid var(--hairline);
  /* 帯そのものが muted を名乗る (部品の契約は帯に掛かっている)。中の語は
     これを継いで muted、現在地だけが瑠璃で上書きする — 見た目は変わらない
     (帯に直の文字は無く、語はすべて button の中にある) */
  color: var(--muted);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: var(--z-sticky);
}
.bottom-nav button {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: var(--step-min);
  min-height: var(--row);
  padding: 0.4rem 0;
  cursor: pointer;
}
.bottom-nav button[aria-current="page"] { color: var(--ruri); }
.bottom-nav svg { width: 22px; height: 22px; }

[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .button-quiet:active, .button-ghost:active { transform: none; }
}
