@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600&family=Outfit:wght@300;400;500;600;700&family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

:root {
  --bg:          #0b0d12;
  --bg2:         #0f1117;
  --surface:     #181b22;
  --surface2:    #1e2230;
  --border:      #252836;
  --border2:     #2e3347;
  --text:        #dde1ec;
  --text-sec:    #6b7191;
  --text-dim:    #3d4258;
  --accent:      #5b9cf6;
  --accent-g:    rgba(91,156,246,0.13);
  --accent2:     #e8624a;
  --accent3:     #58c49a;
  --sidebar-w:   256px;
  --radius:      8px;
  --radius-lg:   12px;
  --mono:        'JetBrains Mono', monospace;
  --sans:        'Outfit', 'Noto Sans JP', sans-serif;
  --t:           0.16s ease;
}

body.light {
  --bg:          #f0f2f7;
  --bg2:         #e8ebf2;
  --surface:     #ffffff;
  --surface2:    #f5f6fb;
  --border:      #dde1ec;
  --border2:     #c8cde0;
  --text:        #1a1d2e;
  --text-sec:    #555975;
  --text-dim:    #9ba0b8;
  --accent:      #2e6fe0;
  --accent-g:    rgba(46,111,224,0.09);
  --accent2:     #d44a35;
  --accent3:     #2a9e72;
}

*,*::before,*::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  transition: background var(--t), color var(--t);
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Sidebar ── */
aside#sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  top: 0; left: 0;
  z-index: 1000;
  transition: transform var(--t), background var(--t);
}

.brand {
  padding: 20px 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.brand img { width: 28px; height: 28px; border-radius: 6px; }
.brand-name { font-size: 0.92em; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.brand-sub  { font-size: 0.68em; color: var(--text-sec); font-family: var(--mono); }

nav { padding: 12px 8px; flex-grow: 1; overflow-y: auto; }

.nav-group {
  font-family: var(--mono);
  font-size: 0.62em;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 1px;
  border: none;
  background: transparent;
  color: var(--text-sec);
  cursor: pointer;
  width: 100%;
  text-align: left;
  border-radius: 6px;
  font-size: 0.86em;
  font-family: var(--sans);
  text-decoration: none;
  transition: background var(--t), color var(--t);
  position: relative;
}
.nav-item:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-g); color: var(--accent); font-weight: 500; }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.nav-icon { font-size: 0.95em; width: 15px; text-align: center; flex-shrink: 0; }

.nav-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.version-chip {
  font-family: var(--mono);
  font-size: 0.7em;
  color: var(--text-sec);
  display: flex;
  align-items: center;
  gap: 6px;
}
.version-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent3); flex-shrink: 0; }

.theme-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 11px;
  cursor: pointer;
  color: var(--text-sec);
  font-size: 0.8em;
  font-family: var(--sans);
  transition: all var(--t);
  width: 100%;
}
.theme-btn:hover { color: var(--text); border-color: var(--border2); }

/* ── Main ── */
main {
  margin-left: var(--sidebar-w);
  flex-grow: 1;
  padding: 44px 52px;
  max-width: calc(var(--sidebar-w) + 860px);
  transition: background var(--t);
}

.container { max-width: 800px; }

.page-title {
  font-size: 1.7em;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  line-height: 1.2;
}
.page-desc {
  font-size: 0.88em;
  color: var(--text-sec);
  margin-bottom: 30px;
  line-height: 1.65;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 14px;
  transition: background var(--t), border-color var(--t);
}
.card-hover {
  cursor: pointer;
  transition: all var(--t);
}
.card-hover:hover {
  border-color: var(--border2);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.section-label {
  font-family: var(--mono);
  font-size: 0.7em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
}

h2.section-title {
  font-size: 1.12em;
  font-weight: 600;
  margin: 26px 0 13px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text);
  font-size: 0.83em;
  font-family: var(--sans);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--t);
  margin-right: 7px;
  margin-bottom: 7px;
  line-height: 1;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
.btn-primary:hover { background: #4a8ae8; border-color: #4a8ae8; color: #fff; }

.meta {
  font-family: var(--mono);
  font-size: 0.73em;
  color: var(--text-sec);
  margin-bottom: 8px;
}

/* ── News modal ── */
#news-modal {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
#news-modal.show { display: flex; }
#news-modal-inner {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  max-width: 700px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.4);
}
#news-modal-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
#news-modal-header h3 { font-size: 1.05em; flex: 1; }
#news-modal-close {
  background: none; border: none;
  font-size: 1.1em; cursor: pointer;
  color: var(--text-sec); padding: 3px 7px;
  border-radius: 4px; transition: all var(--t);
}
#news-modal-close:hover { background: var(--surface2); color: var(--text); }
#news-modal-date {
  padding: 7px 22px;
  font-family: var(--mono);
  font-size: 0.76em;
  color: var(--text-sec);
  border-bottom: 1px solid var(--border);
}
#news-modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  font-size: 0.9em;
  line-height: 1.8;
}
#news-modal-body img, #news-modal-body video { max-width:100%; border-radius:6px; margin:8px 0; }
#news-modal-body h1, #news-modal-body h2 { font-size:1.05em; margin:14px 0 7px; border-bottom:1px solid var(--border); padding-bottom:4px; }
#news-modal-body h3 { font-size:.95em; margin:11px 0 5px; }
#news-modal-body p { margin:5px 0; color:var(--text-sec); }
#news-modal-body hr { border:none; border-top:1px solid var(--border); margin:11px 0; }
#news-modal-loading { text-align:center; padding:40px; color:var(--text-sec); }

/* ── Hamburger ── */
#hamburger {
  display: none;
  position: fixed; top: 13px; left: 13px;
  z-index: 1100;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 9px;
  cursor: pointer;
  color: var(--text);
  font-size: 1em;
  line-height: 1;
}

/* ── Back to top ── */
#back-to-top {
  position: fixed; bottom: 26px; right: 26px;
  width: 36px; height: 36px;
  border-radius: 7px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text-sec);
  cursor: pointer;
  opacity: 0; pointer-events: none;
  transition: all var(--t);
  font-size: 0.95em;
}
#back-to-top.show { opacity: 1; pointer-events: auto; }
#back-to-top:hover { color: var(--accent); border-color: var(--accent); }

/* ── Footer ── */
.page-footer {
  margin-top: 56px;
  padding: 18px 0 28px;
  font-size: 0.76em;
  color: var(--text-dim);
  font-family: var(--mono);
  border-top: 1px solid var(--border);
}

/* ── Blog article content ── */
.article-body {
  font-size: 0.94em;
  line-height: 1.85;
  color: var(--text-sec);
}
.article-body h1 { font-size: 1.5em; font-weight: 700; color: var(--text); margin: 32px 0 14px; letter-spacing: -0.02em; }
.article-body h2 { font-size: 1.2em; font-weight: 600; color: var(--text); margin: 28px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.article-body h3 { font-size: 1.05em; font-weight: 600; color: var(--text); margin: 20px 0 8px; }
.article-body p  { margin-bottom: 14px; }
.article-body ul, .article-body ol { padding-left: 22px; margin-bottom: 14px; }
.article-body li { margin-bottom: 5px; }
.article-body img { max-width: 100%; border-radius: 8px; margin: 16px 0; display: block; }
.article-body blockquote { border-left: 3px solid var(--accent); padding-left: 16px; color: var(--text-sec); margin: 16px 0; }
.article-body hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.article-body a { color: var(--accent); }
.article-body strong { color: var(--text); font-weight: 600; }
.article-body code { font-family: var(--mono); font-size: 0.87em; background: var(--surface2); padding: 2px 6px; border-radius: 4px; color: var(--accent); }
.article-body pre { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; overflow-x: auto; margin-bottom: 16px; }
.article-body pre code { background: none; padding: 0; color: var(--text-sec); }

/* ── Responsive ── */
@media (max-width: 860px) {
  aside#sidebar { transform: translateX(-100%); }
  aside#sidebar.show { transform: translateX(0); }
  main { margin-left: 0; padding: 56px 20px 20px; }
  #hamburger { display: block; }
  .page-title { font-size: 1.4em; }
}
