/* Dad Ping: navy ink, amber rules and a warm paper background. */
:root {
  --bg: #f7f5f0;
  --surface: #ebe9e3;
  --surface-2: #fffdf7;
  --line: #868a90;
  --text: #1f2a44;
  --text-2: #5a606c;
  --accent: #1f2a44;
  --accent-strong: #755011;
  --accent-soft: #f1e4ca;
  --amber: #c8811a;
  --navy: #1f2a44;
  --ok: #0f5132;
  --focus: #8b570a;
  --on-accent: #ffffff;
  --radius: 4px;
  --fs: 20px;
  --maxw: 72rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141c2b; --surface: #263147; --surface-2: #1d283d; --line: #8491a7;
    --text: #f7f5f0; --text-2: #c1c8d3; --accent: #f0b95f; --accent-strong: #ffd393; --accent-soft: #393627;
    --ok: #8fd6ae; --focus: #93b4ff; --on-accent: #141c2b; color-scheme: dark;
  }
}
html[data-size="1"] { --fs: 23px; }
html[data-size="2"] { --fs: 26px; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--fs)/1.6 "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}
a { color: var(--accent); text-underline-offset: .15em; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--radius); }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif; line-height: 1.25; color: var(--text); font-weight: 700; overflow-wrap: break-word; }
/* CJK pages: keep the regional glyph forms; serif Latin headings fall back to the same sans CJK faces */
:lang(zh-Hans) body, body:lang(zh-Hans) { font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif; }
:lang(zh-Hant) body, body:lang(zh-Hant) { font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", "Noto Sans CJK TC", sans-serif; }
:lang(zh-Hans) h1, :lang(zh-Hans) h2, :lang(zh-Hans) h3 { font-family: Georgia, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif; }
:lang(zh-Hant) h1, :lang(zh-Hant) h2, :lang(zh-Hant) h3 { font-family: Georgia, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif; }
/* long words (pt-br, es at large text sizes) wrap instead of widening the page */
.msg-text, .tiles a, .hol-list li, .brand, .prose li { overflow-wrap: anywhere; }
h1 { font-size: 1.75em; margin: .4em 0 .3em; letter-spacing: -.01em; }
h2 { font-size: 1.3em; margin: 1.6em 0 .6em; }
h3 { font-size: 1.1em; margin: 1.2em 0 .4em; }
p { margin: 0 0 .9em; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 16px; top: 8px; background: var(--bg); padding: 8px 12px; z-index: 10; }

/* header */
.site-head { border-bottom: 3px solid var(--amber); background: var(--navy); color: #fff; }
.head-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15em; color: var(--text); text-decoration: none; margin-right: auto; min-height: 48px; }
.brand svg { width: 34px; height: 34px; flex: none; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; max-width: 100%; }
.size-btn { min-width: 48px; min-height: 48px; border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: var(--radius); font: inherit; font-weight: 700; cursor: pointer; }
.size-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.lang { position: relative; }
.lang summary { list-style: none; min-height: 48px; display: flex; align-items: center; gap: 6px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; background: var(--bg); }
.lang summary::-webkit-details-marker { display: none; }
.lang ul { position: absolute; right: 0; top: 54px; z-index: 5; list-style: none; margin: 0; padding: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); min-width: 14rem; }
.lang li a { display: block; padding: 10px 12px; border-radius: var(--radius); text-decoration: none; color: var(--text); }
.lang li a:hover, .lang li a[aria-current="true"] { background: var(--accent-soft); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 0 8px; margin: 0; list-style: none; }
.nav a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 12px; border-radius: var(--radius); text-decoration: none; color: var(--text); font-weight: 600; }
.nav a[aria-current="page"] { background: #303f5e; color: #fff; border-bottom: 3px solid var(--amber); }
.nav a:hover { background: #303f5e; color: #fff; }

/* Header controls remain legible on the navy bar in both colour schemes. */
.site-head .brand, .site-head .nav a, .site-head .lang summary { color: #fff; }
.site-head .brand:hover { color: #fff; text-decoration: underline; }
.site-head .size-btn, .site-head .lang summary { background: transparent; border-color: #a9b3c5; color: #fff; }
.site-head .size-btn[aria-pressed="true"] { background: #f7f5f0; border-color: #f7f5f0; color: #1f2a44; }
.site-head :focus-visible, .site-foot :focus-visible { outline-color: #ffd393; }

/* banner */
.lang-banner { background: var(--accent-soft); border-bottom: 1px solid var(--line); }
.lang-banner .wrap { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 8px 16px; }
.lang-banner[hidden] { display: none; }

/* main */
main { padding: 8px 0 48px; }
.lead { font-size: 1.1em; color: var(--text-2); max-width: 46rem; }
.ai-note { font-size: .85em; font-style: italic; color: var(--text-2); margin: .5em 0 1.4em; }
.ai-note::before { content: ""; display: inline-block; width: 1.5rem; height: 2px; margin-right: .7em; vertical-align: middle; background: var(--amber); }
.meta { color: var(--text-2); font-size: .9em; }
.crumbs { font-size: .9em; color: var(--text-2); margin: 12px 0 0; }
.crumbs a { color: var(--text-2); }

/* messages */
.msgs { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); }
.msg { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 12px; display: flex; flex-direction: column; gap: 10px; border-left: 4px solid var(--amber); }
.msg-text { margin: 0; font-size: 1.05em; white-space: pre-line; }
.msg-tags { font-size: .8em; color: var(--text-2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; min-width: 48px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: .9em; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--accent); color: var(--accent-strong); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-strong); color: var(--on-accent); }
.btn[hidden] { display: none; }
.btn.done { border-color: var(--ok); color: var(--ok); }

/* cards */
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(46%, 15rem), 1fr)); }
.cards a { display: block; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--text); border-left: 4px solid var(--amber); }
.cards img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.card-hero { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 52rem) { .card-hero { grid-template-columns: minmax(0, 26rem) minmax(0, 1fr); } }
.card-hero img { border-radius: var(--radius); border: 1px solid var(--line); }

/* scenario grid */
.tiles { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.tiles a { display: flex; flex-direction: column; justify-content: center; min-height: 84px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); text-decoration: none; color: var(--text); font-weight: 700; border-left: 4px solid var(--amber); }
.tiles a span { font-weight: 400; color: var(--text-2); font-size: .85em; }
.tiles a:hover { border-color: var(--accent); }

/* holidays */
.hol-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.hol-list li { padding: 12px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); border-left: 4px solid var(--amber); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9em; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface); }

/* generator */
.gen fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 14px; margin: 0 0 14px; }
.gen legend { font-weight: 700; padding: 0 6px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices label { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); cursor: pointer; }
.choices input { width: 20px; height: 20px; accent-color: var(--accent); }
.gen-out { margin-top: 16px; }

/* article */
.prose { max-width: 46rem; }
.prose li { margin: .3em 0; }
.sources { font-size: .9em; }
.sources li { margin: .4em 0; word-break: break-word; }
.notice { background: var(--surface); border-radius: var(--radius); padding: 12px 16px; font-size: .9em; }

/* footer */
.site-foot { border-top: 3px solid var(--amber); background: var(--navy); padding: 24px 0 36px; font-size: .9em; color: #f7f5f0; }
.site-foot ul { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.site-foot a { color: #f7f5f0; display: inline-flex; min-height: 48px; align-items: center; }
.pager { display: flex; gap: 12px; justify-content: space-between; flex-wrap: wrap; margin: 24px 0; }
.langs-root { margin: 2rem 0 0; font-size: .9em; color: var(--text-2); }
.langs-root a { display: inline-block; padding: 10px 2px; }
ul.langs-root { list-style: none; padding: 0; }
ul.langs-root li { display: inline; }
ul.langs-root li + li::before { content: " · "; }
ul.langs-root span { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.more { display: inline-block; }
.more summary { list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more[open] { display: flex; flex-wrap: wrap; gap: 8px; }
.more[hidden] { display: none; }

/* the open language menu is a light panel: use the dark gold focus ring there */
.site-head .lang ul :focus-visible { outline-color: var(--focus); }
