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

:root {
  --bg: #0d1117;
  --bg-alt: #10161f;
  --panel: #161d29;
  --panel-2: #1b2434;
  --border: #2b3648;
  --border-soft: #222c3d;
  --text: #d7dee8;
  --text-strong: #f2f6fb;
  --text-dim: #93a0b4;
  --orange: #f74c00;
  --orange-soft: #ff7a3d;
  --mint: #3ddc97;
  --mint-dim: #2aa877;
  --code-bg: #0a0e14;
  --mono: 'JetBrains Mono', 'Courier New', monospace;
  --sans: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
  --radius: 10px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --transition: all 0.25s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 120px;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.9;
  font-size: 16px;
  overflow-wrap: break-word;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--mint);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--orange-soft);
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border-soft);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.7rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-logo {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.site-logo::before {
  content: '$ ';
  color: var(--mint);
}

.site-logo span {
  color: var(--orange);
}

.site-logo:hover {
  color: var(--text-strong);
  text-shadow: 0 0 12px rgba(247, 76, 0, 0.4);
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 0.2rem 0.4rem;
  align-items: center;
  flex-wrap: wrap;
  max-width: 900px;
  justify-content: center;
}

.nav-item a {
  display: block;
  font-weight: 500;
  color: var(--text);
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  font-size: 0.86rem;
  white-space: nowrap;
  border: 1px solid transparent;
}

.nav-item a:hover,
.nav-item a.active {
  color: var(--mint);
  background: var(--panel);
  border-color: var(--border-soft);
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 40px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 0 10px;
}

.hamburger span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--mint);
  border-radius: 2px;
  transition: var(--transition);
}

.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--border-soft);
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(13, 17, 23, 0.25) 0%, rgba(13, 17, 23, 0.55) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 4rem 1.5rem;
  max-width: 900px;
}

.hero-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--mint);
  background: rgba(10, 14, 20, 0.85);
  border: 1px solid var(--mint-dim);
  border-radius: 999px;
  padding: 0.25rem 1rem;
  margin-bottom: 1.2rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.hero h1 {
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  font-weight: 900;
  color: #ffffff;
  line-height: 1.35;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95), 0 4px 24px rgba(0, 0, 0, 0.85);
  margin-bottom: 1rem;
}

.hero h1 .accent {
  color: var(--orange-soft);
}

.hero p {
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  color: #f2f6fb;
  font-weight: 500;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.95), 0 3px 16px rgba(0, 0, 0, 0.8);
}

.hero-page {
  min-height: 320px;
}

/* ===== Layout ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.2rem;
}

.section {
  padding: 3.5rem 0;
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.section-title {
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--text-strong);
  margin-bottom: 1.6rem;
  padding-left: 1rem;
  border-left: 5px solid var(--orange);
  line-height: 1.4;
}

.section-title .mono {
  font-family: var(--mono);
  color: var(--mint);
  font-size: 0.85em;
}

.lead-text {
  max-width: 860px;
  margin-bottom: 1.4rem;
  color: var(--text);
}

/* ===== 2-column page layout ===== */
.page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 2.6rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.8rem 1.2rem 4rem;
  align-items: start;
}

.main-content {
  min-width: 0;
}

.main-content > p {
  margin-bottom: 1.3rem;
}

.article-section {
  margin-bottom: 3rem;
}

.article-section h2 {
  font-size: 1.55rem;
  font-weight: 900;
  color: var(--text-strong);
  border-left: 5px solid var(--orange);
  border-bottom: 1px solid var(--border-soft);
  padding: 0.2rem 0 0.5rem 0.9rem;
  margin-bottom: 1.4rem;
  line-height: 1.45;
}

.article-section h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--mint);
  margin: 1.8rem 0 0.9rem;
  padding-left: 0.7rem;
  border-left: 3px solid var(--mint-dim);
  line-height: 1.5;
}

.article-section p {
  margin-bottom: 1.2rem;
}

.article-section ul,
.article-section ol {
  margin: 0 0 1.3rem 1.5rem;
}

.article-section li {
  margin-bottom: 0.45rem;
}

.article-section strong {
  color: var(--text-strong);
}

/* ===== Figure / SVG ===== */
.figure-block {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.4rem 1.2rem 0.9rem;
  margin: 1.8rem 0;
}

.figure-block svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.figure-block figcaption {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 0.8rem;
  font-family: var(--mono);
}

/* ===== Code blocks ===== */
.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 1.4rem 0;
  overflow: hidden;
}

.code-block .code-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 1rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.code-block .code-head::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 16px 0 0 var(--mint), 32px 0 0 #f7c948;
  margin-right: 32px;
}

.code-block pre {
  padding: 1rem 1.2rem;
  overflow-x: auto;
  line-height: 1.7;
}

.code-block code {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: #d7e3f4;
}

.code-block .cmd {
  color: var(--mint);
}

.code-block .cmt {
  color: #667a94;
}

.code-block .out {
  color: #9fb0c6;
}

.code-block .key {
  color: var(--orange-soft);
}

.code-block .str {
  color: #f7c948;
}

code.inline {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: 0.1em 0.45em;
  color: var(--mint);
}

/* ===== Tables ===== */
.table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 640px;
  background: var(--panel);
}

table.data-table th {
  background: var(--panel-2);
  color: var(--mint);
  font-family: var(--mono);
  font-weight: 600;
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

table.data-table td {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}

table.data-table tr:last-child td {
  border-bottom: none;
}

table.data-table td.hl {
  color: var(--orange-soft);
  font-weight: 700;
}

/* ===== Callout ===== */
.callout {
  background: linear-gradient(135deg, rgba(61, 220, 151, 0.08), rgba(247, 76, 0, 0.06));
  border: 1px solid var(--border);
  border-left: 5px solid var(--mint);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin: 1.6rem 0;
}

.callout .callout-title {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--mint);
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.callout.warn {
  border-left-color: var(--orange);
}

.callout.warn .callout-title {
  color: var(--orange-soft);
}

.callout p:last-child {
  margin-bottom: 0;
}

/* ===== Ads ===== */
.amazon-banner {
  margin: 1.2rem 0;
}

.amazon-banner a {
  display: block;
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  color: var(--text-dim);
  text-align: center;
}

.amazon-banner a:hover {
  color: var(--mint);
  border-color: var(--mint-dim);
}

.ad-inline {
  margin: 1.6rem 0;
  text-align: center;
  overflow-x: auto;
}

.ad-inline img {
  max-width: 100%;
  height: auto;
}

.ad-note {
  display: block;
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: var(--mono);
  margin-bottom: 0.3rem;
  text-align: center;
}

/* ===== Sidebar ===== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 110px;
}

.sidebar-widget {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}

.sidebar-widget .widget-title {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--orange-soft);
  margin-bottom: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-soft);
}

.sidebar-widget .widget-title::before {
  content: '# ';
  color: var(--mint);
}

.sidebar-ad {
  text-align: center;
  overflow: hidden;
}

.sidebar-ad img {
  max-width: 100%;
  height: auto;
}

.toc-list {
  list-style: none;
}

.toc-list li {
  margin-bottom: 0.5rem;
  font-size: 0.86rem;
  line-height: 1.55;
}

.toc-list li a {
  color: var(--text);
  display: block;
  padding-left: 1.1em;
  position: relative;
}

.toc-list li a::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--mint);
  font-family: var(--mono);
}

.toc-list li a:hover {
  color: var(--mint);
}

.related-list {
  list-style: none;
}

.related-list li {
  margin-bottom: 0.55rem;
  font-size: 0.86rem;
  line-height: 1.55;
}

.related-list li a {
  color: var(--text);
  display: block;
  padding-left: 1.1em;
  position: relative;
}

.related-list li a::before {
  content: '->';
  position: absolute;
  left: 0;
  color: var(--orange-soft);
  font-family: var(--mono);
  font-size: 0.8em;
  top: 0.15em;
}

.related-list li a:hover {
  color: var(--orange-soft);
}

/* ===== Top page: news ===== */
.news-list {
  list-style: none;
  max-width: 900px;
}

.news-list li {
  display: flex;
  gap: 1.2rem;
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--border-soft);
  background: var(--panel);
  align-items: baseline;
}

.news-list li:first-child {
  border-radius: var(--radius) var(--radius) 0 0;
}

.news-list li:last-child {
  border-bottom: none;
  border-radius: 0 0 var(--radius) var(--radius);
}

.news-list time {
  font-family: var(--mono);
  color: var(--mint);
  font-size: 0.82rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.news-list .news-text {
  font-size: 0.92rem;
}

/* ===== Top page: cards ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.4rem;
}

.guide-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.5rem 1.4rem;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.guide-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--orange), var(--mint));
  opacity: 0;
  transition: var(--transition);
}

.guide-card:hover {
  transform: translateY(-4px);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.guide-card:hover::before {
  opacity: 1;
}

.guide-card .card-no {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--orange-soft);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.guide-card h3 {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: 0.6rem;
  line-height: 1.5;
}

.guide-card p {
  font-size: 0.86rem;
  color: var(--text-dim);
  flex-grow: 1;
  margin-bottom: 1rem;
}

.guide-card .card-link {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--mint);
  font-weight: 600;
}

.guide-card .card-link::after {
  content: ' ->';
}

.guide-card:hover .card-link {
  color: var(--orange-soft);
}

/* ===== Feature strip (top) ===== */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  margin-top: 1.8rem;
}

.feature-item {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.2rem;
  text-align: center;
}

.feature-item .feature-num {
  font-family: var(--mono);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--orange-soft);
  display: block;
  line-height: 1.3;
}

.feature-item .feature-label {
  font-size: 0.84rem;
  color: var(--text-dim);
}

/* ===== Hero image on article pages ===== */
.article-hero-img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  margin-bottom: 2rem;
  display: block;
}

/* ===== Page pager ===== */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.pager a {
  font-family: var(--mono);
  font-size: 0.86rem;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.7rem 1.1rem;
  color: var(--text);
  max-width: 48%;
}

.pager a:hover {
  border-color: var(--mint-dim);
  color: var(--mint);
}

/* ===== Footer ===== */
.site-footer {
  background: #090c11;
  border-top: 1px solid var(--border-soft);
  padding: 3rem 0 2rem;
  margin-top: 0;
}

.footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 2rem;
}

.footer-col h4 {
  font-family: var(--mono);
  font-size: 0.88rem;
  color: var(--mint);
  margin-bottom: 0.9rem;
}

.footer-col h4::before {
  content: '// ';
  color: var(--text-dim);
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: 0.45rem;
}

.footer-col a {
  color: var(--text-dim);
  font-size: 0.84rem;
}

.footer-col a:hover {
  color: var(--mint);
}

.footer-brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-strong);
  margin-bottom: 0.6rem;
}

.footer-brand span {
  color: var(--orange);
}

.footer-desc {
  font-size: 0.82rem;
  color: var(--text-dim);
}

.footer-bottom {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding: 1.2rem 1.2rem 0;
  border-top: 1px solid var(--border-soft);
  text-align: center;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.2rem 0;
  font-size: 0.8rem;
  font-family: var(--mono);
  color: var(--text-dim);
}

.breadcrumb a {
  color: var(--text-dim);
}

.breadcrumb a:hover {
  color: var(--mint);
}

.breadcrumb .sep {
  margin: 0 0.4rem;
  color: var(--border);
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .hamburger {
    display: flex;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    padding: 0.8rem 1.2rem 1.2rem;
    max-width: none;
    gap: 0.2rem;
    box-shadow: var(--shadow);
  }

  .nav-menu.open {
    display: flex;
  }

  .nav-item a {
    padding: 0.7rem 0.9rem;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-soft);
    border-radius: 0;
  }

  .page-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 15px;
  }

  .hero {
    min-height: 380px;
  }

  .section {
    padding: 2.4rem 0;
  }

  .section-title {
    font-size: 1.35rem;
  }

  .article-section h2 {
    font-size: 1.25rem;
  }

  .news-list li {
    flex-direction: column;
    gap: 0.15rem;
  }

  .pager a {
    max-width: 100%;
    width: 100%;
  }
}

/* Mobile content-width baseline. Blog-specific rules live in blog/blog.css. */
@media (max-width: 768px) {
  .page-content, .two-col-layout { padding-inline: 16px; }
  .two-col-layout, .blog-main { min-width: 0; }
  .sidebar { position: static; order: 2; }
}
