/* ===== DEZIGN GLOBAL CSS ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  overflow-x: hidden;
  position: relative;
}

body {
  font-family: 'Outfit', 'Noto Sans JP', sans-serif;
  background: #0d1117;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== DESIGN TOKENS ===== */
:root {
  --white: #ffffff;
  --gray-50: #fcfcfc;

  /*--gray-50: #f8fafc;*/
  --gray-100: #f0f4f8;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --navy: #0f2d52;
  --navy-mid: #1a3f6f;
  --navy-light: #1e4d8c;
  --blue: #2563eb;
  --blue-mid: #3b82f6;
  --blue-light: #93c5fd;
  --blue-pale: #dbeafe;
  --blue-ghost: #eff6ff;
  --ink: #0f172a;
  --ink-mid: #334155;
  --ink-light: #64748b;
  --ink-faint: #94a3b8;
  --border: #e2e8f0;
  --border-mid: #cbd5e1;
  --ff-heading: 'Outfit', 'Noto Sans JP', sans-serif;
  --ff-body: 'Outfit', 'Noto Sans JP', sans-serif;
  --ff-mono: 'DM Mono', monospace;
}

/* ===== HEADER ===== */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.site-logo {
  font-family: var(--ff-heading);
  font-size: 21px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.1em;
  text-decoration: none;
}

.site-logo em {
  font-style: normal;
  color: var(--blue);
}

.site-nav-container {
  display: flex;
  align-items: center;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
}

.site-nav li {
  list-style: none;
}

.site-nav a {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-light);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 14px;
  transition: all 0.18s;
  border-radius: 4px;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--blue);
}

.site-nav a.active {
  background: var(--blue-ghost);
}

.site-nav-header {
  display: none;
}

.mobile-menu-sidebar {
  display: none;
}

/* Header Right Elements */
.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.lang-switcher {
  display: flex;
  gap: 10px;
  font-size: 11px;
  font-family: var(--ff-heading);
  letter-spacing: 0.05em;
}

.lang-link {
  color: var(--ink-faint);
  text-decoration: none;
  font-weight: 700;
}

.lang-link.active {
  color: var(--blue);
}

.lang-sep {
  color: var(--border-mid);
  opacity: 0.5;
}

.search-trigger {
  background: none;
  border: none;
  color: var(--ink-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
}

.search-hint {
  font-size: 10px;
  color: var(--ink-faint);
  font-weight: 500;
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Menu Toggle Button */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1100;
}

.menu-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--navy);
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.menu-toggle.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ===== LAYOUT ===== */
.site-bg {
  background: var(--gray-50);
  min-height: calc(100vh - 60px);
}

.layout-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 60px;
  align-items: start;
}

/* ===== SIDEBAR ===== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: -webkit-sticky;
  position: sticky;
  top: 24px;
  align-self: start;
}

.s-widget {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.s-title {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-light);
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--gray-50);
}

.s-cat-list {
  list-style: none;
}

.s-cat-list li a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--ink-mid);
  text-decoration: none;
  border-bottom: 1px solid var(--gray-50);
  transition: all 0.15s;
}

.s-cat-list li:last-child a {
  border-bottom: none;
}

.s-cat-list li a:hover {
  background: var(--blue-ghost);
  color: var(--blue);
}

.s-cat-list li {
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
}

.s-cat-list li.cat-tips {
  border-left-color: #00f2ff;
}

.s-cat-list li.cat-column {
  border-left-color: #ff00a2;
}

.s-cat-list li.cat-html {
  border-left-color: #ff9d00;
}

.s-cat-list li.cat-css {
  border-left-color: #6e00ff;
}

.s-cat-list li a .cnt {
  font-size: 11px;
  color: var(--ink-faint);
  background: var(--gray-100);
  padding: 1px 7px;
  border-radius: 10px;
}

.tag-cloud {
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.side-tag {
  font-size: 11px;
  color: var(--ink-mid);
  background: var(--gray-100);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.tag:hover {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}

.s-recent-list {
  list-style: none;
}

.s-recent-list li a {
  display: block;
  padding: 10px 16px;
  text-decoration: none;
  border-bottom: 1px solid var(--gray-50);
  transition: background 0.15s;
}

.s-recent-list li:last-child a {
  border-bottom: none;
}

.s-recent-list li a:hover {
  background: var(--blue-ghost);
}

.s-recent-title {
  font-size: 12px;
  color: var(--ink);
  line-height: 1.5;
  margin-bottom: 3px;
}

.s-recent-meta {
  font-size: 11px;
  color: var(--ink-faint);
}

/* TOC in sidebar */
.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-list li {
  margin: 0;
}

.toc-list a {
  display: block;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--ink-light);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.2s;
}

.toc-list a:hover {
  background: var(--blue-ghost);
  color: var(--blue);
}

.toc-list a.active {
  color: var(--blue);
  font-weight: 700;
  border-left: 2px solid var(--blue);
  background: var(--blue-ghost);
}

/* Profile widget */
.profile-box {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-light), var(--blue-mid));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-heading);
  font-size: 22px;
  color: var(--white);
  margin-bottom: 12px;
  font-weight: 700;
}

.profile-name {
  font-family: var(--ff-heading);
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 4px;
}

.profile-role {
  font-size: 11px;
  color: var(--blue);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.profile-bio {
  font-size: 12px;
  color: var(--ink-light);
  line-height: 1.65;
  margin-bottom: 14px;
}

.profile-link {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue);
  text-decoration: none;
  border: 1px solid var(--blue-light);
  padding: 5px 14px;
  border-radius: 3px;
  transition: all 0.15s;
}

.profile-link:hover {
  background: var(--blue);
  color: var(--white);
}

/* ===== PAGE TITLE BAR ===== */
.page-title-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 28px 32px 30px;
}

.page-title-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.breadcrumb {
  font-size: 11px;
  color: var(--ink-faint);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

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

.page-title-bar h2 {
  font-family: var(--ff-heading);
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--navy);
  padding: 32px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-logo {
  font-family: var(--ff-heading);
  font-size: 18px;
  color: var(--white);
  letter-spacing: 0.1em;
  font-weight: 700;
}

.footer-logo em {
  font-style: normal;
  color: var(--blue-light);
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--blue-light);
}

.footer-copy {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.25);
}

/* RESPONSIVE BASE */
@media (max-width: 1024px) {
  .layout-wrap {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .sidebar {
    position: static;
    align-self: auto;
  }

  .footer-inner {
    flex-direction: column;
    gap: 24px;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 1100;
    /* Higher than body overlay (1040) */
  }

  .header-inner {
    height: 56px;
    padding: 0 16px;
  }

  .site-logo {
    font-size: 19px;
  }

  .header-right {
    gap: 8px; /* Reduced gap from 12px */
  }

  .lang-switcher {
    gap: 6px;
    font-size: 10px;
  }

  .search-hint {
    display: none;
  }

  /* Hamburger Menu Implementation */
  .menu-toggle {
    display: flex;
  }

  .site-nav-container {
    position: fixed;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background: var(--white);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    padding: 20px 0 60px;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    flex-direction: column;
    align-items: stretch;
    overflow-y: auto;
    transform: translateX(100%);
    visibility: hidden;
    pointer-events: none;
  }

  .site-nav-container.active {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  .site-nav-header {
    display: block;
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
    font-family: var(--ff-heading);
    font-weight: 700;
    font-size: 14px;
    color: var(--navy);
  }

  .site-nav {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0;
    padding: 0 10px;
  }

  .site-nav li {
    width: 100%;
  }

  .site-nav a {
    display: block;
    font-size: 15px;
    padding: 14px 20px;
    width: 100%;
    color: var(--ink);
    border-radius: 6px;
  }

  /* Mobile Sidebar in Menu */
  .mobile-menu-sidebar {
    display: flex;
    margin-top: 30px;
    padding: 0 16px;
    flex-direction: column;
    gap: 24px;
  }

  .mobile-menu-sidebar .s-widget {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--gray-50);
  }

  .mobile-menu-sidebar .s-title {
    font-size: 10px;
    padding: 10px 16px;
    background: var(--white);
  }

  body.menu-open {
    overflow: hidden;
  }

  body.menu-open::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1040;
    animation: fadeIn 0.3s forwards;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
    }

    to {
      opacity: 1;
    }
  }

  .page-title-bar {
    padding: 24px 16px;
  }

  .page-title-bar h2 {
    font-size: 22px;
  }
}

@media (max-width: 480px) {
  .site-logo {
    font-size: 17px;
  }
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.3);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--navy-light);
  transform: translateY(-4px);
  box-shadow: 0 6px 25px rgba(37, 99, 235, 0.4);
}