/* ============================================================
   279 デザインシステム v4 — Base Styles
   配信URL: https://design.279agent.jp/v4/base.css
   依存: tokens.css を先に読み込むこと
   バージョン: v1.0.0 (2026-05-01)

   使い方:
     <link rel="stylesheet" href="https://design.279agent.jp/v4/tokens.css">
     <link rel="stylesheet" href="https://design.279agent.jp/v4/base.css">

   このファイルは v4 共通の body / heading / フォーム要素 / リンクの
   ベーススタイルを提供します。Tailwind / shadcn と併用可。
   ============================================================ */

body {
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-base);
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* v4: 見出しは明朝 */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: var(--letter-tight);
  color: var(--color-ink);
  margin: 0;
}

h1 { font-size: var(--text-h1); line-height: var(--leading-snug); }
h2 { font-size: var(--text-h2); line-height: var(--leading-snug); }
h3 { font-size: var(--text-xl); line-height: var(--leading-snug); }
h4 { font-size: var(--text-lg); line-height: var(--leading-snug); }
h5 { font-size: var(--text-md); line-height: var(--leading-snug); }

/* リンク（インライン） */
a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { color: var(--color-primary-dark); }

/* フォーム要素のデフォルト文字色（Tailwind v4 リセット対策） */
input, select, textarea, button {
  color: var(--color-ink);
  font-family: var(--font-base);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-ink-muted);
}

/* フォーカスリング（共通） */
*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* 選択範囲 */
::selection {
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
}

/* ============================================================
 * モバイルヘッダー / ドロワー共通クラス（since v4.2.0 / rule25 / rule26）
 *
 * <two79-mobile-header> Web Component を使わないアプリ向けの
 * 素のクラスベース実装。Component と同じ視覚仕様を再現する。
 *
 * 期待する DOM 構造:
 *   <header class="two79-mobile-header" style="--app-color:#3a8a5a">
 *     <button class="two79-mh-hamburger" aria-expanded="false" aria-controls="drawer">
 *       <i class="ti ti-menu-2"></i>
 *     </button>
 *     <i class="ti ti-{icon}"></i>
 *     <h1 class="two79-mh-title">現在ページ</h1>
 *   </header>
 *
 *   <div class="two79-drawer-backdrop" data-open="false"></div>
 *   <aside class="two79-drawer" id="drawer" role="dialog" aria-modal="true"
 *          aria-label="ナビゲーション" data-open="false" inert>
 *     ...
 *   </aside>
 *
 * 開閉: 親要素に data-open="true|false" を付与。
 * lg(1024px) 以上では .two79-mobile-header が非表示になる。
 * ============================================================ */

.two79-mobile-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 8px 0 4px;
  background: var(--app-color, var(--color-primary));
  color: #ffffff;
  font-family: var(--font-base);
}
@media (min-width: 1024px) {
  .two79-mobile-header { display: none; }
}

.two79-mh-hamburger {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  border-radius: 8px;
  padding: 0;
}
.two79-mh-hamburger:hover { background: rgba(255,255,255,0.12); }
.two79-mh-hamburger:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: -3px;
}
.two79-mh-hamburger i { font-size: 22px; }

.two79-mh-title {
  font-family: var(--font-serif, "Noto Serif JP", serif);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}

.two79-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 40;
}
.two79-drawer-backdrop[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
}

.two79-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(280px, 80vw);
  height: 100dvh;
  background: #ffffff;
  box-shadow: 4px 0 24px rgba(0,0,0,0.18);
  transform: translateX(-100%);
  transition: transform 240ms cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 41;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.two79-drawer[data-open="true"] {
  transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
  .two79-drawer,
  .two79-drawer-backdrop { transition: none; }
}

/* バッジ最小サイズ（rule07 補強） */
.vm-badge,
.two79-badge {
  font-size: 12px !important;
  line-height: 1.2;
}
