/* Klaro Market: the parts every version shares, on top of klaro.css (the app's tokens and kit). */

/* Public page or inside the app: one body attribute swaps the chrome around the same market. */
[data-chrome="public"] .app-only, [data-chrome="app"] .pub-only { display: none !important; }

/* The app's top bar: wordmark, the menu with the ink glass pill on the open page, then bell and avatar */
.appbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; background: rgb(243 243 241 / .86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.appbar .wrap { height: 64px; display: grid; grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr); align-items: center; gap: 24px; }
.appbar .brand img { height: 26px; width: auto; }
.appnav { display: flex; gap: 2px; padding: 4px; border-radius: var(--r-pill); background: rgb(255 255 255 / .7); border: 1px solid var(--border); }
.appnav a { height: 34px; padding-inline: 14px; display: inline-flex; align-items: center; gap: 7px; border-radius: var(--r-pill); font-weight: 600; font-size: 13px; color: var(--ink-soft); text-decoration: none; transition: color .15s, background-color .15s; }
.appnav a:hover { color: var(--ink); }
.appnav a[aria-current="page"] { color: #fff; background: linear-gradient(rgb(255 255 255 / .11), rgb(255 255 255 / .02) 50%, transparent 62%), var(--ink); box-shadow: var(--shadow-glass); }
.appnav .new { font-size: 9px; font-weight: 700; letter-spacing: .06em; padding: 2px 5px; border-radius: 4px; background: var(--yellow); color: var(--ink); }
.appbar .tools { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.round { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-soft); border: 1px solid transparent; background: none; position: relative; cursor: pointer; }
.round:hover { background: rgb(255 255 255 / .84); border-color: rgb(35 35 37 / .1); color: var(--ink); }
.round .badge { position: absolute; top: 4px; inset-inline-end: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--purple); color: #fff; font-size: 9px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--page); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; background: linear-gradient(135deg, #9254e0, #c58be8 60%, #f0c93d); border: 2px solid #fff; box-shadow: 0 1px 3px rgb(23 23 23 / .15); flex-shrink: 0; }
.menu-btn { display: none; }
@media (max-width: 1000px) { .appnav { display: none; } .appbar .wrap { grid-template-columns: auto 1fr auto; } .menu-btn { display: grid; } }

/* App page head (PageHead): kicker, 34px title, lead */
.pagehead { padding-block: 34px 22px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.pagehead .title { font-weight: 600; font-size: 34px; line-height: 1.05; letter-spacing: -.045em; margin-top: 6px; }
.pagehead .lead { font-size: 14px; margin-top: 8px; }
.headfigs { display: flex; gap: 22px; padding: 12px 16px; border-radius: var(--r-control); border: 1px solid var(--border); background: var(--card); }
.headfigs dt { font-size: 11px; color: var(--muted); }
.headfigs dd { margin: 0; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.headfigs dl { margin: 0; display: flex; flex-direction: column; gap: 3px; }

/* Filter bar: chips (the kit's one chip style) and a compact search, one row */
.filterbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 30px; padding-inline: 12px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--card); font: 600 12px/1 var(--font); color: var(--ink-soft); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: background-color .15s, color .15s, border-color .15s; }
.chip:hover { border-color: var(--purple-line); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--purple); border-color: var(--purple); color: #fff; }
.chip .count { font-size: 11px; opacity: .7; font-variant-numeric: tabular-nums; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; inset-inline-start: 12px; color: var(--muted); pointer-events: none; }
.search input { height: 40px; width: 100%; padding-inline: 38px 14px; border-radius: var(--r-button); border: 1px solid var(--border-strong); background: var(--card); font: 500 14px/1 var(--font); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.search input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-soft); }
.search input::placeholder { color: var(--muted); }
@media (pointer: coarse) { .chip { height: 44px; } }

/* Market course card: the kit's media card, plus the tutor and the price */
.mcard { cursor: pointer; text-align: start; font: inherit; padding: 0; width: 100%; }
.mcard .tutor { display: flex; align-items: center; gap: 8px; padding: 12px 18px 0; font-size: 13px; font-weight: 600; }
.mcard .tutor .avatar { width: 26px; height: 26px; font-size: 10px; border-width: 1.5px; }
.mcard .figs { padding-top: 8px; }
.mcard .foot { border-top: 1px solid var(--border); margin-top: 14px; padding-block: 12px 14px; justify-content: space-between; }
.price { display: inline-flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price b { font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.price span { font-size: 12px; color: var(--muted); }
.btn-sm { height: 30px; padding-inline: 12px; border-radius: 7px; font-size: 11px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 1080px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid3 { grid-template-columns: minmax(0, 1fr); } }

/* Course drawer: slides in from the inline end; a bottom sheet on phones */
.scrim-bg { position: fixed; inset: 0; z-index: 80; background: rgb(23 18 30 / .35); opacity: 0; pointer-events: none; transition: opacity .25s var(--ease-out); }
.drawer { position: fixed; inset-block: 0; inset-inline-end: 0; z-index: 90; width: min(520px, 100%); background: var(--card); box-shadow: 0 18px 60px rgb(34 25 48 / .22); display: flex; flex-direction: column;
  translate: 100% 0; transition: translate .45s var(--ease-settle); }
[dir="rtl"] .drawer { translate: -100% 0; }
body.drawer-open .scrim-bg { opacity: 1; pointer-events: auto; }
body.drawer-open .drawer { translate: 0 0; }
body.drawer-open { overflow: hidden; }
.drawer .pic { position: relative; aspect-ratio: 16 / 9; flex-shrink: 0; overflow: hidden; }
.drawer .pic img { width: 100%; height: 100%; object-fit: cover; }
.drawer .pic .scrim { position: absolute; inset-inline: 0; inset-block-end: 0; padding: 60px 24px 18px; color: #fff; background: linear-gradient(to top, rgb(18 14 26 / .78), rgb(18 14 26 / .45) 55%, rgb(18 14 26 / 0)); }
.drawer .pic .eyebrow { font-size: 12px; font-weight: 600; color: rgb(255 255 255 / .82); }
.drawer .pic h2 { font-weight: 600; font-size: 28px; letter-spacing: -.04em; line-height: 1.1; }
.drawer .close { position: absolute; top: 14px; inset-inline-end: 14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgb(255 255 255 / .9); color: var(--ink); display: grid; place-items: center; cursor: pointer; z-index: 2; }
.drawer .body { flex: 1; overflow-y: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 20px; }
.drawer .facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1px solid var(--border); border-radius: var(--r-control); }
.drawer .facts div { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.drawer .facts div + div { border-inline-start: 1px solid var(--border); }
.drawer .facts dt { font-size: 11px; color: var(--muted); }
.drawer .facts dd { margin: 0; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.lessons { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r-control); overflow: hidden; }
.lessons li { display: flex; align-items: center; gap: 12px; padding: 11px 14px; font-size: 13.5px; font-weight: 600; }
.lessons li + li { border-top: 1px solid var(--border); }
.lessons .n { width: 24px; height: 24px; border-radius: 7px; background: var(--purple-soft); color: var(--purple-dark); display: grid; place-items: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.lessons .more { color: var(--muted); font-weight: 500; }
.drawer .buy { border-top: 1px solid var(--border); padding: 16px 24px calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--card); }
.drawer .buy .price b { font-size: 22px; }
.checkout { display: flex; flex-direction: column; gap: 12px; animation: rise .4s var(--ease-out) both; }
.checkout .line { display: flex; justify-content: space-between; font-size: 14px; padding-block: 8px; border-bottom: 1px dashed var(--border-strong); }
.checkout .line.total { font-weight: 700; border-bottom: 0; font-size: 16px; }
@media (max-width: 640px) {
  .drawer { inset-block: auto 0; inset-inline: 0; width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; translate: 0 100%; }
  [dir="rtl"] .drawer { translate: 0 100%; }
  .drawer .pic { border-radius: 20px 20px 0 0; }
}

/* Toast */
.toast { position: fixed; inset-block-end: calc(76px + env(safe-area-inset-bottom, 0px)); inset-inline-start: 50%; translate: -50% 20px; z-index: 120; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--r-control); font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lift); opacity: 0; pointer-events: none; transition: opacity .25s, translate .35s var(--ease-settle); max-width: calc(100% - 32px); }
.toast.on { opacity: 1; translate: -50% 0; }

/* Review dock: Public / In the app, and V1 to V4 (review aid, not part of the design) */
.dock { position: fixed; inset-block-end: calc(16px + env(safe-area-inset-bottom, 0px)); inset-inline: 16px; z-index: 100; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; }
.dock > * { pointer-events: auto; }
.dock .vswitch { position: static; }
.chromeswitch { display: flex; gap: 2px; padding: 4px; border-radius: var(--r-pill); background: var(--ink); box-shadow: var(--shadow-glass); }
.chromeswitch button { height: 30px; padding-inline: 12px; border: 0; border-radius: var(--r-pill); background: none; color: rgb(255 255 255 / .7); font: 700 12px/1 var(--font); cursor: pointer; }
.chromeswitch button[aria-pressed="true"] { background: #fff; color: var(--ink); }
.example { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 16px; text-align: center; }
.empty img { width: 150px; height: 150px; }
[hidden] { display: none !important; }
body.drawer-open .dock { display: none; }
