@font-face {
  font-family: Gloock;
  src: url("fonts/gloock-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("fonts/plus-jakarta-sans-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --kb-type-display: Gloock, Georgia, serif;
  --kb-type-text: "Plus Jakarta Sans", system-ui, sans-serif;
  --kb-type-meta: .875rem;
  --kb-type-deck: clamp(1.0625rem, 1rem + .45vw, 1.25rem);
  --kb-type-tight: -.026em;
  --kb-type-small-leading: 1.5;
  --kb-type-body-leading: 1.65;
  --kb-type-focus-dark: #e3c58f;
}

body { font-family: var(--kb-type-text); }
.skip:focus-visible { outline-color: var(--kb-type-focus-dark); }

.kb-chrome {
  --kb-serif: var(--kb-type-display);
  --kb-sans: var(--kb-type-text);
}

.kb-chrome :where(.kb-links, summary) { font-family: var(--kb-type-text); }

.kb-chrome .kb-mobile-menu .kb-links {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.kb-chrome .kb-mobile-menu li { grid-column: span 3; }
.kb-chrome .kb-mobile-menu li:nth-last-child(-n + 3) { grid-column: span 2; }

.kb-author.kb-author-page {
  --kb-serif: var(--kb-type-display);
  --kb-sans: var(--kb-type-text);
}

.kb-post {
  --ground: #10131e;
  --frame: #181c2a;
  --paper: #e8e6df;
  --caption: #e3c58f;
  --rule: #947c56;
  --target: 2.75rem;
  --kb-story-gutter: clamp(1rem, 4.4vw, 4rem);
  --kb-story-copy: clamp(1.0625rem, .975rem + .45vw, 1.25rem);
  --kb-story-title: clamp(2.25rem, 1.5rem + 3.4vw, 4.15rem);
  --kb-story-section: clamp(1.55rem, 1.28rem + 1.05vw, 2.15rem);
  --kb-story-detail: clamp(1.25rem, 1.17rem + .4vw, 1.5rem);
  --kb-story-line: 1px solid var(--rule);
  margin: 0;
  background: var(--ground);
  color: var(--paper);
  font: var(--kb-story-copy)/var(--kb-type-body-leading) var(--kb-type-text);
}

.kb-post .skip {
  position: absolute;
  z-index: 2;
  inset-block-start: .5rem;
  inset-inline-start: var(--kb-story-gutter);
  display: inline-flex;
  align-items: center;
  min-block-size: var(--target);
  padding-inline: 1rem;
  transform: translateY(-160%);
  background: var(--paper);
  color: var(--ground);
}

.kb-post .skip:focus { transform: none; }
.kb-post :is(.skip, .story a, .vis-table):focus-visible {
  outline: 2px solid var(--kb-type-focus-dark);
  outline-offset: 3px;
}

.story {
  box-sizing: border-box;
  inline-size: min(68ch, calc(100% - 2 * var(--kb-story-gutter)));
  margin-inline: auto;
  padding-block: clamp(2rem, 4vw, 3rem);
  font: var(--kb-story-copy)/var(--kb-type-body-leading) var(--kb-type-text);
  container: kestbest-story / inline-size;
}

.story *, .story *::before, .story *::after { box-sizing: border-box; }
.story :where(h1, h2, h3, p, figure, ul, ol) { margin: 0; }
.story :where(ul, ol) { padding-inline-start: 1.5rem; }
.story > * + * { margin-block-start: 1rem; }
.story a { color: var(--caption); text-underline-offset: .18em; }
.story a:is(:hover, :active) { color: var(--paper); }

.story :is(h1, h2, h3) {
  font-family: var(--kb-type-display);
  font-weight: 400;
  letter-spacing: var(--kb-type-tight);
  overflow-wrap: break-word;
  text-wrap: balance;
}

.story h1 { font-size: var(--kb-story-title); line-height: 1.07; }
.story h2 { font-size: var(--kb-story-section); line-height: 1.16; margin-block-start: 2.5rem; }
.story h3 { color: var(--caption); font-size: var(--kb-story-detail); line-height: 1.25; margin-block-start: 2rem; }

.story :is(.story-header > p:not(.byline), .lede) {
  font-size: inherit;
  font-weight: 500;
}

.story :is(figcaption, .table-hint, .byline) {
  font-size: var(--kb-type-meta);
  line-height: var(--kb-type-small-leading);
}

.story :is(time, table) { font-variant-numeric: tabular-nums; }
.story .story-hero { margin-block: 2rem; border-block: 3px dashed var(--rule); padding-block: .5rem; }
.story figure img { display: block; inline-size: 100%; block-size: auto; }
.story :is(.vis-pull, .vis-note, .vis-steps) { margin-block: 1.5rem; padding-block: 1rem; border-block: var(--kb-story-line); }
.story .vis-pull { color: var(--caption); font: var(--kb-story-copy)/1.5 var(--kb-type-display); }
.story .vis-steps li + li { margin-block-start: .5rem; }

.story .byline.byline-std {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem 1rem;
  margin-block: .5rem 1rem;
  color: var(--paper);
}

.story .byline-author { display: inline-flex; align-items: center; gap: .25rem; }
.story .byline a[rel="author"] {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--target);
  min-inline-size: var(--target);
  color: var(--caption);
  text-decoration: underline;
  text-underline-offset: .18em;
}
.story .byline a[rel="author"]:is(:hover, :active) { color: var(--paper); }
.story .byline time { white-space: nowrap; }
.story .vis-table { overflow-x: auto; outline: var(--kb-story-line); outline-offset: -1px; background: var(--frame); }
.story .vis-table table { min-inline-size: 100%; border-collapse: collapse; line-height: 1.5; }
.story .vis-table :is(th, td) { padding: .5rem 1rem; text-align: start; vertical-align: top; }
.story .vis-table thead { background: var(--ground); color: var(--caption); }
.story .vis-table tbody tr { border-block-start: var(--kb-story-line); }
.story .table-hint { display: none; color: var(--caption); }

@container kestbest-story (width < 48rem) {
  .story .vis-table table { inline-size: 100%; table-layout: fixed; }
  .story .vis-table :is(th, td) { padding-inline: .625rem; overflow-wrap: anywhere; }
}

@container kestbest-story (width < calc(27rem - .5px)) {
  .story .table-hint { display: block; margin-block-end: .5rem; }
  .story .table-hint + .vis-table { margin-block-start: 0; }
  .story .vis-table table { inline-size: 27rem; }
}

@container kestbest-story (width < calc(36rem - .5px)) {
  .story .table-hint:has(+ .vis-table thead th:nth-child(4)) { display: block; margin-block-end: .5rem; }
  .story .table-hint:has(+ .vis-table thead th:nth-child(4)) + .vis-table { margin-block-start: 0; }
  .story .vis-table table:has(thead th:nth-child(4)) { inline-size: 36rem; }
}

@container kestbest-story (width < 36rem) {
  .story .vis-table :is(thead th:first-child, th[scope="row"]) {
    inline-size: 6rem;
    padding-inline: .5rem;
    position: sticky;
    inset-inline-start: 0;
    background: var(--ground);
    box-shadow: 1px 0 var(--rule);
  }
}

.story aside[class*="author"] { font-family: var(--kb-type-text); line-height: var(--kb-type-body-leading); }
.story aside[class*="author"] :where(h2, h3, [rel="author"]) { font-family: var(--kb-type-display); }
