:root {
  --page-width: 778px;
  --blue: #003399;
  --green: #55a400;
  --orange: #f39800;
  --red: #c00000;
  --nav-gray: #dedede;
  --page-bg: #efefef;
  --panel-line: #bcd98e;
  font-family: Arial, Helvetica, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: #202020;
  background: var(--page-bg);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page-bg); }
body { font-size: 16px; line-height: 1.7; }
body[data-lang="zh"] [data-en], body[data-lang="en"] [data-zh] { display: none !important; }
img { display: block; max-width: 100%; }
a { color: var(--blue); text-underline-offset: 2px; }
button { font: inherit; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; padding: .6rem 1rem; background: #fff; border: 1px solid #999; }
.skip-link:focus { top: 1rem; }

.page-shell { width: min(var(--page-width), 100%); min-height: 100vh; margin: 0 auto; background: #fff; box-shadow: 0 0 22px rgba(0,0,0,.08); }
.legacy-header { position: relative; background: #fff; }
.header-art { display: block; width: 100%; }
.header-art img { width: 100%; height: auto; }
.brand-header { position: relative; min-height: 101px; display: flex; align-items: stretch; background: #fff; }
.brand-lockup { min-width: 0; flex: 1 1 auto; display: flex; align-items: center; color: inherit; text-decoration: none; }
.brand-heart { width: 145px; height: 101px; overflow: hidden; flex: 0 0 145px; }
.brand-heart img { width: 778px; max-width: none; height: 101px; }
.brand-names { min-width: 0; display: flex; flex-direction: column; justify-content: center; line-height: 1.15; }
.brand-en { order: 1; color: #d71920; font-family: Georgia, "Times New Roman", serif; font-size: 19px; font-weight: 700; white-space: nowrap; }
.brand-zh { order: 2; margin-top: 6px; color: #004b91; font-family: "DFKai-SB", "KaiTi", "STKaiti", "Noto Serif TC", serif; font-size: 36px; font-weight: 700; letter-spacing: 3px; white-space: nowrap; }
html[lang="zh-Hant"] .brand-zh { order: 1; margin: 0 0 6px; }
html[lang="zh-Hant"] .brand-en { order: 2; }
.header-contact { width: 200px; flex: 0 0 200px; align-self: flex-end; padding: 0 8px 6px 0; text-align: right; font-family: Arial, sans-serif; font-size: 14px; line-height: 1.25; }
.header-contact a { display: block; color: #ed1f27; text-decoration: none; }
.header-contact span { display: block; color: var(--blue); }
.language-links { position: absolute; z-index: 2; right: 5px; top: 7px; display: flex; gap: 14px; }
.language-links button, .language-links a { padding: 1px 0; border: 0; border-bottom: 1px solid transparent; background: transparent; color: var(--blue); font-family: "Times New Roman", serif; font-size: 13px; text-decoration: underline; cursor: pointer; }
.language-links button[aria-pressed="true"] { color: var(--green); border-bottom-color: var(--green); text-decoration: none; }
.language-links a[aria-current="page"] { color: var(--green); text-decoration: none; }
.language-links span { color: #777; font-size: 12px; }

.main-nav, .sub-nav { display: flex; align-items: center; justify-content: space-around; width: 100%; }
.main-nav { min-height: 30px; padding: 2px 5px; background: var(--nav-gray); border-top: 1px solid #c7c7c7; border-bottom: 2px solid #bdbdbd; }
.sub-nav { min-height: 50px; padding: 8px 7px; background: #fff; }
.main-nav a, .sub-nav a { position: relative; flex: 1 1 auto; padding: 2px 7px; color: var(--blue); text-align: center; white-space: nowrap; font-size: 13px; }
.main-nav a:not(:last-child)::after { content: "|"; position: absolute; right: -2px; color: #555; text-decoration: none; }
.main-nav a:hover, .main-nav a:focus-visible, .sub-nav a:hover, .sub-nav a:focus-visible,
.main-nav a[aria-current="page"], .sub-nav a[aria-current="page"] { color: #ed1f27; font-weight: 700; }

.content-panel { margin: 0 7px; border: 2px solid var(--panel-line); border-radius: 3px; background: #fff; min-height: 420px; }
.section-title { min-height: 48px; display: flex; align-items: center; padding: 0 28px; background: linear-gradient(#fff 0%,#fff 78%,#fff8ee 100%); border-bottom: 2px dotted #efbd6b; }
.title-flourish { width: 26px; height: 26px; margin-right: 8px; border-radius: 50% 0 50% 50%; border: 4px solid var(--orange); border-right-color: transparent; transform: rotate(20deg); flex: 0 0 auto; }
h1 { margin: 0; color: #111; font-family: "Times New Roman", "Noto Serif TC", serif; font-size: 22px; font-weight: 500; line-height: 1.15; }
.title-primary, .title-secondary { display: block; }
.title-secondary { margin-top: 2px; color: #666; font-size: 13px; font-weight: 400; }
h2 { margin: 1.6rem 0 .55rem; color: var(--blue); font-size: 20px; line-height: 1.35; }
h3 { margin: 0 0 .25rem; color: #222; font-size: 17px; }

.page-content { width: min(700px, calc(100% - 30px)); margin: 0 auto; padding: 27px 0 35px; font-family: "Times New Roman", "Noto Serif TC", "PMingLiU", serif; font-size: 17px; }
.page-content p { margin: 0 0 17px; text-align: justify; }
.page-content p.indent { text-indent: 1.5em; }
.company-name { margin: 0 0 18px; text-align: center; font-size: 21px; line-height: 1.35; }
.opening img { float: left; width: 49%; max-width: 341px; margin: 3px 10px 3px 0; border: 1px solid #aaa; border-radius: 5px; }
.opening::after { content: ""; display: table; clear: both; }
.intro-strip { width: min(591px,100%); margin: 20px auto 0; }

.feature-grid, .service-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin: 15px 0 25px; }
.feature-card, .service-card { padding: 15px; border: 1px solid #d6d6d6; border-top: 3px solid var(--green); background: #fafafa; }
.feature-card p, .service-card p { margin: 0; text-align: left; }
.photo-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 16px 0 24px; }
.photo-grid img { width: 100%; height: 128px; object-fit: cover; border: 1px solid #aaa; background: #f3f3f3; }
.art-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; margin: 14px 0; }
.art-card { margin: 0; padding: 8px; border: 1px solid #ccc; background: #fafafa; }
.art-card img { width: 100%; height: 220px; object-fit: contain; background: white; }
.art-card figcaption { padding-top: 7px; text-align: center; font-family: Arial, sans-serif; font-size: 14px; }
.honor-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.honor-card { margin: 0; padding: 9px; border: 1px solid #ccc; background: #fff; }
.honor-card img { width: 100%; height: 230px; object-fit: contain; }
.honor-card figcaption { margin-top: 8px; font-size: 14px; line-height: 1.45; text-align: center; }
.flyer-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-top: 18px; }
.flyer-grid img { width: 100%; border: 1px solid #bbb; }

.clean-list { margin: 8px 0 22px; padding-left: 1.35rem; }
.clean-list li { margin-bottom: 8px; }
.timeline { margin: 12px 0; padding: 0; list-style: none; }
.timeline li { display: grid; grid-template-columns: 75px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px dotted #bbb; }
.timeline strong { color: var(--green); }
.archive-note, .notice { margin: 15px 0 20px; padding: 12px 14px; border-left: 4px solid var(--orange); background: #fff8ea; font-family: Arial, "Microsoft JhengHei", sans-serif; font-size: 14px; }
.contact-card { display: grid; grid-template-columns: minmax(0,1fr) 260px; gap: 22px; align-items: start; }
.contact-card address { font-style: normal; }
.contact-card img { border: 1px solid #aaa; }
.song-sheet { width: min(494px,100%); margin: 0 auto; border: 1px solid #ccc; }
.portrait { float: left; width: 170px; margin: 3px 18px 8px 0; border: 1px solid #aaa; }
.prose::after { content: ""; display: table; clear: both; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.button-link { display: inline-block; padding: 8px 15px; color: #fff; background: var(--blue); border-radius: 3px; font-family: Arial, sans-serif; text-decoration: none; }
.button-link.secondary { color: var(--blue); background: #fff; border: 1px solid var(--blue); }
.legacy-footer { min-height: 62px; padding: 18px 14px; display: flex; flex-wrap: wrap; justify-content: center; gap: 0 5px; color: #333; text-align: center; font-size: 12px; }
.footer-links { flex: 1 0 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin-top: 6px; }
.footer-links a { color: #444; }
.update-card { margin: 0 0 18px; padding: 16px; border: 1px solid #d4d4d4; border-top: 3px solid var(--green); background: #fafafa; }
.update-card h2 { margin-top: 8px; }
.update-meta { display: flex; justify-content: space-between; gap: 12px; color: #666; font-family: Arial, sans-serif; font-size: 14px; }

/* Original-page body preservation. */
.legacy-source, .legacy-translation {
  color: #333;
  font-family: "Times New Roman", "Noto Serif TC", "PMingLiU", serif;
  font-size: 10pt;
  line-height: normal;
}
.legacy-source { width: 100% !important; border-collapse: collapse; table-layout: auto; }
.legacy-source table { max-width: 100%; border-collapse: collapse; }
.legacy-source td { vertical-align: top; }
.legacy-source p { margin: 1em 0; line-height: normal; }
.legacy-source img { display: inline-block; max-width: 100%; height: auto; margin: 0; vertical-align: middle; }
.legacy-source [align="center"] { text-align: center; }
.legacy-source [align="right"] { text-align: right; }
.legacy-source a { overflow-wrap: anywhere; }
.legacy-source > tbody > tr > td, .legacy-source > tr > td { padding: 0; }
.legacy-source .\31 0 { font-size: 10pt; color: #000; font-weight: 400; }
.legacy-source .green10, .legacy-source .greens10 { font-size: 10pt; color: #55a400; font-weight: 400; }
.legacy-source .white10 { font-size: 10pt; color: #fff; font-weight: 400; }
.legacy-source .hui09, .legacy-source .hui10 { font-size: 10pt; color: #333; font-weight: 400; }
.legacy-source .title { font-size: 10pt; color: #000; font-weight: 700; }
.legacy-source .o { font-size: 12pt; color: #f90; font-weight: 700; }
.legacy-source .blue { font-size: 10pt; color: #039; font-weight: 400; }
.legacy-source .\31 2 { font-size: 12pt; color: #000; font-weight: 700; }
.legacy-source td[bgcolor="#0099FF" i] { background: #0099ff; }
.legacy-source td[bgcolor="#E1F2FF" i] { background: #e1f2ff; }
.legacy-source h1 { font-size: 2em; line-height: 1.15; }
.legacy-translation p { margin: 0 0 8px; line-height: 1.35; }
.legacy-translation h2, .legacy-translation h3 { margin: 12px 0 5px; line-height: 1.25; }

/* The health-program tables are organized as fixed photo/topic rows. Keeping
   their archived heights and top alignment reconnects every photo to its title. */
body[data-page="health-overview"] .legacy-source td { vertical-align: top; }
body[data-page="health-overview"] .legacy-source p { line-height: normal; }

/* Archived directory tables used alternating blue bands and compact rows. */
body[data-page="medical-housing-3"] .legacy-source td { padding: 0 2px; }
body[data-page="medical-housing-3"] .legacy-source p { margin: 0; line-height: 20px; }

@media (max-width: 720px) {
  html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
  .page-shell { box-shadow: none; }
  .brand-header { min-height: 78px; }
  .brand-heart { width: 98px; height: 78px; flex-basis: 98px; }
  .brand-heart img { width: 600px; height: auto; }
  .brand-en { font-size: clamp(10px, 2.7vw, 15px); }
  .brand-zh { margin-top: 4px; font-size: clamp(20px, 5.6vw, 30px); letter-spacing: 1px; }
  html[lang="zh-Hant"] .brand-zh { margin-bottom: 4px; }
  .header-contact { width: 137px; flex-basis: 137px; padding-right: 5px; padding-bottom: 4px; font-size: clamp(9px, 2.4vw, 12px); }
  .language-links { right: 4px; top: 3px; gap: 8px; }
  .language-links button, .language-links a { font-size: clamp(9px,2.7vw,12px); }
  .main-nav, .sub-nav { flex-wrap: wrap; justify-content: center; }
  .main-nav { padding: 4px 2px; }
  .sub-nav { padding: 7px 2px; }
  .main-nav a, .sub-nav a { flex: 0 1 auto; padding: 3px 8px; font-size: clamp(11px,3vw,13px); }
  .main-nav a::after { display: none; }
  .content-panel { margin: 0 5px; }
  .section-title { padding: 0 18px; }
  .page-content { width: calc(100% - 26px); min-width: 0; padding-top: 22px; font-size: clamp(16px,4.5vw,18px); overflow-wrap: anywhere; }
  .company-name { font-size: clamp(18px,5vw,21px); }
  .opening img { width: 48%; }
  .photo-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .contact-card { grid-template-columns: 1fr; }
  .contact-card img { width: min(402px,100%); }

  /* The desktop archive uses 700px presentation tables. On phones, make every
     nested table use the available white panel instead of widening the page. */
  .legacy-source,
  .legacy-source table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
  }
  .legacy-source td {
    min-width: 0 !important;
    max-width: 100%;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: normal;
  }
  .legacy-source td[width]:not([width$="%"]) { width: auto !important; }
  .legacy-source td[height] { height: auto !important; }
  .legacy-source img { max-width: 100% !important; height: auto !important; }

  /* The introduction photograph is a desktop text float. Stacking it on a
     phone prevents the opening paragraph from forming a clipped narrow strip. */
  body[data-page="about-intro"] .legacy-source img[align="left"] {
    display: block;
    float: none;
    width: 100%;
    margin: 0 0 12px;
  }
}

@media (max-width: 480px) {
  .brand-header { min-height: 70px; }
  .brand-heart { width: 72px; height: 70px; flex-basis: 72px; }
  .brand-heart img { width: 520px; height: auto; transform: translateX(-3px); }
  .brand-en { font-size: clamp(9px,2.55vw,12px); white-space: normal; }
  .brand-zh { font-size: clamp(18px,5.3vw,24px); }
  .header-contact { width: 118px; flex-basis: 118px; font-size: clamp(8px,2.25vw,10px); }
  .feature-grid, .service-grid, .flyer-grid, .honor-grid { grid-template-columns: 1fr; }
  .art-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .art-card img { height: 180px; }
  .timeline li { grid-template-columns: 60px 1fr; gap: 8px; }
  .portrait { width: 42%; margin-right: 12px; }
  .legacy-footer { font-size: 11px; }
  .legacy-source { font-size: 10pt; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
