/* _refine.css — 全ページ共通のデザイン層（middleware が <head> の末尾に注入）
   2026-10-18 改訂：運営会社アルデンシア（audentia-inc.com）のデザイン言語に揃える。
   - 色：紺 #0b1d46 / 墨 #141a2b / 補助 #555e72 / 罫線 #d9dee8 / 紙 #eef1f6 / 金 #f3c74e
   - 金は「下線・アクティブ表示・細線」専用。文字色や塗りには使わない
   - 見出しは Noto Sans JP 900（明朝は使わない）、本文は palt＋行間広め
   - 角丸・影・グラデーションは使わず、2px の紺罫線と 1px の薄罫線で区切る
   - ヘッダーは白、フッターと強調帯は紺
   ページ固有 CSS と auth-gate.js の注入 CSS より優先させるため、
   ヘッダー等は `html body` を前置して詳細度を上げ、必要な箇所だけ !important を使う。 */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400%3B500%3B700%3B900&display=swap');

:root {
  --au-navy: #0b1d46;
  --au-navy2: #13306e;
  --au-ink: #141a2b;
  --au-sub: #555e72;
  --au-line: #d9dee8;
  --au-paper: #eef1f6;
  --au-gold: #f3c74e;

  /* 既存トークンを上書き（_brand.css / 各ページの :root より後に読まれる） */
  --primary: #0b1d46;
  --primary-hover: #13306e;
  --primary-bg: rgba(11, 29, 70, .05);
  --accent: #0b1d46;
  --accent-hover: #13306e;
  --text: #141a2b;
  --text-muted: #3a4256;
  --text-subtle: #555e72;
  --border: #d9dee8;
  --border-strong: #b9c1cf;
  --bg-elev: #eef1f6;
  --bg-subtle: #eef1f6;
  --serif: "Noto Sans JP", -apple-system, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  --sans: "Noto Sans JP", -apple-system, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;
  --radius-pill: 0px;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: 0 10px 30px rgba(11, 29, 70, .12);
  --rule: #d9dee8;
  --rule-strong: #0b1d46;

  /* ヘッダー配色（ダークモードで切り替える） */
  --hd-bg: rgba(255, 255, 255, .96);
  --hd-ink: #141a2b;
  --hd-sub: #555e72;
  --hd-line: #d9dee8;
  --hd-cta-bg: #0b1d46;
  --hd-cta-ink: #fff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #F0F4F9; --primary-hover: #fff; --accent: #F0F4F9;
    --text: #F0F4F9; --text-muted: #B0BBD0; --text-subtle: #8D99B3;
    --border: rgba(240, 244, 249, .14); --border-strong: rgba(240, 244, 249, .26);
    --bg-elev: #0F1F3D; --bg-subtle: #0F1F3D;
    --rule: rgba(240, 244, 249, .14); --rule-strong: #F0F4F9;
    --hd-bg: rgba(10, 21, 48, .96); --hd-ink: #F0F4F9; --hd-sub: #B0BBD0; --hd-line: rgba(240, 244, 249, .14);
    --hd-cta-bg: #F0F4F9; --hd-cta-ink: #0b1d46;
  }
}
:root[data-theme="dark"] {
  --primary: #F0F4F9; --primary-hover: #fff; --accent: #F0F4F9;
  --text: #F0F4F9; --text-muted: #B0BBD0; --text-subtle: #8D99B3;
  --border: rgba(240, 244, 249, .14); --border-strong: rgba(240, 244, 249, .26);
  --bg-elev: #0F1F3D; --bg-subtle: #0F1F3D;
  --rule: rgba(240, 244, 249, .14); --rule-strong: #F0F4F9;
  --hd-bg: rgba(10, 21, 48, .96); --hd-ink: #F0F4F9; --hd-sub: #B0BBD0; --hd-line: rgba(240, 244, 249, .14);
  --hd-cta-bg: #F0F4F9; --hd-cta-ink: #0b1d46;
}

/* ---- 文字組み ---- */
html body {
  font-family: var(--sans);
  font-feature-settings: "palt" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2 { font-family: var(--sans); font-weight: 900; letter-spacing: .01em; }
h3 { font-family: var(--sans); }
table, td, th, .metric-value, .stock-price, .stock-chg, .preset-count, .earn-date,
.ticker-price, .ticker-up, .ticker-down, .disc-date, .ir-date, .peer-code, .stock-code {
  font-variant-numeric: tabular-nums;
}
::selection { background: rgba(243, 199, 78, .4); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--au-gold); outline-offset: 3px;
}

/* ---- 点滅・脈打つ装飾は止める ---- */
.ticker-pulse, .panel-live, .hero-badge { display: none !important; }
.ticker-track { animation-duration: 90s !important; }

/* =========================================================
   ヘッダー：白地・墨の文字・金の下線・紺のCTA（アルデンシアと同じ型）
   ページにより NAV.nav > .nav-inner か HEADER.site-header の2通り
   ========================================================= */
html body .nav, html body .site-header {
  background: var(--hd-bg) !important;
  border-bottom: 1px solid var(--hd-line) !important;
  backdrop-filter: saturate(1.2) blur(6px);
  color: var(--hd-ink) !important;
  box-shadow: none !important;
}
html body .nav-brand, html body .site-header .brand, html body .brand-name,
html body .nav .nav-brand span {
  color: var(--hd-ink) !important;
  font-family: var(--sans) !important;
  font-weight: 900 !important;
  letter-spacing: .04em !important;
}
html body .nav-brand img, html body .site-header .brand img { border-radius: 0 !important; }
html body .nav-sep { background: var(--hd-line) !important; }

@media (min-width: 1025px) {
  html body .nav .nav-primary, html body .site-header .nav-link,
  html body .nav .nav-link {
    color: var(--hd-ink) !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    padding: 8px 2px !important;
    margin: 0 10px !important;
    box-shadow: inset 0 -2px 0 transparent !important;
  }
  html body .nav .nav-primary:hover, html body .nav .nav-primary.active,
  html body .site-header .nav-link:hover, html body .site-header .nav-link.active {
    color: var(--hd-ink) !important;
    background: transparent !important;
    box-shadow: inset 0 -2px 0 var(--au-gold) !important;
  }
  /* 「AIに聞く」は枠線だけの控えめなボタン */
  html body .nav .nav-primary-cta, html body .site-header .nav-cta {
    color: var(--hd-ink) !important;
    background: transparent !important;
    border: 1px solid var(--hd-ink) !important;
    border-radius: 0 !important;
    padding: 8px 16px !important;
    margin-left: 8px !important;
    box-shadow: none !important;
    font-weight: 700 !important;
  }
  html body .nav .nav-primary-cta:hover, html body .site-header .nav-cta:hover {
    background: var(--hd-ink) !important; color: var(--hd-bg) !important; box-shadow: none !important;
  }
  html body .nav .nav-sub, html body .site-header .nav-sub {
    color: var(--hd-sub) !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    font-weight: 700 !important;
  }
  html body .nav .nav-sub:hover, html body .site-header .nav-sub:hover { color: var(--hd-ink) !important; background: transparent !important; }
  html body .nav .nav-auth-login, html body .site-header .nav-auth-login {
    color: var(--hd-ink) !important; background: transparent !important; border: 0 !important; font-weight: 700 !important;
  }
}
/* 新規登録＝唯一の塗りボタン（紺） */
html body .nav-auth-signup, html body .site-header .nav-auth-signup {
  background: var(--hd-cta-bg) !important;
  color: var(--hd-cta-ink) !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 10px 18px !important;
  font-weight: 700 !important;
  letter-spacing: .04em !important;
  box-shadow: none !important;
}
html body .nav-auth-signup:hover { background: var(--au-navy2) !important; color: #fff !important; }
/* テーマ切替・ハンバーガー：墨の線 */
html body .nav button[aria-label*="テーマ"], html body .site-header button[aria-label*="テーマ"],
html body .__moat_theme_toggle, html body .__moat_hamburger {
  color: var(--hd-ink) !important;
  border: 1px solid var(--hd-line) !important;
  border-radius: 0 !important;
  background: transparent !important;
}

/* ドロワー（1024px 以下）：白地の縦リスト、行は罫線で区切る */
@media (max-width: 1024px) {
  html body .nav-links, html body .site-nav {
    background: var(--hd-bg) !important;
    border-left: 1px solid var(--hd-line) !important;
    box-shadow: -10px 0 30px rgba(11, 29, 70, .12) !important;
    gap: 0 !important;
  }
  html body .nav-links > a, html body .nav-links > button,
  html body .site-nav > a, html body .site-nav > button {
    color: var(--hd-ink) !important;
    background: transparent !important;
    border: 0 !important;
    border-bottom: 1px solid var(--hd-line) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    padding: 16px 4px !important;
  }
  html body .nav-links > .nav-primary-cta, html body .site-nav > .nav-primary-cta,
  html body .nav-links > .nav-auth-signup, html body .site-nav > .nav-auth-signup,
  html body .site-nav > .nav-cta {
    background: var(--hd-cta-bg) !important;
    color: var(--hd-cta-ink) !important;
    justify-content: center !important;
    margin-top: 14px !important;
    border-bottom: 0 !important;
  }
  html body .nav-spacer { background: transparent !important; margin: 4px 0 !important; }
  html body .__moat_nav_backdrop { background: rgba(11, 29, 70, .35) !important; backdrop-filter: none !important; }
}

/* ---- マーケットのティッカー：紙色の細い帯に ---- */
html body .ticker-bar, html body .market-ticker, html body .ticker {
  background: var(--au-paper) !important;
  color: var(--au-ink) !important;
  border-bottom: 1px solid var(--au-line) !important;
}
html body .ticker-name { color: var(--au-sub) !important; }
html body .ticker-price { color: var(--au-ink) !important; font-family: var(--sans) !important; font-weight: 700 !important; }
html body .ticker-up { color: #1d7a4c !important; font-family: var(--sans) !important; }
html body .ticker-down { color: #b4312f !important; font-family: var(--sans) !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body .ticker-bar { background: #0F1F3D !important; color: #F0F4F9 !important; border-color: rgba(240,244,249,.12) !important; }
  :root:not([data-theme="light"]) body .ticker-price { color: #F0F4F9 !important; }
}
:root[data-theme="dark"] body .ticker-bar { background: #0F1F3D !important; color: #F0F4F9 !important; border-color: rgba(240,244,249,.12) !important; }
:root[data-theme="dark"] body .ticker-price { color: #F0F4F9 !important; }

/* =========================================================
   フッター：紺の面（共通フッター #__moat_footer__）
   ========================================================= */
html body #__moat_footer__ {
  background: var(--au-navy) !important;
  color: rgba(255, 255, 255, .78) !important;
  border-top: 0 !important;
  margin-top: 0 !important;
  padding: 64px 24px 40px !important;
}
html body #__moat_footer__ * { color: inherit; }
html body #__moat_footer__ a { color: rgba(255, 255, 255, .88) !important; }
html body #__moat_footer__ a:hover { color: #fff !important; text-decoration: underline; text-underline-offset: 5px; }
html body #__moat_footer__ strong, html body #__moat_footer__ b { color: #fff !important; }
/* ページ側の <footer> は共通フッターと重複するので隠す（共通フッターがある時だけ） */
body:has(#__moat_footer__) footer:not(#__moat_footer__) { display: none !important; }

/* ---- Cookie 同意バナー：右下の小さな四角いカード ---- */
#__moat_consent_banner__ {
  left: auto !important; right: 16px !important; bottom: 16px !important; top: auto !important;
  width: min(420px, calc(100vw - 32px)) !important; max-width: none !important;
  border-radius: 0 !important; border: 1px solid var(--au-line) !important; border-top: 2px solid var(--au-navy) !important;
  box-shadow: 0 10px 30px rgba(11, 29, 70, .14) !important;
}
#__moat_consent_banner__ * { font-size: 12.5px !important; line-height: 1.75 !important; }
#__moat_consent_banner__ > * { max-width: none !important; }
#__moat_consent_banner__ button { border-radius: 0 !important; padding: 8px 16px !important; }
#__moat_consent_banner__ button:first-of-type { background: var(--au-navy) !important; color: #fff !important; border-color: var(--au-navy) !important; }
#__moat_consent_banner__ div { flex-wrap: wrap !important; gap: 8px !important; }

/* =========================================================
   部品
   ========================================================= */
/* パネル：箱ではなく、2px 紺罫線の下に見出しを置く「行」の型 */
html body .panel {
  background: transparent !important; border: 0 !important; border-top: 2px solid var(--rule-strong) !important;
  border-radius: 0 !important; padding: 18px 0 0 !important; box-shadow: none !important;
}
.panel-title::before { display: none !important; }
.panel-title { font-size: 19px !important; font-weight: 900 !important; color: var(--primary) !important; }
.panel-link { font-size: 13px; font-weight: 700; color: var(--primary); border-bottom: 2px solid var(--au-gold); padding-bottom: 2px; }
.panel-link:hover { color: var(--primary); opacity: .75; }
.panel-link:empty { display: none; }

/* ボタン：紺の四角 */
.cta-btn, .search-btn, .chat-send-btn, .upgrade-btn, .btn-primary {
  border-radius: 0 !important; transform: none !important; box-shadow: none !important;
}
.search-btn, .cta-btn, .chat-send-btn {
  background: var(--au-navy) !important; color: #fff !important; letter-spacing: .08em;
}
.search-btn:hover, .cta-btn:hover, .chat-send-btn:hover { background: var(--au-navy2) !important; }

/* 銘柄ページ：カードの浮遊感を消し、罫線と数字で読ませる */
.metric, .peer-card, .moat-deep, .moat-ev-item, .moat-cmp, .chart-box, .cta-strip, .disc-item, .stock-hero {
  box-shadow: none !important; border-radius: 0 !important;
}
.metric:hover, .peer-card:hover { transform: none !important; }
.section > h2, .section-title {
  font-family: var(--sans) !important; font-weight: 900 !important; color: var(--primary) !important;
  padding-top: 14px; border-top: 2px solid var(--rule-strong); border-bottom: 0;
}
.section > h2::before, .section-title::before { display: none !important; }
.stock-tab, .period-btn { border-radius: 0 !important; }
html body .stock-tab.active, html body .period-btn.active {
  background: var(--au-navy) !important; color: #fff !important; border-color: var(--au-navy) !important;
}
html body .stock-name { font-weight: 900 !important; font-family: var(--sans) !important; }

/* 銘柄ページ：auth-gate.js が :root に金色トークンを !important で入れるため body 側で上書き */
body:has(.stock-tabs) { --gold: #0b1d46 !important; --gold-bright: #13306e !important; --border: #d9dee8 !important; --border-strong: #b9c1cf !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body:has(.stock-tabs) { --gold: #E8D49A !important; --gold-bright: #F3E2B0 !important; --border: rgba(240,244,249,.12) !important; --border-strong: rgba(240,244,249,.22) !important; }
}
:root[data-theme="dark"] body:has(.stock-tabs) { --gold: #E8D49A !important; --gold-bright: #F3E2B0 !important; --border: rgba(240,244,249,.12) !important; --border-strong: rgba(240,244,249,.22) !important; }
body:has(.stock-tabs) .site-header { --gold: #f3c74e !important; }

/* ブログ・辞典 */
article p { line-height: 2.05; }
blockquote { border-radius: 0 !important; }

@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none !important; } }

/* 銘柄ページ末尾の質問導線：紙色の帯 */
html body .cta-strip { background: var(--au-paper) !important; border: 0 !important; border-top: 2px solid var(--au-navy) !important; }
html body .cta-strip h3 { font-weight: 900 !important; color: var(--au-navy) !important; font-family: var(--sans) !important; }
html body #__moat_footer__ p, html body #__moat_footer__ span, html body #__moat_footer__ small, html body #__moat_footer__ .__mf-disclaimer { color: rgba(255,255,255,.72) !important; }
html body .metric, html body .metric.metric-clickable { background: #fff !important; border-color: var(--au-line) !important; }
html body .metric.metric-clickable:hover { border-color: var(--au-navy) !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body .metric { background: #0F1F3D !important; border-color: rgba(240,244,249,.12) !important; } }
:root[data-theme="dark"] body .metric { background: #0F1F3D !important; border-color: rgba(240,244,249,.12) !important; }
/* 簡易ヘッダー（辞典の用語ページ・自動記事など .nav 直下に a が並ぶ型） */
html body .nav > a { color: var(--hd-ink) !important; font-weight: 700 !important; }
html body .nav > a:first-child { font-weight: 900 !important; letter-spacing: .04em; }
/* 見出しは全ページ Noto Sans JP（ページ側 :root の明朝指定より優先） */
html body h1, html body h2, html body h3, html body .post-title, html body .card-title {
  font-family: "Noto Sans JP", -apple-system, "Hiragino Sans", "Yu Gothic UI", sans-serif !important;
}
html body h1, html body h2 { font-weight: 900 !important; }

/* 数値も見出しと同じ極太ゴシック（アルデンシアの実績数値と同じ） */
html body .metric-value, html body .stock-code, html body .moat-ev-sc { font-family: "Noto Sans JP", -apple-system, "Hiragino Sans", sans-serif !important; font-weight: 900 !important; }

/* =========================================================
   共通フッター（middleware がサーバー側で挿入するメニュー構造のサイトマップ）
   ========================================================= */
html body #__moat_footer__ { padding: 72px 0 36px !important; text-align: left !important; font-family: var(--sans) !important; }
#__moat_footer__ .mf-in { max-width: 1200px; margin: 0 auto; padding: 0 6vw; }
#__moat_footer__ .mf-top { display: flex; align-items: baseline; gap: 28px; flex-wrap: wrap; padding-bottom: 28px; border-bottom: 1px solid rgba(255,255,255,.18); }
#__moat_footer__ .mf-brand { font-size: 22px; font-weight: 900; letter-spacing: .06em; color: #fff !important; text-decoration: none !important; }
#__moat_footer__ .mf-lead { margin: 0; font-size: 13px; color: rgba(255,255,255,.72) !important; }
#__moat_footer__ .mf-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 32px 28px; padding: 36px 0; border-bottom: 1px solid rgba(255,255,255,.18); }
#__moat_footer__ .mf-h { display: block; margin-bottom: 12px; font-size: 14px; font-weight: 900; color: #fff !important; text-decoration: none !important; padding-bottom: 6px; border-bottom: 2px solid #f3c74e; width: max-content; max-width: 100%; }
#__moat_footer__ ul { list-style: none; margin: 0; padding: 0; }
#__moat_footer__ li { margin: 0; }
#__moat_footer__ li a { display: block; padding: 4px 0; font-size: 13px; color: rgba(255,255,255,.78) !important; text-decoration: none !important; line-height: 1.6; }
#__moat_footer__ li a:hover { color: #fff !important; text-decoration: underline !important; text-underline-offset: 4px; }
#__moat_footer__ .__mf-disclaimer { margin: 24px 0 0 !important; max-width: 60em; font-size: 12px !important; line-height: 1.9 !important; text-align: left !important; }
#__moat_footer__ .mf-bottom { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 20px; }
#__moat_footer__ .mf-bottom nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
#__moat_footer__ .mf-bottom nav a { font-size: 12px; color: rgba(255,255,255,.72) !important; text-decoration: none !important; }
#__moat_footer__ .__mf-copy { margin: 0 !important; font-size: 12px !important; color: rgba(255,255,255,.5) !important; }
@media (max-width: 1024px) { #__moat_footer__ .mf-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { html body #__moat_footer__ { padding: 48px 0 28px !important; } #__moat_footer__ .mf-in { padding: 0 22px; } #__moat_footer__ .mf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 20px; } }

/* 記事で取り上げた企業（記事→企業分析ページの内部リンク） */
.stocks-in-article { margin: 48px 0 8px; padding-top: 16px; border-top: 2px solid var(--au-navy); }
.stocks-in-article h2 { margin: 0 0 8px !important; padding: 0 !important; border: 0 !important; font-size: 19px !important; color: var(--au-navy) !important; }
.stocks-in-article p { margin: 0 0 12px !important; font-size: 13.5px; color: var(--text-muted); }
.stocks-in-article ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 24px; }
.stocks-in-article li { margin: 0 !important; border-bottom: 1px solid var(--au-line); }
.stocks-in-article a { display: block; padding: 8px 0; font-size: 14px; font-weight: 700; color: var(--au-navy) !important; text-decoration: none; background: none !important; }
.stocks-in-article a:hover { text-decoration: underline; }

/* 銘柄ページの適時開示リスト：色付きの左帯・箱をやめ、罫線の一覧に */
html body .disc-list { border-top: 2px solid var(--au-navy); }
html body .disc-item { border: 0 !important; border-bottom: 1px solid var(--au-line) !important; border-radius: 0 !important; background: transparent !important; padding: 12px 4px !important; margin: 0 !important; box-shadow: none !important; }
html body .disc-item .disc-date { color: var(--text-subtle) !important; font-variant-numeric: tabular-nums; }
html body .disc-item .disc-desc, html body .disc-item .disc-desc a { color: var(--text) !important; font-weight: 700; }
html body .disc-item .disc-desc a:hover { color: var(--au-navy) !important; text-decoration: underline; }
html body .disc-priority-5 .disc-desc::after, html body .disc-priority-4 .disc-desc::after { content: '重要'; margin-left: 10px; font-size: 11px; font-weight: 700; color: var(--au-navy); border-bottom: 2px solid var(--au-gold); }
html body .disc-list > li { background: transparent !important; border: 0 !important; border-bottom: 1px solid var(--au-line) !important; border-radius: 0 !important; margin: 0 !important; padding: 12px 4px !important; }
html body .disc-list > li a { color: var(--text) !important; font-weight: 700; }
html body .disc-list > li a:hover { color: var(--au-navy) !important; text-decoration: underline; }

/* ヘッダーの基本レイアウト（ページ側にヘッダーCSSを持たないページ用の保険） */
@media (min-width: 1025px) {
  html body .nav .nav-inner { display: flex !important; align-items: center !important; gap: 16px !important; max-width: 1280px; margin: 0 auto; flex-wrap: nowrap !important; }
  html body .nav .nav-links { flex: 1 1 auto !important; display: flex !important; align-items: center !important; gap: 4px !important; }
  html body .nav .nav-spacer { flex: 1 1 auto !important; }
  html body .nav .nav-brand { display: inline-flex !important; align-items: center !important; gap: 10px !important; text-decoration: none !important; font-size: 18px !important; }
  html body .nav .nav-brand img { width: 30px !important; height: 30px !important; }
  html body .nav { padding: 12px 24px !important; }
}
