/* 稅務新知、稅務小工具、常用表單及查詢（content/library/build.mjs 產生的頁面）共用的樣式；
   共用的部分在 site.css。文章內文自己的樣式在各頁的 <style> 與 /news/article.css，都限定在 .article-body 裡。 */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ===== 三個分頁 ===== */

.library-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: clamp(1.25rem, 0.5rem + 2vw, 2rem);
}

.library-tabs a {
  padding: 0.45rem 1rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--tofu);
  font-weight: 700;
  text-decoration: none;
  transition: border-color var(--fast) ease, background-color var(--fast) ease;
}

.library-tabs a:hover {
  border-color: var(--wood);
}

.library-tabs a[aria-current='page'] {
  border-color: var(--wood-dark);
  background: var(--wood-dark);
  color: var(--tofu);
}

.library-head {
  display: grid;
  gap: 0.75rem;
  padding-block: clamp(1.75rem, 1rem + 3vw, 3rem) clamp(1.25rem, 1rem + 1vw, 2rem);
}

/* ===== 分類 ===== */

.chips ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-bottom: clamp(1.5rem, 1rem + 1.5vw, 2.25rem);
}

.chips a {
  display: block;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  background: var(--cream-deep);
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.chips a:hover {
  color: var(--wood-dark);
  background: var(--butter);
}

.chips a[aria-current='page'] {
  background: var(--wood);
  color: var(--tofu);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tags li,
.tags a {
  padding: 0.1rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--cream);
  color: var(--wood);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.tags li:has(a) {
  padding: 0;
  border: 0;
  background: none;
}

.tags a:hover {
  border-color: var(--wood);
  color: var(--wood-dark);
}

.dates {
  color: var(--wood);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

/* ===== 文章列表 ===== */

.news-list {
  display: grid;
  gap: 1rem;
  padding-bottom: var(--space-section);
}

.news-card {
  position: relative;
  display: grid;
  gap: 0.6rem;
  padding: clamp(1.25rem, 1rem + 1vw, 1.75rem) clamp(1.25rem, 1rem + 1.5vw, 2rem);
  border: 2px solid var(--line-soft);
  border-radius: 24px;
  background: var(--tofu);
  box-shadow: var(--thick);
  transition: transform var(--fast) var(--ease-jelly), box-shadow var(--fast) ease;
}

.news-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 0 var(--line);
}

.news-card h2 {
  font-size: clamp(1.15rem, 1rem + 0.7vw, 1.5rem);
  font-weight: 900;
  line-height: 1.4;
}

/* 整張卡片都按得到，連結本身只在標題上 */
.news-card h2 a {
  text-decoration: none;
}

.news-card h2 a::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.news-card .tags {
  position: relative;
  z-index: 1;
}

/* ===== 一篇文章 ===== */

.article {
  display: grid;
  gap: clamp(1.25rem, 1rem + 1vw, 2rem);
  padding-top: clamp(1.25rem, 0.5rem + 2vw, 2.25rem);
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.crumbs a {
  font-weight: 700;
  text-underline-offset: 0.25em;
}

.article-head {
  display: grid;
  gap: 0.75rem;
}

.article-head h1 {
  font-size: var(--text-title);
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

/* 內文是作者自己排的版：外框只負責圓角與不超出畫面 */
.article-body {
  /* 內文裡定位、疊層的東西都以這個框為準，出不去 */
  position: relative;
  isolation: isolate;
  max-width: 100%;
  overflow-x: auto;
  border: 2px solid var(--line-soft);
  border-radius: 28px;
  background-color: var(--tofu);
}

.article-body img,
.article-body table {
  max-width: 100%;
}

/* ===== 預約諮詢 ===== */

.library-booking {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
  margin-block: clamp(2rem, 1rem + 3vw, 3.5rem);
  padding: clamp(1.25rem, 1rem + 1.5vw, 2rem);
  border-radius: 28px;
  background: var(--butter);
  box-shadow: 0 7px 0 #f1d27a;
}

.library-booking h2 {
  font-size: 1.35rem;
  font-weight: 900;
}

.library-booking p {
  color: var(--ink-soft);
}

.article-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 1rem;
  padding-bottom: var(--space-section);
}

.article-steps a {
  display: grid;
  gap: 0.25rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--line);
  border-radius: 20px;
  background: var(--tofu);
  font-weight: 700;
  text-decoration: none;
}

.article-steps a[rel='next'] {
  text-align: right;
}

.article-steps a span {
  color: var(--wood);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
}

.article-steps a:hover {
  border-color: var(--wood);
}

/* ===== 小工具與表單 ===== */

.link-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: 1rem;
}

.link-card a {
  display: grid;
  align-content: start;
  gap: 0.5rem;
  height: 100%;
  padding: 1.25rem 1.4rem;
  border: 2px solid var(--line-soft);
  border-radius: 22px;
  background: var(--tofu);
  box-shadow: var(--thick);
  text-decoration: none;
  transition: transform var(--fast) var(--ease-jelly), box-shadow var(--fast) ease;
}

.link-card a:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 0 var(--line);
}

.link-card h2 {
  font-size: 1.08rem;
  font-weight: 900;
  line-height: 1.45;
}

.link-card p {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.link-card .host {
  margin-top: auto;
  color: var(--wood);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
  .news-card,
  .link-card a {
    transition: none;
  }
}
