/* Reference motion: cover scale 1.1 / 700ms ease, shadow / 300ms ease. */
:root { --accent: #3a8beb; --ink: #000d25; --muted: #52525b; --page: #f9fafd; }
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
h1, h2, p, figure { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.container { width: 100%; max-width: 1230px; margin-inline: auto; padding-inline: 15px; }
.icon { width: 16px; height: 16px; flex: 0 0 auto; vertical-align: middle; }
.site-header { min-height: 80px; background: #fff; display: flex; align-items: center; }
.site-header-inner { width: calc(100% - 40px); max-width: 1280px; margin-inline: auto; padding-block: 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px 30px; }
.brand { min-width: 0; flex: 0 1 auto; font-size: 20px; font-weight: 800; color: #4a505c; overflow-wrap: anywhere; }
.site-header nav { min-width: 0; max-width: 70%; margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 30px; font-size: 20px; font-weight: 800; }
.site-header .nav-link { min-width: 0; overflow-wrap: anywhere; color: var(--nav-link-color, #353943); }
.site-header a { transition: color .3s ease; }
.site-header a:hover { color: var(--accent); }
.catalog { padding-top: 90px; padding-bottom: 80px; min-height: calc(100vh - 220px); }
.catalog-heading { text-align: center; display: grid; grid-template-rows: auto 62px; }
.catalog-heading h1 { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 40px; line-height: 1.25; font-weight: 700; overflow-wrap: anywhere; }
/* Reuse the existing gap: optional copy must not move the search or cards. */
.catalog-subtitle { grid-row: 2; width: 100%; max-width: 660px; min-height: 0; margin: 12px auto 2px; overflow: auto; scrollbar-width: thin; color: var(--muted); line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.toolbar { display: flex; justify-content: flex-end; align-items: center; margin-bottom: 24px; min-height: 36px; }
.search { position: relative; }
.search .icon { position: absolute; left: 14px; top: 10px; color: #a1a1aa; pointer-events: none; }
.search input { display: block; border: 0; border-radius: 10px; height: 36px; width: 237px; padding: 8px 12px 8px 36px; background: #fff; box-shadow: 0 1px 2px #bebed733; color: #454b58; font-size: 14px; }
.search input::placeholder { color: #a1a1aa; }
.course-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 24px; align-items: stretch; }
.course-card { position: relative; isolation: isolate; min-width: 0; border-radius: 12px 12px 8px 8px; background: #fff; box-shadow: 0 1px 2px #dbdde1; transition: box-shadow .3s ease; display: flex; flex-direction: column; }
.course-cover { overflow: hidden; height: 160px; flex: 0 0 160px; border-radius: 12px 12px 0 0; }
.course-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s ease; }
@media (hover: hover) and (pointer: fine) {
  .course-card:hover { box-shadow: 0 10px 20px #d3d6dd4d; }
  .course-card:hover .course-cover img { transform: scale(1.1); }
}
.course-card:has(:focus-visible) { box-shadow: 0 10px 20px #d3d6dd4d; }
.course-card:has(:focus-visible) .course-cover img { transform: scale(1.1); }
.course-info { flex: 1; padding: 15px; display: flex; flex-direction: column; }
.course-info h2 { margin-bottom: 13px; font-size: 16px; line-height: 1.4; font-weight: 600; overflow-wrap: anywhere; }
.detail-link { transition: color .3s ease; }
/* The native detail anchor covers the whole card; the learning anchor stays above it. */
.detail-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: 12px; }
.detail-link:hover { color: var(--accent); }
.detail-link:focus-visible { outline: none; }
.detail-link:focus-visible::after { outline: 3px solid var(--accent); outline-offset: 4px; }
.course-meta { padding: 0; margin: 0 0 15px; list-style: none; display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 12px; line-height: 1.3; }
.course-meta li { display: flex; gap: 4px; align-items: center; min-width: 0; overflow-wrap: anywhere; }
.course-meta .icon { height: 13px; width: 13px; color: #a1a1aa; }
.price { font-weight: 600; margin: 0 0 14px; font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.learn-button { display: flex; position: relative; z-index: 2; justify-content: center; align-items: center; min-height: 40px; padding: 8px 16px; border: 1px solid transparent; border-radius: 8px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 700; line-height: 1.5; text-align: center; transition: filter .3s ease, box-shadow .3s ease; margin-top: auto; }
.learn-button:hover { filter: brightness(.92); box-shadow: 0 3px 10px #2439501a; }
.learn-button:active { filter: brightness(.85); }
.learn-button.unavailable { color: #87909f; background: #fff; border-color: #a9b1bd; cursor: not-allowed; filter: none; box-shadow: none; }
.empty-state { padding: 55px 20px 80px; text-align: center; color: var(--muted); }
.empty-state h2 { color: var(--ink); font-size: 22px; margin: 14px 0 8px; }
.empty-icon { display: flex; justify-content: center; }
.empty-icon .icon { width: 36px; height: 36px; }
.text-link { display: inline-block; color: var(--accent); margin-top: 18px; }
.breadcrumbs { background: #fff; border-bottom: 1px solid #e3e4e8; font-size: 13px; color: #969aa3; }
.breadcrumbs .container { display: flex; gap: 9px; align-items: center; min-height: 45px; padding-block: 10px; }
.breadcrumbs a { color: #4a505c; flex-shrink: 0; }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .icon { width: 12px; height: 12px; }
.breadcrumbs span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-page { background: linear-gradient(to bottom, var(--page) 0 246px, #fff 246px 100%); min-height: calc(100vh - 280px); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 416px; grid-template-rows: minmax(246px, auto) 1fr; column-gap: 60px; align-items: start; padding-bottom: 80px; }
.detail-heading { padding: 58px 0 36px; grid-column: 1; grid-row: 1; }
.detail-heading h1 { font-size: 30px; font-weight: 800; line-height: 1.4; margin-bottom: 20px; overflow-wrap: anywhere; }
.detail-heading .course-meta { font-size: 14px; margin-bottom: 26px; gap: 16px; }
.detail-heading .course-meta .icon { width: 16px; height: 16px; }
.author { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.author img, .avatar-fallback { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.avatar-fallback { display: flex; align-items: center; justify-content: center; background: #e9edf8; color: #6e81ad; font-size: 12px; }
.author span:not(.avatar-fallback) { color: #9499a4; margin-left: -3px; }
.summary { margin-top: 20px; color: #676e7d; font-size: 15px; line-height: 1.8; overflow-wrap: anywhere; }
.learning-sidebar { grid-column: 2; grid-row: 1 / span 2; padding-top: 58px; position: sticky; top: 24px; min-width: 0; }
.sidebar-cover { padding: 10px; background: #fff; border-radius: 12px; box-shadow: 0 0 28px #3333330a; margin-bottom: 20px; }
/* Detail artwork keeps its intrinsic ratio, including covers that are not 16:9. */
.sidebar-cover img { width: 100%; height: auto; aspect-ratio: auto; object-fit: contain; border-radius: 10px; }
.learning-box { padding: 10px 15px 20px; background: #fff; border-radius: 12px; box-shadow: 0 0 28px #3333330a; }
.detail-price { font-size: 30px; font-weight: 700; line-height: 1.5; margin-bottom: 16px; overflow-wrap: anywhere; }
.learning-box .learn-button { min-height: 46px; font-size: 14px; }
.sidebar-meta { border: 1px solid #f0f0f3; border-radius: 14px; margin-top: 20px; padding: 22px; }
.sidebar-meta .course-meta { display: flex; flex-direction: column; gap: 20px; margin: 0; font-size: 14px; }
.sidebar-meta .icon { width: 16px; height: 16px; }
.introduction { grid-column: 1; grid-row: 2; padding-top: 36px; min-width: 0; font-size: 16px; line-height: 1.9; color: #4a505c; overflow-wrap: anywhere; }
.introduction h2 { color: var(--ink); font-size: 22px; margin-bottom: 22px; }
.introduction p { margin-bottom: 20px; }
.highlights { margin: 18px 0 24px; padding-left: 22px; }
.highlights li { padding-left: 3px; margin-bottom: 12px; }
.intro-image { border-radius: 12px; width: 100%; height: auto; margin: 28px 0; }
.back-link { display: inline-block; margin-top: 30px; font-size: 14px; color: var(--accent); }
.back-link:hover, .text-link:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.site-footer { padding: 28px 20px 36px; background: #fff; text-align: center; font-size: 13px; color: #9298a3; line-height: 1.8; overflow-wrap: anywhere; }
.site-footer p + p { margin-top: 8px; }
.back-top { position: fixed; bottom: 24px; right: 24px; z-index: 10; width: 40px; height: 40px; background: #fff; border: 1px solid #e6e8ee; border-radius: 8px; color: #616978; box-shadow: 0 4px 16px #1f293714; font-size: 22px; }
.error-page { text-align: center; padding-top: 100px; padding-bottom: 140px; min-height: 60vh; }
.error-code { font-size: 60px; color: #c4cbd9; }
.error-page h1 { font-size: 30px; margin: 10px 0; }
.error-page > p { color: var(--muted); }
.error-page .learn-button { max-width: 220px; margin: 26px auto 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 12px; top: -100px; z-index: 100; padding: 8px 16px; background: #fff; border-radius: 5px; }
.skip-link:focus { top: 8px; }
@media (max-width: 1399px) { .container { max-width: 1170px; } }
@media (max-width: 1199px) {
  .container { max-width: 960px; }
  .detail-grid { grid-template-columns: minmax(0, 1fr) 340px; gap: 0 36px; }
}
@media (max-width: 991px) {
  .container { max-width: 720px; }
  .course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 24px; }
  .course-cover { height: 190px; flex-basis: 190px; }
  .detail-grid { grid-template-columns: minmax(0, 1fr) 280px; gap: 0 28px; }
  .detail-heading h1 { font-size: 26px; }
}
@media (max-width: 767px) {
  .container { max-width: 540px; padding-inline: 20px; }
  .site-header { min-height: 70px; }
  .site-header-inner { max-width: 500px; padding-block: 18px; gap: 12px 16px; flex-wrap: wrap; }
  .brand { font-size: 17px; }
  .site-header nav { max-width: 100%; gap: 8px 14px; font-size: 14px; }
  .catalog { padding-top: 54px; padding-bottom: 50px; }
  .catalog-heading { grid-template-rows: auto 36px; }
  .catalog-heading h1 { font-size: 30px; letter-spacing: -.5px; }
  .catalog-subtitle { margin-block: 6px; font-size: 14px; }
  .search, .search input { width: 100%; }
  .toolbar { margin-bottom: 22px; }
  .course-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .course-cover { height: auto; flex-basis: auto; aspect-ratio: 16 / 9; }
  .course-info { padding: 18px; }
  .learn-button { min-height: 44px; }
  .detail-page { background: var(--page); }
  .detail-grid { display: flex; flex-direction: column; gap: 0; padding-bottom: 48px; }
  .detail-heading { width: 100%; padding: 34px 0 28px; }
  .detail-heading h1 { font-size: 26px; }
  .learning-sidebar { position: static; padding-top: 0; width: 100%; }
  .sidebar-cover { margin-bottom: 16px; }
  .learning-box { padding: 15px 18px 18px; }
  .sidebar-meta { padding: 18px; }
  .sidebar-meta .course-meta { flex-direction: row; gap: 16px; }
  .introduction { margin-top: 30px; background: #fff; padding: 24px 20px; border-radius: 12px; width: 100%; }
  .detail-price { font-size: 27px; }
  .back-top { right: 16px; bottom: 16px; }
}
@media (max-width: 359px) { .site-header-inner { gap: 8px; } .site-header nav { width: 100%; justify-content: flex-end; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; }
  .course-card:hover .course-cover img, .course-card:has(:focus-visible) .course-cover img { transform: none; }
}
