/* Tong Ming Group — site stylesheet */
:root {
  --navy: #1b3a5c;
  --navy-dark: #142c46;
  --accent: #2e6da4;
  --text: #222;
  --muted: #667;
  --line: #d9dee4;
  --bg: #f5f6f8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Helvetica Neue", Arial, "Noto Sans TC", "PingFang TC",
               "Microsoft JhengHei", sans-serif;
  line-height: 1.7;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* header (logo images carry white lettering, so the header is dark) */
.site-header { background: var(--navy-dark); border-bottom: 3px solid var(--accent); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-top: 16px; padding-bottom: 16px;
}
.brand { display: block; min-width: 0; }
.brand img { display: block; width: auto; max-width: 100%; height: auto; }
.lang-switch {
  color: #fff; text-decoration: none; font-size: .95rem;
  border: 1px solid rgba(255,255,255,.5); border-radius: 4px; padding: 6px 12px;
  white-space: nowrap;
}
.lang-switch:hover { background: var(--navy); }

/* main nav */
.main-nav { background: var(--navy); }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.main-nav li a {
  display: block; padding: 12px 18px; color: #fff; text-decoration: none;
  font-size: 1rem;
}
.main-nav li a:hover { background: var(--navy-dark); }
.main-nav li.current a { background: var(--navy-dark); font-weight: 700; }
.menu-toggle { display: none; }

/* layout */
.layout { display: flex; gap: 28px; padding-top: 28px; padding-bottom: 48px; align-items: flex-start; }
.sidebar {
  flex: 0 0 260px; background: #fff; border: 1px solid var(--line);
  border-radius: 6px; padding: 18px; position: sticky; top: 16px;
}
.sidebar h2 { font-size: 1.05rem; margin: 0 0 10px; color: var(--navy);
  border-bottom: 2px solid var(--navy); padding-bottom: 8px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a {
  display: block; padding: 7px 8px; color: var(--text); text-decoration: none;
  border-radius: 4px; font-size: .95rem;
}
.sidebar li a:hover { background: var(--bg); color: var(--accent); }
.sidebar li.current > a,
.sidebar li.current > details > summary > a { background: var(--navy); color: #fff; }

/* nested sidebar groups: <details> accordions */
.sidebar summary {
  display: flex; align-items: center; cursor: pointer; list-style: none;
  border-radius: 4px;
}
.sidebar summary::-webkit-details-marker { display: none; }
.sidebar summary:hover { background: var(--bg); }
.sidebar summary > a, .sidebar summary > span { flex: 1; }
.sidebar summary > span {
  display: block; padding: 7px 8px; font-size: .95rem; color: var(--navy);
}
.sidebar summary > a, .sidebar summary > span { font-weight: 700; }
.sidebar summary::after {
  content: "▸"; flex: none; padding: 0 8px; color: var(--muted);
  font-size: .8rem; transition: transform .15s ease;
}
.sidebar details[open] > summary::after { transform: rotate(90deg); }
.sidebar li ul {
  margin: 2px 0 6px 14px; padding-left: 6px; border-left: 2px solid var(--line);
}
.sidebar li li a, .sidebar li li span { font-size: .875rem; padding: 5px 8px; }

main {
  flex: 1; min-width: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 6px; padding: 28px 32px;
}
main h1, main h2 { color: var(--navy); line-height: 1.4; }
main h1 { font-size: 1.5rem; }
main h2 { font-size: 1.35rem; }
main img { max-width: 100%; height: auto; }
main a { color: var(--accent); }
main hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

/* content tables (financial reports etc.) */
main table {
  border-collapse: collapse; max-width: 100%; margin: 12px 0;
}
main table td, main table th {
  border: 1px solid #b9c2cc; padding: 6px 10px; vertical-align: top;
}
main table > :first-child > tr:first-child td p strong, main table th { color: var(--navy); }
main table > :first-child > tr:first-child { background: #edf1f5; }
div[style*="overflow-y: hidden"], .table-scroll { overflow-x: auto; }
/* scroll-wrapped data tables scroll on narrow screens instead of
   squeezing to a character per column (was a fixed Weebly pixel width) */
.table-scroll > table { min-width: 640px; }

/* dense legacy data tables (Weebly exports with border="1") */
main table[border] { font-size: .9rem; }
main table[border] td, main table[border] th { padding: 4px 7px; }

/* nested sub-row tables (aligned name/relation pairs inside a cell) */
main table.subrows { width: 100%; margin: 0; }
main table.subrows tr:first-child { background: none; }
main table.subrows td:first-child { width: 62%; }

/* data tables with centered cells (board rosters, holdings, …);
   .cell-left opts a column back out (bio/name columns) */
main table.center td { text-align: center; }
main table.center td.cell-left { text-align: left; }

/* alignment utilities (replace legacy align= attrs) */
main .ta-r { text-align: right; }
main .ta-c { text-align: center; }

/* Weebly multicol layout tables (wrapped in margin:0 -15px divs): render as
   plain side-by-side columns, not bordered data tables. Child selectors keep
   real data tables nested inside a column styled normally. */
main div[style*="margin:0 -15px"] > table { width: 100%; margin: 0; }
main div[style*="margin:0 -15px"] > table > tbody > tr { background: none; }
main div[style*="margin:0 -15px"] > table > tbody > tr > td { border: 0; }

/* uniform PDF download lists (replaces Weebly's spacer-div/table layouts) */
main ul.download-list { list-style: none; padding: 0; }
main ul.download-list > li { padding: 8px 0; border-bottom: 1px dashed var(--line); }
main ul.download-row {
  list-style: none; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px 32px;
}

/* side-by-side label pairs (was nbsp-faked columns in the Weebly export) */
main .pair-row { display: flex; flex-wrap: wrap; gap: 1em 6em; }
main .pair-row > p { margin: 12px 0; }

/* outline lists in governance prose and MOPS announcement archives
   (markers match the source documents) */
main ol.ol-cjk { list-style: trad-chinese-informal; }
main ol.ol-upper-alpha { list-style: upper-alpha; }
main ol.ol-lower-alpha { list-style: lower-alpha; }
main ol.ol-alpha-paren { list-style: none; counter-reset: ap; padding-left: 2.5em; }
main ol.ol-alpha-paren > li { counter-increment: ap; }
main ol.ol-alpha-paren > li::before {
  content: "(" counter(ap, lower-alpha) ") ";
  margin-left: -2em;
  display: inline-block; width: 2em;
}
main ol.ol-cjk-paren { list-style: none; counter-reset: cp; padding-left: 3.5em; }
main ol.ol-cjk-paren > li { counter-increment: cp; }
main ol.ol-cjk-paren > li::before {
  content: "（" counter(cp, trad-chinese-informal) "）";
  margin-left: -3.5em;
  display: inline-block; width: 3.5em;
}
main ul.ul-star { list-style-type: "＊ "; }
main ul.ul-ref { list-style-type: "※ "; }
main ol.ol-cjk > li > p:first-of-type { margin-top: 0; }

/* news */
.news-list { list-style: none; padding: 0; }
.news-list li { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.news-date { color: var(--muted); font-size: .9rem; margin-right: 10px; }

/* footer */
.site-footer {
  background: var(--navy); color: #cdd8e4; padding: 20px 0; font-size: .9rem;
}
.site-footer a { color: #fff; }

/* mobile */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  /* stack multicol layout columns (inline widths need the override) */
  main div[style*="margin:0 -15px"] > table,
  main div[style*="margin:0 -15px"] > table > tbody,
  main div[style*="margin:0 -15px"] > table > tbody > tr,
  main div[style*="margin:0 -15px"] > table > tbody > tr > td {
    display: block; width: auto !important;
  }
  .sidebar { position: static; width: 100%; flex: none; }
  /* width needed: .layout align-items:flex-start makes main fit-content,
     so wide tables would otherwise inflate it past the viewport */
  main { padding: 20px 16px; width: 100%; }
  .menu-toggle {
    display: block; background: none; border: 1px solid rgba(255,255,255,.4);
    color: #fff; font-size: 1rem; padding: 8px 14px; margin: 8px 0;
    border-radius: 4px;
  }
  .main-nav ul { display: none; }
  body.nav-open .main-nav ul { display: block; }
}
