/* ===========================================================
   AvianJay — 路線圖版型
   概念：整頁是一條公車路線，往下捲＝往下一站
   =========================================================== */

:root {
  /* 顏色：夜間車廂 + LED 跑馬燈 */
  --ink: #12100e;
  --ink-2: #1b1815;
  --line: rgba(255, 240, 214, 0.12);
  --paper: #f2ead8;
  --paper-dim: #a89e8c;
  --paper-mute: #6f675b;
  --amber: #ffb627;
  --frog: #a3c644;

  --w: 760px;
  --rail-x: 26px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  /* 到站顯示器是固定的，錨點捲動要讓開 */
  scroll-padding-top: 96px;
}

body {
  background: var(--ink);
  color: var(--paper);
  font-family: 'Noto Sans TC', 'Bricolage Grotesque', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 4px;
}

/* 車廂燈光不均勻的顆粒感 */
.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255, 182, 39, 0.09) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

/* ===== 到站顯示器 ===== */
.board {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: rgba(18, 16, 14, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.board-line {
  max-width: var(--w);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.board-label {
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  color: var(--paper-mute);
  flex-shrink: 0;
}

.board-code {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--ink);
  background: var(--amber);
  padding: 1px 7px;
  border-radius: 3px;
  flex-shrink: 0;
}

.board-name {
  font-family: 'Bricolage Grotesque', 'Noto Sans TC', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 行程進度 */
.board-bar {
  height: 2px;
  background: rgba(255, 240, 214, 0.08);
}

.board-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--amber);
  box-shadow: 0 0 12px rgba(255, 182, 39, 0.6);
}

/* ===== 路線主體 ===== */
.route {
  position: relative;
  z-index: 1;
  max-width: var(--w);
  margin: 0 auto;
  padding: 132px 24px 96px;
}

/* 左側鋼軌：實際的起訖點由 JS 對齊第一站與終點站的圓標 */
.rail {
  position: absolute;
  top: 140px;
  bottom: 190px;
  left: calc(24px + var(--rail-x) - 2px);
  width: 4px;
  border-radius: 2px;
  background: rgba(255, 240, 214, 0.1);
}

/* 亮起來的那段：JS 用 scaleY 由上往下長 */
.rail-live {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--amber);
  box-shadow: 0 0 10px rgba(255, 182, 39, 0.5);
  transform-origin: top center;
  transform: scaleY(0);
}

/* ===== 站 ===== */
.stop {
  position: relative;
  padding-left: calc(var(--rail-x) + 34px);
  padding-bottom: 76px;
}

.stop:last-child {
  padding-bottom: 0;
}

/* 站點圓標 */
.stop-mark {
  position: absolute;
  left: calc(var(--rail-x) - 7px);
  top: 8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid var(--paper-mute);
  transition: border-color 0.45s var(--ease), box-shadow 0.45s var(--ease);
}

/* 車到過的站就保持亮著，讀起來像走過的路線 */
.stop.is-passed .stop-mark {
  border-color: var(--amber);
}

.stop.is-here .stop-mark {
  border-color: var(--amber);
  box-shadow: 0 0 0 5px rgba(255, 182, 39, 0.14), 0 0 16px rgba(255, 182, 39, 0.5);
}

.stop-end .stop-mark {
  border-radius: 3px;
}

.eyebrow {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-mute);
  margin-bottom: 10px;
}

.stop-title {
  font-family: 'Bricolage Grotesque', 'Noto Sans TC', sans-serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 4.5vw, 2rem);
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin-bottom: 8px;
}

.stop-note {
  font-size: 0.86rem;
  color: var(--paper-dim);
  margin-bottom: 18px;
}

.stop-title + .cards {
  margin-top: 22px;
}

/* ===== 起站 ===== */
.hero-head {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.portrait {
  position: relative;
  flex-shrink: 0;
}

.portrait img {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid var(--line);
  cursor: pointer;
}

/* 行駛中的小綠燈 */
.running {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--frog);
  border: 3px solid var(--ink);
}

.hero-name {
  font-family: 'Bricolage Grotesque', 'Noto Sans TC', sans-serif;
  font-weight: 800;
  font-size: clamp(2.4rem, 9vw, 3.9rem);
  line-height: 1;
  letter-spacing: -0.035em;
  margin-bottom: 8px;
}

.hero-sub {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.9rem;
  color: var(--amber);
}

.hero-note {
  font-size: 0.94rem;
  color: var(--paper-dim);
  max-width: 46ch;
}

/* ===== 卡片 ===== */
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.cards-wide {
  grid-template-columns: 1fr;
}

.card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 17px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease);
}

.card:hover {
  background: #221e1a;
  border-color: rgba(255, 182, 39, 0.4);
  transform: translateX(4px);
}

.card-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-icon.gravatar { background: rgba(26, 159, 228, 0.14); color: #4db4ec; }
.card-icon.discord  { background: rgba(88, 101, 242, 0.16); color: #7d88f5; }
.card-icon.twitter  { background: rgba(255, 240, 214, 0.08); color: var(--paper); }
.card-icon.bluesky  { background: rgba(32, 139, 254, 0.15); color: #5aa8fe; }
.card-icon.glyph    { background: rgba(255, 182, 39, 0.12); font-size: 1.25rem; }

.card-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.card-name {
  font-weight: 500;
  font-size: 0.92rem;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.74rem;
  color: var(--paper-mute);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 專案：右側箭頭 */
.card-project {
  gap: 16px;
}

.card-go {
  margin-left: auto;
  padding-left: 12px;
  color: var(--paper-mute);
  font-size: 1.05rem;
  flex-shrink: 0;
  transition: color 0.25s var(--ease), transform 0.25s var(--ease);
}

.card-project:hover .card-go {
  color: var(--amber);
  transform: translateX(4px);
}

/* ===== 友鏈 ===== */
.friends {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.friend {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 17px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease);
}

.friend:hover {
  background: #221e1a;
  border-color: rgba(163, 198, 68, 0.42);
  transform: translateX(4px);
}

.friend-face {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* 橫幅友鏈 */
.banner {
  justify-content: center;
  padding: 16px;
}

.banner img {
  max-width: 100%;
  max-height: 54px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* 圖掛掉時 onerror 會移除 <img>，備援文字才會變成第一個子元素而顯示 */
.banner-alt {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  font-weight: 500;
  font-size: 0.92rem;
}

.banner-alt span {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.74rem;
  color: var(--paper-mute);
  font-weight: 400;
}

.banner > .banner-alt:first-child {
  display: flex;
}

/* ===== 終點站 ===== */
.croak {
  font-family: 'Bricolage Grotesque', 'Noto Sans TC', sans-serif;
  font-weight: 700;
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  color: var(--frog);
  letter-spacing: 0.06em;
  word-break: break-all;
  margin-bottom: 8px;
}

.end-note {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--paper-mute);
}

/* ===== 手機 ===== */
@media (max-width: 560px) {
  :root {
    --rail-x: 18px;
  }

  .route {
    padding: 118px 18px 72px;
  }

  .rail {
    top: 118px;
    bottom: 72px;
    left: calc(18px + var(--rail-x) - 2px);
  }

  .stop {
    padding-left: calc(var(--rail-x) + 26px);
    padding-bottom: 60px;
  }

  .board-line {
    padding: 11px 18px;
  }

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

  .portrait img {
    width: 84px;
    height: 84px;
  }
}

/* ===== 動畫關掉時，一切照常顯示 ===== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    animation: none !important;
    transition: none !important;
  }
}

/* twemoji */
img.emoji {
  height: 1.15em;
  width: 1.15em;
  margin: 0 0.05em;
  vertical-align: -0.18em;
}
