/* ==========================================================================
   oskarproctor.com
   Plain CSS (native nesting), no build step.
   ========================================================================== */

:root {
  --black: #222;
  --grey: #767676; /* was #777; nudged to pass WCAG AA (4.54:1 on white) */
  --speed: 500ms;
}

/* --------------------------------------------------------------------------
   Reset (Eric Meyer v2.0, trimmed)
   -------------------------------------------------------------------------- */

html, body, div, span, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a,
abbr, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strong, sub,
sup, var, b, u, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas,
details, embed, figure, figcaption, footer, header, menu, nav, output, section,
summary, time, mark, audio, video, main, picture {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}

ol, ul {
  list-style: none;
}

blockquote, q {
  quotes: none;
  &::before, &::after {
    content: none;
  }
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  line-height: inherit;
  text-align: inherit;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Defaults
   -------------------------------------------------------------------------- */

* {
  box-sizing: border-box;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  position: relative;
  height: 100%;
  background: #fff;
}

html {
  font-size: 62.5%;
  overflow: scroll;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-size: 15px;
  font-family: Arial, Helvetica, sans-serif;
  display: flex;
  flex-direction: column;
  line-height: 1.35;
  color: var(--black);
}

img {
  max-width: 100%;
}

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

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

/* --------------------------------------------------------------------------
   Gallery
   (Native nesting can't build BEM names like `&__slide`, so those are
   written out in full; nesting is used for states, children and media.)
   -------------------------------------------------------------------------- */

.gallery__container {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
  padding: 0;
}

.gallery__wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Slides are stacked and crossfaded. Only the active slide (plus one fading
   out) is displayed, so lazy images on the others aren't fetched early. */
.gallery__slide {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--speed) ease;
}

.gallery__slide--visible {
  display: flex;
}

.gallery__slide--active {
  opacity: 1;
}

.gallery__slide--right .gallery__caption {
  right: auto;
  left: 2rem;
  @media screen and (max-width: 768px) {
    right: 2rem;
    left: auto;
  }
}

.gallery__figure {
  max-height: 100%;
  max-width: 100%;
  display: flex;
  position: relative;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  padding: 1em;
  opacity: 1;
  transition: opacity var(--speed) ease-in-out;
  @media only screen
    and (min-width: 1024px)
    and (max-height: 1366px)
    and (-webkit-min-device-pixel-ratio: 1.5) {
    height: calc(100% - 6em);
  }
  @media screen and (max-width: 768px) {
    height: calc(100% - 6em);
  }
}

.gallery__figure--left {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 100%;
  padding: 0;
  .gallery__image {
    height: 100% !important;
    top: 0;
    img {
      object-fit: cover;
      max-height: 100%;
      height: 100%;
    }
    @media only screen and (min-device-width: 1024px) and (max-device-width: 1366px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait) {
      height: 66% !important;
    }
    @media only screen
      and (min-width: 1024px)
      and (max-height: 1366px)
      and (-webkit-min-device-pixel-ratio: 1.5) {
      left: -10%;
    }
    @media screen and (max-width: 768px) {
      height: 50% !important;
    }
  }
}

.gallery__figure--right {
  position: absolute;
  top: 0; right: 0;
  height: 100%;
  width: 100%;
  padding: 0;
  .gallery__image {
    height: 100% !important;
    top: 0;
    img {
      position: absolute;
      right: 0;
      object-fit: cover;
      max-height: 100%;
      height: 100%;
    }
    @media only screen and (min-device-width: 1024px) and (max-device-width: 1366px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait) {
      height: 66% !important;
    }
    @media screen and (max-width: 768px) {
      height: 50% !important;
    }
  }
}

.gallery__figure--full {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
  padding: 0;
  .gallery__image {
    height: 100% !important;
    transform: scale(1.1);
    img {
      position: absolute;
      width: 100%;
      object-fit: cover;
    }
  }
}

.gallery__image {
  line-height: 0;
  position: relative;
  max-height: 100%;
  height: 100%;
  width: 100%;
  min-height: 280px;
  display: flex;
  flex-shrink: 1;
  picture {
    display: contents;
  }
  img {
    object-fit: contain;
    max-height: 100%;
    height: 100%;
    width: auto; /* width/height attributes are only for the aspect ratio */
  }
}

.gallery__caption {
  font-size: 0.85em;
  color: var(--grey);
  position: absolute;
  right: 2rem;
  bottom: 1rem;
  a {
    color: inherit;
  }
}

.gallery__pagination {
  position: fixed;
  top: 0; left: 0;
  width: 50%; height: 100%;
  display: block;
  cursor: none;
  &:focus-visible {
    outline-offset: -4px;
  }
}

.gallery__pagination--next {
  left: auto;
  right: 0;
}

.gallery__pagination__cursor {
  position: fixed;
  top: 0; left: 0;
  opacity: 0;
  pointer-events: none;
  @media screen and (max-width: 768px) {
    display: none;
  }
  @media only screen
    and (min-width: 1024px)
    and (max-height: 1366px)
    and (-webkit-min-device-pixel-ratio: 1.5) {
    display: none;
  }
  svg {
    display: block;
    width: 24px;
    height: auto;
    fill: inherit;
  }
}

/* --------------------------------------------------------------------------
   Gallery navigation (thumbnail ring)
   -------------------------------------------------------------------------- */

.gallery-navigation {
  position: relative;
  width: 160px;
  height: 160px;
  transition: filter var(--speed) ease-in-out;
}

.gallery-navigation__wrapper {
  position: fixed;
  top: 0; right: 0;
  padding: 24px;
  @media screen and (max-width: 768px) {
    display: none;
  }
  @media only screen
    and (min-width: 1024px)
    and (max-height: 1366px)
    and (-webkit-min-device-pixel-ratio: 1.5) {
    display: none;
  }
}

.gallery-navigation__image {
  cursor: pointer;
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  max-height: 12px;
  max-width: 12px;
  margin: -6px;
  opacity: 0;
  transition: opacity 350ms ease-in-out;
}

body.is-about-mode .gallery-navigation {
  pointer-events: none;
  filter: invert(1) grayscale(1);
}

/* --------------------------------------------------------------------------
   Site navigation
   -------------------------------------------------------------------------- */

.navigation {
  padding: 1rem 3rem 3rem 1rem;
  position: fixed;
  top: 0; left: 0;
  z-index: 1;
  transition: color var(--speed) ease-in-out;
}

body.is-about-mode .navigation {
  color: #fff;
  a {
    color: #000;
  }
}

/* --------------------------------------------------------------------------
   About overlay
   -------------------------------------------------------------------------- */

.about {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  background: #000;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  padding: 1rem;
  transition: opacity var(--speed) ease-in-out;
  pointer-events: none;
  &.is-active {
    opacity: 1;
    pointer-events: auto;
  }
  &:focus {
    outline: none;
  }
  a {
    color: #fff;
  }
}

.about__wrapper {
  max-width: 55em;
}

.about__columns {
  display: grid;
  grid-template-columns: 1fr;
  column-gap: 1rem;
  @media screen and (min-width: 48em) {
    grid-template-columns: 1fr 1fr;
  }
  > div {
    margin-bottom: 2rem;
  }
}

.about__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: #fff;
  &:not(:focus-visible) {
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

a {
  text-decoration: none;
  color: var(--grey);
  transition: color 125ms;
  &:hover {
    opacity: 0.5;
  }
}

em, i {
  font-style: italic;
}

h2 {
  margin-bottom: 1rem;
  font-weight: bold;
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Error page
   -------------------------------------------------------------------------- */

.error-page {
  padding: 8rem 1rem 1rem;
  p + p {
    margin-top: 1rem;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */

@media print {
  * {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  a,
  a:visited {
    text-decoration: underline;
  }
  a[href]::after {
    content: " (" attr(href) ")";
  }
  abbr[title]::after {
    content: " (" attr(title) ")";
  }
  a[href^="javascript:"]::after,
  a[href^="#"]::after {
    content: "";
  }
  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }
  thead {
    display: table-header-group;
  }
  tr,
  img {
    page-break-inside: avoid;
  }
  img {
    max-width: 100% !important;
  }
  @page {
    margin: 0.5cm;
  }
  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }
  h2,
  h3 {
    page-break-after: avoid;
  }
}
