/* ==========================================================================
   Articles — articles.css
   - 0) Variables & base typography
   - 1) Article list: blog entries + lang chips
   - 2) Article reading view: header + lang tabs
   - 3) Markdown body typography
   ========================================================================== */


/* ====== 0) Variables & base typography =================================== */

:root {
  --container-max: 56rem; /* max-w-4xl — lang-toggle 對齊用 */
}

body   { font-family: var(--font-sans-en); }
:lang(zh), .lang-zh { font-family: var(--font-sans-zh); }

main {
  padding-top:    max(env(safe-area-inset-top,    0px), 3.5rem);
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 3.5rem);
}

/* 頁面標題：Shippori Mincho */
.page-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.75rem, 4vw, 2.1rem);
}


/* ====== 1) Article list: blog entries =================================== */

/* 列表容器：條目之間以細線分隔 */
#articles-list {
  border-top: 1px solid rgba(255,255,255,.1);
}

.art-card {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 2rem 0;
  border-bottom: 1px solid rgba(255,255,255,.1);
  transition: opacity .15s ease;
}
.art-card:hover { opacity: .75; }

/* Meta row: date on left, lang chips on right */
.art-card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .6rem;
}

.art-card-meta {
  font-family: var(--font-sans-en);
  font-size: .72rem;
  font-weight: 300;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
}

/* Lang availability chips (list view) */
.art-lang-chips {
  display: flex;
  gap: .3rem;
  flex-shrink: 0;
}

.art-lang-chip {
  font-family: var(--font-sans-en);
  font-size: .6rem;
  font-weight: 400;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 2px;
  padding: .08rem .32rem;
  line-height: 1.5;
}

.art-card-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  line-height: 1.3;
  color: rgba(255,255,255,.92);
  margin-bottom: .55rem;
}

.art-card-excerpt {
  font-family: var(--font-sans-en);
  font-size: .9rem;
  font-weight: 300;
  line-height: 1.7;
  color: rgba(255,255,255,.45);
  margin-bottom: .75rem;
}

.art-card-readmore {
  font-family: var(--font-sans-en);
  font-size: .75rem;
  letter-spacing: .06em;
  color: rgba(255,255,255,.3);
}

.art-empty {
  padding: 3rem 0;
  font-size: .9rem;
  color: rgba(255,255,255,.3);
  font-weight: 300;
}


/* ====== 2) Article reading view: header + lang tabs ====================== */

.art-reading-header {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: 2.5rem;
}

.art-reading-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: white;
  line-height: 1.25;
  margin: 1rem 0 .5rem;
}

.art-reading-date {
  font-family: var(--font-sans-en);
  font-size: .78rem;
  font-weight: 300;
  color: rgba(255,255,255,.4);
  letter-spacing: .06em;
}

/* Mini lang-switcher tabs (injected below art-date when multiple langs) */
.art-view-lang-tabs {
  display: flex;
  gap: .4rem;
  margin-top: .75rem;
}

.art-view-lang-tab {
  font-family: var(--font-sans-en);
  font-size: .65rem;
  font-weight: 400;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 2px;
  padding: .15rem .45rem;
  line-height: 1.4;
  background: transparent;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}

.art-view-lang-tab:hover {
  color: rgba(255,255,255,.6);
  border-color: rgba(255,255,255,.35);
}

.art-view-lang-tab.active {
  color: rgba(255,255,255,.85);
  border-color: rgba(255,255,255,.5);
}


/* ====== 3) Markdown body typography ====================================== */

.art-content {
  font-size: 1rem;
  line-height: 1.85;
  color: rgba(255,255,255,.85);
  max-width: 42rem;
}

.art-content > * + * { margin-top: .9em; }

.art-content p {
  font-weight: 300;
}

/* 文章首個 h1 通常與卡片標題相同，在閱讀 view 隱藏避免重複 */
.art-content > h1:first-child { display: none; }

.art-content h1,
.art-content h2,
.art-content h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  color: white;
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: .4rem;
}
.art-content h1 { font-size: 1.5rem; }
.art-content h2 { font-size: 1.2rem; }
.art-content h3 { font-size: 1.05rem; }

.art-content hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,.2);
  width: 3.5rem;
  margin: 2.25rem 0;
}

.art-content blockquote {
  margin: 1.25rem 0;
  padding: .05rem 1.1rem;
  border-left: 2px solid rgba(255,255,255,.3);
  color: rgba(255,255,255,.6);
  font-style: italic;
}
.art-content blockquote p { font-style: italic; }

.art-content strong {
  font-weight: 500;
  color: rgba(255,255,255,.95);
}

/* 斜體回歸 Shippori Mincho，中英文皆適用 */
.art-content em {
  font-family: var(--font-serif);
  font-style: italic;
}

/* Inline code */
.art-content code {
  font-family: ui-monospace, 'SF Mono', 'Fira Code', monospace;
  font-size: .82em;
  color: rgba(255,255,255,.8);
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  padding: .1em .38em;
  border-radius: 3px;
}

/* Code block */
.art-content pre {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 4px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 1.25rem 0;
}
.art-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: .82rem;
  color: rgba(255,255,255,.7);
  line-height: 1.65;
}

.art-content ul,
.art-content ol {
  padding-left: 1.5rem;
  margin: .8em 0;
}
.art-content li + li { margin-top: .3em; }

.art-content a {
  color: rgba(200, 215, 255, .85);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.art-content a:hover { color: white; text-decoration: none; }

/* 中文內文：Noto Sans TC，略大行高 */
:lang(zh-TW) .art-content {
  font-family: var(--font-sans-zh);
  font-weight: 300;
  line-height: 1.9;
}

/* Loading / error 狀態 */
.art-status {
  font-size: .9rem;
  color: rgba(255,255,255,.35);
  font-weight: 300;
}
