/* =========================================================
   bahanoko — link page
   キャラの「太い線・クリーム・オレンジ」と、写真の「くすみブルー」から配色
   ========================================================= */

:root {
  --bg: #fbf3e6;
  --paper: #fffaf2;
  --ink: #2b2622;
  --ink-soft: #6b625a;
  --orange: #f39a2b;
  --orange-soft: #ffe1b8;
  --blue: #5e7489;
  --blue-soft: #dde5ec;
  --band: #b4c3d0;
  --shadow: var(--ink);

  --radius-lg: 28px;
  --radius-md: 20px;
  --border: 3px;

  --font-en: "Fredoka", "Zen Maru Gothic", system-ui, sans-serif;
  --font-ja: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic", system-ui, sans-serif;

  color-scheme: light;
}

/* カードの外（ページ地）だけで使う色 */
:root {
  --page-ink: var(--ink);
  --page-ink-soft: var(--ink-soft);
}

/* ダークモード：カードはそのまま（クリーム＋黒線のステッカー）で、地の色だけ夜にする */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #26303a;
    --band: #3a4957;
    --page-ink: #f1e8dc;
    --page-ink-soft: #a9b5c0;
    --shadow: #11161b;
    color-scheme: dark;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--page-ink);
  font-family: var(--font-ja);
  line-height: 1.6;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
ul { list-style: none; margin: 0; padding: 0; }

/* ---------- background ---------- */
/* 上部だけ写真の背景色に近いブルーの帯。下ふちはスカラップ */
.band {
  --scallop: 18px;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 0;
  height: 250px;
  background: var(--band);
}
.band::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: var(--scallop);
  background:
    radial-gradient(circle at 50% 0, var(--band) calc(var(--scallop) - 0.5px), transparent var(--scallop))
    center top / calc(var(--scallop) * 2) var(--scallop) repeat-x;
}

/* ---------- layout ---------- */
.page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 140px 16px 40px;
}

.card {
  background: var(--paper);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: 6px 6px 0 var(--shadow);
  color: var(--ink);
}

/* ---------- profile ---------- */
.profile {
  position: relative;
}

/* カードの上ふちに寝そべるキャラ（前足がちょっとはみ出る位置） */
.chara {
  --w: 196px;
  position: absolute;
  z-index: 2;
  left: 50%;
  top: calc(var(--w) * -0.623);   /* 画像高さ(=w*0.702) の 88.7% を上に出す */
  width: var(--w);
  margin-left: calc(var(--w) / -2);
  transform-origin: 50% 100%;
  animation: breathe 3.6s ease-in-out infinite;
}
.chara img {
  width: 100%;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.06));
  user-select: none;
  -webkit-user-drag: none;
}
/* 放置すると出る「zzZ」 */
.zzz {
  position: absolute;
  top: 30%;
  right: 4%;
  width: 0;
  height: 0;
  pointer-events: none;
}
.zzz span {
  position: absolute;
  left: 0;
  bottom: 0;
  font-family: var(--font-en);
  font-weight: 700;
  line-height: 1;
  color: var(--page-ink);
  opacity: 0;
}
.zzz span:nth-child(1) { font-size: 20px; }
.zzz span:nth-child(2) { font-size: 27px; }
.zzz span:nth-child(3) { font-size: 36px; }

.is-sleeping .zzz span { animation: snooze 2.7s ease-in-out infinite; }
.is-sleeping .zzz span:nth-child(2) { animation-delay: 0.9s; }
.is-sleeping .zzz span:nth-child(3) { animation-delay: 1.8s; }
.is-sleeping .chara { animation-duration: 5.5s; }

@keyframes snooze {
  0%   { opacity: 0; transform: translate(0, 0) rotate(-12deg); }
  20%  { opacity: 1; }
  75%  { opacity: 1; }
  100% { opacity: 0; transform: translate(38px, -60px) rotate(14deg); }
}

/* 起こされたときの「!」とびくっ */
.startle {
  position: absolute;
  top: 16%;
  left: 82%;
  font-family: var(--font-en);
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  color: var(--orange);
  -webkit-text-stroke: 1.5px var(--ink);
  opacity: 0;
  pointer-events: none;
}
.is-startled .startle { animation: startle 0.9s cubic-bezier(.3,1.6,.5,1) forwards; }
.is-startled .chara img { animation: hop 0.45s cubic-bezier(.3,1.6,.5,1); }

@keyframes startle {
  0%   { opacity: 0; transform: translate(-50%, 10px) scale(0.3); }
  25%  { opacity: 1; transform: translate(-50%, -14px) scale(1.15) rotate(8deg); }
  75%  { opacity: 1; transform: translate(-50%, -14px) scale(1) rotate(8deg); }
  100% { opacity: 0; transform: translate(-50%, -20px) scale(1) rotate(8deg); }
}
@keyframes hop {
  0%, 100% { transform: translateY(0); }
  35%      { transform: translateY(-14px); }
}

@keyframes breathe {
  0%, 100% { transform: scale(1, 1); }
  50%      { transform: scale(1.015, 0.985); }
}
.profile__card {
  position: relative;
  padding: 44px 24px 28px;
  text-align: center;
}

/* 写真：オレンジのリング＋回る点線リング */
.photo {
  position: relative;
  width: 148px;
  aspect-ratio: 1;
  margin: 0 auto 16px;
}
.photo::before {
  content: "";
  position: absolute;
  inset: -10px;
  border: 2.5px dashed var(--blue);
  border-radius: 50%;
  opacity: 0.55;
  animation: spin 24s linear infinite;
}
.photo img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 55% 50%;
  border-radius: 50%;
  border: var(--border) solid var(--ink);
  box-shadow: 0 0 0 6px var(--orange-soft);
  background: var(--blue-soft);
}
@keyframes spin { to { transform: rotate(360deg); } }

.name {
  margin: 0;
  font-family: var(--font-en);
  font-size: clamp(1.9rem, 8.4vw, 2.4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.005em;
  text-wrap: balance;
}

.handle {
  margin: 6px 0 0;
  font-family: var(--font-en);
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

.role {
  margin: 18px 0 0;
  font-family: var(--font-en);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.role::before {
  content: "";
  display: block;
  width: 28px;
  height: 3px;
  margin: 0 auto 16px;
  border-radius: 2px;
  background: var(--orange);
}

.meta {
  margin: 4px 0 0;
  font-family: var(--font-en);
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.meta span { white-space: nowrap; }

/* ---------- links ---------- */
.links { margin-top: 40px; }

.section-title {
  margin: 0 0 14px 4px;
  font-family: var(--font-en);
  font-size: 1.35rem;
  font-weight: 600;
}
.link-list { display: grid; gap: 16px; }

.link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px 14px 14px;
  border-radius: var(--radius-md);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.18s cubic-bezier(.3,1.6,.5,1), box-shadow 0.18s ease, background-color 0.18s ease;
}
.link:hover {
  transform: translate(-2px, -3px) rotate(-0.6deg);
  box-shadow: 8px 9px 0 var(--orange);
}
.link:active {
  transform: translate(4px, 4px);
  box-shadow: 1px 1px 0 var(--shadow);
}
.link:focus-visible {
  outline: 3px dashed var(--orange);
  outline-offset: 4px;
}

.link__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 50px;
  height: 50px;
  border: 2.5px solid var(--ink);
  border-radius: 16px;
}
.link__icon svg { width: 24px; height: 24px; }

.link--github .link__icon { background: var(--orange-soft); }
.link--github .link__icon svg { fill: var(--ink); }
.link--x .link__icon { background: var(--blue-soft); }
.link--x .link__icon svg { fill: var(--ink); width: 21px; height: 21px; }
.link--note .link__icon { background: #dcefe7; }
.link--instagram .link__icon { background: #fbe1e3; }
.link--instagram .link__icon svg { fill: none; stroke: var(--ink); stroke-width: 2.2; }
.link--instagram .link__icon svg .fill { fill: var(--ink); stroke: none; }
.link__icon--text {
  font-family: var(--font-en);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.link__text { display: grid; min-width: 0; flex: 1; }
.link__label {
  font-family: var(--font-en);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.25;
}
.link__handle {
  font-family: var(--font-en);
  font-size: 0.9rem;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link__arrow {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  font-family: var(--font-en);
  font-weight: 700;
  border: 2px solid var(--ink);
  border-radius: 50%;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.link:hover .link__arrow {
  background: var(--orange);
  color: #fff;
  transform: rotate(-30deg);
}

/* ---------- footer ---------- */
.footer {
  margin-top: 48px;
  text-align: center;
  font-family: var(--font-en);
  font-size: 0.85rem;
  color: var(--page-ink-soft);
}
.footer p { margin: 0; }

/* ---------- larger screens ---------- */
@media (min-width: 720px) {
  .page { padding-top: 170px; max-width: 480px; }
  .chara { --w: 224px; }
  .band { height: 290px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  /* 動きを減らす設定のときは、階段状に並べて止めておく */
  .is-sleeping .zzz span,
  .is-startled .startle { opacity: 1; }
  .startle { transform: translate(-50%, -14px) rotate(8deg); }
  .zzz span:nth-child(2) { transform: translate(16px, -19px); }
  .zzz span:nth-child(3) { transform: translate(34px, -42px); }
}
