/* SavComponents Academy — everything on screen is a SavComponents component: this file only spaces them out
   and sizes the two things that are not components (the logo in the header and the preview frame of a challenge). */
html { scroll-padding-top: 5rem; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; outline: none; }
#view { display: grid; gap: 1.1rem; padding-block: 1.25rem 2.5rem; }
#view > sav-button[appearance="link"]:first-child { justify-self: start; }

/* the logo, in the header's logo slot */
/* "SavComponents" exactly as on savcomponents.com (Sav, then Components in heavy type), then "Academy" in the primary colour */
#top [slot="logo"] { display: inline-flex; align-items: center; gap: .65rem; color: var(--sav-color-text); text-decoration: none; white-space: nowrap; font-size: 1.1rem; font-weight: 400; letter-spacing: -.01em; }
#top [slot="logo"] .sc b { font-weight: 800; }
#top [slot="logo"] .ac { font-weight: 900; color: color-mix(in oklab, var(--sav-color-primary) var(--sav-tint, 62%), var(--sav-color-text)); }
#actions { display: flex; align-items: center; gap: .35rem; }
.skip { position: absolute; left: -999px; top: .5rem; z-index: 100; }
.skip:focus-within { left: .5rem; }
@media (max-width: 560px) { .hide-sm { display: none; } }
/* small phones: the XP are on the home page and in the profile; the header keeps the streak and the account */
@media (max-width: 480px) { #actions .xp { display: none; } }

/* rows of buttons, forms */
.acts { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.acts.between { justify-content: space-between; }
.acts.center { justify-content: center; }
.stack { display: grid; gap: .85rem; }
.form-err:empty, #qAfter:empty, #chDone:empty { display: none; }
/* SavAccount: its mark in the colours of the theme */
.sav-mark { display: block; width: 1.15em; height: 1.15em; flex: none; }
.sav-mark path { fill: color-mix(in oklab, var(--sav-color-primary) 55%, var(--sav-color-text)); }
.sav-mark rect { fill: var(--sav-color-primary); }
.sav-head { display: flex; align-items: flex-start; gap: .75rem; }
.sav-head > .sav-mark { width: 2rem; height: 2rem; margin-top: .15rem; }
.sav-head h3 { margin: 0 0 .2rem; }
.sav-head p { margin: 0; }
#qAfter, #chDone { display: grid; gap: .7rem; margin-top: .9rem; }

/* home: the level ring next to the welcome */
.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; }
.hero > div { flex: 1 1 18rem; display: grid; gap: .8rem; }
.stage { display: block; margin-block: .75rem; overflow: auto; }
#lbody, #dbody { outline: none; }
#lbody > * + *, #dbody > * + * { margin-top: .9rem; }
.opt::part(base) { justify-content: flex-start; text-align: left; white-space: normal; height: auto; min-height: var(--sav-control-md, 2.5rem); padding-block: .55rem; line-height: 1.35; }
.opt.mono::part(base) { font-family: var(--sav-font-mono); }

/* the accessibility section of the documentation (docs/a11y.js), shown in a lesson */
.a11y-box h2 { font-size: 1.1rem; margin-top: 0; }
.a11y-notes { padding-left: 0; list-style: none; display: grid; gap: .6rem; }
.a11y-n { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: .6rem; font-size: .92rem; }
.a11y-st { display: inline-flex; gap: .3rem; align-items: center; font-weight: 600; }
.a11y-r { display: inline-block; min-width: 2.2rem; margin: 0 .1rem; padding: .05rem .25rem; border-radius: 4px; font-size: .78rem; text-align: center; }
.a11y-r.pass { background: color-mix(in oklab, var(--sav-color-success) 18%, transparent); } .a11y-r.fail { background: color-mix(in oklab, var(--sav-color-danger) 22%, transparent); }
.a11y-t small { display: block; font-weight: 400; }

/* a challenge: the brief beside the editor and the preview frame */
.ch { display: grid; grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr); gap: 1.1rem; align-items: start; }
@media (max-width: 860px) { .ch { grid-template-columns: 1fr; } }
#checks sav-list-item[data-ok] sav-icon { color: var(--sav-color-success); }
#hint { margin-top: .75rem; }
.editor::part(textarea) { font-family: var(--sav-font-mono); font-size: .88rem; line-height: 1.55; tab-size: 2; }
.preview { display: block; box-sizing: border-box; width: 100%; height: 22rem; margin-top: .5rem; border: 0; border-radius: var(--sav-radius); background: var(--sav-color-bg); }

.foot { display: block; padding-block: .5rem 2rem; text-align: center; }
/* phones: the bottom navigation takes the place of the links, the page keeps room for it */
@media (max-width: 760px) {
  body { padding-bottom: calc(4.5rem + env(safe-area-inset-bottom)); }
  .foot { display: none; }
}

/* stars: the rating's own label stays for screen readers only (the number of stars is said, not shown) */
.stars::part(label) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* a path: cards on wide screens, the winding levels on phones */
.path-levels { display: none; }
@media (max-width: 760px) { .path-levels { display: block; } .path-cards { display: none; } }
