/* 皇家學堂 (academy.html) — prefix k3- */

/* ---------- shared bits ---------- */
.k3-mat { padding: clamp(12px, 1.4vw, 22px); background: var(--sand); border: 1px solid var(--line); border-radius: var(--r); }
.k3-mat .media { border-radius: 3px; }
.k3-arrow { position: relative; width: 48px; height: 48px; border-radius: 50%; border: 1px solid currentColor; opacity: .85; transition: background .35s, color .35s, opacity .3s; flex: none; }
.k3-arrow::before { content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translate(-30%, -50%) rotate(45deg); }
.k3-arrow--next::before { transform: translate(-70%, -50%) rotate(-135deg); }
.k3-arrow:hover { opacity: 1; background: var(--on-dark); color: var(--ink); }

/* ---------- 1. masthead ---------- */
.k3-mast { padding-top: calc(var(--hd-h) + clamp(40px, 6vw, 96px)); padding-bottom: clamp(56px, 7vw, 112px); }
.k3-mast__grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .7fr); gap: clamp(40px, 6vw, 112px); align-items: end; }
.k3-mast__copy { display: grid; gap: 28px; justify-items: start; }
.k3-mast__title { font-size: clamp(2.6rem, 5.6vw, 5.5rem); line-height: 1.2; letter-spacing: .06em; }
.k3-mast__fig { align-self: start; margin-top: clamp(0px, 4vw, 64px); }
.k3-mast__fig .media { aspect-ratio: 4 / 5; }

.k3-search { position: relative; display: flex; align-items: center; width: 100%; max-width: 560px; min-height: 60px; padding: 6px 6px 6px 52px; border: 1px solid var(--ink); border-radius: 99px; background: rgba(255,255,255,.35); transition: box-shadow .3s; }
.k3-search:focus-within { box-shadow: 0 0 0 4px var(--burgundy-tint); }
.k3-search__ic { position: absolute; left: 20px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--muted); }
.k3-search__in { flex: 1; min-width: 0; height: 46px; border: 0; background: transparent; font: 400 1rem/1 var(--f-sans); letter-spacing: .04em; color: var(--ink); outline: none; }
.k3-search__in::placeholder { color: #8b8077; }
.k3-search__in::-webkit-search-cancel-button { display: none; }
.k3-search__go { height: 48px; padding: 0 24px; border-radius: 99px; background: var(--burgundy); color: #fff; font-size: var(--fs-small); letter-spacing: .14em; transition: background .3s; }
.k3-search__go:hover { background: var(--burgundy-deep); }

.k3-mast__stats { display: grid; grid-template-columns: repeat(3, minmax(0, auto)); gap: 0 clamp(24px, 3.4vw, 56px); margin-top: 8px; }
.k3-mast__stats > div { padding-top: 14px; border-top: 1px solid var(--line); }
.k3-mast__stats dt { font-size: var(--fs-label); letter-spacing: .14em; color: var(--muted); }
.k3-mast__stats dd { margin-top: 4px; font-size: clamp(1.9rem, 2.8vw, 2.6rem); line-height: 1.1; color: var(--burgundy); }
.k3-mast__stats small { margin-left: 4px; font: 400 .875rem/1 var(--f-sans); color: var(--muted); }
.k3-mast__stats i { font-style: normal; margin: 0 .12em; color: var(--muted); }

/* ---------- 2. syllabus ---------- */
.k3-course { border-top: 1px solid var(--line); }
.k3-course__head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px 40px; margin-bottom: clamp(32px, 4vw, 56px); }
.k3-course__head .muted { max-width: 26em; font-size: var(--fs-small); }
.k3-course__list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.k3-topic { display: flex; flex-direction: column; gap: 14px; padding: 8px clamp(16px, 1.8vw, 28px) 8px; border-left: 1px solid var(--line); }
.k3-topic:first-child { padding-left: 0; border-left: 0; }
.k3-topic__n { font-size: clamp(2.4rem, 3.4vw, 3.4rem); line-height: 1; color: var(--burgundy); }
.k3-topic__t { font: 500 clamp(1.2rem, 1.5vw, 1.4rem)/1.4 var(--f-zh-serif); letter-spacing: .1em; }
.k3-topic__d { font-size: var(--fs-small); line-height: 1.85; color: var(--muted); }
.k3-topic__list { display: grid; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: .875rem; line-height: 1.6; }
.k3-topic__list a { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; transition: color .3s; }
.k3-topic__list a:hover { color: var(--burgundy); }
.k3-topic__all { display: inline-flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 10px; font-size: .875rem; letter-spacing: .1em; color: var(--burgundy); text-align: left; min-height: 40px; }
.k3-topic__all span { width: 18px; height: 1px; background: currentColor; transition: width .35s var(--ease); }
.k3-topic__all:hover span { width: 30px; }

/* ---------- 3. reading lane ---------- */
.k3-lane { padding-block: var(--sec); overflow: hidden; }
.k3-lane__head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px 64px; align-items: end; margin-bottom: clamp(40px, 5vw, 72px); }
.k3-lane__side { display: grid; gap: 28px; justify-items: start; }
.k3-lane__ctl { display: flex; align-items: center; gap: 12px; color: var(--on-dark); }
.k3-lane__count { margin-right: 12px; font-size: 1rem; color: var(--on-dark-muted); letter-spacing: .08em; }
.k3-lane__count b { font-weight: 400; font-size: 1.6rem; color: var(--on-dark); }
.k3-lane__track {
  --pad: max(var(--gutter), calc((100vw - 1440px) / 2 + var(--gutter)));
  display: flex; gap: clamp(18px, 2vw, 32px); overflow-x: auto; overscroll-behavior-x: contain;
  padding-inline: var(--pad); scroll-padding-inline: var(--pad); scroll-snap-type: x mandatory;
  scrollbar-width: none; cursor: grab; outline-offset: -2px;
}
.k3-lane__track::-webkit-scrollbar { display: none; }
.k3-lane__track.is-grab { cursor: grabbing; }
.k3-lane__track.is-drag { scroll-snap-type: none; }
.k3-lane__track.is-drag a { pointer-events: none; }
.k3-card { flex: 0 0 clamp(240px, 21vw, 300px); display: flex; flex-direction: column; gap: 18px; scroll-snap-align: start; color: var(--on-dark); user-select: none; -webkit-user-drag: none; }
.k3-card--lead { flex-basis: clamp(290px, 50vw, 720px); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: clamp(20px, 2.4vw, 36px); }
.k3-card--lead .k3-card__no { grid-column: 1 / -1; }
.k3-card--lead .k3-card__body { align-content: end; padding-bottom: 6px; }
.k3-card__no { font-size: .9375rem; color: var(--on-dark-muted); letter-spacing: .1em; padding-bottom: 12px; border-bottom: 1px solid rgba(244, 237, 227, .16); }
.k3-card__media { display: block; padding: 10px; background: rgba(244, 237, 227, .05); border: 1px solid rgba(244, 237, 227, .12); border-radius: var(--r); }
.k3-card__media img { width: 100%; aspect-ratio: 1; height: auto; object-fit: cover; border-radius: 3px; transition: transform 1s var(--ease), filter .6s; pointer-events: none; }
.k3-card--lead .k3-card__media { overflow: hidden; }
.k3-card--lead .k3-card__media img { aspect-ratio: 4 / 5; }
.k3-card__media { overflow: hidden; }
.k3-card:hover .k3-card__media img { transform: scale(1.04); }
.k3-card__body { display: grid; gap: 10px; }
.k3-card__meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: var(--fs-label); letter-spacing: .1em; color: var(--on-dark-muted); }
.k3-card__title { font: 400 clamp(1.15rem, 1.35vw, 1.3rem)/1.6 var(--f-zh-serif); letter-spacing: .06em; transition: color .3s; }
.k3-card--lead .k3-card__title { font-size: clamp(1.35rem, 2vw, 1.9rem); line-height: 1.5; }
.k3-card:hover .k3-card__title { color: #E9C9C3; }
.k3-card__ex { font-size: var(--fs-small); line-height: 1.85; color: var(--on-dark-muted); }
.k3-card__go { margin-top: 6px; justify-self: start; padding-bottom: 4px; border-bottom: 1px solid currentColor; font-size: var(--fs-small); letter-spacing: .14em; }
.k3-lane__bar { position: relative; height: 2px; margin-top: clamp(36px, 4vw, 56px); background: rgba(244, 237, 227, .14); overflow: hidden; }
.k3-lane__bar span { position: absolute; left: 0; top: 0; bottom: 0; width: 20%; background: var(--on-dark); transition: transform .2s linear; }

/* ---------- 4. index ---------- */
.k3-index__head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 24px 64px; align-items: end; margin-bottom: clamp(36px, 4vw, 56px); }
.k3-note { display: grid; gap: 10px; justify-items: start; padding: 18px 20px; border: 1px dashed var(--brass); border-radius: var(--r); font-size: .875rem; line-height: 1.8; color: var(--muted); }
.k3-tools { display: grid; gap: 22px; padding-bottom: 26px; border-bottom: 1px solid var(--ink); }
.k3-search--line { max-width: 640px; min-height: 52px; padding: 0 0 0 36px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; }
.k3-search--line:focus-within { box-shadow: none; border-bottom-color: var(--burgundy); }
.k3-search--line .k3-search__ic { left: 2px; }
.k3-search--line .k3-search__in { font-size: 1.0625rem; }
.k3-search__clear { min-height: 40px; padding: 0 6px; font-size: var(--fs-small); color: var(--burgundy); letter-spacing: .1em; }
.k3-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.k3-filters__g { margin-left: 12px; font-size: var(--fs-label); letter-spacing: .2em; color: var(--muted); }
.k3-filters__g::before { content: ""; display: inline-block; width: 1px; height: 18px; margin-right: 18px; vertical-align: -4px; background: var(--line); }
.k3-chip { min-height: 42px; }
.k3-chip__n { font-size: .75rem; opacity: .7; }
.k3-chip--topic { gap: 10px; }
.k3-chip__x { font-size: 1.1rem; line-height: 1; }
.k3-status { margin-top: 18px; font-size: var(--fs-label); letter-spacing: .1em; color: var(--muted); }

.k3-years { margin-top: clamp(20px, 3vw, 40px); }
.k3-year { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr); gap: 16px clamp(24px, 4vw, 64px); padding-block: clamp(24px, 3vw, 40px); border-top: 1px solid var(--line); }
.k3-year:first-child { border-top: 0; }
.k3-year__y { font: 400 clamp(2.4rem, 4vw, 3.75rem)/1 var(--f-num); color: var(--burgundy); }
.k3-year__n { margin-top: 10px; font-size: var(--fs-label); letter-spacing: .14em; color: var(--muted); }
.k3-row { border-top: 1px solid var(--line); }
.k3-row:first-child { border-top: 0; }
.k3-row > a, .k3-row summary {
  display: grid; grid-template-columns: 64px 96px minmax(0, 1fr) 28px; gap: 4px 20px; align-items: baseline;
  padding: 20px 12px; margin-inline: -12px; border-radius: var(--r); transition: background .35s var(--ease);
}
.k3-row summary { cursor: pointer; list-style: none; }
.k3-row summary::-webkit-details-marker { display: none; }
.k3-row > a:hover, .k3-row summary:hover { background: var(--sand); }
.k3-row__d { font-size: .9375rem; color: var(--muted); letter-spacing: .04em; }
.k3-row__c { justify-self: start; padding: 2px 10px; border: 1px solid var(--line); border-radius: 99px; font-size: .75rem; letter-spacing: .12em; color: var(--muted); white-space: nowrap; }
.k3-row--know .k3-row__c { border-color: var(--burgundy); background: var(--burgundy); color: #fff; }
.k3-row__t { display: grid; gap: 6px; }
.k3-row__h { font-size: 1.0625rem; line-height: 1.7; letter-spacing: .04em; transition: color .3s; }
.k3-row--know .k3-row__h { font: 400 clamp(1.15rem, 1.4vw, 1.3rem)/1.6 var(--f-zh-serif); letter-spacing: .06em; }
.k3-row a:hover .k3-row__h, .k3-row summary:hover .k3-row__h { color: var(--burgundy); }
.k3-row__ex, .k3-row__snip { font-size: .875rem; line-height: 1.75; color: var(--muted); }
.k3-row mark { background: var(--burgundy-tint); color: var(--burgundy-deep); padding: 0 2px; border-radius: 2px; }
.k3-row__go { position: relative; align-self: center; width: 28px; height: 28px; }
.k3-row__go::before { content: ""; position: absolute; left: 4px; right: 4px; top: 50%; height: 1px; background: currentColor; transform: scaleX(.5); transform-origin: right; transition: transform .45s var(--ease); }
.k3-row__go::after { content: ""; position: absolute; right: 4px; top: 50%; width: 7px; height: 7px; border-top: 1px solid currentColor; border-right: 1px solid currentColor; transform: translateY(-50%) rotate(45deg); }
.k3-row a:hover .k3-row__go::before { transform: scaleX(1); }
.k3-row__go--plus::before { transform: none; left: 7px; right: 7px; }
.k3-row__go--plus::after { right: 50%; width: 1px; height: 14px; border: 0; background: currentColor; transform: translate(50%, -50%); transition: transform .4s var(--ease); }
.k3-row details[open] .k3-row__go--plus::after { transform: translate(50%, -50%) scaleY(0); }
.k3-bundle { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; margin: 4px 0 20px calc(64px + 96px + 40px); }
.k3-bundle a { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: .9375rem; transition: color .3s; }
.k3-bundle a:hover { color: var(--burgundy); }
.k3-bundle time { color: var(--muted); font-size: .875rem; }
.k3-row.is-new { animation: k3-in .7s var(--ease) both; animation-delay: var(--d, 0s); }
@keyframes k3-in { from { opacity: 0; transform: translateY(18px); } }
.k3-empty { display: grid; gap: 14px; justify-items: start; padding: 48px 0; color: var(--muted); }
.k3-more { display: flex; justify-content: center; margin-top: clamp(28px, 4vw, 48px); }

/* hover preview */
.k3-peek { position: fixed; left: 0; top: 0; z-index: 70; width: 200px; padding: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 18px 40px rgba(38, 32, 28, .16); pointer-events: none; opacity: 0; scale: .92; transition: opacity .35s var(--ease), scale .45s var(--ease); }
.k3-peek img { width: 100%; aspect-ratio: 4 / 5; height: auto; object-fit: cover; border-radius: 3px; }
.k3-peek.is-on { opacity: 1; scale: 1; }

/* ---------- 5. CTA ---------- */
.k3-cta__in { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px clamp(40px, 7vw, 120px); align-items: center; }
.k3-cta__copy { display: grid; gap: 24px; justify-items: start; }
.k3-cta__btns { display: flex; flex-wrap: wrap; gap: 12px; }
.k3-cta__qr { display: grid; gap: 14px; justify-items: center; padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); text-align: center; font-size: .875rem; line-height: 1.7; color: var(--muted); }
.k3-cta__qr img { width: 168px; height: auto; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .k3-course__list { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); gap: 0; }
  .k3-course__list::-webkit-scrollbar { display: none; }
  .k3-topic { flex: 0 0 min(300px, 78vw); scroll-snap-align: start; }
}
@media (max-width: 991px) {
  .k3-mast__grid { grid-template-columns: minmax(0, 1fr); }
  .k3-mast__fig { max-width: 480px; margin-top: 0; }
  .k3-mast__fig .media { aspect-ratio: 4 / 3; }
  .k3-lane__head, .k3-index__head { grid-template-columns: minmax(0, 1fr); }
  .k3-year { grid-template-columns: minmax(0, 1fr); }
  .k3-year__side { display: flex; align-items: baseline; gap: 16px; }
  .k3-year__n { margin-top: 0; }
  .k3-bundle { margin-left: calc(64px + 96px + 40px); }
  .k3-cta__in { grid-template-columns: minmax(0, 1fr); }
  .k3-cta__qr { justify-self: start; grid-template-columns: auto 1fr; text-align: left; }
  .k3-cta__qr img { width: 120px; }
}
@media (max-width: 640px) {
  .k3-mast__title { font-size: clamp(2.3rem, 10.5vw, 3rem); }
  .k3-search { min-height: 56px; padding-left: 46px; }
  .k3-search__ic { left: 16px; }
  .k3-search__go { padding: 0 18px; height: 44px; }
  .k3-mast__stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
  .k3-mast__stats dd { font-size: 1.6rem; }
  .k3-mast__stats dt { font-size: .75rem; letter-spacing: .06em; }
  .k3-filters { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding: 2px var(--gutter); scrollbar-width: none; }
  .k3-filters::-webkit-scrollbar { display: none; }
  .k3-filters > * { flex: none; }
  .k3-row > a, .k3-row summary { grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; padding: 18px 10px; margin-inline: -10px; }
  .k3-row__t { grid-column: 1 / -1; }
  .k3-row__go { display: none; }
  .k3-bundle { grid-template-columns: minmax(0, 1fr); margin-left: 0; }
  .k3-lane__ctl .k3-arrow { width: 44px; height: 44px; }
  .k3-card { flex-basis: 76vw; }
  .k3-card--lead { flex-basis: 84vw; display: flex; }
  .k3-card--lead .k3-card__media img { aspect-ratio: 1; }
  .k3-cta__qr { grid-template-columns: minmax(0, 1fr); justify-items: start; }
}
@media (prefers-reduced-motion: reduce) {
  .k3-lane__track { scroll-behavior: auto; }
}
