/* ------------------------------------------------------------------
   the visible site is black and white. the things on the home page are
   hidden in the white and only fade in when the cursor finds them.
   color on the surface only appears when you touch something:
   a hovered link, selected text, keyboard focus.
------------------------------------------------------------------- */
:root {
  --paper: #ffffff;
  --ink: #111111;
  --graphite: #8a8a8a;

  /* the one color on the surface: hovers, selection, focus */
  --accent: #67a35d;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "Fragment Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(16px, 3vw, 28px);
  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: #c4c4c4;
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover { color: var(--accent); text-decoration-color: currentColor; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- handwriting ----------
   words written by hand, cut out into img/hand/. each one is used as a
   stencil filled with the text color, so it turns green on hover like any
   link. --w/--h give each word's shape and its size at --scale 1 (the image
   file itself can be sharper, at any multiple of that), --base is where its
   baseline sits (0 = top, 1 = bottom) so words line up like writing on a line.
   --scale sets the size; every word uses the same scale, so they keep the
   sizes they were written at. */
.hand {
  --scale: 0.2;
  display: inline-block;
  width: calc(var(--w) * var(--scale));
  height: calc(var(--h) * var(--scale));
  vertical-align: calc(var(--h) * var(--scale) * (var(--base) - 1));
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}
.hand-hi      { --w: 1890px; --h: 312px; --base: 0.85; -webkit-mask-image: url(../img/hand/hi-i-am-arsenii.webp); mask-image: url(../img/hand/hi-i-am-arsenii.webp); }
.hand-domain  { --w: 656px; --h: 181px; --base: 0.65; -webkit-mask-image: url(../img/hand/arsenij-love.webp); mask-image: url(../img/hand/arsenij-love.webp); }
.hand-library { --w: 2298px; --h: 1218px; --base: 0.79; -webkit-mask-image: url(../img/hand/library.webp); mask-image: url(../img/hand/library.webp); }
.hand-art     { --w: 1152px; --h: 536px;  --base: 0.945; -webkit-mask-image: url(../img/hand/art.webp); mask-image: url(../img/hand/art.webp); }
.hand-music   { --w: 1740px; --h: 391px;  --base: 0.86; -webkit-mask-image: url(../img/hand/music.webp); mask-image: url(../img/hand/music.webp); }
.hand-exhibitions { --w: 1711px; --h: 487px; --base: 0.89; -webkit-mask-image: url(../img/hand/exhibitions.webp); mask-image: url(../img/hand/exhibitions.webp); }

/* ---------- top bar (every page) ---------- */
.bar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 20px var(--gutter);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.4;
}
.bar a { text-decoration: none; }
.bar a:hover { text-decoration: underline; }

/* the menu: looks like plain text, but each word is a solid block that
   can't be selected, copied or dragged */
.nav { display: flex; align-items: baseline; gap: 22px; margin: 0; padding: 0; list-style: none; }
.nav a {
  display: inline-block;
  padding-bottom: 3px;
  /* one thin line under the word, shown on hover and for the page you're on */
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
.nav a:hover,
.nav a[aria-current] {
  text-decoration: none;
  background-size: 100% 1px;
}

/* ---------- home ---------- */
/* nothing on the home page is selectable, so dragging around to find the
   hidden things never highlights anything */
body.home {
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.home .page {
  position: relative;
  z-index: 2;
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
}

.hero { margin-top: auto; padding: 0 var(--gutter) clamp(28px, 7vh, 72px); }

.hero h1 { margin: 0 0 0 -6px; }
.hero h1 .hand {
  display: block;
  width: clamp(300px, 56vw, 860px);
  height: auto;
  aspect-ratio: 1890 / 312;
}

/* the two lines under your name, one per line */
.lede {
  margin: clamp(14px, 2.4vh, 22px) 0 0;
  font-size: clamp(17px, 1.6vw, 21px);
  line-height: 1.35;
}
.lede span { display: block; }

/* short screens (phone held sideways): let the page scroll */
@media (max-height: 540px) {
  body.home { height: auto; overflow: auto; touch-action: auto; }
  .home .page { height: auto; min-height: 100svh; }
}

/* ---------- the hidden things ---------- */
.under {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* the pictures, placed by collage.js, shown by reveal.js */
.things { position: absolute; inset: 0; }
.thing {
  position: absolute;
  display: block;
  max-width: none;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  opacity: 0;
  transform: rotate(var(--tilt, 0deg)) scale(0.97);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
.thing.is-shown {
  opacity: 1;
  transform: rotate(var(--tilt, 0deg)) scale(1);
  transition-duration: 0.3s;
}

/* ---------- inner pages ---------- */
.wrap {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(48px, 13vh, 132px) var(--gutter) 96px;
}

/* a handwritten page title */
.title .hand { display: block; height: auto; margin-left: -6px; }
.title .hand-library { width: clamp(170px, 24vw, 300px); aspect-ratio: 2298 / 1218; }
.title .hand-art { width: clamp(130px, 17vw, 210px); aspect-ratio: 1152 / 536; }
.title .hand-music { width: clamp(190px, 26vw, 320px); aspect-ratio: 1740 / 391; }
.title .hand-exhibitions { width: clamp(230px, 32vw, 400px); aspect-ratio: 1711 / 487; }

/* exhibitions: the two handwritten doors, to art and to music */
.rooms {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 28px 64px;
  margin-top: clamp(40px, 8vh, 80px);
}
.rooms a {
  display: inline-block;
  color: var(--ink);
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
.rooms a:hover { color: var(--accent); }
/* sized so the small letters of both words come out the same height
   (you wrote 'art' bigger than 'music') and they share one baseline */
.rooms .hand-art { --scale: 0.145; }
.rooms .hand-music { --scale: 0.188; }

/* the way back up, on the art and music pages */
.back {
  display: inline-block;
  margin-bottom: 28px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--graphite);
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
}
.back:hover { color: var(--accent); }

/* page titles, set in the body serif */
.title {
  margin: 0;
  font-weight: 400;
  font-size: clamp(40px, 5.6vw, 68px);
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.site-foot {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 var(--gutter) 28px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--graphite);
}

/* ---------- art: the pictures from content/art ---------- */
.wrap.wide { max-width: 1240px; }
.gallery { columns: 2 340px; column-gap: 44px; margin-top: clamp(36px, 6vh, 64px); }
.piece { break-inside: avoid; margin: 0 0 44px; }
.piece a { display: block; }
.piece img { display: block; width: 100%; height: auto; }
.piece figcaption { margin-top: 10px; font-family: var(--mono); font-size: 12px; color: var(--graphite); }

/* ---------- music: the tracks from content/music ---------- */
.tracks { list-style: none; margin: clamp(36px, 6vh, 64px) 0 0; padding: 0; border-top: 1px solid #e6e6e6; }
.track {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: baseline;
  gap: 4px 16px;
  padding: 16px 0 10px;
  border-bottom: 1px solid #e6e6e6;
}
.play {
  all: unset;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--graphite);
  user-select: none;
  -webkit-user-select: none;
}
.play:hover,
.is-playing .play { color: var(--accent); }
.play:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.track-title { font-size: 20px; line-height: 1.3; }
.track-time { font-family: var(--mono); font-size: 12px; color: var(--graphite); white-space: nowrap; }
.track-bar { grid-column: 2 / -1; position: relative; height: 12px; cursor: pointer; }
.track-bar::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 1px; background: #e6e6e6; }
.track-bar i { position: absolute; left: 0; top: 6px; width: 0; height: 1px; background: var(--accent); }

/* ---------- library: the essays from content/essays ---------- */
.essays { list-style: none; margin: clamp(36px, 6vh, 64px) 0 0; padding: 0; border-top: 1px solid #e6e6e6; }
.essays a {
  display: grid;
  grid-template-columns: 11ch 1fr;
  gap: 20px;
  align-items: baseline;
  padding: 16px 0;
  border-bottom: 1px solid #e6e6e6;
  color: var(--ink);
  text-decoration: none;
  -webkit-user-drag: none;
}
.essays a:hover { color: var(--accent); }
.essay-date { font-family: var(--mono); font-size: 12px; color: var(--graphite); }
.essay-name { font-size: 21px; line-height: 1.3; }

/* one essay */
.essay-meta { margin: 16px 0 0; font-family: var(--mono); font-size: 12px; color: var(--graphite); }
.prose { margin-top: clamp(36px, 6vh, 56px); max-width: 34em; font-size: 20px; line-height: 1.6; }
.prose p { margin: 0 0 1.1em; }
.prose h2 { margin: 2em 0 0.6em; font-size: 26px; font-weight: 400; line-height: 1.25; }
.prose blockquote { margin: 1.6em 0; padding-left: 20px; border-left: 1px solid var(--ink); font-style: italic; }
.prose blockquote p { margin: 0; }

/* ---------- small screens ---------- */
@media (max-width: 600px) {
  .nav { gap: 14px; }
  .essays a { grid-template-columns: 1fr; gap: 2px; }
  .prose { font-size: 18px; }
  /* the menu drops onto its own line when it doesn't fit next to the domain */
  .bar { flex-wrap: wrap; row-gap: 12px; }
  .bar nav { margin-left: auto; }
  .bar .hand { --scale: 0.15; }
}

@media (prefers-reduced-motion: reduce) {
  .thing { transform: rotate(var(--tilt, 0deg)); transition-property: opacity; }
  .thing.is-shown { transform: rotate(var(--tilt, 0deg)); }
  a { transition: none; }
}
