/* 中華足部反射區健康法協會 — site stylesheet (mobile first) */
:root {
  --ink: #1c2630;
  --muted: #5b6874;
  --navy: #0b4f8a;
  --navy-deep: #083963;
  --mist: #eef3f8;
  --rule: #d3dde8;
  --gold: #b08d1e;
  --paper: #fff;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC", sans-serif;
  --serif: "Noto Serif TC", "Songti TC", "Source Han Serif TC", "PMingLiU", "MingLiU", serif;
  --wrap: 72rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font: 1.0625rem/1.85 var(--sans);
  color: var(--ink);
  background: var(--paper);
  overflow-wrap: anywhere;
}
img { max-width: 100%; height: auto; }
a { color: var(--navy); text-underline-offset: .2em; }
a:hover { color: var(--navy-deep); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.4; color: var(--navy-deep); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }
.skip { position: absolute; left: -999px; top: 0; background: var(--gold); color: #fff; padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }

/* ---------- header ---------- */
.site-header { border-bottom: 1px solid var(--rule); background: var(--paper); }
.bar { display: flex; align-items: center; gap: 1rem; padding-top: .75rem; padding-bottom: .75rem; }
.brand { display: block; flex: 1 1 auto; min-width: 0; }
.brand img { display: block; height: 44px; width: auto; }
.util { display: none; list-style: none; margin: 0; padding: 0; gap: 1.25rem; font-size: .9375rem; }
.util a { color: var(--muted); text-decoration: none; }
.util a:hover { color: var(--navy); text-decoration: underline; }
.nav-toggle {
  display: none; flex: none; font: inherit; font-size: .9375rem;
  border: 1px solid var(--navy); color: var(--navy); background: var(--paper);
  border-radius: 4px; padding: .3rem .9rem; cursor: pointer;
}
.site-nav { background: var(--navy); }
.site-nav ul { list-style: none; margin: 0 auto; display: flex; flex-wrap: wrap; }
.site-nav a {
  display: block; color: #fff; text-decoration: none; padding: .7rem .8rem;
  border-bottom: 3px solid transparent; font-size: .96875rem;
}
.site-nav a:hover { background: var(--navy-deep); color: #fff; }
.site-nav a[aria-current], .site-nav a.active { border-bottom-color: var(--gold); }

/* collapsed nav on small screens (only when JS is available to reopen it) */
@media (max-width: 59.99rem) {
  .js .nav-toggle { display: block; }
  .js .site-nav { display: none; }
  .js .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; padding: 0; }
  .site-nav a { padding: .75rem 1.25rem; border-bottom: 1px solid rgba(255, 255, 255, .15); border-left: 4px solid transparent; }
  .site-nav a[aria-current], .site-nav a.active { border-bottom-color: rgba(255, 255, 255, .15); border-left-color: var(--gold); }
}
@media (min-width: 40rem) {
  .brand img { height: 56px; }
  .util { display: flex; }
}
@media (min-width: 60rem) {
  .site-nav ul { padding: 0 .45rem; }
}

/* ---------- page layout ---------- */
.page { padding-top: 1rem; padding-bottom: 3rem; }
.crumbs ol { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; font-size: .875rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin: 0 .5rem; color: var(--rule); }
.crumbs a { color: var(--muted); }
.layout { display: grid; gap: 2.5rem; }
.content { min-width: 0; }
.content > h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.125rem); margin: 0 0 1.25rem; padding-bottom: .75rem; border-bottom: 2px solid var(--navy); }
@media (min-width: 60rem) {
  .layout { grid-template-columns: 15rem minmax(0, 1fr); gap: 3rem; }
  .subnav { grid-column: 1; grid-row: 1; }
  .content { grid-column: 2; }
}

/* section menu */
.subnav { font-size: .9375rem; align-self: start; }
.subnav h2 { font-size: 1.125rem; margin: 0 0 .5rem; }
.subnav h2 a { text-decoration: none; color: var(--navy-deep); }
.subnav ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.subnav li a { display: block; padding: .5rem .75rem; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--rule); border-left: 3px solid transparent; line-height: 1.5; }
.subnav li a:hover { background: var(--mist); }
.subnav a[aria-current], .subnav a.active { border-left-color: var(--gold); background: var(--mist); color: var(--navy-deep); font-weight: 600; }
@media (max-width: 59.99rem) {
  .subnav { border-top: 2px solid var(--navy); padding-top: 1rem; }
}

/* ---------- content typography ---------- */
.prose { max-width: 48em; }
.prose > * + * { margin-top: 1em; }
.prose p, .prose div, .prose ul, .prose ol { margin-top: 0; margin-bottom: 0; }
.prose p + p, .prose div + div, .prose div + p, .prose p + div { margin-top: 1em; }
.prose h2 { font-size: 1.375rem; margin: 2em 0 .6em; }
.prose h3 { font-size: 1.1875rem; margin: 1.75em 0 .5em; color: var(--navy); }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose li + li { margin-top: .35em; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.prose img { display: inline-block; vertical-align: middle; margin: .25rem 0; }
.prose strong { color: var(--navy-deep); }
.tc { text-align: center; }
.tr { text-align: right; }
.lead { font-size: 1.125rem; color: var(--muted); margin-top: 0; }
.note { background: var(--mist); padding: .75rem 1rem; border-left: 3px solid var(--navy); }
.small { font-size: .875rem; color: var(--muted); }

/* side-by-side blocks that stack on narrow screens */
.cols { display: flex; flex-wrap: wrap; gap: 1.25rem 2rem; align-items: flex-start; }
.col { flex: 1 1 16rem; min-width: 0; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1.25em 0; border: 1px solid var(--rule); }
.prose .table-wrap { max-width: none; }
table { border-collapse: collapse; width: 100%; font-size: .9375rem; line-height: 1.6; }
th, td { border: 1px solid var(--rule); padding: .5rem .7rem; text-align: left; vertical-align: top; overflow-wrap: normal; word-break: normal; min-width: 4em; }
.table-wrap > table { border: 0; }
.table-wrap > table tr > :first-child { border-left: 0; }
.table-wrap > table tr > :last-child { border-right: 0; }
.table-wrap > table thead tr:first-child > *, .table-wrap > table > tbody:first-child > tr:first-child > * { border-top: 0; }
.table-wrap > table tr:last-child > * { border-bottom: 0; }
th { background: var(--mist); color: var(--navy-deep); font-weight: 600; white-space: nowrap; }
tbody tr:nth-child(even) td { background: #f8fafc; }
td > div + div { margin-top: .5em; }

/* tables with a clear header row become labelled cards on phones */
@media (max-width: 39.99rem) {
  .stack { border: 0; overflow: visible; }
  .stack table, .stack tbody, .stack tr, .stack td { display: block; width: 100%; }
  .stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .stack tr { border: 1px solid var(--rule); margin-bottom: .75rem; }
  .stack tbody tr:nth-child(even) td { background: none; }
  .stack td { min-width: 0; border: 0; border-bottom: 1px solid var(--mist); display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: .75rem; overflow-wrap: anywhere; }
  .stack td:last-child { border-bottom: 0; }
  .stack td::before { content: attr(data-label); color: var(--muted); font-size: .8125rem; }
  .stack td:not([data-label])::before { content: none; }
  .stack td:not([data-label]) { display: block; }
}

/* ---------- lists on hub pages ---------- */
.index-list, .list, .prose .index-list, .prose .list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.index-list li, .list li { border-bottom: 1px solid var(--rule); padding: .8rem 0; margin: 0; }
.index-list a, .list a { font-weight: 600; text-decoration: none; font-size: 1.0625rem; }
.index-list a:hover, .list a:hover { text-decoration: underline; }
.index-list .ex { display: block; color: var(--muted); font-size: .9375rem; line-height: 1.6; margin-top: .15rem; }
.pager a { margin-right: .5rem; }
.tree { padding-left: 1.25rem; }
.tree ul { padding-left: 1.25rem; font-size: .9375rem; }
.prose .tree li + li { margin-top: .25em; }

/* previous / next */
.prevnext { display: grid; gap: .75rem; margin-top: 3rem; border-top: 1px solid var(--rule); padding-top: 1.25rem; }
.prevnext a { text-decoration: none; line-height: 1.5; padding: .5rem 0; }
.prevnext span { display: block; font-size: .8125rem; color: var(--muted); }
.prevnext a:hover { text-decoration: underline; }
@media (min-width: 40rem) {
  .prevnext { grid-template-columns: 1fr 1fr; }
  .prevnext .next { grid-column: 2; text-align: right; }
}

/* ---------- home ---------- */
.home { padding-top: 1.5rem; padding-bottom: 3rem; }
.hero { display: grid; gap: 1.5rem; align-items: center; }
.hero h1 { font-size: clamp(1.5rem, 1rem + 2.2vw, 2.125rem); margin: 0 0 .75rem; letter-spacing: .04em; }
.hero p { margin: 0 0 .75rem; }
.hero .award { color: var(--navy); font-weight: 600; padding-left: .75rem; border-left: 3px solid var(--gold); }
.hero-img { margin: 0; }
.hero-img img { display: block; width: 100%; border-radius: 3px; }
.line-btn img { display: block; }
@media (min-width: 60rem) {
  .hero { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 2.5rem; }
}
.home h2 { font-size: 1.5rem; margin: 0 0 1rem; padding-bottom: .5rem; border-bottom: 2px solid var(--navy); }
.home-cols { display: grid; gap: 2.5rem; margin-top: 3rem; }
@media (min-width: 60rem) {
  .home-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3rem; }
}
.news-list { list-style: none; margin: 0; padding: 0; }
.news-list li { padding: .65rem 0; border-bottom: 1px solid var(--rule); line-height: 1.6; }
.news-list li:first-child { font-weight: 600; color: var(--navy-deep); }
.more { margin-top: 1rem; }
.home-letter .prose { font-size: 1rem; }
.home-sections { margin-top: 3rem; }
.section-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 0 2rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.section-grid li { padding: .9rem 0; border-top: 1px solid var(--rule); }
.section-grid a { font-family: var(--serif); font-size: 1.1875rem; font-weight: 700; text-decoration: none; }
.section-grid a:hover { text-decoration: underline; }
.section-grid span { display: block; color: var(--muted); font-size: .9375rem; line-height: 1.6; margin-top: .2rem; }

/* ---------- footer ---------- */
.site-footer { background: var(--navy-deep); color: #e6edf5; padding: 2.5rem 0 1.5rem; font-size: .9375rem; }
.site-footer a { color: #fff; }
.foot { display: grid; gap: 2rem; }
@media (min-width: 60rem) { .foot { grid-template-columns: 1fr 1fr; } }
.foot-name { font-family: var(--serif); font-size: 1.25rem; font-weight: 700; margin: 0 0 .75rem; color: #fff; }
.contact { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 0; }
.contact dt { color: #a9bdd3; }
.contact dd { margin: 0; }
.foot-nav { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: .25rem 1rem; align-content: start; }
.foot-nav a { text-decoration: none; }
.foot-nav a:hover { text-decoration: underline; }
.copy { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid rgba(255, 255, 255, .15); color: #a9bdd3; font-size: .8125rem; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print {
  .site-header, .site-footer, .subnav, .prevnext, .crumbs { display: none; }
  .layout { display: block; }
}

/* image mosaics (charts cut into tiles by old image editors) */
.mosaic { margin: 1.25em auto; max-width: 600px; }
.mosaic table { table-layout: fixed; width: 100%; border: 0; }
.mosaic td, .mosaic tr { padding: 0; border: 0; background: none !important; }
.mosaic img { display: block; width: 100%; height: auto; margin: 0; }
@media (max-width: 39.99rem) { .stack td .tc, .stack td.tc { text-align: left; } }

.site-nav .m-only a { font-size: .9375rem; color: #cfdcea; }
@media (min-width: 40rem) { .site-nav .m-only { display: none; } }

/* picture grids (book covers, photos with captions) */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1.5rem; margin: 1.25em 0; }
.gallery .item { border-top: 1px solid var(--rule); padding-top: .75rem; font-size: .9375rem; line-height: 1.65; }
.gallery .item img { display: block; margin: 0 0 .5rem; }

/* archived reflexology chart references */
.reflexology-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1.5em 0; }
.reflexology-figure { display: grid; place-content: center; min-height: 11rem; margin: 0; padding: 1.25rem; border: 1px solid var(--rule); background: var(--mist); text-align: center; }
.reflexology-figure .chart-id { color: var(--navy-deep); font-family: var(--serif); font-size: 1.375rem; font-weight: 700; letter-spacing: .03em; }
@media (max-width: 39.99rem) {
  .reflexology-gallery { grid-template-columns: 1fr; }
  .reflexology-figure { min-height: 8rem; }
}
