/* AIニュースまとめ — shared site styles */

:root {
  --c-bg:        #f4f5f7;
  --c-surface:   #ffffff;
  --c-surface-2: #fafbfc;
  --c-border:    #e3e6eb;
  --c-border-2:  #d4d8df;
  --c-ink:       #1d2129;
  --c-ink-2:     #4a5260;
  --c-ink-3:     #8a90a0;
  --c-shiro:     #4a90e2;       /* シロの瞳の青 */
  --c-shiro-bg:  #f0f6ff;
  --c-shiro-border: #cfe1f7;
  --c-kuro:      #2c2c2c;
  --c-kuro-bg:   #2c2c2c;
  --c-kuro-border:#1a1a1a;
  --c-accent:    #e74c3c;       /* コメント数バッジ・タグ */
  --c-accent-2:  #c0392b;
  --c-line:      #06c755;       /* LINEっぽい既読チェック用 */

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;

  --shadow-card: 0 1px 2px rgba(20,30,50,.04), 0 4px 16px rgba(20,30,50,.06);
  --shadow-pop:  0 8px 32px rgba(20,30,50,.12);

  --content-max: 1200px;
  --gap-card: 18px;

  --f-jp: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN",
          "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--f-jp);
  background: var(--c-bg);
  color: var(--c-ink);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Top bar / header ---------- */
.topbar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 14px 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--c-ink);
}
.brand__chars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
}
.brand__char {
  width: 56px;
  height: 72px;
  object-fit: cover;
  object-position: top center;
}
.brand__char--shiro { transform: translateY(2px); }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.brand__title em {
  color: var(--c-accent);
  font-style: normal;
}
.brand__tag {
  font-size: 11px;
  color: var(--c-ink-3);
  margin-top: 2px;
}

.search {
  position: relative;
  max-width: 420px;
  width: 100%;
  justify-self: center;
}
.search__input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 38px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 999px;
  font: inherit;
  color: var(--c-ink);
  outline: none;
  transition: border-color .15s, background .15s;
}
.search__input:focus {
  border-color: var(--c-shiro);
  background: var(--c-surface);
}
.search__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-ink-3);
  pointer-events: none;
}

.nav {
  display: flex;
  gap: 4px;
  font-size: 14px;
  color: var(--c-ink-2);
}
.nav a {
  padding: 8px 12px;
  border-radius: var(--r-sm);
  transition: background .15s;
}
.nav a:hover { background: var(--c-bg); color: var(--c-ink); }
.nav a.is-active { color: var(--c-ink); font-weight: 600; }

/* ---------- Sub bar / page intro strip ---------- */
.subbar {
  background: linear-gradient(180deg, #fafbfc 0%, var(--c-bg) 100%);
  border-bottom: 1px solid var(--c-border);
}
.subbar__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 22px 24px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.subbar__lead {
  font-size: 13px;
  color: var(--c-ink-2);
}
.subbar__lead strong { color: var(--c-ink); font-weight: 700; }
.subbar__count {
  font-size: 12px;
  color: var(--c-ink-3);
}

/* ---------- Layout ---------- */
.shell {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 304px;
  gap: 28px;
  align-items: start;
}
.main { min-width: 0; }
.aside { min-width: 0; }

/* ---------- Card grid ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.toolbar__title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toolbar__title::before {
  content: "";
  width: 4px;
  height: 18px;
  background: var(--c-accent);
  border-radius: 2px;
}
.toolbar__sort {
  display: flex;
  gap: 4px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 999px;
  padding: 3px;
}
.toolbar__sort button {
  border: 0;
  background: transparent;
  font-size: 12px;
  color: var(--c-ink-2);
  padding: 6px 12px;
  border-radius: 999px;
  transition: background .15s, color .15s;
}
.toolbar__sort button.is-active {
  background: var(--c-ink);
  color: #fff;
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-card);
}

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  box-shadow: var(--shadow-card);
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--c-border-2);
  box-shadow: 0 4px 8px rgba(20,30,50,.06), 0 12px 28px rgba(20,30,50,.10);
}
.card__thumb {
  aspect-ratio: 16 / 9;
  background: #e9ecf1;
  position: relative;
  overflow: hidden;
}
.card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card__hot {
  position: absolute;
  top: 10px;
  left: 10px;
  background: linear-gradient(135deg, #ff7849 0%, var(--c-accent) 100%);
  color: #fff;
  font-weight: 800;
  font-size: 11.5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  box-shadow: 0 3px 8px rgba(231,76,60,.32);
  letter-spacing: 0.02em;
}
.card__read {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255,255,255,.92);
  color: var(--c-ink-2);
  font-weight: 700;
  font-size: 10.5px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  letter-spacing: 0.04em;
  border: 1px solid var(--c-border);
  backdrop-filter: blur(4px);
}
.card--read { opacity: 0.78; }
.card--read .card__title { color: var(--c-ink-2); font-weight: 600; }
.card--read:hover { opacity: 1; }
.card__source {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(0,0,0,.62);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  backdrop-filter: blur(4px);
}
.card__body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.card__title {
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.005em;
  color: var(--c-ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--c-ink-3);
  margin-top: auto;
}
.card__date { display: inline-flex; align-items: center; gap: 5px; }
.card__date svg { width: 12px; height: 12px; }
.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #fdecea;
  color: var(--c-accent-2);
  font-weight: 600;
  border: 1px solid #fbd9d4;
  text-decoration: none;
  transition: background .15s;
  white-space: nowrap;
}
.tag:hover { background: #fbd9d4; }
.tag--ghost {
  background: var(--c-bg);
  color: var(--c-ink-2);
  border-color: var(--c-border);
}
.tag--ghost:hover { background: var(--c-border); }

/* ---------- Sidebar ---------- */
.aside-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}
.aside-card__title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--c-ink);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
}
.aside-card__title::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: var(--c-accent);
  display: inline-block;
}
.aside-card__title--shiro::before { background: var(--c-shiro); }
.aside-card__title--ink::before { background: var(--c-ink); }
.aside-card__title--accent::before { background: var(--c-accent); }

/* weekly link card */
.aside-card--weekly { background: linear-gradient(135deg, #fff7f5 0%, var(--c-surface) 60%); }
.weekly-link {
  display: block;
  padding: 14px 14px;
  background: var(--c-ink);
  color: #fff;
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.weekly-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(20,30,50,.18);
}
.weekly-link__title {
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}
.weekly-link__sub {
  font-size: 11px;
  opacity: .78;
  line-height: 1.55;
}

.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.rank-list li { display: flex; gap: 10px; }
.rank-list__no {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--c-bg);
  color: var(--c-ink-2);
  font-weight: 800;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rank-list li:nth-child(1) .rank-list__no { background: var(--c-accent); color: #fff; }
.rank-list li:nth-child(2) .rank-list__no { background: #f39c12; color: #fff; }
.rank-list li:nth-child(3) .rank-list__no { background: #95a5a6; color: #fff; }
.rank-list__title {
  font-size: 13px;
  line-height: 1.5;
  color: var(--c-ink);
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rank-list a { display: block; }
.rank-list a:hover .rank-list__title { color: var(--c-accent-2); }
.rank-list__meta {
  font-size: 11px;
  color: var(--c-ink-3);
  margin-top: 2px;
}

.tagcloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tagcloud .tag { font-size: 12px; }
.tagcloud .tag .count { color: var(--c-ink-3); margin-left: 4px; font-weight: 500; }

.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-list li {
  border-bottom: 1px dashed var(--c-border);
}
.archive-list li:last-child { border-bottom: 0; }
.archive-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 2px;
  font-size: 13px;
  color: var(--c-ink-2);
}
.archive-list a:hover { color: var(--c-ink); }
.archive-list .count {
  font-size: 11px;
  color: var(--c-ink-3);
  background: var(--c-bg);
  padding: 2px 8px;
  border-radius: 999px;
}

.cast {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.cast__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 6px 12px;
  border-radius: var(--r-sm);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
}
.cast__card--shiro { background: var(--c-shiro-bg); border-color: var(--c-shiro-border); }
.cast__card--kuro  { background: #1f1f1f; border-color: #0d0d0d; color: #fff; }
.cast__img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center center;
  background: #fff;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  display: block;
  margin: 0 auto;
}
.cast__name {
  font-size: 13px;
  font-weight: 800;
  margin-top: 6px;
}
.cast__role {
  font-size: 10.5px;
  margin-top: 2px;
  opacity: .75;
}
.cast__quote {
  font-size: 10.5px;
  margin-top: 8px;
  color: inherit;
  opacity: .9;
  line-height: 1.5;
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 60px;
  padding: 28px 24px 36px;
  background: #1a1d24;
  color: #b0b6c2;
  font-size: 13px;
}
.footer__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: space-between;
}
.footer__brand {
  font-weight: 800;
  color: #fff;
  letter-spacing: .03em;
  margin-bottom: 8px;
}
.footer__note {
  font-size: 11.5px;
  color: #6c7280;
  max-width: 560px;
  line-height: 1.6;
}
.footer__links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer__links a { color: #b0b6c2; }
.footer__links a:hover { color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 18px;
    gap: 18px;
  }
  .topbar__inner {
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand nav" "search search";
    gap: 12px;
    padding: 12px 16px;
  }
  .brand { grid-area: brand; gap: 10px; align-items: center; }
  .nav   { grid-area: nav; }
  .search { grid-area: search; max-width: none; }
  .brand__title { font-size: 18px; line-height: 1.2; white-space: nowrap; }
  .brand__char { width: 36px; height: 46px; }
  .brand__tag { font-size: 10px; line-height: 1.3; }
  .cards { grid-template-columns: 1fr; }
  .subbar__inner { padding: 16px; }
}
@media (max-width: 720px) {
  /* スマホ：ブランド部分は省スペース化（!important で強制適用） */
  .topbar__inner { padding: 10px 14px !important; gap: 8px !important; }
  .brand { gap: 8px !important; align-items: center !important; }
  .brand__chars { display: none !important; } /* スマホではチビキャラ非表示（topbar幅確保） */
  .brand__text { line-height: 1.1 !important; }
  .brand__title { font-size: 16px !important; line-height: 1.1 !important; white-space: nowrap !important; }
  .brand__tag { display: none !important; } /* キャッチコピーは非表示で省スペース */
  .nav { gap: 0 !important; font-size: 12px !important; }
  .nav a { padding: 6px 8px !important; }
}
@media (max-width: 480px) {
  /* 小さいスマホ：さらに最適化 */
  .topbar__inner { padding: 8px 12px !important; gap: 6px !important; }
  .brand__title { font-size: 15px !important; }
  .nav a { padding: 5px 6px !important; font-size: 11px !important; }
  .toolbar__sort button { padding: 5px 10px; font-size: 11px; }
  .subbar__lead { font-size: 12px; }
  .subbar__inner { padding: 12px 14px; }
  /* hero のキャラ画像はやや小さく */
  .hero__char-img { width: 64px; height: 84px; }
  .hero__bubble { font-size: 10px; padding: 3px 8px; }
  .hero__copy h1 { font-size: 16px; }
  .hero__copy p { font-size: 12px; }
}

/* ---------- Cookie 同意バナー ---------- */
.consent-banner {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  max-width: 720px;
  margin: 0 auto;
  background: var(--c-ink);
  color: #fff;
  padding: 16px 20px;
  border-radius: var(--r-md);
  box-shadow: 0 12px 36px rgba(0,0,0,.35);
  z-index: 9999;
  animation: consent-slide-up 0.3s ease-out;
}
@keyframes consent-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.consent-banner__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.consent-banner__text {
  flex: 1;
  min-width: 240px;
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255,255,255,.92);
}
.consent-banner__text a {
  color: #fff;
  text-decoration: underline;
}
.consent-banner__text a:hover { color: var(--c-accent); }
.consent-banner__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.consent-banner__btn {
  border: 0;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s, background .15s;
}
.consent-banner__btn--accept {
  background: var(--c-accent);
  color: #fff;
}
.consent-banner__btn--accept:hover {
  background: #ff5e4a;
  transform: translateY(-1px);
}
.consent-banner__btn--reject {
  background: transparent;
  color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.3);
}
.consent-banner__btn--reject:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}
@media (max-width: 720px) {
  .consent-banner { left: 8px; right: 8px; bottom: 8px; padding: 14px 16px; }
  .consent-banner__inner { flex-direction: column; align-items: stretch; }
  .consent-banner__actions { justify-content: stretch; }
  .consent-banner__btn { flex: 1; }
}

/* density tweak */
body[data-density="compact"] { --gap-card: 12px; }
body[data-density="compact"] .card__body { padding: 10px 12px 12px; gap: 8px; }
body[data-density="compact"] .card__title { font-size: 14.5px; -webkit-line-clamp: 2; }
body[data-density="roomy"] { --gap-card: 24px; }
body[data-density="roomy"] .card__body { padding: 18px 20px 20px; gap: 12px; }
body[data-density="roomy"] .card__title { font-size: 16.5px; }

/* accent override hook */
body[data-accent="indigo"]  { --c-accent: #4f46e5; --c-accent-2: #3b34b3; }
body[data-accent="emerald"] { --c-accent: #10a36b; --c-accent-2: #0a8557; }
body[data-accent="amber"]   { --c-accent: #d97706; --c-accent-2: #b45309; }
body[data-accent="rose"]    { --c-accent: #e11d48; --c-accent-2: #b00d36; }
body[data-accent="indigo"] .tag,
body[data-accent="emerald"] .tag,
body[data-accent="amber"] .tag,
body[data-accent="rose"] .tag {
  background: color-mix(in oklab, var(--c-accent) 12%, white);
  color: var(--c-accent-2);
  border-color: color-mix(in oklab, var(--c-accent) 20%, white);
}

/* ダークモードは廃止（ライトモード固定）
   理由: システム設定によるダーク自動適用で見栄えが崩れるため、
   Claude Design 元デザインに忠実にライトモード一本化。 */

/* ============================================================
   アクセシビリティ強化
   ============================================================ */

/* Skip to main content（キーボード操作時のみ表示） */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  z-index: 10000;
  padding: 12px 18px;
  background: var(--c-ink);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus {
  top: 0;
  outline: 3px solid var(--c-accent);
  outline-offset: -3px;
}

/* フォーカスインジケーター（キーボード操作時のみ） */
*:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
  border-radius: 2px;
}
button:focus-visible, a:focus-visible {
  outline-offset: 3px;
}

/* スクリーンリーダー専用テキスト */
.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;
}

/* prefers-reduced-motion: 動きを減らしたい人向け */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   印刷CSS（@media print）
   ============================================================ */
@media print {
  .topbar, .aside, .footer, .toolbar__sort,
  .share, .cta-consulting, .actions, .cta,
  .theme-toggle, .consent-banner, #tweaksPanel,
  .ai-notice__detail, .article__source-link {
    display: none !important;
  }
  body {
    background: #fff !important;
    font-size: 11pt;
    color: #000;
  }
  .shell { grid-template-columns: 1fr; padding: 0; }
  .article {
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
  }
  .article__hero { aspect-ratio: 16/8; max-height: 280px; }
  .article__title { color: #000 !important; text-shadow: none !important; }
  .dialog {
    background: #fff !important;
    background-image: none !important;
    padding: 12px 0 !important;
  }
  .bubble {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    background: #fff !important;
    color: #000 !important;
  }
  .bubble--kuro { background: #e8f5e0 !important; }
  .bubble-name { color: #000 !important; text-shadow: none !important; }
  .summary { background: #f8f8f8 !important; }
  a { color: #000 !important; text-decoration: underline; }
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666;
  }
  a[href^="#"]::after, a[href^="javascript:"]::after { content: ""; }
  /* 改ページ制御 */
  h1, h2, h3 { page-break-after: avoid; }
  .bubble-row, .actions__step { page-break-inside: avoid; }
}
