/* jor.dev base styles. Optional, link after tokens.css for the resume look out of the box. */

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

* {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings are sentence case: a capital first letter, never all caps or title case. */

h1,
h2,
h3 {
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-heading);
}

h1 {
  font-size: var(--text-2xl);
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-lg);
  font-weight: 600;
}

h4,
h5,
h6 {
  font-weight: 600;
  line-height: var(--leading-tight);
}

p,
li {
  max-width: var(--measure);
}

small,
.muted {
  color: var(--text-muted);
}

ul,
ol {
  padding-left: 1.25em;
}

a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 150ms ease;
}

a:hover {
  border-bottom-color: currentColor;
}

/* Links inside running text are underlined, so they do not rely on color alone. */

p a,
li a,
td a,
dd a,
figcaption a {
  border-bottom: 0;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 0.15em;
}

p a:hover,
li a:hover,
td a:hover,
dd a:hover,
figcaption a:hover {
  text-decoration-color: currentColor;
}

/* Skip link: the first element in the body, visible only when focused. */

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 10;
  padding: var(--space-2) var(--space-4);
  font-weight: 600;
  color: var(--on-primary-fill);
  background: var(--primary-fill);
  border-radius: var(--radius-full);
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: none;
  outline-offset: 2px;
}

code,
kbd,
pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

pre {
  overflow-x: auto;
  padding: var(--space-4);
  background: var(--surface-2);
  border-radius: var(--radius);
  line-height: 1.5;
}

code:not(pre code) {
  padding: 0.1em 0.35em;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

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

hr {
  border: 0;
  border-top: 1px solid var(--border);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--turquoise);
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Components */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.5rem;
  padding: 0 var(--space-5);
  font: inherit;
  font-weight: 600;
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  color: var(--on-primary-fill);
  background: var(--primary-fill);
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: filter 150ms ease;
}

.button:hover {
  filter: brightness(0.93);
  border-bottom-color: transparent;
}

.button-secondary {
  color: var(--on-secondary-fill);
  background: var(--secondary-fill);
}

.button-outline {
  color: var(--text);
  background: transparent;
  border-color: var(--border-strong);
}

.button-outline:hover {
  border-color: var(--text);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.card {
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.field {
  display: grid;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.field > span {
  font-weight: 600;
  letter-spacing: 0.04em;
}

.input,
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 2.5rem;
  padding: var(--space-2) var(--space-3);
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

.input:focus-visible,
.field :is(input, select, textarea):focus-visible {
  border-color: var(--focus);
  outline-offset: 0;
}

select.input,
.field select {
  appearance: none;
  padding-right: var(--space-10);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23858b92' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 1rem;
}

input[type="checkbox"],
input[type="radio"] {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--primary);
}

.badge {
  display: inline-block;
  padding: 0.15em 0.6em;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--on-highlight);
  background: var(--highlight);
  border-radius: var(--radius-full);
}

.badge-primary {
  color: var(--on-primary-fill);
  background: var(--primary-fill);
}

.badge-secondary {
  color: var(--on-secondary-fill);
  background: var(--secondary-fill);
}

.mark {
  color: var(--text);
}

/* Shared site header: the wordmark and the color scheme picker, see brand/theme.js. */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-4) var(--space-6);
}

.brand-link {
  display: inline-flex;
  border-bottom: 0;
}

.brand-link:hover {
  border-bottom: 0;
}

.brand-link img {
  height: 1.75rem;
  width: auto;
}

.theme-picker {
  display: inline-flex;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.theme-picker button {
  padding: var(--space-1) var(--space-3);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: 0;
  border-radius: var(--radius-full);
  cursor: pointer;
}

.theme-picker button[aria-pressed="true"] {
  color: var(--on-primary-fill);
  background: var(--primary-fill);
}

/* Shared site footer: what the page is, credits, then the made by line. */

.site-footer {
  margin-top: var(--space-16);
  padding: var(--space-8) var(--space-6);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  line-height: var(--leading-loose);
  color: var(--text-muted);
}

.site-footer p {
  margin: 0 0 var(--space-3);
}

.site-footer p:last-child {
  margin-bottom: 0;
}

.site-footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
}

/* Theme aware images, for example the two wordmark files. */

.only-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .only-light {
    display: none;
  }

  :root:not([data-theme="light"]) .only-dark {
    display: block;
  }
}

:root[data-theme="dark"] .only-light {
  display: none;
}

:root[data-theme="dark"] .only-dark {
  display: block;
}
