:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1d2433;
  --sub: #4f5a6f;
  --line: #dfe3ee;
  --accent: #3b6df0;
  --accent-soft: #e8eefe;
  --background-wash: rgba(246, 247, 251, .82);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f131c;
    --card: #1a2030;
    --text: #eef1f8;
    --sub: #b8c2d6;
    --line: #2b344a;
    --accent: #7ea2ff;
    --accent-soft: #232c45;
    --background-wash: rgba(15, 19, 28, .78);
  }

  body::before {
    background-image:
      linear-gradient(var(--background-wash), var(--background-wash)),
      url("portfolio-profile-background-dark.jpg");
  }

  .invert-dark {
    filter: invert(1);
  }

  .emoji-icon.bmac {
    background: #3a3210;
  }

  .emoji-icon.ofuse {
    background: #3a1c24;
  }
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  isolation: isolate;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.8;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--background-wash), var(--background-wash)),
    url("portfolio-profile-background-light.jpg");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
}

@media (prefers-color-scheme: dark) {
  body::before {
    background-image:
      linear-gradient(var(--background-wash), var(--background-wash)),
      url("portfolio-profile-background-dark.jpg");
  }
}

@media (max-width: 600px) {
  :root {
    --background-wash: rgba(246, 247, 251, .90);
  }

  body::before {
    /* 縦画面では背景画像を縦幅に合わせ、キーの模様が大きくなりすぎないようにする */
    background-size: auto 100vh;
  }
}

@media (max-width: 600px) and (prefers-color-scheme: dark) {
  :root {
    --background-wash: rgba(15, 19, 28, .86);
  }
}

.back-nav {
  margin-bottom: 20px;
}

.back-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.back-nav a:hover {
  text-decoration: underline;
}

main {
  max-width: 520px;
  margin: 0 auto;
  padding: 32px 16px 56px;
}

.home-page main {
  padding-top: 40px;
}

header {
  text-align: center;
  margin-bottom: 24px;
}

.avatar {
  display: block;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0;
  border: 3px solid var(--card);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.avatar-button {
  display: block;
  margin: 0 auto 12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  line-height: 0;
  cursor: zoom-in;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.avatar-button:focus-visible,
.profile-image-dialog__close:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.profile-image-dialog {
  width: min(420px, calc(100vw - 40px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
}

.profile-image-dialog::backdrop {
  background: rgba(8, 12, 22, .72);
}

.profile-image-dialog__image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border: 3px solid var(--card);
  border-radius: 50%;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .35);
}

.profile-image-dialog__close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .2);
  font: inherit;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 4px;
  letter-spacing: .04em;
}

.home-page h1 {
  font-size: 1.6rem;
}

.handle {
  color: var(--sub);
  font-size: .95rem;
  margin: 0;
}

.support-note {
  color: var(--text);
  font-size: .9rem;
  font-weight: 600;
  margin: 8px 0 0;
  text-shadow: 0 0 6px var(--card), 0 0 2px var(--card);
}

.about {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 40px 20px 20px;
  margin-bottom: 28px;
}

.about h2 {
  font-size: 1.05rem;
  margin: 0 0 8px;
}

.about p {
  margin: 0;
  font-size: 1rem;
}

.home-page .group {
  margin-bottom: 24px;
}

.subpage .group {
  margin-top: 28px;
}

.home-page .group h3,
.subpage .group h2 {
  font-size: .95rem;
  color: var(--text);
  letter-spacing: .05em;
  margin: 0 0 8px 4px;
}

.subpage .group h2 {
  margin-bottom: 10px;
}

.links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.home-page .links {
  gap: 10px;
}

.subpage .links {
  gap: 12px;
}

.links a {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  transition: all .2s ease;
}

.home-page .links a {
  padding: 12px 16px;
}

.subpage .links a {
  padding: 14px 16px;
}

.links a:hover,
.links a:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.link-icon {
  object-fit: cover;
  flex-shrink: 0;
}

.home-page .link-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  transition: filter .2s ease;
}

.home-page .discord-icon {
  padding: 6px;
  object-fit: contain;
  background: var(--accent-soft);
}

.subpage .link-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.emoji-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
}

.home-page .emoji-icon {
  font-size: 24px;
}

.subpage .emoji-icon {
  font-size: 26px;
}

.emoji-icon.bmac {
  background: #fff6cc;
}

.emoji-icon.ofuse {
  background: #ffeef2;
}

.link-content {
  flex: 1;
  min-width: 0;
}

.link-title {
  display: block;
  line-height: 1.4;
}

.home-page .link-title {
  font-size: 1rem;
}

.subpage .link-title {
  font-size: 1.05rem;
}

.links small {
  display: block;
  font-weight: 400;
  line-height: 1.5;
  color: var(--sub);
}

.home-page .links small {
  font-size: .88rem;
  margin-top: 2px;
}

.subpage .links small {
  font-size: .9rem;
  margin-top: 3px;
}

footer {
  text-align: center;
  color: var(--sub);
  font-size: .8rem;
}

.home-page footer {
  margin-top: 32px;
}

.subpage footer {
  margin-top: 40px;
}




/* Link-card descriptions for touch screens */
.links li {
  position: relative;
}

.home-page .links a,
.subpage .links a {
  padding-right: 36px;
}

.link-info-button {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--accent);
  font: inherit;
  font-size: .47rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.link-info-button::before {
  content: "";
  position: absolute;
  inset: -6px;
}

.link-info-button:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

@media (prefers-color-scheme: dark) {
  .link-info-button {
    border-color: #a9bfff;
    background: #2b3854;
    color: #e5ecff;
    box-shadow: 0 0 0 1px rgba(126, 162, 255, .22);
  }
}

.link-info-button:focus-visible,
.link-info-dialog__close:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.link-info-dialog {
  width: min(420px, calc(100% - 32px));
  max-width: none;
  max-height: min(80vh, 480px);
  margin: auto;
  padding: 20px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .28);
}

.link-info-dialog::backdrop {
  background: rgba(8, 12, 22, .58);
}

.link-info-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.link-info-dialog h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.4;
}

.link-info-dialog p {
  margin: 12px 0 0;
  color: var(--sub);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.link-info-dialog__close {
  display: inline-flex;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.link-info-dialog__close:hover {
  color: var(--accent);
}

.qr-dialog .profile-image-dialog__image {
  border-radius: 24px;
  object-fit: contain;
  background: #fff;
}

.lang-switch {
  margin: 10px 0 0;
}

.lang-key {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 18px 4px 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
}

.lang-key > span:last-child {
  clip-path: inset(0 0 0 max(0px, calc(var(--slide, 0px) - 10px)));
  background: linear-gradient(90deg, color-mix(in srgb, var(--text) 60%, transparent) 35%, var(--text) 50%, color-mix(in srgb, var(--text) 60%, transparent) 65%) 100% 0 / 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine 2.6s linear infinite;
}

.lang-key.is-sliding > span:last-child {
  animation-play-state: paused;
}

@keyframes shine {
  to {
    background-position: 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lang-key > span:last-child {
    animation: none;
    background: none;
    -webkit-text-fill-color: currentColor;
  }
}

.lang-key__num {
  position: relative;
  z-index: 1;
  transform: translateX(var(--slide, 0));
  transition: transform .25s ease;
  touch-action: none;
  -webkit-user-drag: none;
  cursor: grab;
  user-select: none;
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 34px;
  border: 1px solid rgba(0, 0, 0, .35);
  border-radius: 7px;
  background: linear-gradient(#fdfdfd, #d9d9de 50%, #b9b9c0);
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(0, 0, 0, .3);
  color: #333;
  font-size: 1.1rem;
  font-weight: 700;
}

.lang-key.is-sliding .lang-key__num {
  transition: none;
  cursor: grabbing;
}

.is-arriving {
  animation: arrive .6s cubic-bezier(.2, .7, .2, 1);
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: scale(.94);
    filter: blur(6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .is-arriving {
    animation: none;
  }
}
