/* 個人檔案（linktree）獨立頁：XP 桌面上的一個視窗（inc/profile-page.php） */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font: 14px/1.5 Tahoma, 'Segoe UI', 'Microsoft JhengHei', 'PingFang TC', 'Noto Sans TC', sans-serif;
  color: #1b1b1b;
  background: #3a6ee8;
}

html[lang='zh-Hans-CN'] body {
  font-family: Tahoma, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', 'Noto Sans SC', sans-serif;
}

html[lang='ja'] body {
  font-family: Tahoma, 'Segoe UI', Meiryo, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
}

html[lang='ko'] body {
  font-family: Tahoma, 'Segoe UI', 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
}

html[lang='th'] body {
  font-family: Tahoma, 'Leelawadee UI', Thonburi, 'Noto Sans Thai', sans-serif;
}

a {
  color: inherit;
}

/* 桌面：藍天、雲、綠色山丘 */
.pf-desk {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(28px, env(safe-area-inset-top)) 14px max(40px, env(safe-area-inset-bottom));
  background:
    radial-gradient(120% 42% at 30% 100%, #4c9a2a 0 58%, transparent 59%),
    radial-gradient(90% 34% at 85% 100%, #3d8a22 0 60%, transparent 61%),
    radial-gradient(40% 9% at 22% 18%, rgb(255 255 255 / 0.75), transparent 70%),
    radial-gradient(34% 7% at 78% 30%, rgb(255 255 255 / 0.6), transparent 70%),
    linear-gradient(180deg, #2a62d6 0%, #4f8ff0 45%, #a9d1fb 78%, #d7ecff 100%);
  background-attachment: fixed;
}

/* XP 視窗 */
.pf-win {
  width: 100%;
  max-width: 460px;
  padding: 0 3px 3px;
  border-radius: 8px 8px 0 0;
  background: #0831d9;
  box-shadow: 0 10px 34px rgb(0 0 0 / 0.38);
}

.pf-title {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  margin: 0 -3px;
  padding: 0 5px 0 7px;
  border-radius: 7px 7px 0 0;
  background: linear-gradient(180deg, #0997ff 0%, #0053ee 8%, #0050ee 40%, #0066ff 88%, #0066ff 93%, #005bff 95%, #003dd7 96%, #003dd7 100%);
  color: #fff;
}

.pf-title__icon {
  display: inline-flex;
}

.pf-title__text {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 13px;
  text-shadow: 1px 1px #0f1089;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pf-title__btns {
  display: flex;
  gap: 2px;
}

.pf-tb {
  position: relative;
  display: block;
  width: 21px;
  height: 21px;
  border: 1px solid #fff;
  border-radius: 3px;
  background: radial-gradient(circle at 90% 90%, #0054e9 0%, #2263d5 55%, #4479e4 70%, #a3bbec 90%, #fff 100%);
}

.pf-tb:hover {
  filter: brightness(1.2);
}

.pf-tb::before,
.pf-tb::after {
  content: '';
  position: absolute;
  background: #fff;
}

.pf-tb--max::before {
  inset: 3px;
  background: none;
  border: 1px solid #fff;
  border-top-width: 3px;
}

.pf-tb--close {
  background: radial-gradient(circle at 90% 90%, #cc4600 0%, #dc6527 55%, #cd7546 70%, #ffccb2 90%, #fff 100%);
}

.pf-tb--close::before,
.pf-tb--close::after {
  left: 8px;
  top: 3px;
  width: 2px;
  height: 13px;
  transform: rotate(45deg);
}

.pf-tb--close::after {
  transform: rotate(-45deg);
}

/* 視窗內容：跟拍貼機一樣的銀白 CRT 螢幕（亮面漸層＋細掃描線＋四角暗角＋玻璃反光） */
.pf-body {
  position: relative;
  padding: 0 0 18px;
  background:
    linear-gradient(160deg, rgb(255 255 255 / 0.5) 0%, rgb(255 255 255 / 0) 30%),
    repeating-linear-gradient(0deg, rgb(0 0 0 / 0.05) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 40%, #fbfbfc 0%, #e9ebef 55%, #c3c7cf 100%);
  box-shadow: inset 0 0 0 1px #9da2ad, inset 0 0 60px rgb(0 0 0 / 0.16);
  text-align: center;
}

/* 封面、頭像、分享 */
.pf-cover {
  height: 150px;
  background: var(--cover, linear-gradient(135deg, #245edb 0%, #3f8cff 55%, #8ec5ff 100%)) center / cover no-repeat;
}

.pf-head {
  position: relative;
  display: flex;
  justify-content: center;
  height: 56px;
}

.pf-avatar {
  position: absolute;
  top: -56px;
  width: 112px;
  height: 112px;
  border: 4px solid #f4f5f7;
  border-radius: 50%;
  object-fit: cover;
  background: #ece9d8;
  box-shadow: 0 3px 12px rgb(0 0 0 / 0.25);
}

.pf-share {
  position: absolute;
  right: 12px;
  top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border: 1px solid #003c74;
  border-radius: 3px;
  background: linear-gradient(180deg, #fff 0%, #ecebe6 86%, #d6d0c5 100%);
  color: #000;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.pf-share:hover,
.pf-share:focus-visible {
  box-shadow: inset 0 0 0 2px #f8b636;
  outline: none;
}

.pf-name {
  margin: 8px 16px 0;
  font-size: 22px;
  line-height: 1.3;
}

.pf-handle {
  margin: 2px 0 0;
  color: #5a6578;
  font-size: 13px;
}

.pf-bio {
  max-width: 34em;
  margin: 10px auto 0;
  padding: 0 22px;
  font-size: 14px;
  line-height: 1.65;
}

.pf-fans {
  margin: 8px 0 0;
  color: #5a6578;
  font-size: 13px;
}

.pf-fans strong {
  color: #1b1b1b;
  font-size: 15px;
}

/* 社群圖示 */
.pf-socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 14px 0 0;
  padding: 0 14px;
  list-style: none;
}

.pf-socials a {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
  padding: 6px 4px 4px;
  border-radius: 8px;
  text-decoration: none;
  color: #5a6578;
}

.pf-socials a:hover,
.pf-socials a:focus-visible {
  background: #e8f0ff;
  outline: none;
}

.pf-socials small {
  font-size: 11px;
  line-height: 1.4;
}

/* GitHub 貢獻圖：跟 GitHub 一樣的白底綠格，有貢獻的格子輕輕閃 */
.pf-gh {
  display: block;
  max-width: 760px;
  margin: 18px auto 0;
  padding: 0 16px;
  text-align: left;
  text-decoration: none;
}

.pf-gh__head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 13px;
}

.pf-gh__head small {
  margin-left: auto;
  color: #5a6578;
  font-size: 12px;
}

.pf-gh__screen {
  position: relative;
  display: block;
  padding: 10px 12px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  background: #fff;
  color: #59636e;
  font-size: 10px;
  line-height: 1.3;
}

.pf-gh:hover .pf-gh__screen,
.pf-gh:focus-visible .pf-gh__screen {
  box-shadow: 0 0 0 2px #f8b636;
}

.pf-gh:focus-visible {
  outline: none;
}

.pf-gh__months,
.pf-gh__grid {
  display: grid;
  grid-template-columns: repeat(var(--w), minmax(0, 1fr));
  column-gap: 1.5px;
}

.pf-gh__months {
  min-height: 13px;
  margin-bottom: 3px;
  white-space: nowrap;
}

.pf-gh__months span {
  grid-row: 1;
}

.pf-gh__grid {
  grid-template-rows: repeat(7, auto);
  grid-auto-flow: column;
  row-gap: 1.5px;
}

.pf-gh__screen i {
  display: block;
  aspect-ratio: 1;
  border-radius: 1.5px;
  background: #ebedf0;
}

.pf-gh__screen i.is-pad {
  background: none;
}

.pf-gh__screen i.l1 {
  background: #9be9a8;
}

.pf-gh__screen i.l2 {
  background: #40c463;
}

.pf-gh__screen i.l3 {
  background: #30a14e;
}

.pf-gh__screen i.l4 {
  background: #216e39;
}

.pf-gh__grid i:is(.l1, .l2, .l3, .l4) {
  animation: pf-gh-twinkle 2.8s ease-in-out var(--d, 0s) infinite;
}

.pf-gh__legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 6px;
}

.pf-gh__legend i {
  width: 8px;
}

@keyframes pf-gh-twinkle {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* 連結：XP 按鈕樣式 */
.pf-links {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0 16px;
  list-style: none;
}

.pf-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 9px 12px;
  border: 1px solid #003c74;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff 0%, #f4f3ee 60%, #e3dfd3 100%);
  text-align: left;
  text-decoration: none;
  color: #000;
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.08);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.pf-link:hover,
.pf-link:focus-visible {
  box-shadow: inset 0 0 0 2px #f8b636, 0 3px 10px rgb(0 0 0 / 0.12);
  transform: translateY(-1px);
  outline: none;
}

.pf-link:active {
  transform: translateY(1px);
  background: linear-gradient(180deg, #e3dfd3 0%, #f4f3ee 100%);
}

.pf-link__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
}

.pf-link__icon img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
}

.pf-link__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.pf-link__text strong {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.pf-link__text small {
  color: #5a6578;
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.pf-link__go {
  flex: none;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border-top: 2px solid #0a246a;
  border-right: 2px solid #0a246a;
  transform: rotate(45deg);
}

/* 語言、回桌面 */
.pf-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 22px 16px 0;
}

.pf-langs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
  font-size: 12px;
}

.pf-langs a {
  color: #0b4fbf;
  text-decoration: none;
}

.pf-langs a[aria-current] {
  color: #1b1b1b;
  font-weight: 700;
}

.pf-xp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px 6px 10px;
  border-radius: 0 12px 12px 0;
  background: linear-gradient(180deg, #3c9b3a 0%, #2f8a2c 40%, #3daa3b 85%, #2c7a2a 100%);
  color: #fff;
  font-style: italic;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  text-shadow: 1px 1px 1px rgb(0 0 0 / 0.4);
}

.pf-xp:hover {
  filter: brightness(1.08);
}

/* 分享選單：XP 右鍵選單樣式 */
.pf-menu {
  position: absolute;
  z-index: 10;
  width: 180px;
  padding: 2px;
  border: 1px solid #848484;
  background: #fff;
  box-shadow: 2px 2px 4px rgb(0 0 0 / 0.35);
}

.pf-menu__item {
  display: block;
  width: 100%;
  padding: 6px 12px;
  border: 0;
  background: none;
  color: #000;
  font: inherit;
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.pf-menu__item:hover,
.pf-menu__item:focus-visible {
  background: #316ac5;
  color: #fff;
  outline: none;
}

/* XP 桌面裡用 iframe 打開：只要視窗內容 */
.pf-embed body {
  background: #e9ebef;
}

.pf-win--embed {
  max-width: none;
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

/* 視窗放大或全螢幕：只有封面滿版，其他內容收在中間同一欄 */
@media (min-width: 761px) {
  .pf-win--embed .pf-cover {
    height: clamp(200px, 20vw, 340px);
    background-image: var(--cover-full, linear-gradient(135deg, #245edb 0%, #3f8cff 55%, #8ec5ff 100%));
  }

  .pf-win--embed :is(.pf-head, .pf-links) {
    max-width: 760px;
    margin-inline: auto;
  }

  .pf-win--embed .pf-share {
    right: 16px;
  }
}

@media (max-width: 520px) {
  .pf-desk {
    padding: 0;
  }

  .pf-win {
    max-width: none;
    min-height: 100dvh;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
  }

  .pf-title {
    margin: 0;
    border-radius: 0;
  }

  .pf-body {
    min-height: calc(100dvh - 30px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pf-gh__grid i:is(.l1, .l2, .l3, .l4) {
    animation: none;
  }

  .pf-link {
    transition: none;
  }
}
