/* ===== 設計變數 ===== */
:root {
  color-scheme: dark;
  --nav-h: 64px;
  --page-max: 980px;
  --sky: #4a91bd;
  --deep: #123d58;
  --navy: #09293f;
  --card: rgba(13, 53, 78, 0.58);
  --card-soft: rgba(255, 255, 255, 0.075);
  --line: rgba(188, 236, 255, 0.2);
  --line-soft: rgba(255, 255, 255, 0.1);
  --text: #f8fcff;
  --muted: rgba(235, 248, 255, 0.76);
  --faint: rgba(225, 242, 250, 0.56);
  --accent: #65d9f3;
  --accent-soft: #bcecff;
  --warm: #ffd66b;
  --shadow: 0 24px 70px rgba(0, 25, 43, 0.28);
}

/* ===== HTML 與頁面背景 ===== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(
      circle at 15% 8%,
      rgba(188, 236, 255, 0.2),
      transparent 26rem
    ),
    radial-gradient(
      circle at 88% 32%,
      rgba(67, 181, 224, 0.14),
      transparent 28rem
    ),
    linear-gradient(180deg, var(--sky) 0, var(--deep) 48%, var(--navy) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family:
    "Noto Sans TC",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.6;
}

body:before,
body:after {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  content: "";
  pointer-events: none;
  filter: blur(10px);
}

body:before {
  top: 14rem;
  left: -9rem;
  width: 28rem;
  height: 28rem;
  background: rgba(120, 218, 255, 0.09);
}

body:after {
  right: -10rem;
  bottom: 3rem;
  width: 32rem;
  height: 32rem;
  background: rgba(22, 111, 160, 0.17);
}

body > br {
  display: none;
}

::selection {
  background: rgba(101, 217, 243, 0.32);
  color: #fff;
}

/* ===== 導覽列相容樣式 ===== */
#navbar-placeholder {
  position: relative;
  z-index: 1000;
  min-height: var(--nav-h);
}

#nav-fixed {
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  display: flex;
  width: 100%;
  min-height: var(--nav-h);
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(7, 49, 72, 0.7);
  box-shadow: 0 8px 28px rgba(0, 30, 48, 0.13);
  backdrop-filter: blur(20px) saturate(145%);
  -webkit-backdrop-filter: blur(20px) saturate(145%);
}

#nav-fixed .nav-container {
  display: flex;
  width: min(calc(100% - 28px), 1200px);
  min-height: var(--nav-h);
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.nav-left {
  display: flex;
  align-items: center;
  flex: none;
}

.nav-left img {
  display: block;
  width: auto;
  height: 42px;
  object-fit: contain;
}

.nav-right {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.nav-right a {
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: 0.2s ease;
}

.nav-right a:hover {
  border-color: rgba(188, 236, 255, 0.15);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: translateY(-1px);
}

/* ===== 作者主卡片 ===== */
.author-card {
  position: relative;
  isolation: isolate;
  width: min(calc(100% - 32px), var(--page-max));
  margin: 42px auto 0;
  padding: clamp(28px, 5vw, 54px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 32px;
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.13),
      rgba(255, 255, 255, 0.04)
    ),
    var(--card);
  box-shadow:
    var(--shadow),
    inset 0 1px rgba(255, 255, 255, 0.1);
  text-align: center;
  backdrop-filter: blur(24px) saturate(135%);
  -webkit-backdrop-filter: blur(24px) saturate(135%);
}

.author-card:before {
  position: absolute;
  z-index: -1;
  top: -180px;
  left: 50%;
  width: 520px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(101, 217, 243, 0.19),
    transparent 70%
  );
  content: "";
  pointer-events: none;
  transform: translateX(-50%);
}

.author-card:after {
  position: absolute;
  z-index: -1;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--accent),
    var(--warm),
    transparent
  );
  content: "";
  opacity: 0.86;
}

.author-avatar {
  position: relative;
  display: inline-grid;
  margin-bottom: 18px;
  place-items: center;
}

.author-avatar:before,
.author-avatar:after {
  position: absolute;
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.author-avatar:before {
  inset: -10px;
  border: 1px solid rgba(188, 236, 255, 0.35);
  background: rgba(188, 236, 255, 0.045);
}

.author-avatar:after {
  right: -5px;
  bottom: 3px;
  width: 22px;
  height: 22px;
  border: 4px solid #245d7e;
  background: #76efba;
  box-shadow: 0 0 16px rgba(118, 239, 186, 0.7);
}

.author-avatar img {
  display: block;
  width: clamp(124px, 18vw, 156px);
  height: clamp(124px, 18vw, 156px);
  border: 4px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  box-shadow:
    0 18px 42px rgba(0, 30, 48, 0.3),
    0 0 0 7px rgba(255, 255, 255, 0.055);
  object-fit: cover;
}

.author-card h1 {
  margin: 8px 0 0;
  color: #fff;
  font-size: clamp(2rem, 5vw, 3.1rem);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 1.15;
  text-shadow: 0 8px 30px rgba(0, 38, 59, 0.25);
}

.author-subtitle {
  width: fit-content;
  max-width: 100%;
  margin: 16px auto 0;
  padding: 11px 18px;
  border: 1px solid rgba(188, 236, 255, 0.18);
  border-radius: 16px;
  background: rgba(8, 48, 71, 0.24);
  color: var(--accent-soft);
  font-size: clamp(0.82rem, 2vw, 0.96rem);
  font-weight: 700;
  line-height: 1.75;
}

.author-card > br {
  display: block;
  content: "";
}

/* ===== 作者故事長文閱讀區 ===== */
.author-desc {
  position: relative;
  max-width: 820px;
  margin: 30px auto 24px;
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid var(--line-soft);
  border-radius: 24px;
  background: linear-gradient(
    145deg,
    rgba(7, 48, 72, 0.32),
    rgba(255, 255, 255, 0.045)
  );
  color: rgba(248, 252, 255, 0.9);
  font-size: clamp(0.94rem, 1.8vw, 1.04rem);
  font-weight: 400;
  line-height: 2;
  text-align: left;
  text-shadow: 0 1px 2px rgba(0, 25, 42, 0.18);
}

.author-desc:before {
  display: block;
  width: 42px;
  height: 4px;
  margin-bottom: 20px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--warm));
  content: "";
}

/* ===== 合作與聯絡文字區 ===== */
.author-desc ~ br {
  line-height: 1.8;
}

.author-card {
  color: rgba(248, 252, 255, 0.84);
  font-size: 0.92rem;
  font-weight: 600;
}

/* ===== 我的連結 ===== */
.links-card {
  position: relative;
  width: min(calc(100% - 32px), var(--page-max));
  margin: 20px auto 0;
  padding: clamp(24px, 4vw, 38px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.11),
      rgba(255, 255, 255, 0.035)
    ),
    var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(130%);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
}

.links-card h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
  color: #fff;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  letter-spacing: -0.025em;
}

.links-card h2:before {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(101, 217, 243, 0.7);
  content: "";
}

.links-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.link-item {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 72px;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  overflow: hidden;
  border: 1px solid rgba(188, 236, 255, 0.13);
  border-radius: 18px;
  background: rgba(7, 43, 65, 0.28);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
  transition:
    border-color 0.22s ease,
    background 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.22s ease;
}

.link-item:after {
  position: absolute;
  top: 50%;
  right: 16px;
  color: var(--faint);
  font-family: "Font Awesome 6 Free";
  font-size: 0.75rem;
  font-weight: 900;
  content: "\f35d";
  transform: translateY(-50%);
  transition:
    color 0.2s ease,
    transform 0.2s ease;
}

.link-item:hover {
  border-color: rgba(188, 236, 255, 0.32);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 14px 30px rgba(0, 27, 44, 0.2);
  transform: translateY(-3px);
}

.link-item:hover:after {
  color: var(--accent-soft);
  transform: translate(3px, -50%);
}

.link-item:focus-visible,
.nav-right a:focus-visible {
  outline: 3px solid rgba(188, 236, 255, 0.75);
  outline-offset: 3px;
}

.link-item > span {
  min-width: 0;
  padding-right: 24px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-icon {
  display: grid;
  width: 44px;
  height: 44px;
  flex: none;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: #fff;
  font-size: 1.16rem;
  box-shadow:
    0 8px 20px rgba(0, 20, 34, 0.2),
    inset 0 1px rgba(255, 255, 255, 0.2);
}

.link-icon img {
  display: block;
  object-fit: contain;
}

/* ===== 頁尾 ===== */
.author-footer {
  width: min(calc(100% - 32px), var(--page-max));
  margin: 0 auto;
  padding: 28px 16px 42px;
  color: var(--faint);
  font-size: 0.76rem;
  text-align: center;
}

/* ===== 動態細節 ===== */
@keyframes author-enter {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.author-card,
.links-card {
  animation: author-enter 0.65s ease both;
}

.links-card {
  animation-delay: 0.1s;
}

/* ===== 平板與手機 ===== */
@media (max-width: 720px) {
  :root {
    --nav-h: 60px;
  }

  .author-card,
  .links-card {
    width: min(calc(100% - 20px), var(--page-max));
  }

  .author-card {
    margin-top: 18px;
    padding: 28px 18px;
    border-radius: 24px;
  }

  .author-subtitle {
    width: 100%;
  }

  .author-desc {
    margin-top: 24px;
    padding: 22px 18px;
    border-radius: 20px;
    font-size: 0.94rem;
    line-height: 1.9;
  }

  .links-card {
    padding: 24px 16px;
    border-radius: 24px;
  }

  .links-grid {
    grid-template-columns: 1fr;
  }

  .link-item {
    min-height: 68px;
  }
}

@media (max-width: 480px) {
  .author-avatar img {
    width: 118px;
    height: 118px;
  }

  .author-avatar:after {
    width: 19px;
    height: 19px;
  }

  .author-card h1 {
    font-size: 2rem;
  }

  .author-subtitle {
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  .author-desc {
    padding: 20px 16px;
    font-size: 0.9rem;
    line-height: 1.85;
  }

  .link-item {
    padding: 12px 14px;
  }

  .link-icon {
    width: 42px;
    height: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .author-card,
  .links-card,
  .link-item,
  .nav-right a {
    animation: none;
    transition: none;
  }
}
