/* Homepage and public course directory pages. */
:root { --bg: #0f172a; --surface: #1e293b; --border: #334155; --text: #f1f5f9; --muted: #a5b4c8; --directory-accent: #7dd3fc; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
a:focus-visible, select:focus-visible { outline: 2px solid var(--directory-accent); outline-offset: 4px; }
.home-main { width: 100%; max-width: 960px; padding: 1.7rem 1.5rem 1.4rem; margin: 0 auto; flex: 1; }
.home-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: 1.5rem; }
.home-heading h1 { font-size: 1.4rem; font-weight: 750; letter-spacing: -.02em; }
.home-heading > span { color: var(--muted); font-size: .75rem; }
.category-section + .category-section { margin-top: 1.3rem; }
.category-section > h2 { font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: .6rem; }
.category-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.category-grid-medicine { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.category-card { display: flex; flex-direction: column; gap: .8rem; min-width: 0; padding: 1.1rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; transition: background .16s, border-color .16s, transform .16s; }
.category-card:hover { background: #24344b; border-color: #7dd3fc; transform: translateY(-2px); }
.category-meta { display: flex; align-items: center; justify-content: space-between; gap: .4rem; font-size: .69rem; color: var(--muted); }
.category-meta > span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.category-card h3 { display: flex; align-items: center; justify-content: space-between; gap: .3rem; font-size: 1.1rem; font-weight: 700; }
.category-arrow { color: var(--directory-accent); font-size: 1rem; }
.category-preview { color: var(--muted); font-size: .76rem; line-height: 1.7; }
.site-footer { padding: .9rem 1rem 1.1rem; border-top: 1px solid var(--border); text-align: center; color: var(--muted); font-size: .68rem; line-height: 1.7; }
.site-footer p + p { margin-top: .2rem; }
.directory-topbar { height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: 0 1rem; background: var(--surface); border-bottom: 1px solid var(--border); font-size: .8rem; }
.directory-brand { font-weight: 750; font-size: .95rem; }
.directory-topbar > a:last-child { color: var(--muted); }
.course-main { width: 100%; max-width: 1040px; padding: 1.5rem; margin: 0 auto; flex: 1; }
.course-breadcrumb { color: var(--muted); font-size: .75rem; margin-bottom: 1rem; }
.course-breadcrumb a:hover { color: var(--text); }
.course-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.course-heading h1 { font-size: 1.4rem; font-weight: 750; }
.course-heading p { color: var(--muted); font-size: .75rem; margin-top: .35rem; }
.directory-picker { flex: 0 0 auto; }
.directory-picker select { min-height: 40px; padding: .4rem .7rem; max-width: 100%; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: .85rem; cursor: pointer; }
.course-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; }
.course-entry { display: flex; align-items: center; justify-content: space-between; gap: .65rem; min-height: 88px; padding: 1rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.course-entry:hover { border-color: var(--directory-accent); background: #24344b; }
.course-info { min-width: 0; }
.course-name { display: block; font-size: .97rem; font-weight: 650; overflow-wrap: anywhere; }
.course-detail { display: block; margin-top: .4rem; color: var(--muted); font-size: .69rem; line-height: 1.5; }
.course-arrow { color: var(--directory-accent); flex-shrink: 0; }
.supplementary-practice { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-top: 1.15rem; padding-top: .9rem; border-top: 1px solid var(--border); }
.supplementary-practice h2 { font-size: .85rem; font-weight: 600; }
.supplementary-practice p { margin-top: .3rem; color: var(--muted); font-size: .72rem; line-height: 1.6; }
.supplementary-practice > a { flex-shrink: 0; display: inline-flex; align-items: center; min-height: 44px; color: var(--directory-accent); font-size: .8rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 900px) { .course-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .home-main { padding: 1.2rem .8rem 1rem; }
  .home-heading { margin-bottom: 1.15rem; }
  .home-heading h1 { font-size: 1.2rem; }
  .home-heading > span { font-size: .68rem; }
  .category-grid { gap: .5rem; }
  .category-section + .category-section { margin-top: 1.1rem; }
  .category-card { padding: .8rem .6rem; gap: .6rem; border-radius: 10px; }
  .category-meta > span:first-child { display: none; }
  .category-meta { font-size: .64rem; }
  .category-card h3 { font-size: .87rem; gap: .1rem; }
  .category-arrow { font-size: .8rem; }
  .category-preview { font-size: .65rem; line-height: 1.75; }
  .site-footer { padding: .7rem .75rem .9rem; font-size: .64rem; }
  .course-main { padding: 1rem .8rem; }
  .course-heading { gap: .5rem; margin-bottom: 1rem; }
  .course-heading h1 { font-size: 1.2rem; }
  .course-heading p { font-size: .69rem; }
  .directory-picker select { font-size: 16px; width: 120px; padding: .4rem; }
  .course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .course-entry { min-height: 68px; padding: .8rem .65rem; }
  .course-name { font-size: .88rem; }
  .course-detail { display: none; }
}
@media (prefers-reduced-motion: reduce) { .category-card { transition: none; } .category-card:hover { transform: none; } }

/* Direct course entrances with one top-level category menu. */
.home-direct-courses { padding-top: 4px; }
.home-course-menu { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .9rem; border-bottom: 1px solid var(--border); }
.home-course-tabs { display: flex; gap: .75rem; }
.home-course-tabs button { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: .55rem .5rem; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font: inherit; font-size: .92rem; font-weight: 650; cursor: pointer; }
.home-course-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--directory-accent); }
.home-course-tabs button:focus-visible { outline: 2px solid var(--directory-accent); outline-offset: 2px; }
.home-resource-link[hidden] { display: none; }
.home-resource-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--directory-accent); font-size: .72rem; white-space: nowrap; }
.home-course-panel[hidden] { display: none; }
.home-course-section + .home-course-section { margin-top: .85rem; }
.home-course-section-title { display: flex; align-items: center; gap: .7rem; margin-bottom: .5rem; color: var(--muted); font-size: .72rem; font-weight: 500; line-height: 1.4; }
.home-course-section-title::after { content: ''; height: 1px; flex: 1; background: var(--border); }
.home-course-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.home-course-entry {
  --entry-accent: 125, 211, 252;
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  min-height: 54px; padding: .8rem; border: 1px solid var(--border); border-radius: 10px;
  background-color: var(--surface);
  background-image: linear-gradient(110deg, rgba(var(--entry-accent), .09), transparent 65%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
  transition: border-color .15s, background-color .15s, box-shadow .15s, transform .15s;
}
.home-course-entry::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 3px;
  background: rgb(var(--entry-accent)); opacity: .8; pointer-events: none;
}
[aria-labelledby="medicine-basic-heading"] .home-course-entry:nth-child(1),
[aria-labelledby="tcm-basic-heading"] .home-course-entry { --entry-accent: 94, 234, 212; }
[aria-labelledby="medicine-basic-heading"] .home-course-entry:nth-child(3) { --entry-accent: 253, 164, 175; }
[aria-labelledby="medicine-basic-heading"] .home-course-entry:nth-child(4),
[aria-labelledby="tcm-clinical-heading"] .home-course-entry { --entry-accent: 196, 181, 253; }
[aria-labelledby="tcm-classics-heading"] .home-course-entry { --entry-accent: 252, 211, 77; }
@media (hover: hover) and (pointer: fine) {
  .home-course-entry:hover {
    background-color: #24344b; border-color: rgba(var(--entry-accent), .6);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .14), inset 0 1px 0 rgba(255, 255, 255, .04);
    transform: translateY(-1px);
  }
}
.home-course-entry:focus-visible { outline-color: rgb(var(--entry-accent)); border-color: rgba(var(--entry-accent), .6); background-color: #24344b; }
.home-course-entry:active { background-color: #2b3d53; border-color: rgb(var(--entry-accent)); box-shadow: inset 0 1px 4px rgba(0, 0, 0, .14); transform: translateY(1px); }
.home-entry-info { min-width: 0; }
.home-entry-with-hint { display: flex; align-items: center; gap: .45rem; }
.home-entry-with-hint .home-entry-name { flex-shrink: 0; }
.home-entry-hint { font-size: .68rem; font-weight: 500; line-height: 1.4; white-space: nowrap; }
.home-hint-structure { color: #5eead4; }
.home-hint-function { color: #7dd3fc; }
.home-hint-disease { color: #fda4af; }
.home-hint-treatment { color: #c4b5fd; }
.home-entry-name { display: flex; align-items: center; gap: .35rem; min-width: 0; font-size: .92rem; font-weight: 650; line-height: 1.4; }
.home-entry-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 1.1rem; width: 1.1rem; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; font-size: 1.1rem; font-weight: 400; line-height: 1; }
.home-entry-title { min-width: 0; overflow-wrap: anywhere; }
.home-entry-arrow { flex-shrink: 0; color: var(--directory-accent); font-size: .9rem; }
.home-entry-count { flex-shrink: 0; color: var(--muted); font-size: .68rem; line-height: 1.4; white-space: nowrap; font-variant-numeric: tabular-nums; }
.home-extra-practice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding-top: .55rem; margin-top: .55rem; }
.home-extra-practice a { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; color: var(--muted); font-size: .75rem; }
.home-extra-practice a:hover { color: var(--directory-accent); }
.home-extra-practice > span { color: var(--muted); font-size: .67rem; }
@media (max-width: 560px) {
  .home-direct-courses { padding: 4px .8rem .8rem; }
  .home-course-menu { margin-bottom: .7rem; }
  .home-course-tabs { gap: .7rem; }
  .home-course-tabs button { font-size: .86rem; }
  .home-course-grid { gap: .45rem; }
  .home-course-entry { min-height: 44px; padding: .55rem; gap: .3rem; border-radius: 9px; }
  .home-entry-name { font-size: .88rem; gap: .25rem; }
  .home-entry-icon { flex-basis: 1rem; width: 1rem; font-size: 1rem; }
  .home-entry-with-hint { gap: .25rem; }
  .home-entry-hint { font-size: .65rem; }
}
@media (max-width: 340px) { .home-entry-with-hint { flex-direction: column; align-items: flex-start; gap: .1rem; } .home-entry-with-hint .home-entry-hint { margin-left: 1.25rem; } }
@media (prefers-reduced-motion: reduce) { .home-course-entry { transition: none; } .home-course-entry:hover, .home-course-entry:active { transform: none; } }
