/*
Theme Name: William Lion Dev Blog
Theme URI: https://williamlion.tw
Author: William Lion
Description: 淺色簡約的個人技術/SEO 筆記主題，色彩與元件對齊 jp-travel.williamlion.tw 的和色品牌系統，字體維持 Noto Sans TC。首頁文章列表、jp-travel 專案案例展示、單篇文章含側欄，分類與標籤彙整頁，完整手機版排版。
Version: 1.3.1
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: williamlion-devblog
*/

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

:root {
  /* Aligned to jp-travel.williamlion.tw's 和色 (washoku) brand system */
  --navy-950: #0B1330;
  --navy-900: #1B2838;  /* 墨 Sumi — primary heading/text, matches jp-travel exactly */
  --navy-800: #1B2C5C;
  --navy-700: #2C3E6B;
  --ink: #1B2838;        /* 墨 Sumi */
  --indigo: #2C4A6E;      /* 藍 Indigo — links, secondary info (jp-travel) */
  --paper: #FFFFFF;
  --paper-tint: #F7F3ED; /* 和紙 Washi — jp-travel's site background */
  --line: #E7E1D6;
  --line-strong: #D6CDBE;
  --muted: #8C8279;       /* 石 Stone — secondary text / meta (jp-travel) */
  --blue: #2C4A6E;
  --green: #6B8F5E;       /* 抹茶 Matcha */
  --coral: #C53D2D;       /* 朱 Vermillion — brand accent, identical to jp-travel's CTA/category color */
  --mono: "SF Mono", "JetBrains Mono", "Courier New", monospace;
  --sans: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", "Segoe UI", sans-serif;
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { font-family: var(--sans); background: var(--paper-tint); color: var(--ink); overflow-x: hidden; }
a { color: inherit; }
img { max-width: 100%; display: block; height: auto; }

/* Any wide embedded content (tables, iframes) from post content must scroll, never blow out the layout */
.article-body table { border-collapse: collapse; width: 100%; }
.article-body table,
.article-body iframe,
.article-body video,
.article-body .wp-block-embed {
  max-width: 100%;
}
.article-body .table-scroll,
.article-body table {
  display: block;
  overflow-x: auto;
}

/* ---- Header ---- */
header.site {
  background: #fff; color: var(--ink);
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between; height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -0.01em; color: var(--navy-900); text-decoration: none; flex-shrink: 0; }
.brand-logo { width: 36px; height: 36px; flex-shrink: 0; }
.brand-name { white-space: nowrap; }
.brand .tag {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; color: #fff;
  background: var(--coral); padding: 2px 7px; border-radius: 5px; letter-spacing: 0.02em;
}
nav.site { display: flex; gap: 26px; order: 2; min-width: 0; overflow: hidden; }
nav.site ul { display: flex; gap: 22px; list-style: none; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
nav.site ul::-webkit-scrollbar { display: none; }
nav.site li { flex-shrink: 0; }
nav.site ul ul { display: none; }
nav.site a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; }
nav.site a:hover, nav.site .current-menu-item a, nav.site .current_page_item a { color: var(--coral); }

/* Hamburger toggle — checkbox-driven, no JS needed */
.nav-toggle-checkbox { display: none; }
.nav-toggle-btn {
  display: none; order: 3; flex-direction: column; justify-content: center; gap: 4px;
  width: 44px; height: 44px; margin: -6px -10px -6px 0; padding: 6px 10px; cursor: pointer;
}
.nav-toggle-btn span { display: block; width: 100%; height: 2px; background: var(--navy-900); border-radius: 2px; }

/* ---- Hero (home) ---- */
.hero {
  background: linear-gradient(160deg, #F5F7FA 0%, #EDF1F8 60%, #E7EDF7 100%);
  color: var(--ink); padding: 64px 28px 56px; position: relative; overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.hero:before {
  content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(197,61,45,0.16) 0%, rgba(197,61,45,0) 70%);
  top: -220px; right: -120px;
}
.hero-inner { max-width: 1120px; margin: 0 auto; position: relative; z-index: 2; }
.kicker { font-size: 13px; font-weight: 700; color: var(--coral); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 16px; }
.hero h1 { font-size: 40px; font-weight: 800; line-height: 1.22; max-width: 680px; letter-spacing: -0.01em; margin-bottom: 14px; color: var(--navy-900); }
.hero p.sub { font-size: 16px; color: var(--muted); max-width: 560px; line-height: 1.6; }

/* ---- Archive / single hero ---- */
.archive-hero, .post-hero {
  background: linear-gradient(160deg, #F5F7FA 0%, #EDF1F8 60%, #E7EDF7 100%);
  border-bottom: 1px solid var(--line); position: relative; overflow: hidden;
}
.archive-hero { padding: 44px 28px 40px; }
.post-hero { padding: 40px 28px 0; }
.archive-hero:before, .post-hero:before {
  content: ''; position: absolute; width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(197,61,45,0.14) 0%, rgba(197,61,45,0) 70%);
  top: -200px; right: -100px;
}
.archive-hero-inner { max-width: 1120px; margin: 0 auto; position: relative; z-index: 2; }
.post-hero-inner { max-width: 760px; margin: 0 auto; position: relative; z-index: 2; padding-bottom: 32px; }
.breadcrumb { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-bottom: 14px; }
.breadcrumb a { text-decoration: none; }
.breadcrumb b, .breadcrumb .current { color: var(--coral); font-weight: 700; }
.archive-hero h1, .post-hero h1 { font-weight: 800; color: var(--navy-900); letter-spacing: -0.01em; }
.archive-hero h1 { font-size: 34px; margin-bottom: 10px; }
.post-hero h1 { font-size: 32px; line-height: 1.4; margin-bottom: 18px; }
.archive-hero p.desc { font-size: 15px; color: var(--muted); max-width: 640px; line-height: 1.6; margin-bottom: 16px; }
.archive-stats { display: flex; gap: 18px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.archive-stats b { color: var(--navy-900); }

.byline { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg,#E7EDF7,#DCE5F3); border: 1px solid var(--line); flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.byline .name { font-weight: 700; color: var(--navy-900); }
.byline .sep { color: var(--line-strong); }

/* ---- Layout ---- */
main.wrap { max-width: 1120px; margin: 0 auto; padding: 48px 28px 80px; display: flex; gap: 40px; align-items: flex-start; }
main.wrap.archive-wrap { padding-top: 44px; }
main.wrap.article-wrap { padding-top: 40px; }
.col-main { flex: 2.4; min-width: 0; }
main.article-wrap .col-main { max-width: 760px; }
.col-side { flex: 1; min-width: 0; position: sticky; top: 88px; display: flex; flex-direction: column; gap: 20px; }
main.article-wrap .col-side { max-width: 300px; }

.section-label {
  font-size: 13px; font-weight: 700; color: var(--coral);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 18px;
}

/* ---- Post cards (home / archive) ---- */
/* Image-forward card matching jp-travel's article card: large cover image with
   the category badge overlaid top-left, text below. */
.post-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.post-card {
  display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden; text-decoration: none; color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.post-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(27,40,56,0.09); }
.post-card .thumb {
  position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden;
  background: linear-gradient(160deg, var(--navy-900) 0%, var(--indigo) 100%);
  border-bottom: 1px solid var(--line);
}
.post-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-card .cat-badge {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  font-size: 11px; font-weight: 700; color: #fff; background: rgba(27,40,56,0.62);
  backdrop-filter: blur(4px); padding: 5px 11px; border-radius: 5px; letter-spacing: 0.02em;
}
.post-card .card-body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.post-card .meta { font-family: var(--mono); font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.post-card h3 { font-size: 17px; font-weight: 800; line-height: 1.5; letter-spacing: -0.005em; color: var(--navy-900); }
.post-card p.excerpt { font-size: 13.5px; color: var(--muted); line-height: 1.7; }

/* ---- Project showcase (jp-travel case study) ---- */
.project-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px 32px; margin-bottom: 40px;
}
.project-card .eyebrow { font-size: 11px; font-weight: 700; color: var(--coral); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.project-card .preview {
  height: 130px; border-radius: 10px; margin-bottom: 20px; position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--navy-900) 0%, var(--indigo) 100%);
}
.project-card .preview .badge {
  position: absolute; top: 12px; left: 12px; font-size: 10.5px; font-weight: 700; color: #fff;
  background: rgba(255,255,255,0.16); padding: 4px 10px; border-radius: 5px;
}
.project-card .preview .ptitle {
  position: absolute; bottom: 12px; left: 14px; right: 14px;
  font-size: 17px; font-weight: 700; color: #fff;
}
.project-card .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.project-card h2 { font-size: 20px; font-weight: 800; color: var(--navy-900); }
/* Filled CTA — matches jp-travel's primary button (vermillion fill, white text) */
.project-card .visit-link, .side-card.project-mini .visit-link {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: #fff;
  background: var(--coral); border: 1px solid var(--coral); border-radius: 8px; padding: 9px 16px; text-decoration: none; white-space: nowrap;
}
.side-card.project-mini .visit-link { padding: 8px 14px; font-size: 12.5px; }
.project-card p.desc { font-size: 14px; color: var(--muted); line-height: 1.7; margin-bottom: 20px; max-width: 640px; }
.project-card .stack-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }
.project-card .stats { display: flex; gap: 14px; flex-wrap: wrap; }
.project-card .stats .stat { flex: 1; min-width: 130px; background: var(--paper-tint); border: 1px solid var(--line); border-radius: 10px; padding: 14px; text-align: center; }
.project-card .stats .stat .num { font-size: 19px; font-weight: 800; color: var(--coral); }
.project-card .stats .stat .label { font-size: 11px; color: var(--muted); margin-top: 3px; }

.side-card.project-mini p { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 12px; }

/* ---- Pagination ---- */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 32px; flex-wrap: wrap; }
.pagination .page-numbers {
  min-width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--navy-900); font-size: 13px; font-weight: 700;
  text-decoration: none; font-family: var(--mono); padding: 0 6px;
}
.pagination .page-numbers.current { background: var(--coral); border-color: var(--coral); color: #fff; }
.pagination .page-numbers.dots { border: none; background: transparent; }

/* ---- Article body ---- */
.article-body {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 36px 40px;
  font-size: 16px; line-height: 1.95; color: #2A3140; overflow-wrap: break-word;
}
.article-body p { margin-bottom: 18px; }
.article-body h2 {
  font-size: 22px; font-weight: 800; color: var(--navy-900); margin: 36px 0 16px;
  padding-left: 14px; border-left: 3px solid var(--coral);
}
.article-body h3 { font-size: 17px; font-weight: 700; color: var(--navy-900); margin: 26px 0 12px; }
.article-body ul, .article-body ol { margin: 0 0 18px 22px; }
.article-body li { margin-bottom: 8px; line-height: 1.8; }
.article-body strong { color: var(--navy-900); }
.article-body figure { margin: 24px 0; }
.article-body figure img { border-radius: 12px; border: 1px solid var(--line); margin: 0 auto; }
.article-body figcaption { font-family: var(--mono); font-size: 11.5px; color: var(--muted); text-align: center; margin-top: 10px; }
.article-body a { color: var(--indigo); text-decoration: underline; }

.article-body pre, .code-block {
  background: var(--navy-950); color: #D9E4FF; border-radius: 10px; padding: 18px 20px;
  font-family: var(--mono); font-size: 13px; line-height: 1.75; margin: 22px 0; overflow-x: auto; white-space: pre-wrap;
}
.article-body code { font-family: var(--mono); }
.code-block .c1 { color: #8FD19E; }
.code-block .c2 { color: #F2A489; }
.code-block .c3 { color: #6FA8F5; }

.callout-box, .article-body blockquote.callout {
  border-left: 3px solid var(--coral); background: #FBEDEA; padding: 16px 20px; border-radius: 0 8px 8px 0;
  font-size: 14.5px; line-height: 1.7; color: #4A2E28; margin: 24px 0;
}
.callout-box.tip { border-left-color: var(--green); background: #EAF6EF; color: #1F4A34; }

.article-body blockquote {
  border-left: 3px solid var(--line-strong); padding: 4px 0 4px 18px; margin: 22px 0;
  font-size: 16px; color: var(--muted); font-style: italic;
}

.stat-row { display: flex; gap: 14px; margin: 24px 0; flex-wrap: wrap; }
.stat-box { flex: 1; min-width: 120px; background: var(--paper-tint); border: 1px solid var(--line); border-radius: 10px; padding: 16px; text-align: center; }
.stat-box .num { font-family: var(--mono); font-size: 24px; font-weight: 800; color: var(--coral); }
.stat-box .label { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.tags-footer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.tag-pill { font-size: 11.5px; font-weight: 700; color: var(--ink); background: #fff; border: 1px solid var(--line); padding: 6px 13px; border-radius: 999px; text-decoration: none; display: inline-block; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; }

.author-box { display: flex; gap: 16px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-top: 28px; align-items: flex-start; }
.author-box .avatar { width: 48px; height: 48px; }
.author-box .name { font-weight: 800; color: var(--navy-900); font-size: 14.5px; margin-bottom: 4px; }
.author-box .bio { font-size: 13px; color: var(--muted); line-height: 1.6; }

.prev-next { display: flex; gap: 16px; margin-top: 24px; flex-wrap: wrap; }
.prev-next a { flex: 1; min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; text-decoration: none; }
.prev-next a.next-post { text-align: right; }
.prev-next .dir { font-family: var(--mono); font-size: 10.5px; color: var(--coral); font-weight: 700; margin-bottom: 6px; }
.prev-next .ttl { font-size: 13.5px; font-weight: 700; color: var(--navy-900); line-height: 1.4; }

/* ---- Sidebar ---- */
.side-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.side-card h4 { font-size: 13px; font-weight: 800; margin-bottom: 14px; display: flex; align-items: center; gap: 7px; color: var(--navy-900); }
.side-card h4 .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--coral); flex-shrink: 0; }
.side-card ul { list-style: none; }
.toc-list { display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.toc-list a { color: var(--muted); text-decoration: none; }
.toc-list a.active { color: var(--coral); font-weight: 700; }
.stack-card .row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.stack-card .row:last-child { border-bottom: none; }
.stack-card .row span:first-child { color: var(--muted); font-family: var(--mono); }
.stack-card .row span:last-child { font-weight: 700; color: var(--navy-900); }

/* ---- Comments ---- */
.comments-area { margin-top: 40px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px 40px; }
.comments-area h2 { font-size: 18px; font-weight: 800; color: var(--navy-900); margin-bottom: 20px; }
.comment-list { list-style: none; }
.comment-body { padding: 16px 0; border-bottom: 1px solid var(--line); }
.comment-author { font-weight: 700; font-size: 13.5px; color: var(--navy-900); }
.comment-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.comment-form input, .comment-form textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-family: var(--sans);
  font-size: 16px; margin-bottom: 12px;
}
.comment-form input[type="submit"] {
  width: auto; background: var(--coral); color: #fff; border: none; font-weight: 700; cursor: pointer; padding: 12px 22px;
  font-size: 15px; min-height: 44px;
}

/* ---- Search / 404 ---- */
.search-form-box { display: flex; gap: 10px; margin-bottom: 24px; }
.search-form-box input[type="search"] { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; font-family: var(--sans); font-size: 16px; }
.search-form-box input[type="submit"] { background: var(--coral); color: #fff; border: none; border-radius: 8px; padding: 10px 18px; font-weight: 700; cursor: pointer; min-height: 44px; }
.error-404-box { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 60px 40px; text-align: center; }
.error-404-box .code { font-family: var(--mono); font-size: 60px; font-weight: 800; color: var(--coral); }

/* ---- Footer ---- */
footer.site { background: #fff; color: var(--muted); padding: 36px 28px; font-size: 13px; text-align: center; border-top: 1px solid var(--line); margin-top: 40px; }
footer.site a { text-decoration: none; color: var(--coral); }

/* ---- Tablet ---- */
@media (max-width: 1024px) and (min-width: 861px) {
  main.wrap { gap: 28px; padding-left: 24px; padding-right: 24px; }
  .col-side { max-width: 260px; }
  .post-grid { grid-template-columns: 1fr; }
}

/* ---- Mobile ---- */
@media (max-width: 860px) {
  .header-inner { padding: 0 18px; }
  .brand .tag { display: none; }
  .brand-logo { width: 30px; height: 30px; }
  .brand { font-size: 15.5px; gap: 8px; }

  .nav-toggle-btn { display: flex; }
  nav.site {
    position: absolute; top: 64px; left: 0; right: 0; z-index: 49;
    background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 8px 16px rgba(15,28,63,0.06);
    max-height: 0; overflow: hidden; transition: max-height 0.22s ease;
  }
  nav.site ul { flex-direction: column; gap: 0; padding: 4px 18px; }
  nav.site li { border-bottom: 1px solid var(--line); }
  nav.site li:last-child { border-bottom: none; }
  nav.site a { display: block; padding: 14px 2px; font-size: 15px; min-height: 44px; }
  .nav-toggle-checkbox:checked ~ nav.site { max-height: 70vh; overflow-y: auto; }

  .hero, .archive-hero, .post-hero { padding-left: 20px; padding-right: 20px; }
  .hero { padding-top: 40px; padding-bottom: 36px; }
  .hero h1, .post-hero h1 { font-size: 24px; line-height: 1.3; }
  .archive-hero h1 { font-size: 24px; }
  .hero p.sub, .archive-hero p.desc { font-size: 14.5px; }
  .archive-hero { padding-top: 32px; padding-bottom: 28px; }
  .post-hero { padding-top: 28px; }
  .kicker { font-size: 12px; }

  main.wrap { flex-direction: column; padding: 32px 20px 60px; gap: 28px; }
  main.wrap.article-wrap, main.wrap.archive-wrap { padding-top: 28px; }
  .col-main, main.article-wrap .col-main { max-width: none; }
  .col-side { position: static; width: 100%; max-width: none; order: 3; }

  .section-label { margin-bottom: 14px; }

  .project-card { padding: 20px 18px; margin-bottom: 28px; }
  .project-card h2 { font-size: 17px; }
  .project-card .stats .stat { min-width: calc(50% - 5px); flex: none; }

  .post-grid { grid-template-columns: 1fr; gap: 16px; }
  .post-card .card-body { padding: 14px 16px 18px; }
  .post-card h3 { font-size: 16.5px; }
  .post-card .cat-badge { top: 10px; left: 10px; font-size: 10.5px; padding: 4px 9px; }

  .article-body { padding: 22px 18px; font-size: 15px; }
  .article-body h2 { font-size: 19px; margin-top: 28px; }
  .article-body h3 { font-size: 16px; }
  .article-body pre, .code-block { font-size: 12px; padding: 14px 16px; }
  .article-body table { font-size: 13px; }
  .stat-row { gap: 10px; }
  .stat-box { min-width: calc(50% - 5px); flex: none; padding: 12px; }
  .stat-box .num { font-size: 19px; }

  .byline { font-size: 12px; }
  .byline > div { line-height: 1.7; }

  .author-box { flex-direction: column; padding: 16px; }
  .prev-next { flex-direction: column; }
  .prev-next a { min-width: 0; }
  .prev-next a.next-post { text-align: left; }

  .comments-area { padding: 24px 18px; }

  .search-form-box { flex-direction: column; }
  .search-form-box input[type="submit"] { width: 100%; }
  .error-404-box { padding: 40px 22px; }
  .error-404-box .code { font-size: 44px; }

  .pagination .page-numbers { min-width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  nav.site { transition: none; }
}
