@import "./common.css";
@import "./sidebar.css";
@import "./table.css";

:root {
  --bg: #f5f5f5;
  --surface: rgba(255, 255, 255, 0.95);
  --surface-strong: #ffffff;
  --text: #111111;
  --muted: #333333;
  --primary: #d7263d;
  --secondary: #1b57d5;
  --accent: #1a6b9a;
  --border: #d9e3f0;
  --shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 18px 38px rgba(15, 23, 42, 0.12);
  --theme-primary: #d7263d;
  --theme-secondary: #1b57d5;
  --theme-soft: #fff1f2;
  --theme-glow: rgba(27, 87, 213, 0.18);
}

/* ===== DARK MODE ===== */
html.dark {
  --bg: #1e1e1e;
  --surface: rgba(42, 42, 42, 0.97);
  --surface-strong: #2a2a2a;
  --text: #ffffff;
  --muted: #999999;
  --border: #3a3a3a;
  --accent: #4da3ff;
  --secondary: #4da3ff;
  --shadow: 0 14px 32px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 18px 38px rgba(0, 0, 0, 0.5);
}

html.dark body {
  background: #1e1e1e;
  color: var(--text);
}

html.dark .site-header {
  background: rgba(30, 30, 30, 0.97);
  border-bottom-color: #3a3a3a;
}

html.dark .button.secondary {
  background: rgba(30, 37, 48, 0.95);
  color: var(--text);
  border-color: var(--border);
}

html.dark .mini-card {
  background: linear-gradient(180deg, rgba(22, 27, 34, 0.8) 0%, rgba(13, 17, 23, 0.8) 100%);
}

html.dark .callout {
  background: rgba(22, 27, 34, 0.6);
}

html.dark .callout.warning {
  border-left-color: #e07b39;
  background: rgba(60, 30, 10, 0.55);

  font: 1.1em/1.6 "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
}

html.dark .category-card.cat-culture    { background: linear-gradient(180deg, #1e1015 0%, var(--surface) 55%); }
html.dark .category-card.cat-life       { background: linear-gradient(180deg, #0e1a16 0%, var(--surface) 55%); }
html.dark .category-card.cat-work       { background: linear-gradient(180deg, #0e1624 0%, var(--surface) 55%); }
html.dark .category-card.cat-education  { background: linear-gradient(180deg, #16101e 0%, var(--surface) 55%); }
html.dark .category-card.cat-jp-learning { background: linear-gradient(180deg, #1e1208 0%, var(--surface) 55%); }

/* Dark mode: text & heading contrast fixes */
html.dark h1,
html.dark h2,
html.dark h3 {
  color: var(--text);
}

html.dark body[class*="theme-"] .card h2,
html.dark body[class*="theme-"] .card h3 {
  color: var(--text);
}

.section.card p,
.section.card li,
.section.card td,
.section.card dt,
.section.card dd,
.section.card strong {
  color: var(--text);
}

html.dark .lead {
  color: var(--text);
}

html.dark .breadcrumb {
  color: var(--text);
}

html.dark .breadcrumb a {
  color: var(--accent);
}

/* Dark mode: hero card & card background overrides */
html.dark .hero-card {
  background: linear-gradient(135deg, rgba(22, 27, 34, 0.98), rgba(30, 38, 52, 0.96));
  border-color: #30363d;
}

html.dark .hero-card::before {
  background:
    linear-gradient(135deg, rgba(30, 40, 60, 0.6), rgba(22, 27, 34, 0.3)),
    linear-gradient(135deg, var(--theme-soft), rgba(22, 27, 34, 0.3));
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

html.dark .card {
  background: var(--surface);
  border-color: var(--border);
}

html.dark .section.card {
  background: var(--surface);
}

html.dark body.theme-culture   { --theme-soft: rgba(215, 38, 61, 0.15); }
html.dark body.theme-life      { --theme-soft: rgba(15, 118, 110, 0.15); }
html.dark body.theme-work      { --theme-soft: rgba(29, 78, 216, 0.15); }
html.dark body.theme-education { --theme-soft: rgba(124, 58, 237, 0.15); }

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  background: #eef4ff;
  border-color: #d9e7ff;
  transform: translateY(-1px);
}

html.dark .theme-toggle-btn:hover {
  background: rgba(30, 37, 48, 0.95);
  border-color: #444c5a;
}

body.theme-culture {
  --theme-primary: #d7263d;
  --theme-secondary: #9f1239;
  --theme-soft: #fff1f2;
  --theme-glow: rgba(215, 38, 61, 0.2);
}

body.theme-life {
  --theme-primary: #0f766e;
  --theme-secondary: #0f5f5a;
  --theme-soft: #ecfdf5;
  --theme-glow: rgba(15, 118, 110, 0.2);
}

body.theme-work {
  --theme-primary: #1d4ed8;
  --theme-secondary: #1e3a8a;
  --theme-soft: #eff6ff;
  --theme-glow: rgba(29, 78, 216, 0.2);
}

body.theme-education {
  --theme-primary: #7c3aed;
  --theme-secondary: #5b21b6;
  --theme-soft: #f5f3ff;
  --theme-glow: rgba(124, 58, 237, 0.2);
}

.hero {
  padding: 56px 0 28px;
}

.hero-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(241, 246, 255, 0.96));
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.hero-card::before {
  content: "";
  position: absolute;
  top: 16px;
  right: 16px;
  width: min(34%, 220px);
  height: 120px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.38)),
    linear-gradient(135deg, var(--theme-soft), rgba(255, 255, 255, 0.48));
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  pointer-events: none;
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -50px;
  bottom: -70px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--theme-glow), transparent 68%);
  pointer-events: none;
}

.hero-card > * {
  position: relative;
  z-index: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--theme-soft);
  color: var(--theme-primary);
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: inset 0 0 0 1px rgba(215, 38, 61, 0.08);
}

body:not([class*="theme-"]) .badge::before {
  content: "🗂️";
}

body.theme-culture .badge::before {
  content: "🏮";
}

body.theme-life .badge::before {
  content: "🌿";
}

body.theme-work .badge::before {
  content: "💼";
}

body.theme-education .badge::before {
  content: "📘";
}

.lead {
  max-width: 64ch;
  font-size: 1.05rem;
  color: var(--text);
}

.author-section .lead {
  max-width: none;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.stats-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.stat-pill {
  min-width: 120px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.stat-pill strong {
  display: block;
  font-size: 1.15rem;
  color: var(--theme-secondary);
}

.magazine-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(260px, 1fr);
  gap: 18px;
  align-items: stretch;
}

.lead-story {
  min-height: 100%;
}

.homepage-hero {
  max-width: none;
}

.homepage-hero::before {
  content: none;
}

.hero-summary {
  max-width: 64ch;
  margin-top: 18px;
}

.hero-summary ul {
  margin: 10px 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
}

.hero-summary .note {
  margin-top: 12px;
}

.hero-points {
  margin: 14px 0 0;
  padding-left: 1.2rem;
  max-width: 60ch;
  color: var(--text);
}

.hero-points li {
  margin-bottom: 2px;
  font-weight: 600;
}

.editorial-panel {
  justify-content: flex-start;
}

.mini-list {
  display: grid;
  gap: 10px;
}

.mini-item {
  display: block;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdff 0%, #f6f9ff 100%);
  border: 1px solid var(--border);
}

.mini-item strong {
  display: block;
  color: var(--theme-secondary);
}

.mini-item span {
  display: block;
  margin-top: 2px;
  font-size: 0.92rem;
  color: var(--muted);
}

.category-card,
.feature-card {
  gap: 14px;
}

.card-thumb {
  position: relative;
  height: 80px;
  border-radius: 12px;
  overflow: hidden;
  border: none;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-thumb::after {
  content: none;
}

/* Compact article list for index pages */
.article-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.article-list li {
  border-bottom: none;
}

.article-list li:first-child {
  border-top: none;
}

.article-list a.article-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  text-decoration: none;
  color: #ffffff;
  background: linear-gradient(135deg, #0f766e, #1a6b9a);
  border: 1px solid #0e5f5a;
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.2);
  transition: border-color 0.15s, background 0.15s, transform 0.1s, box-shadow 0.15s;
  cursor: pointer;
}

.article-list a.article-row:hover {
  background: linear-gradient(135deg, #0d6b64, #155b84);
  border-color: #0b4f63;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.28);
}

.article-list a.article-row:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}

.article-list .article-row-title {
  font-weight: 700;
  color: #ffffff;
  flex-shrink: 0;
  min-width: 0;
}

.article-list .article-row-desc {
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html.dark .article-list .article-row-desc {
  color: #cccccc;
}

html.dark .article-list a.article-row {
  color: #ffffff;
  background: linear-gradient(135deg, #1f5f8a, #194d70);
  border-color: #2f6f9a;
}

html.dark .article-list a.article-row:hover {
  background: linear-gradient(135deg, #246d9d, #1c5c86);
  border-color: #60a5fa;
}

html.dark .article-list .article-row-title {
  color: #ffffff;
}

.article-list .article-row-arrow {
  margin-left: auto;
  flex-shrink: 0;
  color: #ffffff;
  font-size: 1rem;
  opacity: 0.75;
  transition: opacity 0.15s, transform 0.15s;
}

.article-list a.article-row:hover .article-row-arrow {
  opacity: 1;
  transform: translateX(3px);
}

@media (max-width: 600px) {
  .article-list a.article-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .article-list .article-row-desc {
    white-space: normal;
  }
  .article-list .article-row-arrow {
    display: none;
  }
}

.card-thumb::before {
  font-size: 2.2rem;
  line-height: 1;
}

.thumb-culture {
  background: linear-gradient(135deg, #ffe4ea 0%, #ffd2dc 48%, #fff7f8 100%);
}

.thumb-culture::before {
  content: "🏮";
}

.thumb-life {
  background: linear-gradient(135deg, #dff7ef 0%, #c8f0e5 48%, #f7fffb 100%);
}

.thumb-life::before {
  content: "🌿";
}

.thumb-work {
  background: linear-gradient(135deg, #e1ecff 0%, #d2e2ff 48%, #f8fbff 100%);
}

.thumb-work::before {
  content: "💼";
}

.thumb-education {
  background: linear-gradient(135deg, #efe5ff 0%, #e4d6ff 48%, #faf7ff 100%);
}

.thumb-jp-learning {
  background: linear-gradient(135deg, #ffe9d9 0%, #ffdcbc 48%, #fff9f3 100%);
}

.thumb-jp-learning::before {
  content: "🗣️";
}

.category-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--theme-soft) 78%, #ffffff 22%);
  border: 1px solid color-mix(in srgb, var(--theme-primary) 34%, #ffffff 66%);
  font-size: 1rem;
  line-height: 1;
  flex: 0 0 auto;
}

.thumb-education::before {
  content: "📘";
}

/* Per-category card accent colors */
.category-card.cat-culture {
  border-top: 4px solid #db5672;
  background: linear-gradient(180deg, #fff4f6 0%, var(--surface) 55%);
}

.category-card.cat-life {
  border-top: 4px solid #28b87a;
  background: linear-gradient(180deg, #f3fffb 0%, var(--surface) 55%);
}

.category-card.cat-work {
  border-top: 4px solid #4a7ee8;
  background: linear-gradient(180deg, #f4f8ff 0%, var(--surface) 55%);
}

.category-card.cat-education {
  border-top: 4px solid #8862d6;
  background: linear-gradient(180deg, #f8f4ff 0%, var(--surface) 55%);
}

.category-card.cat-jp-learning {
  border-top: 4px solid #e07039;
  background: linear-gradient(180deg, #fff7f3 0%, var(--surface) 55%);
}

.category-card.cat-culture   .button.secondary { background: #db5672; color: #fff; border-color: #db5672; }
.category-card.cat-life      .button.secondary { background: #28b87a; color: #fff; border-color: #28b87a; }
.category-card.cat-work      .button.secondary { background: #4a7ee8; color: #fff; border-color: #4a7ee8; }
.category-card.cat-education .button.secondary { background: #8862d6; color: #fff; border-color: #8862d6; }
.category-card.cat-jp-learning .button.secondary { background: #e07039; color: #fff; border-color: #e07039; }

.info-grid,
.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.mini-card {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fbfdff 0%, #f7faff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.mini-card h3 {
  margin-bottom: 6px;
  font-size: 1rem;
  color: var(--theme-secondary);
}

.callout {
  margin-top: 14px;
  padding: 14px 16px;
  border-left: 4px solid var(--theme-primary);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
}

.callout strong {
  color: var(--theme-secondary);
}

.callout.warning {
  border-left-color: #e07b39;
  background: linear-gradient(180deg, #fff8f4 0%, #fdeee4 100%);
}

.callout.warning strong {
  color: #c05a1a;
}

.section.card strong {
  color: #d7263d;
}

html.dark .section.card strong {
  color: var(--text);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.section.card.conclusion-highlight {
  background: linear-gradient(
    135deg,
    #f2f9ff,
    #edf7f2
  );
  border-color: #b9d8ef;
  border-left: 6px solid #2b6cb0;
  box-shadow: 0 14px 32px rgba(43, 108, 176, 0.16);
}

.section.card.conclusion-highlight h2 {
  color: #173b66;
}

html.dark .section.card.conclusion-highlight {
  background: linear-gradient(
    135deg,
    #1b2433,
    #1a2d28
  );
  border-color: #3f5d7a;
  border-left-color: #60a5fa;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
}

html.dark .section.card.conclusion-highlight h2 {
  color: #ffffff;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  background: #eef4ff;
  color: var(--secondary);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.qa-list {
  display: grid;
  gap: 12px;
  padding-left: 0;
  margin: 0;
  list-style: none;
}

.compact-block {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 85%, var(--theme-soft) 15%);
  padding: 12px 14px;
}

.compact-block summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--theme-secondary);
  list-style: none;
}

.compact-block summary::-webkit-details-marker {
  display: none;
}

.compact-block summary::before {
  content: "+";
  display: inline-block;
  width: 1.1rem;
  color: var(--theme-primary);
  font-weight: 800;
}

.compact-block[open] summary::before {
  content: "-";
}

.compact-block > p,
.compact-block > ul,
.compact-block > ol {
  margin-top: 10px;
}

.qa-list li {
  background: #ffffff;
  border: 1px solid #dde8dd;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  color: #333333;
}

html.dark .qa-list li {
  background: #2f4f3f;
  border-color: rgba(144, 238, 144, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: #cccccc;
}

.qa-list strong {
  color: #222222;
}

.qa-list li strong:first-child {
  color: #2b7bb9;
}

html.dark .qa-list strong {
  color: #afc8ff;
}

html.dark .qa-list li strong:first-child {
  color: #81c784;
}

body[class*="theme-"] .section.card h2,
body[class*="theme-"] .card h2,
body[class*="theme-"] .card h3 {
  color: #222222;
}

html.dark body[class*="theme-"] .section.card h2,
html.dark body[class*="theme-"] .card h2,
html.dark body[class*="theme-"] .card h3 {
  color: var(--text);
}

main p a:not(.button),
main li a:not(.button) {
  color: #2b5fa8;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}

main p a:not(.button):hover,
main li a:not(.button):hover {
  color: var(--primary);
}

.breadcrumb {
  margin: 18px 0 0;
  color: var(--text);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  color: #555555;
  margin: 0 2px;
}

