/* ==========================================================================
   yutat23.com — スタイルシート
   構成: ベース / 星空 / 惑星 / メッセージ / ポートフォリオ / プロフィール /
         オーバーレイ / メディアクエリ
   ========================================================================== */

:root {
  --text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000,
    1px 1px 0 #000;
}

/* --------------------------------------------------------------------------
   ベース
   -------------------------------------------------------------------------- */
html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background: radial-gradient(circle at center, #002030 0%, #000008 80%);
  font-family: "Noto Sans JP", sans-serif;
}

#home-view {
  position: fixed;
  inset: 0;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   星空(瞬く星・流れ星)
   -------------------------------------------------------------------------- */
.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #fff;
  opacity: 0;
  animation: twinkle infinite ease-in-out;
  image-rendering: pixelated;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: var(--max-opacity, 1);
  }
}

.shooting-star {
  position: absolute;
  width: 90px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9));
  opacity: 0;
  pointer-events: none;
  transform: rotate(30deg);
}

.shooting-star.is-active {
  animation: shoot 0.9s linear;
}

@keyframes shoot {
  0% {
    opacity: 0;
    transform: rotate(30deg) translateX(0);
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotate(30deg) translateX(260px);
  }
}

/* --------------------------------------------------------------------------
   ピクセル惑星
   -------------------------------------------------------------------------- */
.pixel-planet {
  position: absolute;
  image-rendering: pixelated;
  animation: float var(--float-duration, 9s) ease-in-out
    var(--float-delay, 0s) infinite;
  transition: opacity 0.3s ease;
}

/* ポートフォリオ表示中はリストの邪魔にならないよう惑星を薄くする */
#home-view.is-portfolio-open .pixel-planet {
  opacity: 0.25;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* --------------------------------------------------------------------------
   メッセージ(HELLO WORLD)
   -------------------------------------------------------------------------- */
#message {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  color: #ffffff;
  font-family: "Press Start 2P", monospace;
  font-size: 16px;
  padding: 8px 12px;
  white-space: nowrap;
  text-align: center;
  text-shadow: var(--text-shadow);
  -webkit-user-select: none;
  user-select: none;
}

#world-link {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-shadow: var(--text-shadow);
  animation: soft-blink 2.5s ease-in-out infinite,
    glitch 10s ease-in-out infinite;
}

#world-link:disabled {
  cursor: default;
  animation: none;
  transform: translate(0);
  text-shadow: var(--text-shadow);
}

#world-link:hover {
  opacity: 0.85;
  transform: translate(0);
  text-shadow: var(--text-shadow);
  animation: none;
}

@keyframes glitch {
  0%,
  94%,
  100% {
    text-shadow: var(--text-shadow);
    transform: translate(0);
  }
  95% {
    text-shadow: -2px 0 rgba(255, 0, 128, 0.9), 2px 0 rgba(0, 255, 255, 0.9),
      var(--text-shadow);
    transform: translate(-2px, 1px);
  }
  95.5% {
    text-shadow: 2px 0 rgba(0, 255, 255, 0.9), -2px 0 rgba(255, 0, 128, 0.9),
      var(--text-shadow);
    transform: translate(2px, -1px);
  }
  96% {
    text-shadow: -1px 0 rgba(255, 0, 128, 0.7), 1px 0 rgba(0, 255, 255, 0.7),
      var(--text-shadow);
    transform: translate(-1px, 0);
  }
  96.5% {
    text-shadow: 1px 0 rgba(0, 255, 255, 0.7), -1px 0 rgba(255, 0, 128, 0.7),
      var(--text-shadow);
    transform: translate(1px, 1px);
  }
  97% {
    text-shadow: var(--text-shadow);
    transform: translate(0);
  }
}

/* --------------------------------------------------------------------------
   ポートフォリオ一覧
   -------------------------------------------------------------------------- */
#portfolio-section {
  display: flex;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  position: fixed;
  top: calc(38% + 36px);
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease,
    visibility 0s linear 0.3s;
  z-index: 10;
  text-align: left;
  width: min(95vw, 600px);
  flex-direction: column;
  overflow: hidden;
  background: rgba(0, 8, 24, 0.15);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 8px;
  padding: 8px 0 0 0;
  mask-image: radial-gradient(
    ellipse 90% 95% at 50% 50%,
    black 40%,
    transparent 100%
  );
  -webkit-mask-image: radial-gradient(
    ellipse 90% 95% at 50% 50%,
    black 40%,
    transparent 100%
  );
}

#portfolio-section.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#portfolio-list {
  flex: 1;
  min-height: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  padding: 0 16px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(94, 231, 255, 0.6) transparent;
}

#portfolio-list::-webkit-scrollbar {
  width: 6px;
}

#portfolio-list::-webkit-scrollbar-track {
  background: transparent;
}

#portfolio-list::-webkit-scrollbar-thumb {
  background: rgba(94, 231, 255, 0.5);
  border-radius: 3px;
}

#portfolio-list::-webkit-scrollbar-thumb:hover {
  background: rgba(94, 231, 255, 0.8);
}

#portfolio-section .portfolio-category {
  margin: 24px 0 12px 0;
  font-family: "DotGothic16", "Noto Sans JP", sans-serif;
  font-size: 14px;
  letter-spacing: 2px;
  color: #ffcf6e;
  text-shadow: var(--text-shadow);
}

#portfolio-section .portfolio-category:first-child {
  margin-top: 0;
}

#portfolio-section ul.portfolio-list {
  list-style: none;
  margin: 0 0 16px 0;
  padding: 0;
  text-align: left;
}

#portfolio-section .portfolio-item {
  margin: 0 -8px 4px -8px;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.95);
  transition: background 0.2s ease;
}

#portfolio-section .portfolio-item:hover {
  background: rgba(94, 231, 255, 0.08);
}

#portfolio-section .portfolio-item a {
  color: #5ee7ff;
  text-decoration: none;
  text-shadow: var(--text-shadow);
}

#portfolio-section .portfolio-item a:hover {
  text-decoration: underline;
  color: #8eefff;
}

#portfolio-section .portfolio-item .sep {
  color: rgba(255, 255, 255, 0.85);
  margin: 0 6px;
}

#back-link {
  appearance: none;
  background: none;
  border: none;
  margin: 0;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
  padding: 12px 0 8px 0;
  color: rgba(255, 255, 255, 0.95);
  font-size: 12px;
  text-decoration: none;
  text-shadow: var(--text-shadow);
}

#back-link:hover {
  color: #fff;
}

/* --------------------------------------------------------------------------
   プロフィール
   -------------------------------------------------------------------------- */
#profile {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  max-width: 90vw;
  transition: opacity 0.3s ease;
}

/* ポートフォリオ表示中はリストと重なるため隠す */
#home-view.is-portfolio-open #profile {
  opacity: 0;
  pointer-events: none;
}

#profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(94, 231, 255, 0.5);
}

#profile-name {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  color: #fff;
  text-shadow: var(--text-shadow);
}

#profile-bio {
  font-family: "DotGothic16", "Noto Sans JP", sans-serif;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: var(--text-shadow);
}

#profile-links {
  display: flex;
  gap: 16px;
}

#profile-links a {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  color: #5ee7ff;
  text-decoration: none;
  text-shadow: var(--text-shadow);
}

#profile-links a:hover {
  color: #8eefff;
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   CRTスキャンライン風オーバーレイ
   -------------------------------------------------------------------------- */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.16) 0,
    rgba(0, 0, 0, 0.16) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* --------------------------------------------------------------------------
   メディアクエリ
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .star {
    animation: none;
    opacity: 0.7;
  }
  #world-link,
  .pixel-planet {
    animation: none;
  }
  .shooting-star {
    display: none;
  }
  #portfolio-section,
  #portfolio-section.is-visible {
    transition: none;
  }
}

@media (max-width: 480px) {
  #message {
    top: 20%;
    transform: translate(-50%, 0);
  }
  #portfolio-section {
    top: calc(20% + 36px);
    bottom: 16px;
  }
  #profile {
    bottom: 16px;
  }
  #profile-bio {
    font-size: 11px;
  }
}
