/* ================================
   Hide scrollbars
================================ */
html, body {
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

/* ================================
   Base
================================ */
body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    "Helvetica Neue",
    Arial,
    sans-serif;
  background-color: #ffffff;
  color: #888888;
  font-size: 16px;
  line-height: 1.6;
}

/* ================================
   Links
================================ */
a {
  display: inline-block;
  padding: 8px 0;
  color: gray;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}
a:visited { color: gray; }
a:hover { background: #f0f0f0; color: #333333; }
a:active { color: orange; }

main a {
  padding: 2px 0;
  text-underline-offset: 4px;
}

/* ================================
   Header / Nav
================================ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: #afafaf;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  z-index: 2000;
}

.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
}
.nav-bar a:hover { background: none; }
.nav-bar a { padding: 0; }

/* ================================
   Burger
================================ */
.burger {
  cursor: pointer;
  z-index: 2100;
  position: fixed;
  top: 15px;
  right: 20px;
}

.burger rect {
  fill: #333;
  transition: all 0.3s ease;
  transform-origin: 50% 50%;
}

.burger.active rect:nth-child(1) {
  transform: rotate(45deg) translate(5px, 27px);
}
.burger.active rect:nth-child(2) {
  opacity: 0;
}
.burger.active rect:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -22px);
}

/* ================================
   Slide menu
================================ */
.nav-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: fixed;
  top: 0;
  right: -300px;
  height: 100vh;
  width: 250px;
  background: #fff;
  padding: 60px 20px;
  gap: 20px;
  box-shadow: -2px 0 6px rgba(0,0,0,0.2);
  transition: right 0.3s ease-in-out;
  z-index: 2001;
}

.nav-links.active { right: 0; }

.nav-links a {
  position: relative;
  text-decoration: none;
  padding: 8px 16px;
  margin: 0 5px;
  background: transparent;
  border: none;
  color: #666666;
  transition: background 0.2s ease, color 0.2s ease;
  font-size: clamp(1rem, 1.2vw, 1.4rem);
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0%;
  height: 2px;
  background-color: #333333;
  transition: width 0.3s ease-in-out;
}

.nav-links a:hover { background: #f0f0f0; color: #333333; }
.nav-links a:hover::after { width: 100%; }
.nav-links a.active::after { width: 100%; }

/* ================================
   Logo image
================================ */
.logo-image {
  display: block;
  height: auto;
  max-width: 100%;
  margin: 0;
}

/* ================================
   Language selector
================================ */
.lang-selector {
  margin-left: 20px;
}
#lang-select {
  font-size: 1rem;
  padding: 6px 12px;
  border-radius: 6px;
  border: 2px solid #999999;
  background-color: #ffffff;
  color: #333333;
  cursor: pointer;
  transition: background 0.2s ease-in-out;
}
#lang-select:hover { background: #f0f0f0; }

/* ================================
   Overlay
================================ */
#overlay {
  display: none;
}

@media (max-width: 1024px) {
  #overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    z-index: 1100;
  }

  #overlay.active {
    opacity: 1;
    visibility: visible;
  }
}

/* ================================
   Main content
================================ */
main {
  padding: 100px 20px 40px 20px;
}

h1 {
  font-size: clamp(1.5rem, 5.5vw, 2.2rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

h2 {
  font-size: clamp(1.15rem, 4.3vw, 1.75rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

@keyframes drop {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInMove {
  0% { opacity: 0; transform: translateY(-30px); }
  100% { opacity: 1; transform: translateY(0); }
}

.title-line {
  font-size: clamp(2rem, 2.5vw, 3rem);
  margin: 0;
  opacity: 0;
  position: relative;
  color: #aaa;
}
.line1 { animation: fadeIn 1s forwards ease; animation-delay: 0s; }
.line2 { animation: slideUp 1s forwards ease; animation-delay: 2s; }
.line3 { animation: slideUp 1s forwards ease; animation-delay: 3s; }
.line-wrap {
  overflow: hidden;
}
@keyframes fadeIn {
  to { opacity: 1; }
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ================================
   RTL
================================ */
html[dir="rtl"] body {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .nav-links {
  align-items: flex-end;
  text-align: right;
}

html[dir="rtl"] .nav-links a::after {
  left: auto;
  right: 0;
}

html[dir="rtl"] .burger {
  right: auto;
  left: 20px;
}

html[dir="rtl"] .nav-links {
  right: auto;
  left: -300px;
  box-shadow: 2px 0 6px rgba(0,0,0,0.2);
}

html[dir="rtl"] .nav-links.active {
  left: 0;
}

html[dir="rtl"] .lang-selector {
  margin-left: 0;
  margin-right: 20px;
}

html[dir="rtl"] .titleA-hero {
  direction: ltr !important;
  text-align: left !important;
  overflow: hidden !important;
}

html[dir="rtl"] .titleA-hero-logo {
  max-width: 100% !important;
}

html[lang="ar"] body {
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    "Tahoma",
    "Arial",
    sans-serif;
}

/* ================================
   Responsive
================================ */
@media (max-width: 480px) {
  body { font-size: 18px; }
  .home-title { font-size: 1.8rem; }
  .nav-links a { font-size: 1rem; padding: 6px 10px; }

  /* タイトルSVG（ロゴ）がスマホで小さく見える問題の対策（←修正：.titleA-hero-logo） */
  .titleA-hero-logo {
    width: min(92vw, 420px);
    max-width: none;
  }

  #lang-select { font-size: 0.85rem; padding: 4px 8px; }

  main { padding: 84px 10px 30px 10px; }
}

@media (min-width: 481px) and (max-width: 600px) {
  body { font-size: 18px; }
  .home-title { font-size: 2rem; }
  .nav-links a { font-size: 1rem; padding: 7px 12px; }

  /* ←修正：.titleA-hero-logo */
  .titleA-hero-logo {
    width: min(80vw, 460px);
    max-width: none;
  }

  #lang-select { font-size: 0.9rem; padding: 5px 10px; }

  main { padding: 88px 15px 30px 15px; }
}

@media (min-width: 601px) and (max-width: 900px) {
  body { font-size: 17px; }
  .home-title { font-size: 2.3rem; }
  .nav-links a { font-size: 1rem; padding: 7px 12px; }

  /* ←修正：.titleA-hero-logo */
  .titleA-hero-logo {
    width: 60%;
    max-width: none;
  }

  #lang-select { font-size: 0.95rem; padding: 5px 10px; }

  main { padding: 92px 20px 35px 20px; }
}

@media (min-width: 901px) {
  body { font-size: 16px; }
  .home-title { font-size: 2.5rem; }
  .nav-links a { font-size: 1rem; padding: 8px 16px; }
  .logo-image { width: 537px; }
  #lang-select { font-size: 1rem; padding: 6px 12px; }
  main { padding: 100px 20px 40px 20px; }
}
