/* About page as a contact sheet (custom-about.hbs). Hand-written, not built by vite.
   The hero and the closing sheet are film and stay dark in both themes; the
   text between them follows the theme. */

.dmr-ab {
  --dmr-ab-film: hsl(30, 8%, 7%);
  --dmr-ab-paper: hsl(36, 30%, 95%);
  --dmr-ab-edge: hsl(35, 82%, 58%);
  --dmr-ab-hole: rgba(240, 232, 214, 0.5);
  --dmr-ab-pencil: var(--accent-color, #ff7a7a);
  --dmr-ab-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  color: var(--foreground);
}

/* ---- hero: the contact sheet ---- */

.dmr-ab__hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: var(--dmr-ab-film);
  color: var(--dmr-ab-paper);
  isolation: isolate;
}

.dmr-ab__sheet {
  position: absolute;
  inset: -6% -10%;
  z-index: -2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-content: start;
  row-gap: 0.75rem;
  counter-reset: dmr-ab-frame;
  transform: rotate(-5deg);
}

/* One frame of film: sprocket holes along both edges, a frame number in the
   edge print, the photo in between. Frames side by side read as one strip. */
.dmr-ab__frame {
  position: relative;
  display: block;
  padding: 0.875rem 0.1875rem;
  background: var(--dmr-ab-film);
  counter-increment: dmr-ab-frame;
}

.dmr-ab__frame::before,
.dmr-ab__frame::after {
  position: absolute;
  inset-inline: 0;
  height: 0.375rem;
  background: repeating-linear-gradient(90deg, transparent 0 0.25rem, var(--dmr-ab-hole) 0.25rem 0.5625rem, transparent 0.5625rem 0.875rem);
  background-clip: content-box;
  content: '';
}

.dmr-ab__frame::before {
  top: 0.25rem;
}

.dmr-ab__frame::after {
  bottom: 0.25rem;
}

/* The frame number sits in the bottom edge, between the holes. */
.dmr-ab__frame:nth-child(odd)::after {
  content: counter(dmr-ab-frame) 'A';
  height: auto;
  padding-inline-start: 0.25rem;
  color: var(--dmr-ab-edge);
  font: 600 0.5rem/0.375rem var(--dmr-ab-mono);
  letter-spacing: 0.08em;
  background-position: 1.75rem 0;
  background-size: calc(100% - 1.75rem) 100%;
  background-repeat: no-repeat;
}

.dmr-ab__frame img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: hsl(30, 6%, 14%);
  filter: invert(1) sepia(0.6) saturate(1.8) hue-rotate(-20deg) brightness(0.85);
  animation: dmr-ab-develop 2.6s ease forwards;
  animation-delay: calc(0.4s + var(--dmr-ab-a, 0s) + var(--dmr-ab-b, 0s));
}

/* Frames develop out of order, like a print in the tray. */
.dmr-ab__frame:nth-child(4n + 2) img { --dmr-ab-a: 0.9s; }
.dmr-ab__frame:nth-child(4n + 3) img { --dmr-ab-a: 0.35s; }
.dmr-ab__frame:nth-child(4n + 4) img { --dmr-ab-a: 1.4s; }
.dmr-ab__frame:nth-child(3n + 2) img { --dmr-ab-b: 0.6s; }
.dmr-ab__frame:nth-child(3n) img { --dmr-ab-b: 1.2s; }

@keyframes dmr-ab-develop {
  to { filter: none; }
}

.dmr-ab__scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 70% at 30% 100%, rgba(13, 12, 11, 0.85) 0%, rgba(13, 12, 11, 0) 70%),
    linear-gradient(180deg, rgba(13, 12, 11, 0.55) 0%, rgba(13, 12, 11, 0.3) 35%, rgba(13, 12, 11, 0.8) 72%, rgba(13, 12, 11, 0.96) 100%);
}

.dmr-ab__intro {
  display: grid;
  gap: 2.25rem;
  align-items: end;
  width: 100%;
  max-width: var(--max-width-container, 72.5rem);
  margin: 0 auto;
  padding: 7.5rem 1.25rem 5rem;
}

/* The chosen print: a bordered enlargement, circled in grease pencil. */
.dmr-ab__print {
  position: relative;
  justify-self: start;
  width: min(62vw, 17rem);
  margin: 0;
  padding: 0.5rem;
  background: var(--dmr-ab-paper);
  box-shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.8);
  transform: rotate(2.5deg);
}

[dir="rtl"] .dmr-ab__print {
  transform: rotate(-2.5deg);
}

.dmr-ab__print img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 30%;
}

.dmr-ab__grease {
  position: absolute;
  inset: -10% -12%;
  width: 124%;
  height: 120%;
  overflow: visible;
  pointer-events: none;
}

.dmr-ab__grease path {
  fill: none;
  stroke: var(--dmr-ab-pencil);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0.92;
  animation: dmr-ab-draw 1.3s cubic-bezier(0.6, 0.1, 0.3, 1) 2.4s forwards;
}

@keyframes dmr-ab-draw {
  to { stroke-dashoffset: 0; }
}

.dmr-ab__title {
  max-width: 13ch;
  margin: 0;
  font-family: 'Montserrat', var(--gh-font-heading, var(--font-family));
  font-size: clamp(2.375rem, 10vw, 5.5rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.dmr-ab__lead {
  max-width: 34rem;
  margin: 1.25rem 0 0;
  font-size: 1.0625rem;
  line-height: 1.55;
  opacity: 0.86;
  text-wrap: pretty;
}

.dmr-ab__down {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  display: flex;
  padding: 0.375rem;
  color: inherit;
  opacity: 0.55;
  transform: translateX(-50%);
  transition: opacity 200ms linear;
}

.dmr-ab__down:hover,
.dmr-ab__down:focus-visible {
  opacity: 1;
}

@media (min-width: 45rem) {
  .dmr-ab__sheet {
    grid-template-columns: repeat(5, 1fr);
    row-gap: 1rem;
  }

  .dmr-ab__intro {
    padding: 9rem var(--spacing-m, 2.5rem) 6rem;
  }

  .dmr-ab__lead {
    font-size: 1.1875rem;
  }
}

@media (min-width: 64rem) {
  .dmr-ab__sheet {
    grid-template-columns: repeat(6, 1fr);
  }

  .dmr-ab__intro {
    grid-template-columns: minmax(0, 1fr) 24rem;
    padding-left: var(--spacing-l, 3.75rem);
    padding-right: var(--spacing-l, 3.75rem);
  }

  .dmr-ab__print {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    width: 22rem;
    margin-bottom: 1rem;
  }

  .dmr-ab__words {
    grid-column: 1;
    grid-row: 1;
  }
}

/* ---- the page's own text ---- */

.dmr-ab__body {
  width: 100%;
  max-width: calc(var(--max-width-post-container, 47.5rem) + 2.5rem);
  margin: 0 auto;
  padding: 4rem 1.25rem 3rem;
}

.dmr-ab__text.g-post-content {
  padding: 0;
  counter-reset: dmr-ab-chapter;
}

.dmr-ab__text > p:first-child {
  font-size: clamp(1.25rem, 3.8vw, 1.625rem);
  line-height: 1.45;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

/* Headings are numbered like frames on the sheet. */
.dmr-ab__text > h2 {
  position: relative;
  padding-top: 1.75rem;
  counter-increment: dmr-ab-chapter;
}

.dmr-ab__text > h2::before {
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  color: var(--dmr-ab-pencil);
  font: 600 0.75rem/1 var(--dmr-ab-mono);
  letter-spacing: 0.2em;
  content: counter(dmr-ab-chapter, decimal-leading-zero) 'A';
}

.dmr-ab__text > h2::after {
  position: absolute;
  top: 0.1875rem;
  inset-inline: 3.5rem 0;
  height: 0.375rem;
  background: repeating-linear-gradient(90deg, var(--border) 0 0.3125rem, transparent 0.3125rem 0.625rem);
  border-radius: 1px;
  content: '';
}

/* ---- closing sheet: linked story frames ---- */

.dmr-ab__more {
  padding: 4rem 1rem 4.5rem;
  background: var(--dmr-ab-film);
  color: var(--dmr-ab-paper);
}

.dmr-ab__more-title {
  max-width: var(--max-width-container, 72.5rem);
  margin: 0 auto 1.75rem;
  color: var(--dmr-ab-edge);
  font: 600 0.8125rem/1 var(--dmr-ab-mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

[dir="rtl"] .dmr-ab__more-title {
  letter-spacing: 0;
}

.dmr-ab__shots {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  row-gap: 1.25rem;
  max-width: var(--max-width-container, 72.5rem);
  margin: 0 auto;
  counter-reset: dmr-ab-frame;
}

.dmr-ab__shot {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0.875rem 0.1875rem 0;
  background: var(--dmr-ab-film);
  color: inherit;
  text-decoration: none;
  counter-increment: dmr-ab-frame;
}

.dmr-ab__shot::before {
  position: absolute;
  top: 0.25rem;
  inset-inline: 0;
  height: 0.375rem;
  background: repeating-linear-gradient(90deg, transparent 0 0.25rem, var(--dmr-ab-hole) 0.25rem 0.5625rem, transparent 0.5625rem 0.875rem);
  content: '';
}

.dmr-ab__shot-img {
  display: block;
  overflow: hidden;
}

.dmr-ab__shot-img img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: hsl(30, 6%, 14%);
  transition: transform 400ms ease, filter 400ms ease;
}

.dmr-ab__shot:hover .dmr-ab__shot-img img,
.dmr-ab__shot:focus-visible .dmr-ab__shot-img img {
  transform: scale(1.04);
}

.dmr-ab__shot-title {
  display: -webkit-box;
  overflow: hidden;
  min-height: 2.6em;
  margin: 0.5rem 0.375rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.3;
  opacity: 0.88;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dmr-ab__shot-title::before {
  margin-inline-end: 0.5em;
  color: var(--dmr-ab-edge);
  font: 600 0.6875rem/1 var(--dmr-ab-mono);
  letter-spacing: 0.08em;
  content: counter(dmr-ab-frame) 'A';
}

.dmr-ab__shot:focus-visible {
  outline: 2px solid var(--dmr-ab-paper);
  outline-offset: 2px;
}

@media (min-width: 45rem) {
  .dmr-ab__more {
    padding: 5.5rem var(--spacing-m, 2.5rem) 6rem;
  }

  .dmr-ab__shots {
    grid-template-columns: repeat(4, 1fr);
    row-gap: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dmr-ab__frame img {
    filter: none;
    animation: none;
  }

  .dmr-ab__grease path {
    stroke-dashoffset: 0;
    animation: none;
  }
}
