/* GLOBAL CSS */

html {
  font-size: 100%;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
}

body {
  font: var(--text-md)/var(--leading-md) var(--font-sans);
  letter-spacing: var(--tracking-wide);
  text-rendering: optimizeSpeed;
  font-variant-ligatures: common-ligatures;
  -moz-font-feature-settings: "liga", "clig"; 
  -webkit-font-feature-settings: "liga", "clig"; 
  font-feature-settings: "liga", "clig";
  background-color: var(--color-grey-50);
  color: var(--color-text, currentColor);
  accent-color: var(--color-primary);
  padding: var(--gutter);
}

/* Scrollbar */
* {
  scrollbar-color: hsla(180, 1%, 51%, .7) transparent;
}

/* If an element is [hidden] it needs to be max priority */
.hidden, [hidden] {
  display: none !important;
}


/* Disabled state */
.disabled, [disabled] {
  opacity: var(--alpha);
}

/* Placeholder */
::placeholder {
  font: inherit;
  color: var(--color-grey-700) !important;
}


/* Main */
main {
  position: relative;
  min-height: calc(100vh - var(--gutter) * 2);
}
main > header {
  --column-gap: 1rem;
  --row-gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
}


/* Section */
section {
  position: relative;
  width: 100%;
}


/* Headings */

h1, h2, h3, h4, h5, h6 {
  font-size: var(--text-md);
  font-weight: 400;
  text-wrap: balance;
  position: relative;
}

h1 > a, 
h2 > a, 
h3 > a, 
h4 > a, 
h5 > a, 
h6 > a {
  text-decoration: none;
  border-bottom: none;
}

*:not(.sr-only) + h2,
*:not(.sr-only) + h3 {
  margin-top: var(--space-4);
}


/* General typesetting */

p {
  max-width: 40em;
}


/* Lists */

ul:not([class]),
ol:not([class]) {
  list-style: none;
  padding-left: 0;
}


/* Blockquotes */

blockquote {
  padding-left: 0;
}
blockquote > * {
  padding-left: var(--space-12);
}


/* Separators */

hr {
  border: none;
  border-top: var(--border);
  margin-inline: 0;
}

hr,
hr + * {
  --flow-space: var(--space-4);
}

/* Sub and sup */
sub,
sup {
  font-size: 0.75em;
}

sub {
  vertical-align: sub;
}

sup {
  vertical-align: middle;
  position: relative;
  top: -1ex;
}


/* Details */

details {
  position: relative;
}
summary {
  -webkit-appearance: none;
  list-style: none;
  cursor: pointer;
  width: fit-content;
  display: flex;
  -webkit-user-select: none;
  user-select: none;
}
summary::-webkit-details-marker,
summary::marker {
 display: none; 
 content: "";
}
summary::after {
  content: "";
  display: inline-block;
  width: 3rem;
  height: 2.5rem;
  background-color: var(--color-background);
  background-image: var(--icon-summary);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 1rem;
  position: absolute;
  right: 0;
}
details[open] > summary::after {
  transform: rotate(180deg);
}


/* Media */

figure {
  width: fit-content;
  height: fit-content;
}
figcaption {
  font-size: var(--text-md);
  margin: .16666667em 0;
  position: relative;
}
figcaption::before {
  float: right;
  margin-left: var(--gap);
}
figure + p {
  margin-top: var(--space-4);
}

video {
  background-color: var(--color-gray);
  max-width: 100%;
  border-radius: var(--rounded-md);
}

/* Selects images that are likely to have a transparent BG and applies a */
/* theme-driven mask to them */
img[src$='.svg'],
img[src$='.png'] {
  background-color: transparent;
}
img {
  object-fit: cover;
  background-size: cover;
  background-repeat: no-repeat;
}
[data-ratio="auto"] img {
  height: auto;
}

/* Links */

a {
  color: inherit;
  text-decoration: none;
}

a.link-full::after {
  content: '';
  display: block;
  position: absolute;
  inset: 0;
  z-index: 1;
  transition: outline var(--timing) var(--easing);
}
a.link-full:focus-visible {
  outline-width: 0;
}
a.link-full:focus-visible::after {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
  text-decoration: underline;
}


/* Form, Input, Buttons */

form {
  display: flex;
  gap: var(--space-4);
}
input {
  font: inherit;
}
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  border: 1px solid var(--color-grey-200);
  cursor: pointer;
  --icon-color: var(--color-grey-400);
}
input[type="checkbox"]:checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
input[type="checkbox"]:hover {
  border-color: var(--color-black-20);
  --icon-color: var(--color-grey-800);  
}
input[type="checkbox"]::before {
  content: "";
  display: inline-block;
  width: 100%;
  height: 100%;
  background: var(--icon-color, currentColor);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 1em;
  mask-image: var(--icon-check-2);
}
input[type="checkbox"]:checked::before {
  --icon-color: white;
}
button {
  cursor: pointer;
}
.field {
  position: relative;
}
[aria-invalid="true"]:focus-visible {
  outline-color: #ef8d8d;
}
button[aria-controls*="password"] {
  position: absolute;
  right: var(--space-8);
  bottom: var(--space-8);
  max-height: unset;
  height: 2rem;
  padding: var(--space-8);
  border: none;
}
button[aria-controls*="password"] > svg {
  width: 1rem;
  height: 1rem;
}

/* General interactive states */

:focus-visible {
  outline: 2px solid var(--color-focus-ring);
}


/* High contrast selection style */
::selection {
  background: var(--color-primary);
  color: var(--color-white);
}

/* Hide canvas */
canvas {
  display: none;
}
