:root {
  --black: #222;
  --white: #fff;
  --main-color: #E0525A;
  --link-color: #D9262F;
  --neutral-gray: #eee;

  --gap: 1rem;

  --font-h1: 2.03rem;
  --font-h2: 1.80rem;
  --font-h3: 1.60rem;
  --font-h4: 1.42rem;
  --font-h5: 1.27rem;
  --font-h6: 1.13rem;
  --font-small: 0.89rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --black: #f0f0f0;
    --white: #181818;
    --neutral-gray: #2b2b2b;
    /* --main-color already meets 4.5:1 against this dark background */
    --link-color: var(--main-color);
  }
}

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

/**/

@font-face {
  font-family: "Cabin";
  src: url(/assets/fonts/Cabin.woff2) format("woff2-variations");
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cabin";
  src: url(/assets/fonts/Cabin-Italic.woff2) format("woff2-variations");
  font-style: italic;
  font-display: swap;
}

/**/

@layer reset {

html {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  scroll-behavior: smooth;
  font-size: clamp(1em, 18px, 1.25em);
}

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

body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin-block-end: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
}

body {
  min-height: 100vh;
  line-height: 1.5;
}

h1,
h2,
h3,
h4,
button,
input,
label {
  line-height: 1.1;
}

h1,
h2,
h3,
h4 {
  text-wrap: balance;
}

a:not([class]) {
  text-decoration-skip-ink: auto;
  color: currentColor;
}

input,
button,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

textarea:not([rows]) {
  min-height: 10em;
}

:target {
  scroll-margin-block: 5ex;
}
}
/**/

body {
  font-family:
    Cabin,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Oxygen,
    Ubuntu,
    Cantarell,
    "Helvetica Neue",
    sans-serif;
  font-synthesis: none;
  color: var(--black);
  background-color: var(--white);
  display: grid;
  grid-template-columns:
    [full-start] var(--gap)
    [margin-start] minmax(0, 1fr)
    [wide-start] clamp(0px, 10vi - 30px, 6em)
    [content-start] minmax(auto, 16em) [center]
    minmax(auto, 16em) [content-end]
    clamp(0px, 10vi - 30px, 6em) [wide-end]
    minmax(0, 1fr) [margin-end]
    var(--gap) [full-end];
  margin: 0;
}

h1, .h1 { font-size: var(--font-h1); }
h2, .h2 { font-size: var(--font-h2); }
h3, .h3 { font-size: var(--font-h3); }
h4, .h4 { font-size: var(--font-h4); }
h5, .h5 { font-size: var(--font-h5); }
h6, .h6 { font-size: var(--font-h6); }
small, .small {
  font-size: var(--font-small);
}

:where(h1, h2, h3, h4, h5, h6) {
  margin-block-start: 1.5em;
  margin-block-end: 0.5em;
}

p {
  margin: 0;
}

a {
  color: var(--link-color);

  &:visited {
    color: color-mix(in srgb, var(--link-color) 80%, var(--black) 20%);
  }

  &:hover {
    color: color-mix(in srgb, var(--link-color) 70%, var(--black) 30%);
    text-decoration-thickness: 2px;
  }
}

:focus-visible {
  outline: 2px solid tomato;
  outline-offset: 2px;
}

/**/

.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/**/

#skiplink {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0.5rem;
  color: var(--white);
  background-color: var(--main-color);

  &:not(:focus) {
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
  }
}

.site-header {
  grid-column: margin;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.site-header .top {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-block-start: 1rem;
  padding-inline-end: 2.5rem;

  @media screen and (max-width: 480px) {
    flex-direction: column;
    gap: 0.5rem;
  }
}

.logo {
  img {
    width: 110px;
    height: 110px;
  }
}

.site-header .text {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;

  .name {
    font-size: var(--font-h4);
    font-weight: bold;
    line-height: 1;
  }
}

.header-social {
  position: absolute;
  top: 1rem;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;

  img {
    width: 1.5rem;
    height: 1.5rem;
    display: block;
  }
}

.site-header nav {
  margin-block-end: 0.5rem;
}

.nav-toggle {
  display: none;
}

.site-header nav ul {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 0.25rem 2rem;
}

.site-header nav a {
  position: relative;
  font-size: var(--font-small);
  text-transform: uppercase;
  text-decoration: none;
  letter-spacing: 3%;

  &:hover {
    text-decoration: underline;
  }

  &[aria-current="page"]::after {
    content: "";
    position: absolute;
    inset-inline-start: 50%;
    inset-block-end: -0.15rem;
    transform: translateX(-50%);
    width: 2rem;
    border-block-end: 0.125rem solid var(--main-color);
  }
}

@media screen and (max-width: 768px) {
  html.js .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    align-self: start;
    margin-block-end: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 0.125rem solid var(--main-color);
    border-radius: 0.5rem;
    background: var(--white);
    color: var(--main-color);
    font-size: var(--font-small);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
  }

  html.js .nav-toggle-icon {
    width: 1rem;
    height: 0.1rem;
    background: currentColor;
    position: relative;
    border-radius: 999px;
  }

  html.js .nav-toggle-icon::before,
  html.js .nav-toggle-icon::after {
    content: "";
    position: absolute;
    left: 0;
    width: 1rem;
    height: 0.1rem;
    background: currentColor;
    border-radius: 999px;
  }

  html.js .nav-toggle-icon::before {
    top: -0.3rem;
  }

  html.js .nav-toggle-icon::after {
    top: 0.3rem;
  }

  html.js .site-header .primary-nav {
    display: none;
  }

  html.js .site-header .primary-nav.is-open {
    display: block;
  }

  .site-header .primary-nav ul {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .site-header .primary-nav li {
    width: 100%;
  }
}

@media screen and (min-width: 769px) {
  html.js .site-header .primary-nav {
    display: block;
  }
}

/**/

.banner {
  grid-column: full;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 360px;
}

.banner picture {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.banner-logos {
  position: absolute;
  z-index: 2;
  inset-block-end: 1rem;
  inset-inline-end: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
}

.banner .banner-logos img {
  width: 112px;
  height: 112px;
  object-fit: contain;
  display: block;
}

.banner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-overlay {
  position: absolute;
  z-index: 1;
  inset-inline: 0;
  inset-block-end: 0;
  height: 144px;
  background: linear-gradient(to top, #000, transparent);
}

.home-hero {
  grid-column: full;
  display: grid;
  grid-template-columns: subgrid;
}

.home-hero .banner {
  grid-column: full;
  grid-row: 1;
}

.toolbox {
  grid-column: margin;
  margin-block: 0.5rem;
  padding: 1rem;
  border-radius: 1rem;

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

  li {
    --toolbox-item-color: var(--main-color);
    flex: 1 1 calc((100% - 2.25rem) / 4);
    min-width: min(100%, 11rem);
    display: flex;
  }

  a {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 0.125rem solid var(--toolbox-item-color);
    color: var(--black);
    text-decoration: none;
    font-weight: 600;
    text-align: center;

    &:hover {
      background: color-mix(in srgb, var(--toolbox-item-color) 14%, var(--white) 86%);
      color: var(--black);
    }
  }
}

/**/

:where(body) > .wrapper {
  grid-column: full;
  display: grid;
  grid-template-columns: subgrid;
}

.wrapper img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  border: 0.125rem solid var(--main-color);
}

:where(body:not(.home)) main {
  grid-column: wide;
  margin-block-start: 1.5rem;
}

main > :first-child {
  margin-block-start: 0;
}

:where(main) p {
  margin-block: 1rem;
}

/**/

:where(body) > footer {
  grid-column: full;
  display: grid;
  grid-template-columns: subgrid;
  margin-block-start: 3rem;
  padding-block: 2rem;
  background-color: var(--neutral-gray);
}

:where(body) > footer .wrapper {
  grid-column: margin;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: start;
  gap: 1rem;
}

:where(body) > footer .text {
  flex-basis: 100%;
}

:where(body) > footer .bottom {
  flex: 1;
  display: flex;
}

:where(body) > footer .bottom nav:first-of-type {
  flex: 1;
}

:where(body) > footer .bottom nav:last-of-type {
  flex-shrink: 0;
}

:where(body) > footer .text p:first-of-type {
  font-weight: bold;
}

:where(body) > footer nav ul {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 1rem;
}

/**/

.home-title {
  grid-column: margin;
  text-wrap: auto;
  margin-block: 1rem;
}

.metrics {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  padding: 0;
  margin: 1.5rem 0;
}

.metric {
  display: flex;
  flex-direction: column;
}

.metric-number {
  font-size: var(--font-h2);
  font-weight: bold;
  color: var(--main-color);
  line-height: 1.1;
}

.metric-name {
  font-size: var(--font-small);
}

:where(body.home) > .wrapper {
  grid-column: margin;
  margin-block-start: 3rem;
  display: grid;
  grid-template-columns: subgrid;

  @media screen and (min-width: 768px) {
    grid-template-columns: minmax(0, 65ch) minmax(0, 32.5ch);
    justify-content: center;
    gap: 2rem;
  }
}

:where(body.home) main {
  grid-column: wide;
  @media screen and (min-width: 768px) {
    grid-column: 1;
  }
}

:where(body.home) main > h1 {
  margin-block-start: 0;
}

:where(body.home) aside {
  grid-column: wide;
  border-block-start: 1px solid var(--light-gray);
  @media screen and (min-width: 768px) {
    grid-column: 2;
    padding-inline-start: 2rem;
    border-inline-start: 1px solid var(--light-gray);
    border-block-start: none;
  }
}

:where(body.home) aside > h2 {
  @media screen and (min-width: 768px) {
    margin-block-start: 0;
  }
}

:where(body.home) aside p {
  margin-block-start: 1rem;
}

.event-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.5rem;
  margin-block-end: 1.5rem;

  fieldset {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.5rem;
    border: 0;
    padding: 0;
    margin: 0;
  }

  label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
  }

  input[type="checkbox"] {
    accent-color: var(--main-color);
  }
}

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

.events-list > li + li {
  margin-block-start: 1.5rem;
  padding-block-start: 1.5rem;
  border-block-start: 1px solid var(--neutral-gray);
}

.event-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.event-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0.5rem;
}

.wrapper .event-image {
  border-color: var(--event-category-color, var(--main-color));
}

.event-card .event-image {
  aspect-ratio: 2 / 1;
}

.event-category-dots {
  display: flex;
  flex-shrink: 0;
  gap: 0.25rem;

  span {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--event-category-color, var(--main-color));
  }
}

.event-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-block: 0.5rem 0;
}

.event-meta {
  margin-block: 0;
}

.event-subtitle {
  font-style: italic;
}

.event-detail .event-image {
  aspect-ratio: 21 / 9;
  margin-block-end: 1rem;
}

/**/

#blog-list {
  list-style: none;
  padding: 0;
}

#blog-list > li + li {
  margin-block-start: 1.5rem;
  padding-block-start: 1.5rem;
  border-block-start: 1px solid var(--neutral-gray);
}

#blog-list .h5 {
  margin-block: 0.5rem 0;
}

#blog-list .small,
#blog-list .post-tags {
  margin-block: 0;
  font-style: italic;
}

.post-meta,
.post-tags {
  margin-block: 0;
  font-style: italic;
}

.post-excerpt {
  margin-block: 0.5rem 0;
}

#blog-list .read-more {
  display: inline-block;
  margin-block-start: 0.25rem;
}

.post-banner {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0.5rem;
}

.post-banner-link {
  display: block;
  margin-block-end: 0.75rem;
  text-decoration: none;
}
