/* The Diary Of A CEO：古航海圖。牛皮紙、經緯線、羅盤；深色是同一張圖的夜航版。
   顏色全部是 :root 的變數，深色只換變數，版面一行都不動。 */
:root {
  --paper: #E9DDC0; --paper2: #F2E8D0; --ink: #3D2E1C; --ink2: #6B5236; --muted: #8A7556;
  --line: #B9A57F; --sea1: #D9E3D6; --sea2: #BFD0C3; --grat: #7E9387; --land: #EFE3C6; --land-on: #F6D58E;
  --dot-l: 36%; --dot-s: 55%; --off: #B5A88C; --accent: #9B2F1F; --chip: #E1D2AE;
  --serif: "EB Garamond", "Noto Serif TC", "Songti TC", serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14202A; --paper2: #1B2A36; --ink: #E8DCC0; --ink2: #CDB78E; --muted: #9AA7A6;
    --line: #3A4C58; --sea1: #1C3140; --sea2: #10202B; --grat: #3F5A66; --land: #2D3A35; --land-on: #5A4A22;
    --dot-l: 68%; --dot-s: 60%; --off: #44525A; --accent: #E58A6E; --chip: #24343F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #14202A; --paper2: #1B2A36; --ink: #E8DCC0; --ink2: #CDB78E; --muted: #9AA7A6;
  --line: #3A4C58; --sea1: #1C3140; --sea2: #10202B; --grat: #3F5A66; --land: #2D3A35; --land-on: #5A4A22;
  --dot-l: 68%; --dot-s: 60%; --off: #44525A; --accent: #E58A6E; --chip: #24343F;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.75 var(--serif); }
main { max-width: 1040px; margin: 0 auto; padding: 0 16px 40px; }
a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-weight: 600; line-height: 1.3; }

/* ---------------- 上緣 ---------------- */
.strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.crumb { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: center; }
.crumb span { color: var(--muted); }
.crumb em { font-style: italic; }
.tools { display: flex; gap: 12px; align-items: center; }
.tgl { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 1px 12px; font-size: 13px; }

/* ---------------- 標題框（地圖上的 cartouche） ---------------- */
.cart { margin: 26px 0 18px; padding: 18px 20px; border: 1px solid var(--ink2); outline: 1px solid var(--ink2);
  outline-offset: 4px; background: var(--paper2); }
.eyebrow { margin: 0 0 4px; font-style: italic; color: var(--ink2); font-size: 15px; }
.cart h1 { margin: 0; font-size: clamp(28px, 5vw, 42px); }
.cart h1 span { font-style: italic; font-weight: 400; color: var(--ink2); }
.sub { margin: 8px 0 0; max-width: 46em; }

/* ---------------- 篩選 ---------------- */
.filters { display: grid; gap: 8px; margin: 0 0 14px; }
.fg { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fl { width: 3em; flex: none; font-style: italic; color: var(--ink2); font-size: 15px; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opts button { background: var(--chip); border: 1px solid var(--line); border-radius: 3px; padding: 2px 10px; font-size: 15px; line-height: 1.6; }
.opts button i { font-style: normal; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-left: 6px; }
.opts button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.opts button.on i { color: var(--paper2); }
.opts button.zero:not(.on) { opacity: .45; }
.search input { flex: 1; min-width: 0; max-width: 420px; font: inherit; font-size: 16px; padding: 4px 10px; color: var(--ink);
  background: var(--paper2); border: 1px solid var(--line); border-radius: 3px; }

/* ---------------- 海圖 ---------------- */
.chart { margin: 0 0 18px; }
.seawrap { position: relative; border: 1px solid var(--ink2); }
.sea { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3;
  background: radial-gradient(ellipse at 50% 45%, var(--sea1), var(--sea2) 85%); }
.grat line { stroke: var(--grat); stroke-width: 1px; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.tick { font-style: italic; fill: var(--grat); text-anchor: middle; }
.tick.l, .axis.l { text-anchor: start; }
.axis { font-style: italic; fill: var(--ink2); text-anchor: end; }
.anchor line { stroke: var(--ink2); stroke-width: 1px; stroke-dasharray: 2 3; opacity: .7; vector-effect: non-scaling-stroke; }
.anchor text { fill: var(--ink2); text-anchor: middle; opacity: .8; }
.isl { fill: var(--land); stroke: var(--ink2); stroke-width: 1.6px; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .2s, opacity .2s; }
.isl:hover { fill: var(--paper2); }
.isl.on { fill: var(--land-on); stroke-width: 2.2px; }
.isl.far, .dot.far { opacity: .3; }
.dot circle { fill: hsl(var(--h) var(--dot-s) var(--dot-l)); }
.dot.off circle { fill: var(--off); }
.dot:hover circle { fill: var(--accent); }
.nm { font-weight: 600; fill: var(--ink); text-anchor: middle; cursor: pointer; paint-order: stroke; stroke: var(--sea1); }
.nm tspan, .port tspan { font-weight: 400; font-style: italic; font-family: var(--mono); font-size: .75em; }
.port { fill: hsl(var(--h) var(--dot-s) calc(var(--dot-l) - 6%)); font-weight: 600; cursor: pointer; paint-order: stroke; stroke: var(--sea1); }
.port tspan { fill: var(--ink2); }
.port.on { text-decoration: underline; }
.rose circle { fill: none; stroke: var(--ink2); stroke-width: .9; }
.rose path { fill: var(--ink2); }
.rose text { font: 9px var(--serif); fill: var(--ink2); text-anchor: middle; }
.ashore { position: absolute; left: 8px; top: 8px; background: var(--paper2); border: 1px solid var(--ink2); padding: 0 10px; font-size: 14px; border-radius: 3px; }
.ashore[hidden] { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding: 10px 0 4px; }
.legend .lt { font-style: italic; color: var(--ink2); margin-right: 4px; font-size: 15px; }
.legend button { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 1px 12px; font-size: 15px; }
.legend button i { width: 9px; height: 9px; border-radius: 50%; background: hsl(var(--h) var(--dot-s) var(--dot-l)); }
.legend button b { font-family: var(--mono); font-weight: 400; font-size: 12px; color: var(--muted); }
.legend button.on { background: var(--ink); color: var(--paper); }
.howto { margin: 6px 0 0; font-size: 14px; color: var(--ink2); max-width: 52em; }

/* ---------------- 清單 ---------------- */
.rhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; border-top: 2px solid var(--ink); padding-top: 8px; }
.rhead .n { margin: 0; font-size: 15px; }
.rhead .n b { font-family: var(--mono); font-size: 18px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { background: var(--chip); border: 1px solid var(--line); border-radius: 999px; padding: 0 10px; font-size: 13px; }
.pill.clr { background: none; font-style: italic; }
.yr { margin: 18px 0 2px; font-size: 15px; font-style: italic; color: var(--ink2); border-bottom: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 3.2em 1fr auto 3.2em; grid-template-areas: "no h pt m" "no w w w";
  gap: 0 10px; padding: 7px 0; border-bottom: 1px dotted var(--line); text-decoration: none; }
.row .no { grid-area: no; font-family: var(--mono); font-size: 13px; color: var(--muted); padding-top: 3px; }
.row .h { grid-area: h; font-weight: 600; }
.row .w { grid-area: w; font-size: 14px; color: var(--ink2); font-style: italic; }
.row .pt { grid-area: pt; font-size: 13px; color: hsl(var(--h) var(--dot-s) var(--dot-l)); white-space: nowrap; padding-top: 3px; }
.row .m { grid-area: m; font-family: var(--mono); font-size: 13px; color: var(--muted); text-align: right; padding-top: 3px; }
.row:hover .h { color: var(--accent); }
.none { font-style: italic; color: var(--ink2); }
@media (max-width: 560px) {
  .row { grid-template-columns: 2.8em 1fr 2.8em; grid-template-areas: "no h m" "no w w" "no pt pt"; }
  .row .pt { padding-top: 0; }
  .fl { width: 100%; }
}

/* ---------------- 單集頁 ---------------- */
.ep { max-width: 760px; }
.ep-hd .eyebrow { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.ep-hd .num { font-family: var(--mono); font-style: normal; font-size: 15px; color: var(--accent); }
.ep-hd h1 { font-size: clamp(26px, 4.6vw, 36px); margin-top: 2px; }
.meta { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 10px 0 0; font-size: 15px; }
.meta span { color: var(--ink2); }
.orig { margin: 6px 0 0; font-style: italic; color: var(--muted); font-size: 15px; }
.lede { font-size: 19px; margin: 6px 0 22px; padding-left: 14px; border-left: 3px solid var(--ink2); }
.ep h2 { font-size: 19px; margin: 30px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.points { padding-left: 1.1em; margin: 0; }
.points li { margin: 0 0 10px; }
.points b { display: block; }
.tl { display: grid; }
.tr { display: grid; grid-template-columns: 5.2em 1fr; gap: 0 12px; padding: 6px 0; border-bottom: 1px dotted var(--line); }
.tr .sg { font-weight: 600; }
.tr .nt { grid-column: 2; font-size: 15px; color: var(--ink2); }
.tc { font-family: var(--mono); font-size: 13px; color: var(--accent); text-decoration: none; padding-top: 3px; }
.quotes { list-style: none; padding: 0; margin: 0; }
.quotes li { margin: 0 0 16px; padding: 10px 14px; background: var(--paper2); border-left: 3px solid var(--accent); }
.quotes .en { margin: 0; font-style: italic; font-size: 18px; }
.quotes .zh { margin: 2px 0 2px; color: var(--ink2); font-size: 15px; }
.terms { margin: 0; }
.terms div { display: grid; grid-template-columns: minmax(7em, 13em) 1fr; gap: 0 14px; padding: 5px 0; border-bottom: 1px dotted var(--line); }
.terms dt { font-weight: 600; }
.terms dd { margin: 0; font-size: 15px; }
@media (max-width: 560px) { .terms div { grid-template-columns: 1fr; } }
.ext, .themes-in { padding-left: 1.1em; }
.port-box { margin-top: 26px; }
.mates { list-style: none; padding: 0; margin: 0; }
.mates a { display: grid; grid-template-columns: 3.2em 1fr; grid-template-areas: "no h" "no w"; gap: 0 10px; padding: 6px 0; border-bottom: 1px dotted var(--line); text-decoration: none; }
.mates .no { grid-area: no; font-family: var(--mono); font-size: 13px; color: var(--muted); padding-top: 3px; }
.mates .h { grid-area: h; }
.mates .w { grid-area: w; font-size: 14px; font-style: italic; color: var(--ink2); }
.more { margin: 8px 0 0; font-size: 15px; }
.pn { display: flex; justify-content: space-between; gap: 16px; margin: 34px 0 0; padding-top: 12px; border-top: 2px solid var(--ink); font-size: 15px; }
.pn a { max-width: 48%; }
.pn a[rel=next] { text-align: right; }

/* ---------------- 跨集主題 ---------------- */
.th-list { padding-left: 0; list-style: none; counter-reset: th; max-width: 820px; }
.th-list > li { counter-increment: th; margin: 0 0 26px; scroll-margin-top: 12px; }
.th-list h2 { font-size: 19px; margin: 0 0 4px; }
.th-list h2::before { content: counter(th) "　"; font-family: var(--mono); font-size: 14px; color: var(--muted); }
.th-list > li > p { margin: 0 0 6px; font-size: 15px; color: var(--ink2); }
.th-list > li:target h2 { color: var(--accent); }

/* ---------------- 頁尾 ---------------- */
.foot { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 40px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink2); }
