/* mynumber-bbs.com shared layout. Themes (theme-*.css) only change the variables
   at the top plus a few decorations; the structure stays the same everywhere. */

:root {
  /* colour */
  --bg: #ffffff;
  --text: #1a1a1a;          /* 17.4:1 on white */
  --text-2: #3a3a3a;        /* 11.4:1, for secondary lines; still dark */
  --rule: #d4d7dc;
  --rule-strong: #8c9199;
  --tint: #f4f6f9;          /* only ever behind --text */
  --accent: #1b3a6b;        /* headings, links, markers. Every theme keeps it >= 7:1 on white */
  --accent-2: #1b3a6b;      /* decorative strokes only (borders, route line) */
  --link: var(--accent);
  --focus: #1a5fd0;
  --on-accent: #ffffff;

  /* type */
  --font: system-ui, sans-serif;
  --font-head: var(--font);
  --fs: 17px;
  --lh: 1.75;
  --lh-head: 1.4;
  --h1: 1.75rem;
  --h1-desk: 2.25rem;
  --h2: 1.375rem;
  --h3: 1.125rem;
  --small: 0.9375rem;      /* never below 15px for side text */
  --weight-head: 700;
  --tracking: 0;

  /* shape and rhythm */
  --space: 1;              /* density multiplier: <1 denser, >1 airier */
  --radius: 6px;
  --radius-big: 10px;
  --measure: 40em;
  --page-max: 72rem;
  --tap: 44px;
  --dot: 30px;             /* route marker size */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 1rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: var(--lh);
  letter-spacing: var(--tracking);
  overflow-wrap: break-word;
}
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: var(--weight-head); line-height: var(--lh-head); color: var(--text); }
ul, ol { padding-left: 1.4em; }
small { font-size: var(--small); }
.wrap { max-width: var(--page-max); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }

/* ---------- header ---------- */
.site-head { border-top: 5px solid var(--accent-2); border-bottom: 1px solid var(--rule); background: var(--bg); }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 0; }
.brand-mark { width: 34px; height: 34px; flex: none; color: var(--accent); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.125rem; line-height: 1.3; }
.brand-sub { font-size: var(--small); color: var(--text-2); line-height: 1.4; display: none; }
@media (min-width: 720px) { .brand-sub { display: block; } }

.menu { position: relative; flex: none; }
.menu summary {
  list-style: none; cursor: pointer; min-height: var(--tap); display: flex; align-items: center; gap: 8px;
  padding: 0 14px; border: 1.5px solid var(--accent); border-radius: var(--radius); color: var(--accent); font-weight: 700;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary::before { content: ""; width: 16px; height: 12px; background: linear-gradient(currentColor 0 0) top/100% 2px no-repeat, linear-gradient(currentColor 0 0) center/100% 2px no-repeat, linear-gradient(currentColor 0 0) bottom/100% 2px no-repeat; }
.menu[open] summary { background: var(--accent); color: var(--on-accent); }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: min(20rem, calc(100vw - 32px));
  background: var(--bg); border: 1.5px solid var(--accent); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
}
.menu-panel ul { list-style: none; margin: 0; padding: 6px 0; }
.menu-panel a { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 6px 16px; color: var(--text); text-decoration: none; font-weight: 600; }
.menu-panel a:hover { background: var(--tint); }
.menu-panel .sub a { padding-left: 32px; font-weight: 400; }
.menu-panel .menu-fixed { border-top: 1px solid var(--rule); margin-top: 6px; padding-top: 6px; }

/* language switcher: always visible, wraps instead of hiding */
.langs { background: var(--tint); border-top: 1px solid var(--rule); }
.langs-row { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.langs-label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--small); color: var(--text); font-weight: 700; }
.langs-label svg { width: 18px; height: 18px; color: var(--accent); }
.langs ul { display: flex; flex-wrap: wrap; gap: 4px 4px; list-style: none; margin: 0; padding: 0; }
.langs a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 2px 10px; border-radius: 999px;
  color: var(--text); text-decoration: none; font-size: var(--small); line-height: 1.5; border: 1px solid transparent;
}
.langs a:hover { border-color: var(--rule-strong); background: var(--bg); }
.langs a[aria-current] { background: var(--bg); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.langs a[lang="my"] { line-height: 1.9; }

/* ---------- route markers (the site's one signature element) ---------- */
.stop-dot {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: var(--dot); height: var(--dot); border-radius: 50%;
  border: 4px solid var(--accent); background: var(--bg); color: var(--accent);
  font: 700 0.875rem/1 var(--font-head); font-variant-numeric: tabular-nums;
}
.stop-dot--living { background: var(--accent); color: var(--on-accent); }
.stop-dot--tool { border-radius: 6px; border-width: 3px; border-style: dashed; }
.menu-panel .stop-dot { --dot: 18px; border-width: 3px; font-size: 0; }

/* ---------- home hero ---------- */
.home-hero { padding: calc(28px * var(--space)) 0 calc(20px * var(--space)); }
.home-hero h1 { font-size: var(--h1); margin: 0 0 .4em; color: var(--accent); }
.home-hero .lead { font-size: 1.0625em; max-width: var(--measure); margin: 0; }
@media (min-width: 720px) { .home-hero h1 { font-size: var(--h1-desk); } .home-hero { padding-top: 44px; } }
.home-intro { margin-top: 1rem; }

/* ---------- the route: before -> living -> leaving ---------- */
.route { list-style: none; margin: 0 0 calc(28px * var(--space)); padding: 0; position: relative; }
.stop { position: relative; padding: 0 0 calc(28px * var(--space)) calc(var(--dot) + 18px); }
.stop::before { /* the line between stops */
  content: ""; position: absolute; left: calc(var(--dot) / 2 - 2px); top: var(--dot); bottom: 0; width: 4px; background: var(--accent-2);
}
.stop:last-child::before { display: none; }
.stop-head { display: flex; align-items: center; gap: 12px; margin: 0 0 .25rem calc(-1 * (var(--dot) + 18px)); }
.stop-head h2 { margin: 0; font-size: var(--h2); color: var(--accent); }
.stop-lead { margin: 0 0 .75rem; color: var(--text-2); max-width: var(--measure); }
@media (min-width: 900px) {
  .route { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 32px; padding-top: 4px; }
  .route::before { content: ""; position: absolute; left: calc(var(--dot) / 2); right: 33%; top: calc(4px + var(--dot) / 2 - 2px); height: 4px; background: var(--accent-2); }
  .stop { padding: 0; }
  .stop::before { display: none; }
  .route .stop-head { margin-left: 0; flex-direction: column; align-items: flex-start; gap: 10px; }
  .stop-dot { position: relative; z-index: 1; }
  .stop-lead { min-height: 3.5em; }
}

.link-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.link-list li { border-bottom: 1px solid var(--rule); }
.link-list a { display: block; padding: calc(12px * var(--space)) 4px; text-decoration: none; color: var(--text); min-height: var(--tap); }
.link-list a:hover .ll-title { text-decoration: underline; text-decoration-thickness: 2px; }
.ll-title { display: block; font-weight: 700; color: var(--link); line-height: var(--lh-head); }
.ll-desc { display: block; font-size: var(--small); color: var(--text-2); margin-top: .25em; line-height: 1.6; }

.tools-block { border: 2px dashed var(--accent-2); border-radius: var(--radius-big); padding: 18px 16px 8px; margin: 0 0 40px; }
.tools-block .stop-head { margin-left: 0; }
.tool-list { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 720px) { .tool-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tool-list a { display: block; height: 100%; padding: 12px 14px; border: 1.5px solid var(--rule-strong); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.tool-list a:hover { border-color: var(--accent); }

/* ---------- article page ---------- */
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "side" "body"; padding-bottom: 40px; }
.page-head { grid-area: head; padding: calc(16px * var(--space)) 0 calc(8px * var(--space)); max-width: var(--measure); }
.page-side { grid-area: side; }
.page-body { grid-area: body; min-width: 0; max-width: var(--measure); }
@media (min-width: 1024px) {
  .page-grid { grid-template-columns: minmax(0, 1fr) 17rem; grid-template-areas: "head ." "body side"; column-gap: 56px; }
  .page-side { position: sticky; top: 16px; align-self: start; }
}

.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; margin: 0 0 12px; padding: 0; font-size: var(--small); }
.crumbs li + li::before { content: "/"; margin: 0 .5em; color: var(--text-2); }
.crumbs a { color: var(--text); }
.stage-tag { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-weight: 700; color: var(--accent); }
.stage-tag .stop-dot { --dot: 26px; border-width: 3px; font-size: .8rem; }
.page-head h1 { font-size: var(--h1); margin: 0 0 .5em; }
@media (min-width: 720px) { .page-head h1 { font-size: var(--h1-desk); } }
.lead { font-size: 1.0625em; margin: 0 0 .75em; }
.checked-top { font-size: var(--small); color: var(--text-2); margin: 0; }

.toc { border-left: 4px solid var(--accent-2); padding: 4px 0 4px 16px; margin: 8px 0 24px; }
.toc-h { font-weight: 700; margin: 0 0 4px; }
.toc ol { margin: 0; padding-left: 1.3em; }
.toc li { margin: 4px 0; }
.toc a { color: var(--text); }
.toc a:hover { color: var(--link); }

/* body text */
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose table, .prose blockquote { margin: 0 0 calc(1.1em * var(--space)); }
.prose li { margin: .3em 0; }
.prose h2 { font-size: var(--h2); color: var(--accent); margin: calc(2.2em * var(--space)) 0 .7em; }
.prose h3 { font-size: var(--h3); margin: 1.8em 0 .5em; }
.prose strong { font-weight: 700; }
.prose blockquote { margin-left: 0; padding: 12px 16px; border-left: 4px solid var(--accent-2); background: var(--tint); }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose code { font-size: .9em; background: var(--tint); padding: .1em .3em; border-radius: 3px; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.prose table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: var(--small); line-height: 1.6; }
.prose th, .prose td { border: 1px solid var(--rule-strong); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose thead th { background: var(--tint); font-weight: 700; }
.prose td[align="right"], .prose th[align="right"] { text-align: right; font-variant-numeric: tabular-nums; }

.notice { border: 1.5px solid var(--rule-strong); border-radius: var(--radius); padding: 10px 14px; font-size: var(--small); }

/* ---------- calculators (tools/<slug>/tool.html) ----------
   One card: the .tool div from tool.html. page.html wraps it in an unstyled .tool-section. */
.tool-section { margin: 0 0 28px; }
.tool-section > .tool-note { margin: 10px 0 0; }
.tool { border: 2px solid var(--accent); border-radius: var(--radius-big); padding: 16px; background: var(--bg); }
@media (min-width: 720px) { .tool { padding: 22px 24px; } }
.tool p { margin: 0; }
.tool-form { display: grid; gap: calc(16px * var(--space)); }
.tool-field { display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; }
.tool-field > label { font-weight: 700; line-height: var(--lh-head); }
.tool input[type="number"], .tool input[type="date"], .tool input[type="text"], .tool select {
  font: inherit; line-height: 1.4; color: var(--text); background: var(--bg); width: 100%; min-height: var(--tap);
  border: 1.5px solid var(--rule-strong); border-radius: var(--radius); padding: 6px 10px;
}
@media (min-width: 720px) {
  .tool input[type="number"], .tool input[type="date"], .tool input[type="text"], .tool select { max-width: 24rem; }
}
.tool input:focus-visible, .tool select:focus-visible { border-color: var(--accent); }
.tool-help { display: block; font-size: var(--small); color: var(--text-2); line-height: 1.6; }
.tool-credit a { color: var(--text-2); }
.tool-inline-label { margin-top: 6px; font-weight: 400 !important; font-size: var(--small); }

/* checkbox: box and label on one line, help text underneath */
.tool-field.tool-check { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-items: start; }
.tool-check input[type="checkbox"] { width: 22px; height: 22px; margin: .15em 0 0; accent-color: var(--accent); }
.tool-check > label { font-weight: 700; cursor: pointer; }
.tool-check > .tool-help { grid-column: 2; }

details.tool-more, fieldset.tool-more { border: 1.5px solid var(--rule); border-radius: var(--radius); padding: 0 14px; margin: 0; min-width: 0; }
fieldset.tool-more { padding: 6px 14px 14px; display: grid; gap: 14px; }
fieldset.tool-more legend { font-weight: 700; padding: 0 6px; }
details.tool-more > summary, details.tool-rates > summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; font-weight: 700; color: var(--link); }
details.tool-more[open] { padding-bottom: 14px; }
details.tool-more[open] > .tool-field + .tool-field { margin-top: 14px; }

.tool-actions { padding-top: 4px; }
.tool button, .btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 8px 24px;
  font: 700 1.0625rem/1.3 var(--font); color: var(--on-accent); background: var(--accent); border: 0; border-radius: var(--radius);
  text-decoration: none; cursor: pointer;
}
@media (max-width: 719px) { .tool-button { width: 100%; } }
.tool button:hover, .btn:hover { filter: brightness(1.15); }

/* messages and the result */
.tool-message:empty, .tool-result:empty, .tool-next:empty { display: none; }
.tool-message { margin-top: 16px !important; font-weight: 700; }
.tool-warn { color: #8a1010; border-left: 4px solid #8a1010; padding-left: 10px; } /* 9.9:1 */
.tool-result { display: block; margin-top: 20px; padding-top: 16px; border-top: 3px solid var(--accent); }
.tool-result-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tool-result-table th, .tool-result-table td { padding: 8px 4px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.tool-result-table th { text-align: left; font-weight: 400; }
.tool-result-table td { text-align: right; overflow-wrap: anywhere; }
.tool-result-table td .tool-help { text-align: right; }
.tool-result-table .tool-subtotal th, .tool-result-table .tool-subtotal td { font-weight: 700; border-bottom: 2px solid var(--rule-strong); }
.tool-result-table .tool-total th, .tool-result-table .tool-total td { background: var(--tint); font-weight: 700; color: var(--text); padding: 12px 10px; border-bottom: 2px solid var(--accent); }
.tool-result-table .tool-total td { font-size: 1.5rem; line-height: 1.35; color: var(--accent); }
@media (max-width: 559px) { /* label and value share a line when they fit; a long value wraps under its label */
  .tool-result-table, .tool-result-table tbody { display: block; }
  .tool-result-table tr { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 12px; border-bottom: 1px solid var(--rule); padding: 8px 4px; }
  .tool-result-table tr > th, .tool-result-table tr > td, .tool-result-table tr[class] > th, .tool-result-table tr[class] > td { border-bottom: 0; padding: 0; background: none; }
  .tool-result-table tr > th { flex: 1 1 9em; }
  .tool-result-table tr > td { flex: 0 1 auto; margin-left: auto; }
  .tool-result-table .tool-subtotal { border-bottom: 2px solid var(--rule-strong); }
  .tool-result-table .tool-total { background: var(--tint); border-bottom: 2px solid var(--accent); padding: 12px 10px; }
}
.tool-note { font-size: var(--small); margin: 14px 0 0 !important; }
.tool-next { margin-top: 14px !important; }
.tool-link { font-weight: 700; }
.tool-disclaimer, .tool-privacy { font-size: var(--small); margin-top: 14px !important; }
details.tool-rates { margin-top: 14px; border-top: 1px solid var(--rule); font-size: var(--small); }
details.tool-rates ul { margin: 0 0 8px; }

/* end of article: checked date + sources */
.page-foot { margin-top: 32px; padding: 18px 16px; border: 1.5px solid var(--rule-strong); border-radius: var(--radius); }
.page-foot .checked { margin: 0 0 4px; }
.check-official { margin: 0 0 12px; font-size: var(--small); }
.sources-h { font-size: 1rem; margin: 0 0 6px; color: var(--text); }
.sources { list-style: none; margin: 0; padding: 0; }
.sources li { padding: 6px 0; border-top: 1px solid var(--rule); }
.sources a { font-weight: 600; }
.src-host { display: block; font-size: var(--small); color: var(--text-2); word-break: break-all; }

.related { margin-top: 36px; }
.related h2 { font-size: 1.125rem; color: var(--accent); margin: 0 0 8px; }

/* ads: clearly marked, boxed, never styled like body text */
.ad { margin: 32px 0; padding: 8px 10px 12px; border: 1px dashed var(--rule-strong); border-radius: 4px; background: var(--bg); min-height: 120px; }
.ad-label { margin: 0 0 6px; font: 400 .8125rem/1.4 system-ui, sans-serif; color: var(--text-2); }

/* ---------- root page (Japanese) ---------- */
.doors { display: grid; gap: 20px; padding-bottom: 40px; }
@media (min-width: 900px) { .doors { grid-template-columns: 3fr 2fr; gap: 28px; align-items: start; } }
.door { border: 2px solid var(--accent); border-radius: var(--radius-big); padding: 20px 16px; }
.door h2 { margin: 0 0 .4em; font-size: 1.5rem; color: var(--accent); }
.door-sub { display: block; font-size: 1rem; font-weight: 400; color: var(--text-2); }
.door-lead { margin: 0 0 1rem; }
.door--company { border-color: var(--rule-strong); }
.lang-picker { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); }
.lang-picker a { display: block; padding: 10px 14px; min-height: var(--tap); border: 1.5px solid var(--rule-strong); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.lang-picker a:hover { border-color: var(--accent); background: var(--tint); }
.lp-name { display: block; font-size: 1.25rem; font-weight: 700; color: var(--accent); line-height: 1.5; }
.lp-act { display: block; font-size: var(--small); color: var(--text-2); line-height: 1.6; }
.lang-picker a[lang="my"] .lp-name, .lang-picker a[lang="my"] .lp-act { line-height: 2; }
.lang-picker--compact { margin: 0 0 48px; }
.link-list--plain { margin-top: 1rem; }
.root-intro { padding-bottom: 32px; }

/* ---------- footer ---------- */
.site-foot { border-top: 5px solid var(--accent-2); background: var(--tint); padding: 28px 0 36px; font-size: var(--small); }
.not-gov { margin: 0 0 14px; max-width: var(--measure); font-weight: 600; }
.foot-links { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0 0 14px; padding: 0; }
.foot-links a { display: inline-flex; min-height: var(--tap); align-items: center; color: var(--text); }
.operator { margin: 0; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
@media print { .site-head .menu, .langs, .ad, .page-side { display: none; } }
