:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --bg-color: #0f172a;
  --surface: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: var(--surface);
  border-radius: 6px;
  border: 3px solid var(--bg-color);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--primary-hover);
}

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

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 2rem;
}

nav a {
  color: var(--text-main);
  font-weight: 600;
}

nav a:hover {
  color: var(--primary);
}

/* Hamburger Button */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
  flex-direction: column;
  gap: 5px;
}

.hamburger-line {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--text-main);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hamburger open animation (X shape) */
.hamburger.open .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

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

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

/* Section Base */
section {
  padding: 2rem 0;
}

/* Article Title (h1 = page title) */
.page-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  text-align: center;
  padding-top: 4rem;
  margin-bottom: 0.5rem;
  /* 自然な隙間 */
}

article>h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  padding: 0 0 1rem;
  /* ラベルとの隙間を確保 */
}

/* Section Title (h2 = section title) */
section>h2 {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 2rem;
  text-align: center;
}

section h3 {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.3;
}

section h4 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
}

section p {
  font-size: 1.1rem;
  color: var(--text-muted);
}

/* Hero (centered layout) */
.hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.hero p {
  max-width: 600px;
}

.btn {
  display: inline-block;
  background-color: var(--primary);
  color: white;
  padding: 0.8rem 2rem;
  border-radius: 9999px;
  font-weight: 600;
  transition: transform 0.2s, background-color 0.2s;
  border: none;
  cursor: pointer;
}

.btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  color: white;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.project-card {
  background-color: var(--surface);
  border-radius: 1rem;
  padding: 2rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.project-card h3 {
  margin-bottom: 1rem;
}

.project-card p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Custom Utility Classes */
nav a.active {
  color: var(--primary) !important;
}

/* Profile Page Styles */
.profile-intro {
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.profile-name-text {
  margin-bottom: 0.5rem;
}

.profile-title-text {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  margin-bottom: 0.5rem;
}

.profile-bio-text {
  line-height: 1.8;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 1.1rem;
  text-align: left;
  display: inline-block;
  margin-top: 1rem;
}

.empty-message {
  color: var(--text-muted) !important;
  font-weight: 600 !important;
  font-size: 1.1rem !important;
}

.profile-card {
  margin: 1rem auto 0;
  text-align: left;
  background: var(--surface);
  padding: 2.5rem;
  border-radius: 1rem;
  max-width: 600px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.profile-card h3 {
  margin-bottom: 1rem;
}

.profile-card ul {
  list-style: inside;
  color: var(--text-muted);
  line-height: 2;
}



.contact-form-container {
  background: var(--surface);
  padding: 3rem;
  border-radius: 1rem;
  max-width: 600px;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.dummy-notice {
  margin-top: 2rem;
  margin-bottom: 0;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.5rem;
  font-size: 0.9rem;
  color: #cbd5e1;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group-last {
  margin-bottom: 2rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 0.8rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  color: white;
  font-family: inherit;
}

.form-control::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.btn-full {
  width: 100%;
  text-align: center;
  display: block;
}

.hero-thanks {
  min-height: 50vh;
  display: flex;
  justify-content: center;
}

.thanks-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.thanks-title {
  margin-bottom: 1.5rem;
  font-size: 3rem;
}

.thanks-text {
  margin-bottom: 3rem;
  color: var(--text-muted);
}

.btn-secondary {
  background-color: var(--surface);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background-color: #2a3b54;
  color: white;
}

/* Certification Tree */
.cert-tree-container {
  margin-top: 4rem;
  width: 100%;
  overflow-x: auto;
  padding-bottom: 2rem;
  /* space for scrollbar */
}

.cert-tree {
  display: flex;
  white-space: nowrap;
}

.cert-tree ul {
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  /* Parent stem (20px) + branch length */
  --branch-len: 40px;
  padding-left: calc(var(--branch-len) + 20px);
  list-style: none;
  margin: 0;
}

/* The parent stem (line coming out of the parent node) */
.cert-tree ul::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 20px;
  border-top: 2px solid rgba(255, 255, 255, 0.2);
}

/* Remove padding and stem from the outermost ul */
.cert-tree>ul {
  padding-left: 0;
}

.cert-tree>ul::before {
  display: none;
}

.cert-tree li {
  display: flex;
  align-items: center;
  position: relative;
  margin-bottom: 20px;
}

.cert-tree li:last-child {
  margin-bottom: 0;
}

/* Remove connecting lines for the very first root item */
.cert-tree>ul>li::before,
.cert-tree>ul>li::after {
  display: none;
}

/* --- Curves and Lines --- */
/* Base vertical line (middle children) */
.cert-tree li::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: -20px;
  /* span the margin */
  left: calc(var(--branch-len) * -1);
  border-left: 2px solid rgba(255, 255, 255, 0.2);
  z-index: 0;
}

/* Base horizontal line (middle children) */
.cert-tree li::before {
  content: "";
  position: absolute;
  top: 50%;
  left: calc(var(--branch-len) * -1);
  width: var(--branch-len);
  border-top: 2px solid rgba(255, 255, 255, 0.2);
  z-index: 0;
}

/* First child curve (top-left rounded) */
.cert-tree li:first-child::before {
  top: 50%;
  bottom: -20px;
  /* go down through the margin */
  height: auto;
  border-top: 2px solid rgba(255, 255, 255, 0.2);
  border-left: 2px solid rgba(255, 255, 255, 0.2);
  border-top-left-radius: 15px;
}

.cert-tree li:first-child::after {
  display: none;
  /* Replaced by ::before's left border */
}

/* Last child curve (bottom-left rounded) */
.cert-tree li:last-child::before {
  top: 0;
  bottom: 50%;
  height: auto;
  border-top: none;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  border-left: 2px solid rgba(255, 255, 255, 0.2);
  border-bottom-left-radius: 15px;
}

.cert-tree li:last-child::after {
  display: none;
  /* Replaced by ::before's left border */
}

/* Only child straight line */
.cert-tree li:first-child:last-child::before {
  top: 50%;
  bottom: auto;
  height: 0;
  border: none;
  border-top: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 0;
}

/* Node styles */
.cert-node {
  padding: 1rem 1.5rem;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 0.5rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  justify-content: center;
  z-index: 1;
  /* Stay above connecting lines */
  position: relative;
  width: 250px;
  /* 統一した横幅 */
  min-height: 80px;
  text-align: center;
  transition: all 0.3s ease;
}

.cert-name {
  font-weight: 600;
  line-height: 1.4;
}

.cert-date {
  font-size: 0.75rem;
  margin-top: 0.5rem;
  opacity: 0.7;
}

/* Acquired state */
.cert-node.acquired {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--primary);
  color: var(--text-main);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
}

.cert-node.acquired .cert-date {
  color: var(--primary);
  opacity: 1;
}

/* Root node (Me / 資格) */
.cert-node.root {
  background: var(--primary);
  color: white;
  width: 5rem;
  height: 5rem;
  min-height: auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  border: none;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
  padding: 0;
}

/* Credits Table */
.credits-table-container {
  overflow-x: auto;
}

.credits-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  table-layout: fixed;
  /* 列の幅を制御可能にする */
}

.credits-table thead th {
  text-align: left;
  padding: 1rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  font-weight: 600;
}

/* 1列目（素材名）の幅を調整 */
.credits-table th:nth-child(1),
.credits-table td:nth-child(1) {
  width: 30%;
  min-width: 180px;
}

/* 2列目（提供元） */
.credits-table th:nth-child(2),
.credits-table td:nth-child(2) {
  width: 25%;
  min-width: 150px;
}

.credits-table tbody td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  vertical-align: middle;
  word-wrap: break-word;
  /* 長い単語を折り返す */
  overflow-wrap: break-word;
}

.credits-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.credits-table a {
  color: var(--primary);
}

.credits-empty td {
  text-align: center;
  padding: 2rem 1rem;
  font-style: italic;
  opacity: 0.6;
}

/* Footer */
footer {
  text-align: center;
  padding: 3rem 0;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 5rem;
}

footer p {
  font-size: 0.85rem;
}

.footer-sns {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* SNS icon - default (disabled / no link) */
.sns-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  color: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
  cursor: default;
}

.sns-icon:hover {
  color: rgba(255, 255, 255, 0.2);
}

/* SNS icon - active (linked) */
.sns-icon.linked {
  color: var(--text-main);
  cursor: pointer;
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.15);
}

.sns-icon.linked:hover {
  color: white;
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

@media (max-width: 768px) {
  section {
    padding: 2rem 0;
  }

  .container {
    padding: 0 1.25rem;
  }

  .contact-form-container {
    padding: 2rem 1.5rem;
    max-width: 100%;
  }

  .page-label {
    font-size: 0.7rem;
    padding-top: 2rem;
    margin-bottom: 0.2rem;
  }

  article>h1 {
    font-size: 1.6rem;
    padding: 0 0 0.5rem;
  }

  .hero p {
    font-size: 1rem;
  }

  /* Hamburger visible on SP */
  .hamburger {
    display: flex;
  }

  .header-container {
    flex-wrap: wrap;
    padding: 1rem 2rem;
  }

  /* Accordion nav (Overlay style) */
  #global-nav {
    display: none;
    position: absolute;
    top: 100%;
    /* Headerの直下から開始 */
    left: 0;
    width: 100%;
    background-color: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1000;
  }

  #global-nav.open {
    display: block;
    animation: slideDown 0.3s ease;
  }

  #global-nav ul {
    flex-direction: column;
    gap: 0;
    padding: 1rem 2rem;
    /* 横の余白をcontainerに合わせる */
  }

  #global-nav ul li {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }

  #global-nav ul li:first-child {
    border-top: none;
  }

  #global-nav ul li a {
    display: block;
    padding: 1.2rem 0;
    font-size: 1.1rem;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}