:root {
  color-scheme: light;
  --paper: #f8f7f1;
  --ink: #1b3027;
  --muted: #57695f;
  --line: #d7ded4;
  --accent: #225e46;
  --highlight: #edf1e7;
  --serif: "Songti SC", "Noto Serif CJK SC", "STSong", Georgia, serif;
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: inherit; text-decoration: none; }
a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }
.wrap { width: min(1080px, calc(100% - 2 * clamp(18px, 5vw, 70px))); margin-inline: auto; }
.reading { max-width: 860px; }
.skip { position: fixed; top: 8px; left: 12px; z-index: 5; padding: 8px 16px; background: var(--paper); transform: translateY(-150%); }
.skip:focus { transform: none; }

.site-header { position: sticky; top: 0; z-index: 2; background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar, .course-brand, .topbar nav { display: flex; align-items: center; }
.topbar { justify-content: space-between; min-height: 64px; gap: 12px; }
.course-brand { gap: clamp(10px, 2.1vw, 26px); }
.course-back, .topbar nav a { font-size: 14px; white-space: nowrap; color: var(--muted); }
.course-back { display: inline-flex; align-items: center; min-height: 36px; gap: 4px; }
.course-back span { color: var(--accent); }
.brand { font-weight: 750; white-space: nowrap; color: var(--ink); }
.topbar nav { gap: clamp(12px, 2.8vw, 32px); }
.topbar nav a { display: inline-flex; align-items: center; min-height: 44px; }
.topbar :is(.course-back, nav a, .brand):hover, .topbar nav a[aria-current] { color: var(--accent); }
.topbar nav .manager-login { padding-inline: 13px; min-height: 36px; border: 1px solid #a4b5a7; border-radius: 5px; color: var(--accent); font-weight: 700; }
.topbar nav .manager-login:hover { background: var(--highlight); }

.hero {
  display: grid;
  align-items: center;
  color: #fff9ed;
  background: linear-gradient(90deg, #132c23f5 0%, #173025e8 33%, #1b342763 75%, #1b342729),
    #183027 url("ledger.webp") center 48% / cover no-repeat;
}
.hero-content { padding-block: clamp(38px, 5.6vw, 76px); animation: enter 320ms ease-out both; }
@keyframes enter {
  from { transform: translateY(6px); }
  to { transform: translateY(0); }
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font: 700 clamp(32px, 5vw, 56px)/1.24 var(--serif); overflow-wrap: anywhere; }
.hero h1 { margin-bottom: 12px; font-size: clamp(48px, 6.8vw, 86px); letter-spacing: .055em; }
.hero-meta { margin-bottom: 10px; color: #e1e8dd; font-size: 14px; }
.hero-summary { margin-bottom: 20px; color: #eff0e6; font-size: 16px; }
.hero-link { display: inline-flex; align-items: center; min-height: 43px; gap: 13px; padding: 6px 14px; background: #f8f1df; color: #173329; font-size: 14px; font-weight: 700; transition: background-color 160ms; }
.hero-link:hover { background: #e9efe2; }
.hero a:focus-visible { outline-color: #fff9ed; }

.schedule { padding-block: clamp(28px, 5vw, 52px); scroll-margin-top: 82px; }
.week-list { max-width: 900px; }
h2 { margin-bottom: 13px; font: 700 clamp(21px, 3vw, 27px)/1.36 var(--serif); }
.ruled-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.ruled-list li { border-bottom: 1px solid var(--line); scroll-margin-top: 82px; }
.directory-row, .resource-row {
  display: grid;
  min-height: 61px;
  align-items: center;
  gap: clamp(9px, 2.3vw, 24px);
  padding: 12px 7px;
  transition: color 160ms, background-color 160ms;
}
.directory-row { grid-template-columns: 67px minmax(0, 1fr) auto 18px; }
.resource-row { grid-template-columns: 64px minmax(0, 1fr) 18px; }
:is(.directory-row, .resource-row):hover { background: var(--highlight); color: var(--accent); }
.row-label { color: var(--accent); font-size: 14px; font-weight: 700; white-space: nowrap; }
.row-title { min-width: 0; font-weight: 660; overflow-wrap: anywhere; }
.row-title small, .directory-row small { color: var(--muted); font-size: 13px; font-weight: 450; }
.row-title small { display: block; margin-top: 2px; }
.directory-row small { white-space: nowrap; }
.row-arrow { color: var(--accent); justify-self: end; transition: transform 160ms; }
:is(.directory-row, .resource-row):hover .row-arrow { transform: translateX(3px); }
.file-type { color: var(--accent); font-size: 13px; font-weight: 690; white-space: nowrap; }

.detail { padding-block: clamp(25px, 5vw, 47px) 32px; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; color: var(--muted); font-size: 14px; }
.breadcrumbs a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.detail-intro { margin-block: clamp(20px, 4vw, 36px); }
.section-label { margin-bottom: 6px; color: var(--accent); font-size: 15px; font-weight: 720; }
.lesson-time { margin: 12px 0 0; color: var(--muted); }
.resource-section + .resource-section { margin-top: 29px; }
.resource-section h2 { font-size: clamp(21px, 2.7vw, 25px); }
.task-section { animation: enter 180ms ease-out both; }
.empty { padding: 10px 4px; color: var(--muted); }
.empty:empty { display: none; }

.search-box { display: grid; gap: 7px; max-width: 520px; margin-bottom: 18px; }
.search-box label { color: var(--muted); font-size: 14px; }
.search-box input { width: 100%; padding: 10px 12px; border: 1px solid #98aa9f; border-radius: 4px; background: #fffefa; color: var(--ink); font: inherit; }
.footer { border-top: 1px solid var(--line); margin-top: 22px; padding-block: 17px 25px; color: var(--muted); font-size: 13px; }

@media (max-width: 580px) {
  .topbar { align-items: flex-start; flex-direction: column; padding-block: 7px; gap: 2px; }
  .course-brand { min-height: 31px; }
  .topbar nav { align-self: stretch; gap: 17px; }
  .topbar nav a { min-height: 34px; font-size: 13px; }
  .topbar nav .manager-login { margin-left: auto; min-height: 32px; }
  .hero { background-position: 61% 50%; }
  .hero-meta { font-size: 12px; }
  .directory-row { grid-template-columns: 58px minmax(0, 1fr) 14px; gap: 4px 9px; }
  .directory-row .row-arrow { grid-column: 3; grid-row: 1 / span 2; }
  .directory-row small { grid-column: 2; white-space: normal; }
  .resource-row { grid-template-columns: 50px minmax(0, 1fr) 14px; }
  .row-label, .file-type { font-size: 12px; }
  .directory-row small, .row-title small { font-size: 12px; }
  .schedule, .ruled-list li { scroll-margin-top: 101px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 900px) {
  .topbar { position: relative; align-items: flex-start; flex-direction: column; padding-block: 7px; gap: 2px; }
  .course-brand { min-height: 32px; padding-right: 130px; }
  .topbar nav { align-self: stretch; flex-wrap: wrap; gap: 0 17px; }
  .topbar nav a { min-height: 34px; font-size: 13px; }
  .topbar nav .manager-login { position: absolute; top: 7px; right: 0; margin: 0; min-height: 32px; }
  .topbar:has([data-admin-logout]:not([hidden])) nav .manager-login { right: 46px; }
  .topbar nav [data-admin-logout] { position: absolute; right: 0; top: 7px; }
}
