:root {
  color-scheme: light dark;
  --bg: light-dark(#fff, #121212);
  --surface: light-dark(#fff, #1e1e1e);
  --text: light-dark(rgba(0, 0, 0, 0.87), #fff);
  --text-sub: light-dark(rgba(0, 0, 0, 0.6), rgba(255, 255, 255, 0.7));
  --divider: light-dark(rgba(0, 0, 0, 0.12), rgba(255, 255, 255, 0.12));
  --primary: light-dark(#1976d2, #90caf9);
  --on-primary: light-dark(#fff, rgba(0, 0, 0, 0.87));
  --header-bg: light-dark(#1976d2, #272727);
  --hover: light-dark(rgba(0, 0, 0, 0.04), rgba(255, 255, 255, 0.08));
  --shadow: 0 3px 3px -2px rgba(0, 0, 0, 0.2), 0 3px 4px 0 rgba(0, 0, 0, 0.14), 0 1px 8px 0 rgba(0, 0, 0, 0.12);
  --shadow-hover: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12);
  --header-height: 64px;
}

/* チェックボックスでOS設定と逆のテーマに切り替える */
:root:has(#theme-toggle:checked) {
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:has(#theme-toggle:checked) {
    color-scheme: light;
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.icon {
  width: 24px;
  height: 24px;
  fill: currentColor;
  flex-shrink: 0;
}

.icon-sm {
  width: 18px;
  height: 18px;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  color: #fff;
  box-shadow: var(--shadow);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-height: var(--header-height);
  padding: 0 24px;
}

.brand {
  flex-grow: 1;
  font-size: 1.25rem;
  font-weight: 500;
}

.nav {
  display: flex;
}

.nav a {
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02857em;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.theme-toggle {
  position: relative;
  display: flex;
  margin-left: 8px;
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

.theme-toggle:has(input:focus-visible) {
  outline: 2px solid #fff;
}

.theme-toggle input {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* 表示中のテーマに合わせてアイコンを切り替える */
.theme-toggle .icon-sun,
.theme-toggle input:checked ~ .icon-moon {
  display: none;
}

.theme-toggle input:checked ~ .icon-sun {
  display: block;
}

@media (prefers-color-scheme: dark) {
  .theme-toggle .icon-moon,
  .theme-toggle input:checked ~ .icon-sun {
    display: none;
  }

  .theme-toggle .icon-sun,
  .theme-toggle input:checked ~ .icon-moon {
    display: block;
  }
}

@media (max-width: 599px) {
  :root {
    --header-height: 104px;
  }

  .header-inner {
    padding: 4px 16px;
  }

  .nav {
    order: 3;
    width: 100%;
    justify-content: space-around;
    padding-bottom: 4px;
  }
}

/* Layout */
.section {
  padding: 64px 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-md {
  max-width: 900px;
}

.container-sm {
  max-width: 600px;
}

.center {
  text-align: center;
}

.section-title {
  margin-bottom: 48px;
  font-size: 3rem;
  font-weight: 400;
  line-height: 1.167;
  text-align: center;
}

.paper,
.card {
  background: var(--surface);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.card {
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

/* About */
.profile {
  margin-bottom: 48px;
  padding: 32px;
}

.profile p {
  margin-bottom: 16px;
}

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

.profile-head {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
}

.avatar {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
}

.profile .name {
  margin-bottom: 0.35em;
  font-size: 2.125rem;
  line-height: 1.235;
}

.profile .name-en {
  margin-bottom: 0.35em;
  color: var(--text-sub);
  font-size: 1.25rem;
  font-weight: 500;
}

@media (max-width: 599px) {
  .profile-head {
    flex-direction: column;
  }

  .avatar {
    align-self: center;
  }
}

.table-wrap {
  overflow-x: auto;
}

.career {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.career th,
.career td {
  padding: 16px;
  border-bottom: 1px solid var(--divider);
  text-align: left;
  vertical-align: top;
}

.career th {
  font-weight: bold;
  white-space: nowrap;
}

.career tbody tr:last-child td {
  border-bottom: none;
}

.career tbody tr:hover {
  background: var(--hover);
}

.career .nowrap {
  white-space: nowrap;
}

@media (max-width: 899px) {
  .career {
    min-width: 650px;
  }

  .career td:last-child {
    min-width: 250px;
  }
}

/* Skills */
.skill-category {
  margin-bottom: 24px;
  font-size: 2.125rem;
  font-weight: 400;
  text-align: center;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
  list-style: none;
}

.skill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
}

.skill:hover {
  transform: translateY(-4px);
}

.skill-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  padding: 8px;
  background: #f5f5f5;
  border-radius: 4px;
}

.skill-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 599px) {
  .skill-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .skill {
    font-size: 0.75rem;
  }
}

/* Products */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 32px;
}

.product {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.product:hover {
  transform: translateY(-8px);
}

.product img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.product-body {
  flex-grow: 1;
  padding: 16px;
}

.product-body h3 {
  margin-bottom: 0.35em;
  font-size: 1.5rem;
  font-weight: 400;
}

.product-body p {
  color: var(--text-sub);
  font-size: 0.875rem;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  margin: 8px;
  padding: 4px 5px;
  border-radius: 4px;
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: uppercase;
}

.text-button:hover {
  background: var(--hover);
}

/* Contact */
.contained-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  border-radius: 4px;
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: var(--shadow);
  font-size: 0.9375rem;
  font-weight: 500;
}

.contained-button:hover {
  box-shadow: var(--shadow-hover);
  filter: brightness(0.92);
}

/* Footer */
.footer {
  padding: 32px 16px;
  border-top: 1px solid var(--divider);
  color: var(--text-sub);
  font-size: 0.875rem;
  text-align: center;
}

.social {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.social a {
  display: flex;
  padding: 8px;
  border-radius: 50%;
}

.social a:hover {
  background: var(--hover);
}
