/*
  1. Use a more-intuitive box-sizing model.
*/
*,
*::before,
*::after {
  box-sizing: border-box;
}
/*
  2. Remove default margin
*/
* {
  margin: 0;
}
/*
  3. Allow percentage-based heights in the application
*/
html,
body {
  height: 100%;
}
/*
  Typographic tweaks!
  4. Add accessible line-height
  5. Improve text rendering
*/
body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
/*
  6. Improve media defaults
*/
img,
picture,
video,
canvas,
svg {
  display: block;
  height: auto;
  max-width: 100%;
}
/*
  7. Remove built-in form typography styles
*/
input,
button,
textarea,
select {
  font: inherit;
}
/*
  8. Avoid text overflows
*/
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}
/*
  9. Create a root stacking context
*/
#root,
#__next {
  isolation: isolate;
}

:root {
  /* ##########
    light mode
    ###########  */

  --bg-color: white;
  --bg-color-accent: #f5992f;
  --bg-color-header: var(--bg-color-accent);
  --bg-color-footer: var(--bg-color-header);
  --bg-color-light-accent: #ffe1c0;

  --clr-regular: rgb(29, 0, 0);
  --clr-accent: #1d4158;
  --clr-light-blue-accent: #b2e1ff;
  --clr-code-bg: #ffabbd;
  --clr-caution: rgb(221, 47, 47);

  --clr-link: var(--clr-accent);
  --clr-link-alt: black;
  --clr-link-hover: white;

  /* #######
    general 
    ########*/
  --fw-400: 400;
  --fw-600: 600;
  --fw-700: 700;
  --fw-900: 900;

  --padding: 0.5rem;
  --padding-biggish: 1rem;
  --padding-big: 1.5rem;
  --padding-bigger: 2rem;
  --max-width: 55rem;
  --img-max-width: 20rem;

  /* Utopia type scale */
  --step--2: clamp(0.7813rem, 0.7747rem + 0.0326vi, 0.8rem);
  --step--1: clamp(0.9375rem, 0.9158rem + 0.1087vi, 1rem);
  --step-0: clamp(1.125rem, 1.0815rem + 0.2174vi, 1.3rem);
  --step-1: clamp(1.35rem, 1.2761rem + 0.3696vi, 1.5625rem);
  --step-2: clamp(1.62rem, 1.5041rem + 0.5793vi, 1.9531rem);
  --step-3: clamp(1.944rem, 1.771rem + 0.8651vi, 2.5rem);
  --step-4: clamp(2.3328rem, 2.0827rem + 1.2504vi, 2.8rem);
  --step-5: clamp(2.7994rem, 2.4462rem + 1.7658vi, 3.2rem);
}

.notice {
  outline: solid 1px black;
  padding: 0.5rem;
}

.notice > h2,
.notice > h3 {
  color: black;
}

.dashed {
  outline-style: dashed;
}

.light-accent1 {
  background-color: var(--clr-light-blue-accent);
}

.light-accent2 {
  background-color: var(--bg-color-light-accent);
}

.purple-notice {
  outline: solid 5px #dd1d68;
  padding: 0.5rem;
}

body {
  background-color: var(--bg-color);
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  color: var(--clr-regular);
  font-size: var(--step-0);
  hyphens: auto;
}

h1 {
  font-size: var(--step-5);
}

h2 {
  font-size: var(--step-4);
}

h3 {
  font-size: var(--step-3);
}

h4 {
  font-size: var(--step-2);
}

.not-AI-badge {
  float: left;
  margin-right: 1rem;
  width: 8rem;
}

.smaller-no-margin {
  max-width: 25rem;
  margin: 0;
}

.logo-text {
  font-size: var(--step-2);
  font-weight: var(--fw-700);
}

div[aria-labelledby="site-info"] {
  margin-bottom: 2rem;
}

/* ###############
  containers and flows
  ################ */

.header-container {
  padding: var(--padding-bigger);
  padding-top: 0;
  margin: 0 auto;
}

.header-flow > * + * {
  margin-top: 1rem;
}

.flow > * + * {
  margin-top: var(--flow-space, 1em);
}

.container {
  padding: var(--padding-bigger);
  margin: 0 auto;
}

.footer-container {
  padding: var(--padding-big) var(--padding-bigger);
  margin: 0 auto;
}

.footer-flow > * + * {
  margin-top: 0.5rem;
}

header {
  background-color: var(--bg-color-header);
}

footer {
  background-color: var(--bg-color-footer);
  position: sticky;
  top: 100%;
}

footer h2 {
  color: var(--clr-regular);
  font-size: var(--step-2);
}

/* ##########
  flexbox styling
  ########### */

.even-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;

  align-items: center;
}

.col {
  flex: 1;
}

/* ##########
  image styling
  ########### */

.image {
  max-width: var(--img-max-width);
}

.rounded-image {
  border-radius: 50%;
  border: 10px solid var(--clr-accent);
}

li {
  margin-top: 0.5rem;
}

hr.divider {
  border-top: 1px solid black;
  margin: 2rem 2rem 0 2rem;
}

h1,
h2,
h3,
h4,
h5 {
  max-width: 30ch;
}

.breadcrumb li {
  padding-right: 0.5rem;
}

.breadcrumb li + li::before {
  display: inline-block;
  margin: 0 0.25em;
  transform: rotate(20deg);
  border-right: 0.1em solid currentcolor;
  height: 0.8em;
  content: "";
}

.breadcrumb {
  list-style: none;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  padding: 0;

  hyphens: none;
}

/* Links */
a {
  color: var(--clr-link);
  text-decoration-thickness: 0.1rem;
  text-underline-offset: 0.25rem;
}

header a,
footer a {
  color: var(--clr-link-alt);
}

/* Only styles the links that have an href attribute */
[href]:hover {
  background-color: var(--clr-accent);
  color: var(--clr-link-hover);
  text-decoration: none;
}

/* Makes the current page's link text bold */
a[aria-current="page"],
a[aria-current="location"] {
  font-weight: var(--fw-700);
}

a:focus {
  outline: 4px solid var(--clr-accent);
  color: black;
  outline-offset: 2px;
  text-decoration: none;
}

/* Links in the body have different colored backgrounds. */
main [href]:hover {
  background-color: var(--bg-color-header);
  color: var(--clr-regular);
}

main a:focus {
  outline: 4px solid var(--bg-color-header);
}

/* Take what works */
code {
  color: var(--clr-regular);
  background: var(--clr-code-bg);
  border-radius: 3px;
  hyphens: none;
}

/* Keep what works */
blockquote {
  margin-left: 1rem;
  padding: 0.5rem 1rem;
  border-left: 8px solid var(--bg-color-accent);
  font-size: inherit;
  background-color: #fff0e0;
}

blockquote > * + * {
  margin-top: var(--flow-space, 1em);
}

figure {
  border: 2px solid black;
  margin: auto;
  font-size: inherit;
}

figcaption {
  background-color: var(--bg-color-light-accent);
  padding: 0.5rem 1rem;
}

cite {
  padding-left: 1rem;
}

/* Keep what works */
details {
  display: inline-block;
  border: 2px solid var(--clr-regular);
  border-radius: 4px;
  padding: 0.5em 0.5em 0;
  margin-block-start: 1em;
  margin-block-end: 1em;
}

details > summary {
  font-weight: var(--fw-700);
  margin: -0.5em -0.5em 0;
  padding: 0.5em;
  cursor: pointer;
}

details > summary:focus {
  outline: 4px solid var(--bg-color-accent);
  border-radius: 4px;
  text-decoration: none;
}

details[open] {
  padding: 0.5em;
}

details[open] summary {
  border-bottom: 1px solid var(--clr-regular);
  margin-bottom: 0.5em;
}

details > * + * {
  margin-top: var(--flow-space, 1em);
}

[role="region"][aria-labelledby][tabindex],
.table-wrapper {
  overflow: auto;
  margin-left: 1rem;
  margin-right: 1rem;
}

[role="region"][aria-labelledby][tabindex]:focus,
.table-wrapper:focus {
  outline: 4px solid var(--bg-color-accent);
}

[role="region"][aria-labelledby][tabindex],
.table-wrapper {
  background: linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0)),
    linear-gradient(to right, rgba(255, 255, 255, 0), #fff 70%) 0 100%,
    radial-gradient(
      farthest-side at 0% 50%,
      rgba(0, 0, 0, 0.2),
      rgba(0, 0, 0, 0)
    ),
    radial-gradient(
        farthest-side at 100% 50%,
        rgba(0, 0, 0, 0.2),
        rgba(0, 0, 0, 0)
      )
      0 100%;
  background-repeat: no-repeat;
  background-color: #fff;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-position: 0 0, 100%, 0 0, 100%;
  background-attachment: local, local, scroll, scroll;
}

caption {
  text-align: left;
  margin-bottom: 0.5rem;
}

th,
td {
  padding: 0.25em 0.5em 0.25em 1em;
  vertical-align: text-top;
  text-align: left;
  /* text-indent: -0.5em; */
  outline: 1px solid grey;
}

th {
  vertical-align: bottom;
  background-color: var(--clr-accent);
  color: #fff;
}

th[scope="row"] {
  color: black;
}

tr:nth-child(even) th[scope="row"] {
  background-color: #f2f2f2;
}

tr:nth-child(odd) th[scope="row"] {
  background-color: #fff;
}

tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.05);
}

tr:nth-child(odd) {
  background-color: rgba(255, 255, 255, 0.05);
}

tr td:nth-child(1) {
  min-width: 10em;
  max-width: 90vw;
}

tr td:nth-child(2) {
  max-width: 90vw;
}

tr *:nth-child(3) {
  text-align: left;
}

/* General accessibility stuff */
/* Take what works */
.visually-hidden {
  background: white;
  left: 50%;
  padding: 8px;
  position: absolute;
  transform: translateY(-200%);
  transition: transform 0.3s;
  color: black;
}

.visually-hidden:focus {
  transform: translateY(0%);
}

.visually-hidden:has(:focus, :hover) a[href] {
  transform: translateY(0%);
  color: white;
}

.sr-only {
  border: 0;
  padding: 0;
  margin: 0;
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
}

.eleventy-plugin-embed-twitter {
  margin-left: 3rem;
  margin-right: 3rem;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;

  list-style: none;
  padding: 0;
  gap: 0.75rem;
  font-size: var(--step-1);
}

nav.toc ol {
  padding-left: 1em;
  list-style: none;
}

.post-tag,
kdb {
  border: 1px solid var(--clr-accent);
  padding: 0 var(--padding);
  padding-block: 0.2rem;
  border-radius: 0.3rem;

  background-color: rgb(241, 241, 241);
  text-decoration: none;

  font-size: var(--step-0);
}

li:has(.post-tag) {
  margin-top: 0;
}

.draft {
  font-size: var(--step-2);
}

h1 .post-tag {
  font-size: inherit;
}

h1,
h2,
h3,
h4,
h5 {
  line-height: 1.2;
  color: var(--clr-accent);
}

.displaymath {
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border: none;
}

mjx-container {
  font-size: var(--step-0) !important;
}

.caution {
  position: sticky;
  top: 0;
  background-color: white;
  padding: 0 0.5rem;
  border: 4px solid var(--clr-caution);
  border-left: 10px solid var(--clr-caution);
}

.dashed-box {
  border: 1px dashed black;
  padding: 0.5em; 
}

.toc {
  margin-block-end: 0;
}

@media (min-width: 50em) {
  .container,
  .header-container,
  .footer-container {
    max-width: var(--max-width);
  }

  table {
    /* border-collapse: collapse; */
    /* border: 0.1em solid #d6d6d6; */
    margin: 0 auto;
  }

  figure {
    /* max-height: 30rem; */
    max-width: 40rem;
  }

  .grid {
    display: grid;
    gap: 1rem;
  }

  .col-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .col-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}
