/* ==========================================================================
   勞算 LouSuan — 勞工權益計算站
   設計風格：編輯體 + 印鑑紅 + 米色紙張感
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@500;600;700;900&family=Noto+Sans+TC:wght@400;500;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --bg: #FAF6EE;
  --bg-card: #FFFFFF;
  --bg-paper: #F5EFE2;
  --ink: #1A1A1A;
  --ink-soft: #4A4A4A;
  --ink-muted: #8A8A8A;
  --line: #E5DCC8;
  --line-strong: #C9BBA0;
  --brand: #1B3A5C;
  --brand-deep: #0E2440;
  --seal: #B8341F;
  --seal-deep: #8E2818;
  --gold: #C9A961;
  --highlight: #FFF5DD;

  --serif: 'Noto Serif TC', 'Songti TC', 'PingFang TC', serif;
  --sans: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  --mono: 'IBM Plex Mono', 'Menlo', monospace;

  --radius: 4px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 2px rgba(26,26,26,0.04);
  --shadow-md: 0 4px 16px rgba(26,26,26,0.06);
}

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

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

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(184,52,31,0.025) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(27,58,92,0.02) 0%, transparent 40%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── Header ─────────────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.header-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 36px;
  height: 36px;
  background: var(--seal);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-weight: 900;
  font-size: 18px;
  border-radius: 3px;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--seal);
  letter-spacing: -1px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 19px;
  color: var(--ink);
  letter-spacing: 1px;
}

.brand-tag {
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.header-back {
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.header-back:hover { background: var(--bg-paper); }

/* ── Main container ──────────────────────────────────────── */
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

/* ── Hero / 頁面標題 ─────────────────────────────────────── */
.hero {
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 2px solid var(--ink);
  position: relative;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--ink);
}

.hero-eyebrow {
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--seal);
  font-weight: 700;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.hero-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 34px;
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}

.hero-sub {
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.7;
  max-width: 580px;
}

@media (min-width: 640px) {
  .hero-title { font-size: 42px; }
}

/* ── 工具卡片區（首頁） ──────────────────────────────────── */
.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 48px;
}

@media (min-width: 640px) {
  .tool-grid { grid-template-columns: 1fr 1fr; }
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  text-decoration: none;
  color: var(--ink);
  display: block;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.tool-card:hover {
  border-color: var(--seal);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.tool-card-num {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--seal);
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.tool-card-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink);
  letter-spacing: -0.3px;
}

.tool-card-desc {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.tool-card-arrow {
  position: absolute;
  top: 22px;
  right: 20px;
  font-size: 18px;
  color: var(--ink-muted);
  transition: transform 0.2s;
}

.tool-card:hover .tool-card-arrow {
  color: var(--seal);
  transform: translateX(4px);
}

/* ── Section 標題 ────────────────────────────────────────── */
.section-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  margin: 40px 0 16px;
  padding-left: 14px;
  border-left: 4px solid var(--seal);
  color: var(--ink);
  line-height: 1.4;
}

.section-title-sm {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  margin: 28px 0 12px;
  color: var(--ink);
}

/* ── 計算機表單 ──────────────────────────────────────────── */
.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.field-group {
  margin-bottom: 20px;
}

.field-group:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 8px;
}

.field-hint {
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 400;
  margin-left: 6px;
}

input[type="number"],
input[type="text"],
input[type="date"],
select {
  width: 100%;
  font-family: var(--sans);
  font-size: 16px;
  padding: 12px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}

input[type="number"]:focus,
input[type="text"]:focus,
input[type="date"]:focus,
select:focus {
  outline: none;
  border-color: var(--seal);
  background: #fff;
}

/* number input 不要箭頭 */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] { -moz-appearance: textfield; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%231A1A1A' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--bg);
  transition: all 0.15s;
}

.radio-item:hover { border-color: var(--line-strong); }

.radio-item input[type="radio"] {
  margin-top: 4px;
  accent-color: var(--seal);
  flex-shrink: 0;
}

.radio-item input[type="radio"]:checked + .radio-content {
  font-weight: 500;
}

.radio-item:has(input:checked) {
  border-color: var(--seal);
  background: #FFF8F4;
}

.radio-content { flex: 1; font-size: 14px; line-height: 1.5; }
.radio-content strong { display: block; font-weight: 600; margin-bottom: 2px; }
.radio-content em { color: var(--ink-muted); font-style: normal; font-size: 12px; }

.btn-calc {
  width: 100%;
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 14px 20px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 4px;
  border-radius: var(--radius);
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s;
}

.btn-calc:hover { background: var(--brand-deep); }

.btn-calc:active { transform: translateY(1px); }

/* ── 結果區（印鑑風） ────────────────────────────────────── */
.result {
  margin-top: 24px;
  background: var(--bg-paper);
  border: 1.5px solid var(--seal);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  position: relative;
  display: none;
}

.result.show { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-label {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--seal);
  letter-spacing: 4px;
  font-weight: 700;
  margin-bottom: 8px;
}

.result-amount {
  font-family: var(--mono);
  font-size: 38px;
  font-weight: 600;
  color: var(--seal-deep);
  line-height: 1.1;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
  word-break: break-all;
}

.result-amount-unit {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink-soft);
  margin-left: 6px;
  font-weight: 500;
}

.result-note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.7;
  padding-top: 12px;
  border-top: 1px dashed var(--line-strong);
}

.result-breakdown {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--line-strong);
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.result-row strong {
  font-family: var(--mono);
  color: var(--ink);
  font-weight: 600;
}

.result-row.total {
  border-top: 1px solid var(--line-strong);
  margin-top: 6px;
  padding-top: 12px;
  font-size: 15px;
  color: var(--ink);
  font-weight: 500;
}

.result-row.total strong {
  color: var(--seal-deep);
  font-size: 17px;
}

@media (min-width: 640px) {
  .result-amount { font-size: 46px; }
}

/* ── 內容區塊（法條、範例、FAQ） ──────────────────────────── */
.content-block {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  margin-bottom: 16px;
}

.content-block p {
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.85;
  margin-bottom: 12px;
}

.content-block p:last-child { margin-bottom: 0; }

.content-block ul {
  list-style: none;
  padding: 0;
}

.content-block ul li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 8px;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.7;
}

.content-block ul li::before {
  content: '·';
  position: absolute;
  left: 6px;
  top: -2px;
  color: var(--seal);
  font-weight: 900;
  font-size: 18px;
}

.content-block strong { color: var(--ink); font-weight: 600; }

/* 法條引用 */
.law-quote {
  background: var(--highlight);
  border-left: 3px solid var(--gold);
  padding: 14px 16px;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.7;
  margin: 12px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.law-quote-title {
  font-weight: 700;
  color: var(--ink);
  font-size: 13px;
  margin-bottom: 4px;
  letter-spacing: 1px;
}

/* 表格 */
.rate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 12px 0;
}

.rate-table th,
.rate-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.rate-table th {
  background: var(--bg-paper);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  letter-spacing: 1px;
}

.rate-table td {
  color: var(--ink-soft);
}

.rate-table td:last-child {
  font-family: var(--mono);
  text-align: right;
  color: var(--ink);
  font-weight: 500;
}

/* FAQ 摺疊 */
.faq-item {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.faq-item:last-child { border-bottom: none; }

.faq-q {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  padding-right: 4px;
}

.faq-q::-webkit-details-marker { display: none; }

.faq-q::after {
  content: '+';
  color: var(--seal);
  font-size: 22px;
  font-weight: 300;
  transition: transform 0.2s;
}

details[open] .faq-q::after { transform: rotate(45deg); }

.faq-a {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.85;
  padding-top: 12px;
}

/* ── 警示框 ──────────────────────────────────────────────── */
.disclaimer {
  background: #FFF8E8;
  border: 1px solid #E8C97D;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13px;
  color: #6E5817;
  line-height: 1.7;
  margin: 16px 0;
}

.disclaimer strong { color: #4F3D08; }

/* ── 廣告位 ──────────────────────────────────────────────── */

.ad-slot {
  margin: 32px 0;
}

.ad-slot-label {
  display: block;
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--ink-muted);
  text-align: center;
  margin-bottom: 6px;
  font-weight: 500;
  text-transform: uppercase;
}

.ad-slot-inner {
  background: var(--bg-paper);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.ad-slot-inner::before {
  content: 'AD PLACEHOLDER';
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 4px;
  font-weight: 500;
}

/* AdSense 渲染後，<ins> 會被填入內容；hide 佔位符 */
.ad-slot-inner:has(ins[data-ad-status="filled"])::before { display: none; }

.ad-slot-inner ins.adsbygoogle {
  display: block;
  width: 100%;
  min-height: 90px;
}

/* 計算機下方的廣告位（最高 RPM 位置）給多一點呼吸空間 */
.ad-slot.ad-after-calc { margin: 24px 0 36px; }

/* ── 文章閱讀樣式 ────────────────────────────────────────── */
.article-meta {
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.article-meta time {
  font-family: var(--mono);
}

.article-body {
  font-size: 16px;
  line-height: 1.95;
  color: var(--ink-soft);
}

.article-body h2 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  margin: 36px 0 14px;
  padding-left: 14px;
  border-left: 4px solid var(--seal);
  line-height: 1.4;
}

.article-body h3 {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 24px 0 10px;
}

.article-body p {
  margin-bottom: 16px;
}

.article-body ul, .article-body ol {
  margin: 14px 0 18px 4px;
  padding-left: 0;
  list-style: none;
}

.article-body ul li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
}

.article-body ul li::before {
  content: '·';
  position: absolute;
  left: 6px;
  top: -2px;
  color: var(--seal);
  font-size: 20px;
  font-weight: 900;
}

.article-body ol {
  counter-reset: item;
}

.article-body ol li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 10px;
  counter-increment: item;
}

.article-body ol li::before {
  content: counter(item) '.';
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--mono);
  color: var(--seal);
  font-weight: 600;
  font-size: 15px;
}

.article-body strong { color: var(--ink); font-weight: 600; }

.article-body a {
  color: var(--seal);
  text-decoration: underline;
  text-decoration-color: rgba(184,52,31,0.3);
  text-underline-offset: 3px;
}

.article-body a:hover { text-decoration-color: var(--seal); }

.article-body blockquote {
  background: var(--highlight);
  border-left: 3px solid var(--gold);
  padding: 14px 18px;
  margin: 18px 0;
  font-size: 15px;
  border-radius: 0 4px 4px 0;
}

/* 文章內 CTA 卡片（內鏈到計算機） */
.article-cta {
  background: var(--bg-paper);
  border: 1.5px solid var(--seal);
  border-radius: 8px;
  padding: 20px;
  margin: 24px 0;
  text-decoration: none;
  display: block;
  color: var(--ink);
  transition: all 0.2s;
}

.article-cta:hover {
  background: #FFF8F4;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.article-cta-eyebrow {
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--seal);
  font-weight: 700;
  margin-bottom: 6px;
}

.article-cta-title {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.article-cta-desc {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
}

/* 部落格列表 */
.blog-list {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.blog-item {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px 20px;
  text-decoration: none;
  color: var(--ink);
  transition: all 0.2s;
  display: block;
}

.blog-item:hover {
  border-color: var(--seal);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.blog-item-meta {
  font-size: 12px;
  color: var(--ink-muted);
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.blog-item-title {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 6px;
  color: var(--ink);
}

.blog-item-excerpt {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.7;
}

/* Header 內加導覽 */
.header-nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

.header-nav a {
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.header-nav a:hover { background: var(--bg-paper); }
.header-nav a.active { color: var(--seal); font-weight: 500; }

/* 文章下一篇 / 上一篇 */
.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.article-nav a {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  transition: border-color 0.2s;
}

.article-nav a:hover { border-color: var(--seal); }

.article-nav-label {
  display: block;
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 2px;
  margin-bottom: 4px;
}

@media (max-width: 480px) {
  .article-nav { grid-template-columns: 1fr; }
}

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-paper);
  padding: 32px 20px;
  margin-top: 60px;
}

.footer-inner {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.footer-brand {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: 2px;
}

.footer-text {
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.8;
  margin-bottom: 12px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
}

.footer-links a {
  color: var(--ink-soft);
  text-decoration: none;
}

.footer-links a:hover { color: var(--seal); }

/* ── 雜項 ─────────────────────────────────────────────────── */
.text-error {
  color: var(--seal);
  font-size: 13px;
  margin-top: 6px;
}

hr.divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 32px 0;
}

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  background: var(--bg-paper);
  color: var(--ink-soft);
  border-radius: 99px;
  letter-spacing: 1px;
  margin-right: 6px;
}

.tag-new {
  background: var(--seal);
  color: #fff;
}

/* 行動裝置微調 */
@media (max-width: 480px) {
  main { padding: 24px 16px 60px; }
  .calc-card, .content-block { padding: 20px 16px; }
  .hero-title { font-size: 28px; }
  .result-amount { font-size: 32px; }
  .header-inner { padding: 12px 16px; }
  .brand-name { font-size: 17px; }
  .brand-tag { font-size: 10px; }
}
