@font-face {
  font-family: "Knickerbocker Variable";
  src: url("../fonts/KnickerbockerVariable.woff2") format("woff2"),
    url("../fonts/KnickerbockerVariable.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --nav-width: 24rem;
  font-family: "Knickerbocker Variable", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color-scheme: dark;
  color: #fff;
  background: #222;
  /* The font has separate top and bottom weight axes (100–900). */
  font-variation-settings: "WTOP" 400, "WBTM" 400;
  font-synthesis: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  display: grid;
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  margin: 0;
  padding: 1rem;
}

h1,
h2,
h3 {
  margin: 0 0 1rem;
  font-weight: 400;
  line-height: 1.1;
  font-variation-settings: "WTOP" 400, "WBTM" 400;
}

p,
ul,
ol {
  margin: 0 0 1rem;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
}

img,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

button,
input,
textarea,
select {
  font: inherit;
}

nav {
  min-width: 0;
  position: sticky;
  top: 1rem;
  z-index: 3;
  font-size: 1.25rem;
  line-height: 1.45;
}

nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.disabled {
  color: #999;
  pointer-events: none;
  cursor: default;
  text-decoration: none;
}

nav label {
  display: inline;
  position: relative;
  white-space: normal;
  cursor: pointer;
}

nav li { display: inline-block; max-width: 100%; }
nav li::after { content: ';'; }
nav li:has(.disabled)::after { color: #999; }

nav .nav-group { display: block; margin-top: 1.5rem; }
nav .nav-group::after { content: none; }
.nav-group h2 {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.nav-date {
  font-size: 0.48em;
  line-height: 0;
  vertical-align: super;
  white-space: nowrap;
}

.nav-thumbnail-slot {
  display: inline-block;
  width: 1.5em;
  height: 1em;
  vertical-align: -0.08em;
  position: relative;
}

.nav-thumbnail {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  pointer-events: none;
}

nav label.is-preview .nav-thumbnail {
  width: 146px;
  height: 146px;
  left: var(--preview-x, 0px);
  top: var(--preview-y, 0px);
  z-index: 5;
}

nav input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

nav input:checked + span {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

nav label:not(.disabled) span,
a[href],
button:not(:disabled) {
  font-variation-settings: "WTOP" 400, "WBTM" 400;
  transition: font-variation-settings 0.2s;
}

nav label:not(.disabled):hover span,
nav input:checked + span,
a[href]:hover,
button:not(:disabled):hover {
  font-variation-settings: "WTOP" var(--wtop, 400), "WBTM" var(--wbtm, 400);
}

nav input:focus-visible + span {
  outline: 1px solid currentColor;
  outline-offset: 2px;
}

nav label.disabled {
  cursor: default;
}

main {
  min-width: 0;
  overflow-wrap: anywhere;
  container-type: inline-size;
}

p {
  white-space: pre-wrap;
}

figure {
  margin: 0 0 1rem;
}

figcaption {
  margin-top: 0.625rem;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 0.875rem;
  font-variation-settings: normal;
  line-height: 1.45;
  color: #bbb;
}

.caption-title,
.caption-credit {
  display: block;
}

.caption-title {
  color: #ddd;
}

.caption-credit {
  margin-top: 0.25rem;
  color: #aaa;
}

a.caption-source {
  display: block;
  width: fit-content;
  margin-top: 0.375rem;
  text-decoration: none;
  font-variation-settings: normal;
}

a.caption-source:hover {
  color: #fff;
  text-decoration: underline;
  font-variation-settings: normal;
}

.image-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.image-row > figure {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
}

.image-row img,
.image-row video {
  width: 100%;
}

iframe {
  display: block;
  width: 100%;
  border: 0;
}

.tool {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: #2c2c2e;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), 0 12px 32px rgba(0, 0, 0, 0.25);
}

.tool-header {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #48484a;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 0.875rem;
  font-variation-settings: normal;
}

.tool-header a,
.tool-header a:hover {
  font-variation-settings: normal;
}

.tool-header a {
  flex-shrink: 0;
  color: #bbb;
}

.tool-header a:hover { color: #fff; }

.tool-actions {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.tool-sources summary { color: #bbb; cursor: pointer; }
.tool-sources summary:hover { color: #fff; }
.tool-source-list {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 1rem;
  z-index: 1;
  width: max-content;
  max-width: min(17rem, 70vw);
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  background: #2c2c2e;
  border: 1px solid #48484a;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.email {
  padding: clamp(1rem, 2.5vw, 1.75rem);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: #2c2c2e;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), 0 12px 32px rgba(0, 0, 0, 0.25);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-variation-settings: normal;
  line-height: 1.4;
  color: #fff;
}

.email-header {
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #48484a;
}

.email-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}

.email .email-sender {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  font-variation-settings: normal;
  line-height: 1.4;
}

.email time {
  color: #aaa;
  font-size: 0.875rem;
}

.email .email-subject {
  margin: 0.2rem 0;
}

.email .email-recipients {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0;
  color: #aaa;
  font-size: 0.9375rem;
}

.email-recipients > span > span {
  color: #fff;
}

.email > p,
.email > figure {
  margin-bottom: 1.25rem;
}

.email > :last-child {
  margin-bottom: 0;
}

@media (max-width: 760px) {
  body {
    grid-template-columns: minmax(0, 1fr);
  }
  nav {
    position: static;
  }
}
