/* Minimal CSS — design TBD */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  line-height: 1.8;
  color: #333;
  background: #fff;
}

/* Header */
.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid #ddd;
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  transition: transform 0.25s ease;
}

.site-header.is-hidden {
  transform: translateY(-100%);
}

.site-title {
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  color: #333;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Language switcher */
.lang-switcher {
  font-size: 0.875rem;
  white-space: nowrap;
}

.lang-switcher .current-lang {
  font-weight: 600;
}

/* Hamburger menu toggle */
.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

.hamburger {
  display: block;
  position: relative;
  width: 1.25rem;
  height: 2px;
  background: #333;
  transition: background 0.2s;
}

.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
  width: 1.25rem;
  height: 2px;
  background: #333;
  transition: transform 0.2s;
}

.hamburger::before {
  top: -6px;
}

.hamburger::after {
  top: 6px;
}

/* Hamburger → × when open */
.menu-toggle[aria-expanded="true"] .hamburger {
  background: transparent;
}

.menu-toggle[aria-expanded="true"] .hamburger::before {
  top: 0;
  transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .hamburger::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Navigation */
.site-nav {
  display: none;
  width: 100%;
  border-top: 1px solid #eee;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
}

.site-nav.is-open {
  display: block;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list li {
  border-bottom: 1px solid #f0f0f0;
}

.nav-list li:last-child {
  border-bottom: none;
}

.nav-list a {
  display: block;
  padding: 0.5rem 0;
  text-decoration: none;
  color: #333;
  font-size: 0.9375rem;
}

.nav-list a:hover {
  color: #1a6fb5;
}

.nav-list a[aria-current="page"] {
  font-weight: 600;
  color: #1a6fb5;
}

/* Nested nav (children) */
.nav-children {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.25rem;
}

.nav-children li {
  border-bottom: 1px solid #f0f0f0;
}

.nav-children li:last-child {
  border-bottom: none;
}

.nav-children a {
  display: block;
  padding: 0.375rem 0;
  text-decoration: none;
  color: #333;
  font-size: 0.875rem;
}

.nav-children a:hover {
  color: #1a6fb5;
}

.nav-children a[aria-current="page"] {
  font-weight: 600;
  color: #1a6fb5;
}

/* External nav link */
.nav-external {
  border-top: 1px solid #ddd;
  margin-top: 0.25rem;
  padding-top: 0.25rem;
}

.nav-external-link {
  font-size: 0.8125rem;
  color: #888;
}

.nav-external-link:hover {
  color: #1a6fb5;
}

.nav-external-link::after {
  content: " \2197";
}

/* Content */
.content {
  max-width: 48rem;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.page-summary {
  font-size: 22px;
  font-style: italic;
  color: #666;
  border-left: 3px solid #ccc;
  padding-left: 1rem;
  margin-bottom: 2rem;
}

/* Breadcrumb */
.breadcrumb {
  font-size: 0.8125rem;
  color: #888;
  margin-bottom: 1rem;
}

.breadcrumb a {
  color: #888;
  text-decoration: none;
}

.breadcrumb a:hover {
  color: #1a6fb5;
}

/* Page meta (date, reading time) */
.page-meta {
  margin-bottom: 2rem;
  font-size: 0.875rem;
  color: #888;
}

.page-meta .meta-date + .meta-reading-time::before {
  content: " / ";
}

/* Typography */
h1 { font-size: 1.75rem; line-height: 1.3; margin-top: 0; }
h2 { font-size: 1.375rem; margin-top: 2.5rem; }
h3 { font-size: 1.125rem; margin-top: 2rem; }

a { color: #1a6fb5; }
a:visited { color: #6b4c9a; }
a:hover { color: #c24914; }

blockquote {
  margin: 1.5rem 0;
  padding: 0.5rem 1rem;
  border-left: 3px solid #ccc;
  color: #555;
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  border: 1px solid #ddd;
  padding: 0.5rem 0.75rem;
  text-align: left;
}

th {
  background: #f5f5f5;
}

hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 2rem 0;
}

/* Figures */
figure {
  margin: 2rem auto;
  padding: 1rem;
  background: #f7f7f7;
  border-radius: 4px;
  text-align: center;
  max-width: 80%;
}

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

figcaption {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: #666;
  text-align: left;
}

/* Ad slots */
.ad-slot {
  margin: 2rem 0;
  text-align: center;
  min-height: 90px;
}

/* Revision history */
.revision-history {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #ddd;
  font-size: 0.875rem;
  color: #888;
}

.revision-history h2 {
  font-size: 1rem;
  color: #888;
  margin-top: 0;
}

.revision-history ul {
  padding-left: 1.25rem;
}

/* Footer */
.site-footer {
  margin-top: 4rem;
  padding: 1.5rem;
  border-top: 1px solid #ddd;
  text-align: center;
  font-size: 0.875rem;
  color: #999;
}
.footer-contact {
  margin-top: 0.25rem;
  font-size: 0.8125rem;
}

/* Sidebar (hidden on mobile, shown on desktop) */
.sidebar {
  display: none;
}

/* Desktop layout */
@media (min-width: 960px) {
  .site-header .menu-toggle,
  .site-header .lang-switcher,
  .site-nav {
    display: none !important;
  }

  .layout-wrapper {
    display: flex;
    min-height: calc(100vh - 3rem);
  }

  .sidebar {
    display: block;
    width: 14rem;
    flex-shrink: 0;
    padding: 1.5rem 1rem;
    border-left: 1px solid #eee;
    font-size: 0.875rem;
    position: sticky;
    top: 3rem;
    height: calc(100vh - 3rem);
    overflow-y: auto;
  }

  .sidebar .nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .sidebar .nav-list li {
    border-bottom: none;
  }

  .sidebar .nav-list a {
    display: block;
    padding: 0.375rem 0;
    text-decoration: none;
    color: #555;
    font-size: 0.8125rem;
  }

  .sidebar .nav-list a:hover {
    color: #1a6fb5;
  }

  .sidebar .nav-list a[aria-current="page"] {
    font-weight: 600;
    color: #1a6fb5;
  }

  .sidebar .nav-children {
    padding-left: 1rem;
  }

  .sidebar .nav-children a {
    font-size: 0.8125rem;
    padding: 0.25rem 0;
  }

  .sidebar .nav-external {
    margin-top: 0.5rem;
    border-top: 1px solid #eee;
    padding-top: 0.5rem;
  }

  .sidebar-lang {
    margin-top: 1.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid #eee;
    font-size: 0.8125rem;
  }

  .layout-main {
    flex: 1;
    min-width: 0;
  }

  .layout-main .content {
    max-width: 48rem;
    margin: 2rem auto;
  }
}

/* Responsive — mobile */
@media (max-width: 600px) {
  .content {
    padding: 0 1rem;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }

  figure {
    max-width: 100%;
  }

  .author-email {
    display: block;
  }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  body {
    color: #d4d4d4;
    background: #1a1a1a;
  }

  .site-header {
    background: #1a1a1a;
    border-bottom-color: #333;
  }

  .site-title {
    color: #d4d4d4;
  }

  .hamburger,
  .hamburger::before,
  .hamburger::after {
    background: #d4d4d4;
  }

  .menu-toggle[aria-expanded="true"] .hamburger {
    background: transparent;
  }

  .site-nav {
    border-top-color: #333;
  }

  .nav-list li {
    border-bottom-color: #2a2a2a;
  }

  .nav-list a,
  .nav-children a {
    color: #d4d4d4;
  }

  .nav-external-link {
    color: #888;
  }

  a { color: #5b9fd4; }
  a:visited { color: #a07cc5; }
  a:hover { color: #e07040; }

  .page-summary {
    color: #aaa;
    border-left-color: #555;
  }

  .breadcrumb,
  .breadcrumb a {
    color: #888;
  }

  .page-meta {
    color: #888;
  }

  blockquote {
    color: #aaa;
    border-left-color: #555;
  }

  th, td {
    border-color: #333;
  }

  th {
    background: #2a2a2a;
  }

  hr {
    border-top-color: #333;
  }

  figure {
    background: #2a2a2a;
  }

  figcaption {
    color: #aaa;
  }

  .revision-history {
    border-top-color: #333;
    color: #888;
  }

  .revision-history h2 {
    color: #888;
  }

  .site-footer {
    border-top-color: #333;
    color: #888;
  }

  .nav-external {
    border-top-color: #333;
  }

  /* Desktop sidebar dark */
  @media (min-width: 960px) {
    .sidebar {
      border-left-color: #333;
    }

    .sidebar .nav-list a {
      color: #aaa;
    }

    .sidebar .nav-external {
      border-top-color: #333;
    }

    .sidebar-lang {
      border-top-color: #333;
    }
  }
}

/* Print */
@media print {
  .site-header, .sidebar, .ad-slot { display: none; }

  .layout-wrapper { display: block; }
  .content { max-width: 100%; margin: 0; padding: 0; }

  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #666; }

  h2, h3 { break-after: avoid; }
  figure, table, blockquote { break-inside: avoid; }

  .site-footer { border-top: none; text-align: left; }
}
