:root {
  --bg: #f6f7fb;
  --panel: #ffd7f8;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #EAB308;
  --primary-contrast: #111;
  --border: #e5e7eb;
  --shadow: 0 6px 16px rgba(0, 0, 0, .06);
  --radius: 14px;
  --radius-sm: 10px;
  --header-h: 56px;
}

.m-plus-rounded-1c-regular {
  font-family: "M PLUS Rounded 1c", sans-serif;
  font-weight: 400;
  font-style: normal;
}

.hamburger {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  align-items: center;
  justify-content: center;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  margin: 3px 0;
  transition: transform .2s, opacity .2s;
}

/* 開いたときの“×”アニメ */
body.nav-open .hamburger span:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}

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

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

html,body {
  font-family: "M PLUS Rounded 1c", sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  min-width: 360px;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  height: 100%;
  background: url("黒餅のり太.png") repeat;
  background-size: 225px;
}

.wrapper {
  max-width: 1200px;
  margin: 0 auto;
  /* background: #f5efff; */
}

a {
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  max-width: 650px;
  margin: 5px auto;
  border-radius: 999px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: #f8f6f8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .04);
  border: solid;
}

.site-header .inner {
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: center;
}

.brand {
  font-weight: 800;
  letter-spacing: .2px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 50px;
  height: auto;
  display: block;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.brand-mark:hover {
  transform: translateY(-4px) scale(1.03);
}

.brand-text {
  font-weight: 800;
  letter-spacing: .05em;
}

.nav {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.nav a {
  color: var(--text);
  padding: 6px 10px;
  border-radius: 8px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.nav a:hover {
  text-decoration: none;
  transform: translateY(-4px) scale(1.03);
}

#portfolioCarousel {
  margin: 0 auto;
  width: auto;
  height: auto;
}

.carousel-item img {
  height: 700px;
  object-fit: contain;
}

/* .system {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  object-position: center;
  display: block;
  margin: 0 auto;
  border-bottom: 4px solid #ccc;
} */

nav ul {
  list-style: none;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: 2em;
}

nav a {
  color: white;
  text-decoration: none;
}

.btn {
  background-color: #879dff;
}

.container {
  display: flex;
  flex-wrap: wrap;
}

section {
  padding: 2em;
  background: #fef9ff;
  opacity: 95%;
  margin: 15px auto;
  max-width: 1000px;
  border-radius: 8px;
  box-sizing: border-box;
}

#work {
  margin: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.work-item {
  background: #fef9ff;
  opacity: 95%;
  display: inline-block;
  border: dashed 3px #46b5ff;
  border-radius: 15px;
  margin: 3px;
  text-align: center;
  padding: 3px;
}

#toTopBtn {
  display: none;
  /* 最初は非表示 */
  position: fixed;
  bottom: 30px;
  right: 5px;
  z-index: 100;
  /* font-size: 25px; */
  background: none;
  /* color: white; */
  border: none;
  /* border-radius: 50%; */
  padding: 0;
  cursor: pointer;
  /* box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); */
  transition: opacity 0.3s ease;
}

/* #toTopBtn:hover {
      background-color: #555;
    } */
#toTopBtn img {
  width: 180px;
  height: auto;
}

footer {
  text-align: center;
  padding: 1em;
  background: none;
  /* background: linear-gradient(135deg, #3c2727, #704234, #655d38); */
  color: rgb(0, 0, 0);
}

@media (max-width: 768px) {

  #portfolioCarousel {
    max-height: 500px;
  }

  .carousel-item img {
    max-height: 300px;
  }

  .hamburger {
    display: inline-flex;
  }

  /* 既存の .nav をそのままスライドメニューにする */
  .nav {
    position: fixed;
    top: var(--header-h, 56px);
    right: 0;
    width: min(360px, 86vw);
    height: calc(100vh - var(--header-h, 56px));
    background: #f5ebff;
    border-left: 1px solid var(--border);
    box-shadow: -12px 0 24px rgba(0, 0, 0, .08);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transform: translateX(100%);
    transition: transform .2s ease;
    z-index: 30;
  }

  body.nav-open .nav {
    transform: translateX(0);
  }

  /* タップしやすいように */
  .nav a {
    display: block;
    padding: 12px;
    border-radius: 10px;
  }

  .nav a:hover {
    background: #f3f4f6;
  }

  /* 背景の半透明オーバーレイ */
  .nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 25;
  }

  body.nav-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* メニュー開いたら背面スクロールを止める */
  body.nav-open {
    overflow: hidden;
  }

  nav ul {
    flex-direction: column;
    align-items: center;
    gap: 1em;
  }

  .header-image {
    max-height: 250px;
    object-fit: contain;
  }

  section {
    padding: 1.5em;
    margin: 1em;
  }

  #toTopBtn {
    display: none;
    /* 最初は非表示 */
    position: fixed;
    bottom: 30px;
    right: 5px;
    z-index: 100;
    /* font-size: 25px; */
    background: none;
    /* color: white; */
    border: none;
    /* border-radius: 50%; */
    padding: 0;
    cursor: pointer;
    /* box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); */
    transition: opacity 0.3s ease;
  }

  #toTopBtn img {
    width: 75px;
    height: 75px;
  }
}