/* Simple Garamond site with restrained monochrome artwork. */

:root {
  --paper: #f4f2ec;
  --ink: #171715;
  --muted: #625f58;
  --line: rgba(23, 23, 21, 0.2);
  --font: "EB Garamond", Garamond, Georgia, serif;
  --side: clamp(1.25rem, 5vw, 4.5rem);
  --width: 78rem;
}

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

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.18rem;
  line-height: 1.58;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration: none;
}

.no-wrap {
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

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

.site-header {
  position: relative;
  z-index: 10;
  width: min(100%, var(--width));
  min-height: 5.25rem;
  margin: 0 auto;
  padding: 1.8rem var(--side) 1.3rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  border-bottom: 1px solid var(--line);
}

.site-name {
  flex: 0 0 auto;
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.3rem 1.35rem;
  font-size: 1rem;
}

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

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

/* Home */
.home-page {
  min-height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.home-main {
  position: relative;
  flex: 1 0 auto;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
}

.home-art,
.home-wash {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.home-art {
  z-index: -2;
  left: 34%;
  opacity: 0.3;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 30%);
  mask-image: linear-gradient(to right, transparent 0, #000 30%);
}

.home-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right 25%;
  filter: grayscale(1) contrast(0.88);
}

.home-wash {
  z-index: -1;
  background: linear-gradient(90deg, var(--paper) 0%, rgba(244, 242, 236, 0.92) 35%, rgba(244, 242, 236, 0.12) 76%);
}

.home-intro {
  width: min(32rem, calc(100% - 2 * var(--side)));
  margin-left: max(var(--side), calc((100vw - var(--width)) / 2 + var(--side)));
  padding-top: clamp(6rem, 18vh, 10.5rem);
}

.home-intro h1,
.page-copy h1,
.not-found h1 {
  margin: 0 0 1.3rem;
  font-size: clamp(2.7rem, 5vw, 3.8rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.home-intro p {
  max-width: 31ch;
  margin: 0 0 0.7rem;
  font-size: 1.3rem;
}

.home-footer {
  position: absolute;
  left: max(var(--side), calc((100vw - var(--width)) / 2 + var(--side)));
  bottom: 2rem;
  z-index: 2;
  color: var(--muted);
  font-size: 0.95rem;
}

.home-footer p {
  margin: 0.25rem 0;
}

/* Reading pages */
.content-page {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.page-main {
  position: relative;
  flex: 1 0 auto;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
}

.page-art {
  position: absolute;
  inset: 0 0 0 43%;
  z-index: -2;
  opacity: 0.15;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 28%);
  mask-image: linear-gradient(to right, transparent 0, #000 28%);
}

.page-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(244, 242, 236, 0.7), transparent 50%);
}

.page-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(0.9);
}

.page-art-campaign img {
  object-position: 56% center;
}

.page-art-chess img,
.page-art-writing img {
  object-position: 58% center;
}

.page-art-wagram img {
  object-position: 60% center;
}

.page-copy {
  position: relative;
  z-index: 1;
  width: min(44rem, calc(100% - 2 * var(--side)));
  margin-left: max(var(--side), calc((100vw - var(--width)) / 2 + var(--side)));
  padding: clamp(4rem, 9vh, 7rem) 0 5rem;
}

.page-copy h1 {
  margin-bottom: 2rem;
}

.page-copy h2 {
  margin: 2.5rem 0 0.7rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.page-copy p {
  margin: 0 0 1.15rem;
  text-wrap: pretty;
}

.page-copy ul {
  margin: 0 0 1.2rem;
  padding-left: 1.25rem;
}

.page-copy li {
  margin: 0.3rem 0;
}

.art-caption {
  margin-top: 3.5rem !important;
  color: var(--muted);
  font-size: 0.88rem;
}

.writing-list {
  padding: 0 !important;
  list-style: none;
}

.writing-list li {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.writing-list span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.95rem;
}

/* 404 */
.not-found-page {
  min-height: 100svh;
  overflow: hidden;
}

.not-found-main {
  position: relative;
  min-height: calc(100svh - 5.25rem);
  overflow: hidden;
  isolation: isolate;
}

.not-found-art {
  position: absolute;
  inset: 0 0 0 34%;
  z-index: -1;
  opacity: 0.16;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 32%);
  mask-image: linear-gradient(to right, transparent, #000 32%);
}

.not-found-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right 25%;
  filter: grayscale(1) contrast(0.88);
}

.not-found {
  width: min(32rem, calc(100% - 2 * var(--side)));
  margin-left: max(var(--side), calc((100vw - var(--width)) / 2 + var(--side)));
  padding-top: clamp(5rem, 17vh, 10rem);
}

.not-found-code {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 1rem;
}

/* Mobile */
@media (max-width: 760px) {
  body {
    font-size: 1.08rem;
  }

  .site-header {
    min-height: auto;
    padding-top: 1.25rem;
    padding-bottom: 1rem;
    display: block;
  }

  .site-name {
    display: inline-block;
    margin-bottom: 0.45rem;
  }

  .site-nav {
    justify-content: flex-start;
    gap: 0.15rem 1rem;
    font-size: 0.98rem;
  }

  .home-art {
    left: 0;
    right: 0;
    opacity: 0.26;
    -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 68%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 0, #000 68%, transparent 100%);
  }

  .home-art img {
    object-fit: cover;
    object-position: 60% bottom;
  }

  .home-wash {
    background: linear-gradient(180deg, rgba(244, 242, 236, 0.94) 0%, rgba(244, 242, 236, 0.45) 52%, var(--paper) 100%);
  }

  .home-intro {
    padding-top: clamp(4.5rem, 12vh, 7rem);
  }

  .home-intro h1,
  .page-copy h1 {
    font-size: 2.65rem;
  }

  .home-intro p {
    font-size: 1.18rem;
  }

  .home-footer {
    bottom: 1.25rem;
  }

  .page-art {
    inset: 0;
    opacity: 0.09;
    -webkit-mask-image: linear-gradient(to bottom, #000 0, transparent 85%);
    mask-image: linear-gradient(to bottom, #000 0, transparent 85%);
  }

  .page-art-writing {
    opacity: 0.25;
  }

  .page-art::after {
    background: rgba(244, 242, 236, 0.32);
  }

  .page-copy {
    padding-top: 3.5rem;
  }

  .writing-list li {
    display: block;
  }

  .writing-list span {
    display: block;
    margin-top: 0.2rem;
  }

}

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