/*
  The whole visual design of the site. Written to meet WCAG 2.2 level AAA:
  - text and link colours contrast at least 7:1 with the background
  - lines of text are at most 70 characters wide, never justified
  - line spacing is 1.5, paragraph spacing is larger than that
  - links and buttons are at least 44 pixels tall
  - keyboard focus is always clearly visible
  - sizes use rem and em, so the text scales with the reader's settings
*/

/*
  The typeface: Atkinson Hyperlegible, designed by the Braille Institute for
  low-vision readers. The four files live in static/fonts and are served from
  this site, so no visitor's browser has to contact a font company.
  font-display: swap shows text at once in a fallback font while these load.
*/
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-400-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-700-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-700-italic.woff2") format("woff2");
}

:root {
  color-scheme: light dark;
  --bg: #fdfcf9;
  --text: #1a1a1a;
  --link: #0b3d91;
  --rule: #5c5c5c;
  --panel: #f0ede6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151515;
    --text: #f2f0eb;
    --link: #a8c7ff;
    --rule: #b0b0b0;
    --panel: #232323;
  }
}

html {
  font-size: 112.5%;
}

body {
  margin: 0 auto;
  padding: 1rem;
  max-width: 70ch;
  background: var(--bg);
  color: var(--text);
  font-family: "Atkinson Hyperlegible", Verdana, system-ui, sans-serif;
  line-height: 1.6;
  text-align: left;
}

h1, h2, h3 {
  line-height: 1.25;
  margin: 2rem 0 0.75rem;
}

p, ul, ol, dl, figure {
  margin: 0 0 1.5rem;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-thickness: 0.15em;
}

:focus-visible {
  outline: 0.2rem solid var(--text);
  outline-offset: 0.2rem;
}

main:focus {
  outline: none;
}

.skip-link {
  position: absolute;
  left: -100rem;
}

.skip-link:focus {
  position: static;
  display: inline-block;
  padding: 0.75rem;
}

header, footer {
  padding: 0.5rem 0;
}

header {
  border-bottom: 0.125rem solid var(--rule);
}

footer {
  border-top: 0.125rem solid var(--rule);
  margin-top: 3rem;
}

.site-name {
  font-weight: bold;
  margin: 0;
}

nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
}

/* Navigation links get a tall click area (44px minimum target size). */
nav a, .site-name a {
  display: inline-block;
  min-height: 2.75rem;
  line-height: 2.75rem;
}

nav a[aria-current="page"] {
  font-weight: bold;
  text-decoration-thickness: 0.2em;
}

.meta {
  font-size: 0.95rem;
}

.subscribe, .event-details {
  background: var(--panel);
  padding: 1rem;
  border-left: 0.3rem solid var(--link);
}

.subscribe h2 {
  margin-top: 0;
}

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

label {
  display: block;
  font-weight: bold;
  margin-bottom: 0.25rem;
}

input, button {
  font: inherit;
  min-height: 2.75rem;
  padding: 0.25rem 0.75rem;
  border: 0.125rem solid var(--text);
  border-radius: 0.25rem;
  box-sizing: border-box;
}

input {
  width: 100%;
  max-width: 30rem;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 0.75rem;
}

button {
  display: block;
  background: var(--text);
  color: var(--bg);
  font-weight: bold;
  cursor: pointer;
}

.event-details dt {
  font-weight: bold;
}

.event-details dd {
  margin: 0 0 0.75rem;
}

.event-details dd:last-child {
  margin-bottom: 0;
}

.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  margin-bottom: 1.25rem;
}

img {
  max-width: 100%;
  height: auto;
}

audio {
  width: 100%;
}

figure.audio figcaption {
  font-weight: bold;
  margin-bottom: 0.5rem;
}

/* The outside link on a work post, and the list of a post's tags. */
.outside-link {
  font-weight: bold;
}

.tags {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
}

.tags a {
  display: inline-block;
  min-height: 2.75rem;
  line-height: 2.75rem;
}

/* Post titles in a list are headings; keep them close to their own text. */
.post-list h2, .post-list h3 {
  font-size: 1.15rem;
  margin: 0 0 0.25rem;
}

.post-list p {
  margin: 0;
}

footer p {
  margin: 0.5rem 0;
}

/* Footer links get a tall click area (44px minimum target size). */
footer a {
  display: inline-block;
  min-height: 2.75rem;
  line-height: 2.75rem;
}

/* Landing page introduction: one column on a phone, words beside the
   photo on a wider screen. */
.intro {
  margin-bottom: 2rem;
}

.portrait {
  margin: 1.5rem 0 0;
  max-width: 18rem;
}

.portrait figcaption {
  font-size: 0.95rem;
}

@media (min-width: 46rem) {
  .intro {
    display: grid;
    grid-template-columns: 1fr 15rem;
    gap: 2rem;
    align-items: start;
  }

  .portrait {
    margin-top: 0;
  }
}

/* The two "more" links under the latest posts on the landing page. */
.more-links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 2rem;
}

.more-links a {
  display: inline-block;
  min-height: 2.75rem;
  line-height: 2.75rem;
}

/* Your name at the top of every page. On the landing page it is an h1, on
   other pages a paragraph; both look the same. */
.site-name {
  font-size: 1.6rem;
  font-weight: bold;
  line-height: 1.25;
  margin: 0.5rem 0 0;
}

.site-name a {
  text-decoration: none;
  color: var(--text);
}

.site-name a:hover, .site-name a:focus-visible {
  text-decoration: underline;
}
