/* ================================
   DocTheme — Custom Styles
   ================================ */

/* ================================
   Japanese Typography Contract
   Profile: docs (technical documentation)
   Based on: jp-ui-contracts/templates/docs
   ================================ */

/* Base Japanese text rules */
html {
  scroll-behavior: smooth;
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
}

html:lang(ja) {
  line-break: strict;
  word-break: normal;
  overflow-wrap: anywhere;
  font-kerning: auto;
}

/* Mixed-script heading handling */
:lang(ja) h1,
:lang(ja) h2,
:lang(ja) h3 {
  word-break: auto-phrase;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}

/* Sidebar scrollbar */
aside::-webkit-scrollbar {
  width: 4px;
}

/* ================================
   Document Content Typography
   (.doc-content — prose alternative)
   ================================ */

.doc-content {
  color: #334155;
  line-height: 1.8;
  font-size: 15px;
}

/* Headings — docs profile type scale */
.doc-content h1 {
  color: #0f172a;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0;
  margin-bottom: 1rem;
  scroll-margin-top: 5rem;
}

.doc-content h2 {
  color: #0f172a;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0;
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  scroll-margin-top: 5rem;
}

.doc-content h3 {
  color: #0f172a;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  scroll-margin-top: 5rem;
}

.doc-content h4 {
  color: #0f172a;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  scroll-margin-top: 5rem;
}

/* Paragraphs */
.doc-content p {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
}

.doc-content section:first-child > h1 + p {
  font-size: 1.125rem;
  color: #64748b;
}

/* Links */
.doc-content a {
  color: #0ea5e9;
  text-decoration: none;
  font-weight: 500;
}

.doc-content a:hover {
  text-decoration: underline;
}

/* Lists */
.doc-content ul {
  list-style-type: disc;
  padding-left: 1.625rem;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
}

.doc-content ol {
  list-style-type: decimal;
  padding-left: 1.625rem;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
}

.doc-content li {
  margin-top: 0.375rem;
  margin-bottom: 0.375rem;
  padding-left: 0.375rem;
}

.doc-content li::marker {
  color: #94a3b8;
}

/* Strong & em */
.doc-content strong {
  color: #0f172a;
  font-weight: 600;
}

/* Tables — separate density from body text */
.doc-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.5;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.doc-content thead {
  border-bottom: 2px solid #e2e8f0;
}

.doc-content th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.03em;
  color: #0f172a;
  white-space: nowrap;
}

.doc-content td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
}

.doc-content tbody tr:hover {
  background-color: #f8fafc;
}

/* Inline code */
.doc-content :not(pre) > code {
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 0.25rem;
  padding: 0.125rem 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #0f172a;
  font-family: 'Menlo', 'Monaco', 'Consolas', 'Liberation Mono', 'Courier New', monospace;
}

/* Code blocks (Prism.js enhancements) */
.doc-content pre[class*="language-"] {
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.7;
  margin: 1.5rem 0;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
}

.doc-content code[class*="language-"] {
  font-family: 'Menlo', 'Monaco', 'Consolas', 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.8125rem;
}

/* Horizontal rule */
.doc-content hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 2rem 0;
}

/* Blockquote */
.doc-content blockquote {
  border-left: 4px solid #e2e8f0;
  padding-left: 1rem;
  color: #64748b;
  font-style: italic;
  margin: 1.5rem 0;
}

/* ================================
   TOC & Navigation
   ================================ */

/* TOC active link */
.toc-link.active {
  color: #0ea5e9;
  font-weight: 500;
}

.toc-link.active-parent {
  color: #334155;
  font-weight: 500;
}

/* Left nav active link */
.nav-link.active {
  color: #0ea5e9;
  background-color: #f0f9ff;
  font-weight: 500;
}

/* ================================
   Utilities
   ================================ */

/* Focus visible styles */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
  border-radius: 0.25rem;
}

/* ================================
   Callout (> [!NOTE] 等) の余白調整
   ================================ */

/* .doc-content 内の p/ul/ol マージンが Callout 内で効いて
   アイコンと本文がズレるのを打ち消す */
.doc-content .callout p,
.doc-content .callout ul,
.doc-content .callout ol,
.doc-content .callout > div > div {
  margin-top: 0;
  margin-bottom: 0;
}

/* ================================
   左サイドバーのスライドイン制御
   ================================ */

/* モバイル: 既定で画面外に退避 + トランジション定義 */
#sidebar-nav {
  transform: translateX(-100%);
  transition: transform 500ms ease-out;
}

/* モバイル: Alpine の mobileMenuOpen=true で .open が付与 → 画面内へ */
#sidebar-nav.open {
  transform: translateX(0);
}

/* デスクトップ (xl+): 常に表示、トランジション不要 */
@media (min-width: 1280px) {
  #sidebar-nav {
    transform: none !important;
    transition: none !important;
  }
}

/* Prevent body scroll when mobile menu is open */
body.menu-open {
  overflow: hidden;
}
