/* thichhoc.com/de-thi. Tokens only (design system @thichhoc-org/css, served from _th/).
   Ported from the prototype in hsg-tinhoc nguon/mo-hinh-kinh-doanh/prototype-ban-de. */

html { scroll-behavior: smooth; }
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; margin: 0; background: var(--paper); color: var(--ink); font-family: var(--face-body); font-size: var(--t-body); line-height: var(--t-body-lh); }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
.skip { position: absolute; left: calc(var(--space-unit) * -1000); }
.skip:focus { left: var(--space-gutter); top: var(--space-gutter); z-index: 10; background: var(--paper-card); padding: calc(var(--space-unit) * 2) calc(var(--space-unit) * 3); border-radius: var(--r-md); }

/* ---- type ---- */
.h2 { margin: 0; font-family: var(--t-h2-face); font-size: var(--t-h2); line-height: var(--t-h2-lh); font-weight: var(--t-h2-w); letter-spacing: var(--t-h2-ls); }
.h3 { margin: 0; font-family: var(--t-h3-face); font-size: var(--t-h3); line-height: var(--t-h3-lh); font-weight: var(--t-h3-w); letter-spacing: var(--t-h3-ls); }
.mono { font-family: var(--face-mono); font-variant-numeric: tabular-nums; }
.soft { color: var(--ink-soft); }

/* ---- frame ---- */
.wrap { width: 100%; max-width: var(--page-width); margin-inline: auto; padding-inline: var(--space-gutter-wide); box-sizing: border-box; }
@media (max-width: 40rem) { .wrap { padding-inline: var(--space-gutter); } }
.logo { height: 2rem; width: auto; display: block; }
.page { padding-bottom: calc(var(--space-unit) * 8); }
.narrow { max-width: 40rem; padding-block: calc(var(--space-unit) * 12); }
.intro { max-width: 46rem; }
.crumbs { padding-block: calc(var(--space-unit) * 8) calc(var(--space-unit) * 2); }
body > main { flex: 1 0 auto; width: 100%; }

/* ---- site header and footer: the thichhoc.com shell (thichhoc-v2 SiteHeader / SiteFooter) ---- */
.site-header { position: sticky; top: 0; z-index: 40; border-bottom: 1px solid color-mix(in srgb, var(--rule) 70%, transparent); background: color-mix(in srgb, var(--paper) 85%, transparent); -webkit-backdrop-filter: blur(calc(var(--space-unit) * 3)); backdrop-filter: blur(calc(var(--space-unit) * 3)); }
.site-header__bar { display: flex; align-items: center; justify-content: space-between; gap: calc(var(--space-unit) * 6); padding-block: calc(var(--space-unit) * 3.5); }
.site-nav { display: flex; align-items: center; gap: var(--space-unit); }
.site-nav__link { white-space: nowrap; border-radius: var(--r-pill); padding: calc(var(--space-unit) * 2) calc(var(--space-unit) * 3.5); font-size: var(--t-body); font-weight: var(--t-label-w); color: var(--ink-soft); text-decoration: none; transition: background-color var(--duration-fast) var(--easing-standard), color var(--duration-fast) var(--easing-standard); }
.site-nav__link:hover, .site-nav__link[aria-current] { background: var(--accent-soft); color: var(--ink); }
.site-nav__cta { white-space: nowrap; margin-inline-start: var(--space-unit); border-radius: var(--r-pill); padding: calc(var(--space-unit) * 2) calc(var(--space-unit) * 4); background: var(--ink); color: var(--paper); font-size: var(--t-body); font-weight: var(--t-label-w); text-decoration: none; transition: background-color var(--duration-fast) var(--easing-standard); }
.site-nav__cta:hover { background: var(--accent-strong); }
@media (max-width: 40rem) { .site-nav__link { display: none; } }

.site-footer { margin-top: calc(var(--space-unit) * 24); border-top: 1px solid var(--rule); background: var(--paper-shade); padding-block: calc(var(--space-unit) * 14) calc(var(--space-unit) * 10); color: var(--ink-soft); }
.site-footer a { color: inherit; text-decoration: none; transition: color var(--duration-fast) var(--easing-standard); }
.site-footer a:hover { color: var(--accent); }
.site-footer__top { display: grid; gap: calc(var(--space-unit) * 12); }
@media (min-width: 48rem) { .site-footer__top { grid-template-columns: minmax(0, 1fr) auto; } }
.site-footer__brand { max-width: 24rem; }
.site-footer__tagline { margin: calc(var(--space-unit) * 4) 0 0; font-size: var(--t-body); line-height: var(--t-body-lh); }
.site-footer__links { display: flex; flex-wrap: wrap; gap: calc(var(--space-unit) * 2) calc(var(--space-unit) * 5); margin: calc(var(--space-unit) * 4) 0 0; }
.site-footer__links a { color: var(--accent); font-weight: var(--t-label-w); }
.site-footer__links a:hover { color: var(--accent-strong); }
.site-footer__social { display: flex; flex-wrap: wrap; gap: calc(var(--space-unit) * 2) calc(var(--space-unit) * 5); margin: calc(var(--space-unit) * 6) 0 0; padding: 0; list-style: none; font-size: var(--t-small); color: var(--ink-faint); }
.site-footer__legal h2 { margin: 0; font-family: var(--face-display); font-size: var(--t-body); font-weight: var(--t-h3-w); color: var(--ink); }
.site-footer__legal ul { display: grid; grid-template-columns: repeat(2, auto); gap: calc(var(--space-unit) * 2.5) calc(var(--space-unit) * 10); margin: calc(var(--space-unit) * 4) 0 0; padding: 0; list-style: none; font-size: var(--t-small); }
.site-footer__seller { display: flex; align-items: flex-start; justify-content: space-between; gap: calc(var(--space-unit) * 10); margin-top: calc(var(--space-unit) * 12); padding-top: calc(var(--space-unit) * 6); border-top: 1px solid var(--rule); }
.site-footer__seller address { font-size: var(--t-caption); font-style: normal; line-height: var(--t-body-lh); color: var(--ink-faint); }
.site-footer__company { font-weight: var(--t-label-w); color: var(--ink-soft); }
.site-footer__seal { flex: none; }
.site-footer__seal img { display: block; height: calc(var(--space-unit) * 13.5); width: auto; }
.site-footer__copy { margin: calc(var(--space-unit) * 6) 0 0; font-size: var(--t-caption); color: var(--ink-faint); }
@media (max-width: 40rem) {
  .site-footer__legal ul { gap: calc(var(--space-unit) * 2.5) calc(var(--space-unit) * 6); }
  .site-footer__seller { flex-direction: column; gap: calc(var(--space-unit) * 6); }
}

/* ---- home hero (thichhoc-v2 homepage rhythm) ---- */
.hero { padding-block: calc(var(--space-unit) * 24) calc(var(--space-unit) * 8); max-width: 48rem; }
.hero h1 { margin: 0; font-family: var(--t-display-face); font-size: var(--t-display); line-height: var(--t-display-lh); font-weight: var(--t-display-w); letter-spacing: var(--t-display-ls); color: var(--ink); text-wrap: balance; }
.hero .th-lead { margin: calc(var(--space-unit) * 6) 0 0; max-width: 34em; color: var(--ink-soft); }
.points { display: flex; flex-direction: column; gap: calc(var(--space-unit) * 2.5); margin: calc(var(--space-unit) * 7) 0 0; padding: 0; list-style: none; }
.points li { display: flex; gap: calc(var(--space-unit) * 3); color: var(--ink-soft); }
.points li::before { content: ""; flex: none; width: calc(var(--space-unit) * 2); height: calc(var(--space-unit) * 2); margin-top: 0.55em; border-radius: var(--r-pill); background: var(--pollen); }
.soon { display: grid; gap: calc(var(--space-unit) * 4); padding: calc(var(--space-unit) * 12) calc(var(--space-unit) * 10); border-radius: var(--r-xl); background: var(--paper-shade); }
.soon p { margin: 0; max-width: 36em; color: var(--ink-soft); }
.soon .eyebrow { font-weight: var(--t-label-w); color: var(--accent); }
@media (max-width: 40rem) {
  .hero { padding-block-start: calc(var(--space-unit) * 10); }
  .soon { padding: calc(var(--space-unit) * 8) calc(var(--space-unit) * 5); border-radius: var(--r-lg); }
}
.split { display: flex; flex-wrap: wrap; gap: calc(var(--space-unit) * 8); align-items: flex-start; }
.split > .grow { flex: 999 1 28rem; min-width: 0; }
.split > .aside { flex: 1 1 20rem; min-width: 0; }
.sticky { position: sticky; top: calc(var(--space-unit) * 4); }
.meta-row { display: flex; flex-wrap: wrap; gap: calc(var(--space-unit) * 2); }
.preview-bar { margin: calc(var(--space-unit) * 4) 0 0; }

/* .th-card (components layer) sets display:block and beats .th-stack (layout layer). */
.th-card.th-stack { display: flex; }

/* Long button labels wrap instead of spilling out of their box. */
.th-btn { white-space: normal; text-align: center; padding-block: calc(var(--space-unit) * 2); }

/* ---- index: shelves ---- */
.shelves { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); gap: calc(var(--space-unit) * 3); }
.shelf { display: grid; gap: calc(var(--space-unit) * 1); padding: calc(var(--space-unit) * 3) calc(var(--space-unit) * 4); border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--paper-card); color: var(--ink); text-decoration: none; }
.shelf:hover { border-color: var(--accent); }

/* ---- listing ---- */
.filters { display: flex; flex-wrap: wrap; gap: calc(var(--space-unit) * 2); }
.filters a { display: inline-flex; align-items: center; gap: calc(var(--space-unit) * 1.5); min-height: var(--control-sm); padding-inline: calc(var(--space-unit) * 3); border: 1px solid var(--rule-strong); border-radius: var(--r-pill); color: var(--ink); text-decoration: none; font-size: var(--t-small); }
.filters a[aria-current="page"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); font-weight: var(--t-label-w); }
.filters .is-official svg { color: var(--brand-shadow); background: var(--brand-center-light); border-radius: var(--r-pill); padding: calc(var(--space-unit) * 0.5); }

.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: calc(var(--space-unit) * 4); }
.card { position: relative; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--paper-card); transition: box-shadow var(--duration-fast) var(--easing-standard), border-color var(--duration-fast) var(--easing-standard); }
.card:hover { box-shadow: var(--elev-2); }
.card[class*="lv-"]:hover { border-color: var(--k-strong); }
.card:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.card__body { flex: 1; display: flex; flex-direction: column; gap: calc(var(--space-unit) * 2); padding: calc(var(--space-unit) * 4); }
.card__body p { margin: 0; font-size: var(--t-small); }
.card h2 { margin: 0; font-size: var(--t-body); line-height: var(--t-title-lh); font-weight: var(--t-title-w); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card h2 a { color: var(--ink); text-decoration: none; }
.card h2 a::after { content: ""; position: absolute; inset: 0; }
.card__foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: calc(var(--space-unit) * 2); }
.price-sm { font-family: var(--t-display-face); font-size: var(--t-title); font-weight: var(--t-title-w); font-variant-numeric: tabular-nums; }

/* ---- level colours (tokens --level-1 … --level-7, Codeforces order) ---- */
.lv-1 { --k-strong: var(--level-1); --k-soft: var(--level-1-soft); }
.lv-2 { --k-strong: var(--level-2); --k-soft: var(--level-2-soft); }
.lv-3 { --k-strong: var(--level-3); --k-soft: var(--level-3-soft); }
.lv-4 { --k-strong: var(--level-4); --k-soft: var(--level-4-soft); }
.lv-5 { --k-strong: var(--level-5); --k-soft: var(--level-5-soft); }
.lv-6 { --k-strong: var(--level-6); --k-soft: var(--level-6-soft); }
.lv-7 { --k-strong: var(--level-7); --k-soft: var(--level-7-soft); }

/* Card cover "C". */
.kc-cover { aspect-ratio: 1200 / 630; box-sizing: border-box; display: flex; flex-direction: column; background: var(--k-soft); color: var(--k-strong); border-left: calc(var(--space-unit) * 1.5) solid var(--k-strong); }
.kc-inner { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: calc(var(--space-unit) * 1); padding: calc(var(--space-unit) * 3) calc(var(--space-unit) * 4); min-width: 0; }
.kc-eyebrow { font-size: var(--t-caption); font-weight: var(--t-label-w); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.kc-type { font-family: var(--t-display-face); font-size: var(--t-h2); line-height: var(--t-h2-lh); font-weight: var(--t-h1-w); letter-spacing: var(--t-h1-ls); }
.kc-band { display: flex; align-items: center; gap: calc(var(--space-unit) * 1.5); padding: calc(var(--space-unit) * 2) calc(var(--space-unit) * 4); font-size: var(--t-caption); font-weight: var(--t-label-w); color: var(--ink-soft); border-top: 1px solid color-mix(in srgb, var(--k-strong) 25%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc-band svg { flex: none; }
.kc-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Official papers: fixed brand yellow with dark teal text in both themes. */
.kc-band--official { background: var(--brand-center-light); color: var(--brand-shadow); border-top: 0; }
.k-dot { display: inline-block; flex: none; width: calc(var(--space-unit) * 2.5); height: calc(var(--space-unit) * 2.5); border-radius: var(--r-pill); background: var(--k-strong); }

/* ---- exam page ---- */
.gate { border: 2px solid var(--accent); border-radius: var(--r-lg); background: var(--paper-card); padding: calc(var(--space-unit) * 6); display: grid; gap: calc(var(--space-unit) * 4); box-shadow: var(--elev-2); }
.paths { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: calc(var(--space-unit) * 3); }
.path { border: 1px solid var(--rule-strong); border-radius: var(--r-md); padding: calc(var(--space-unit) * 4); display: grid; gap: calc(var(--space-unit) * 2); align-content: start; }

/* The exam's own HTML, CSS scoped under .de-exam / .de-key. Only the frame is the site's. */
.de-frame { overflow: hidden; border-radius: var(--r-lg); background: var(--paper-shade); padding-block: calc(var(--space-unit) * 3); }
.de-frame > .de-html { background: none; }
.de-frame .x-sheet { box-shadow: var(--elev-1); }
.de-fade { height: calc(var(--space-unit) * 16); margin-top: calc(var(--space-unit) * -16); position: relative; background: linear-gradient(to bottom, transparent, var(--paper-card)); pointer-events: none; }

/* Download buttons. */
.fmts { display: grid; gap: calc(var(--space-unit) * 2); }
.fmt { display: flex; align-items: center; gap: calc(var(--space-unit) * 3); box-sizing: border-box; width: 100%; min-height: var(--hit); padding: calc(var(--space-unit) * 3); border: 1px solid var(--rule-strong); border-radius: var(--r-md); background: var(--paper-card); color: var(--ink); font: inherit; text-align: start; text-decoration: none; cursor: pointer; transition: border-color var(--duration-fast) var(--easing-standard), background-color var(--duration-fast) var(--easing-standard); }
.fmt:hover { border-color: var(--accent); background: var(--accent-soft); }
.fmt__body { flex: 1; display: grid; gap: calc(var(--space-unit) * 0.5); min-width: 0; }
.fmt__title { font-weight: var(--t-label-w); }
.fmt__sub { font-size: var(--t-small); color: var(--ink-soft); }
.fmt svg { flex: none; width: var(--icon); height: var(--icon); color: var(--accent); }

/* Phones: compact download row above the content while the aside sits below the article. */
.dl-mobile { display: none; }
@media (max-width: 52rem) {
  .dl-mobile { display: grid; gap: calc(var(--space-unit) * 2); }
  .dl-mobile__row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: calc(var(--space-unit) * 2); }
  .dl-mobile .th-btn { gap: calc(var(--space-unit) * 1.5); }
  .dl-mobile p { margin: 0; }
}

/* Suggestions: a level-coloured dot before the title. */
.recs { list-style: none; margin: 0; padding: 0; display: grid; gap: calc(var(--space-unit) * 3); }
.rec { position: relative; display: flex; gap: calc(var(--space-unit) * 3); align-items: center; }
.rec__body { display: grid; gap: calc(var(--space-unit) * 1); min-width: 0; }
.rec__title { color: var(--ink); text-decoration: none; font-size: var(--t-small); font-weight: var(--t-label-w); line-height: var(--t-small-lh); padding-inline-start: calc(var(--space-unit) * 4.5); text-indent: calc(var(--space-unit) * -4.5); }
.rec__title::after { content: ""; position: absolute; inset: 0; }
.rec:hover .rec__title { color: var(--accent-strong); text-decoration: underline; }
.rec__title .k-dot { margin-inline-end: calc(var(--space-unit) * 2); vertical-align: 0.1em; }

/* ---- phones ---- */
@media (max-width: 40rem) {
  .th-header .wrap { padding-block: calc(var(--space-unit) * 2); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: calc(var(--space-unit) * 3); }
  .card__body { padding: calc(var(--space-unit) * 3); gap: calc(var(--space-unit) * 1.5); }
  .card h2 { font-size: var(--t-small); }
  .card__body p, .card .th-muted { font-size: var(--t-caption); }
  .price-sm { font-size: var(--t-body); }
  .kc-type { font-size: var(--t-h3); line-height: var(--t-h3-lh); }
  .kc-inner { padding: calc(var(--space-unit) * 2) calc(var(--space-unit) * 3); gap: 0; }
  .kc-eyebrow { letter-spacing: 0.02em; }
  .kc-band { padding: calc(var(--space-unit) * 1.25) calc(var(--space-unit) * 3); font-size: calc(var(--t-caption) * 0.85); }
  .kc-org { display: none; }
}
