/* The public pages (server/site): a single readable column in Björn's
   colours, outside the hub. Tokens and buttons come from /shared/bjorn.css. */

body.site {
  display: flex;
  flex-direction: column;
  font-size: 16px;
  line-height: 1.6;
}
.site a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent);
  text-underline-offset: 0.2em;
}
.site a:hover {
  text-decoration-color: var(--accent);
}
.site h1,
.site h2,
.site h3 {
  line-height: 1.2;
  text-wrap: balance;
}
.site h1 {
  margin: 0.2em 0 0.3em;
  font-size: clamp(32px, 6vw, 46px);
  font-weight: 700;
}
.site h2 {
  margin: 0 0 0.6em;
  font-size: 22px;
}
.site h3 {
  margin: 1.2em 0 0.4em;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.site p {
  margin: 0 0 1em;
  text-wrap: pretty;
}
.site .muted {
  color: var(--ink-2);
}
.site .small {
  font-size: 13px;
}
.site code {
  font-size: 0.92em;
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: var(--surface);
}

/* --- Top and bottom ---------------------------------------------------------------- */

.site-top {
  display: flex;
  align-items: center;
  gap: 24px;
  width: min(1040px, 100% - 40px);
  margin: 0 auto;
  padding: 18px 0;
}
.site-logo {
  width: 78px;
  height: 30px;
  background: var(--accent);
  -webkit-mask: url("/shared/img/logo.svg") no-repeat center / contain;
  mask: url("/shared/img/logo.svg") no-repeat center / contain;
}
.site-top nav {
  display: flex;
  gap: 20px;
  margin-right: auto;
}
.site-top nav a {
  color: var(--ink-2);
  font-weight: 600;
  text-decoration: none;
}
.site-top nav a:hover {
  color: var(--ink);
}
.site-top .button-link.primary {
  padding: 0.5em 1.1em;
  border-radius: 999px;
}

.site-main {
  flex: 1;
  width: min(760px, 100% - 40px);
  margin: 0 auto;
  padding: 12px 0 48px;
}
.site-main > section,
.site-main > article,
.site-main > aside,
.site-main > details {
  margin-top: 44px;
}

.site-foot {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 24px;
  width: min(1040px, 100% - 40px);
  margin: 0 auto;
  padding: 32px 0 48px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.site-foot ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-foot div:first-child ul {
  columns: 2;
}
.site-foot li {
  margin: 0 0 6px;
}
.site-foot a {
  color: var(--ink-2);
  text-decoration: none;
}
.site-foot a:hover {
  color: var(--ink);
}

@media (max-width: 640px) {
  .site-top {
    flex-wrap: wrap;
    gap: 12px 18px;
  }
  .site-top nav {
    order: 3;
    width: 100%;
  }
  .site-top .button-link.primary {
    margin-left: auto;
  }
  .site-foot {
    grid-template-columns: 1fr;
  }
}

/* --- Pieces -------------------------------------------------------------------------- */

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 20px;
  font-size: 13px;
  color: var(--ink-3);
}
.crumbs a {
  color: var(--ink-2);
  text-decoration: none;
}
.crumbs a:hover {
  color: var(--ink);
}

.lede > p {
  font-size: 18px;
  color: var(--ink-2);
}
.lede .eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}
.lede .eyebrow a {
  color: inherit;
}
.lede .native {
  margin-top: -0.2em;
  font-size: 20px;
  color: var(--ink-2);
}
.lede .actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 24px;
  font-size: 14px;
}
.button-link.primary.start {
  padding: 0.65em 1.4em;
  border-radius: 999px;
  font-size: 16px;
}
.button-link.start[aria-busy="true"] {
  opacity: 0.6;
  pointer-events: none;
}

.flag {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}

/* Cards in a list: languages, units, stories, apps. */
.lang-grid,
.units,
.story-list,
.app-list,
.lang-chips {
  margin: 0;
  padding: 0;
  list-style: none;
}
.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 28px;
}
.lang-grid a,
.units a,
.story-list a,
.app-list a,
.story-card {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: calc(0.6em * var(--brm));
  corner-shape: superellipse(1.4);
  background: var(--surface);
  text-decoration: none;
  transition: background 0.15s;
}
.lang-grid a:hover,
.units a:hover,
.story-list a:hover,
.app-list a:hover,
.story-card:hover {
  background: var(--raised);
}
.lang-grid a {
  align-items: center;
}
.lang-grid .flag {
  width: 32px;
  height: 32px;
}
.lang-grid span,
.app-list a {
  display: flex;
  flex-direction: column;
}
.lang-grid small,
.story-list small,
.app-list span {
  color: var(--ink-2);
  font-size: 14px;
}
.app-list a {
  gap: 2px;
}

.units {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px;
}
.units a {
  flex-direction: column;
  gap: 0;
  height: 100%;
  padding: 10px 14px;
}
.units span {
  color: var(--ink-2);
  font-size: 14px;
}
.stage + .stage h3 {
  margin-top: 1.6em;
}

.story-list,
.app-list {
  display: grid;
  gap: 8px;
}
.story-list a {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  align-items: baseline;
}
.story-list .tag {
  grid-row: span 2;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}
.story-card {
  flex-direction: column;
  gap: 4px;
}
.story-card b {
  font-size: 19px;
}
.story-card > span {
  color: var(--ink-2);
}
.story-card small {
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 14px;
}

.lang-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.lang-chips a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: var(--surface);
  text-decoration: none;
  font-size: 14px;
}
.lang-chips a:hover {
  background: var(--raised);
}

.goals {
  margin: 0;
  padding-left: 1.2em;
}
.goals li {
  margin-bottom: 4px;
}

table.words {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
table.words th {
  padding: 0 12px 8px 0;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink-2);
}
table.words td {
  padding: 10px 12px 10px 0;
  border-top: 1px solid var(--line);
  vertical-align: top;
}
table.words td:last-child {
  padding-right: 0;
}
table.words td:nth-child(2) {
  color: var(--ink-2);
}
table.words small {
  color: var(--ink-3);
}
@media (max-width: 560px) {
  table.words thead {
    display: none;
  }
  table.words tr {
    display: block;
    padding: 10px 0;
    border-top: 1px solid var(--line);
  }
  table.words td {
    display: block;
    padding: 0;
    border: 0;
  }
}

.frames {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 19px;
}
.frames li {
  margin-bottom: 8px;
}
.blank {
  display: inline-block;
  width: 5em;
  margin: 0 0.15em;
  border-bottom: 2px dashed var(--ink-3);
  vertical-align: -0.1em;
}

.cta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 24px;
  padding: 22px 24px;
  border-radius: calc(0.8em * var(--brm));
  corner-shape: superellipse(1.4);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}
.cta p {
  flex: 1 1 260px;
  margin: 0;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 36px;
  font-size: 14px;
}
.pager a {
  color: var(--ink-2);
  text-decoration: none;
}
.pager a:hover {
  color: var(--ink);
}

.guide ul,
.guide ol {
  padding-left: 1.2em;
}
.guide li {
  margin-bottom: 8px;
}
.guide h2 {
  margin-top: 1.6em;
}

/* --- A story ------------------------------------------------------------------------- */

.story .subtitle {
  margin-top: -0.2em;
  font-size: 19px;
  color: var(--ink-2);
}
.story-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.story-tools button[aria-pressed="true"] {
  background: var(--ui);
}
.story-text {
  margin-top: 24px;
  font-size: var(--text-size);
  line-height: var(--text-lh);
}
.story-text .tl {
  margin: 0 0 0.9em;
}
.story-text .en {
  display: none;
  margin: -0.5em 0 1.2em;
  padding-left: 14px;
  border-left: 2px solid var(--line);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-2);
}
.story.show-english .en {
  display: block;
}
.w {
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s;
}
.w:hover,
.w.on {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

.gloss {
  position: absolute;
  z-index: 20;
  max-width: min(320px, 100vw - 24px);
  padding: 10px 14px;
  border-radius: calc(0.5em * var(--brm));
  corner-shape: superellipse(1.4);
  background: var(--raised);
  box-shadow: 0 8px 28px rgb(0 0 0 / 0.28);
  font-size: 15px;
  line-height: 1.4;
}
.gloss b {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
}

.quiz ol {
  margin: 0;
  padding-left: 1.2em;
}
.quiz li {
  margin-bottom: 20px;
}
.quiz p {
  margin-bottom: 8px;
}
.quiz .options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.quiz .options button {
  font-weight: 600;
  text-align: left;
}
.quiz .options button.right {
  background: color-mix(in srgb, var(--good) 30%, var(--ui));
}
.quiz .options button.wrong {
  background: color-mix(in srgb, var(--bad) 26%, var(--ui));
}

.glossary summary {
  cursor: pointer;
  font-weight: 700;
}
.glossary table {
  margin-top: 14px;
}
