/* vertigo — black on white. one eye. drawn, erased, redrawn. never finished. */

:root {
  --paper: #fcfcfa;
  --ink: #141412;
  --ink-soft: #55534c;
  --iris: #2450e6;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

body.invert { filter: invert(1); }

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

.mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 300;
  font-size: 12px;
  letter-spacing: .04em;
}

.dim { color: var(--ink-soft); }

a { color: var(--ink); text-decoration: none; }

/* ============ index ============ */

body.index {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 22px 26px 0;
}

.mark {
  font-family: "Caveat", cursive;
  font-weight: 600;
  font-size: 30px;
  transform: rotate(-2deg);
  display: inline-block;
}

.mark.scrambled { transform: rotate(-2deg) skewX(-8deg); }

body.index main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.figure-wrap {
  margin-top: 4vh;
  text-align: center;
}

#figure {
  width: min(62vw, 330px);
  height: auto;
  display: block;
  margin: 0 auto;
  cursor: pointer;
}

/* pencil strokes drawing themselves in */
#figure .stroke {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 1.1s cubic-bezier(.5,0,.3,1) forwards;
  animation-delay: var(--d, 0s);
}

#figure .stroke.thin { stroke-width: 1.8; }
#figure .stroke.faint { opacity: .38; }

#figure .stroke.erase {
  opacity: 0 !important;
  transition: opacity .18s ease;
}

#figure .fillin {
  opacity: 0;
  animation: fadein .5s ease forwards;
  animation-delay: var(--d, 0s);
}

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadein { to { opacity: 1; } }

/* the paper never quite holds still; sometimes it breathes */
#sketch {
  animation: breathe 9s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes breathe {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.006) rotate(.15deg); }
}

/* blink */
#eyeball {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform .18s ease;
}
#figure.blink #eyeball {
  animation: blink .16s ease-in-out;
}
@keyframes blink {
  0% { transform: scaleY(1); }
  45% { transform: scaleY(.04); }
  100% { transform: scaleY(1); }
}
#figure.squint #eyeball { transform: scaleY(.5); }

/* pupil constricts when the eye catches you */
#figure.pinned .pupil {
  transform: scale(.42);
  transform-box: fill-box;
  transform-origin: center;
  transition: transform .15s ease;
}

/* a quick jump, like the paper shifted */
#figure.jump {
  animation: jump .22s steps(2) 1;
}
@keyframes jump {
  0% { transform: translate(0,0); }
  30% { transform: translate(-5px, 3px) rotate(-1.2deg); }
  60% { transform: translate(4px, -2px) rotate(.8deg); }
  100% { transform: translate(0,0); }
}

/* the page sees you */
body.invert { filter: invert(1); }

.whisper {
  margin: 18px 0 0;
  min-height: 1.4em;
  color: var(--ink-soft);
  transition: opacity .6s ease;
}
.whisper.out { opacity: 0; }
.whisper .strike {
  text-decoration: line-through;
  text-decoration-style: wavy;
  text-decoration-thickness: 1px;
}
.whisper.typing::after {
  content: "_";
  animation: caret .7s steps(1) infinite;
}
@keyframes caret { 0%,49% { opacity: 1; } 50%,100% { opacity: 0; } }

/* scrawled notes that wander into the margins */
.note {
  position: fixed;
  font-family: "Caveat", cursive;
  font-size: 21px;
  color: var(--ink-soft);
  opacity: 0;
  transition: opacity .9s ease;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
}
.note.on { opacity: .85; }
.note .strike { text-decoration: line-through; text-decoration-style: wavy; }

/* visit tally, bottom right */
#tally-wrap {
  position: fixed;
  right: 22px;
  bottom: 54px;
  transform: rotate(-2deg);
  text-align: center;
  opacity: .85;
  pointer-events: none;
}
#tally-wrap .who {
  font-family: "Caveat", cursive;
  font-size: 16px;
  color: var(--ink-soft);
}

.writings {
  margin: 9vh auto 12vh;
  text-align: center;
  max-width: 90vw;
}

.scribble {
  font-family: "Caveat", cursive;
  font-size: 24px;
  transform: rotate(-1.4deg);
  margin: 0 0 18px;
}

.entries {
  list-style: none;
  margin: 0;
  padding: 0;
  line-height: 2.1;
}

.entries li::before {
  content: attr(value);
  color: var(--ink-soft);
  font-size: 10px;
  margin-right: 10px;
}

.entries a {
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.entries a:hover { border-bottom-color: var(--ink); }

.bottom {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 26px 20px;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 600px) {
  .top { padding: 18px 18px 0; }
  .bottom { padding: 0 18px 16px; }
  #figure { width: min(76vw, 300px); }
  .note { font-size: 17px; }
  #tally-wrap { right: 14px; bottom: 48px; }
}

/* ============ diary (paper) ============ */

body.paper {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 400;
  font-size: 18px;
  line-height: 1.72;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 22px 90px;
}

.site-head { margin-top: 30px; }

.rule-double {
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  height: 3px;
}

.rule { border-top: 1px solid var(--ink); }

.head-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 2px;
  margin: 6px 0;
}

.sc {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.sc.muted { color: var(--ink-soft); }

.article-head { margin: 46px 0 0; }

.back {
  font-size: 12px;
  color: var(--ink-soft);
  border-bottom: 1px solid transparent;
}
.back:hover { border-bottom-color: var(--ink); color: var(--ink); }

.edate {
  display: block;
  margin: 26px 0 8px;
  font-size: 11px;
  color: var(--ink-soft);
}

.post h1 {
  font-family: "Caveat", cursive;
  font-weight: 600;
  font-size: 44px;
  line-height: 1.1;
  margin: 10px 0 28px;
  transform: rotate(-.8deg);
}

.post p { margin: 0 0 1.35em; }

.post em { font-style: italic; }

.post-meta {
  margin-top: 54px;
  padding-top: 14px;
  border-top: 1px solid var(--ink);
}

.fineprint {
  font-size: 11px;
  color: var(--ink-soft);
}
