/* The article card that makes room: the card of an essay in a small online magazine, warm paper on a white page,
   set in Newsreader. Its only picture is a vermilion moon set in the text, which the words flow around. */
:root {
  --page: #ffffff;          /* the page */
  --card: #f6f3ed;          /* the card */
  --ink: #171512;           /* the title */
  --text: #2d2a25;          /* the excerpt */
  --muted: #8e877c;         /* the small print */
  --rule: #e2ddd3;          /* the hairlines */
  --moon: #e2492b;          /* the lit side of the moon */
  --moon-dark: #ebe5da;     /* the side in shadow */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Newsreader Variable', Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.essay {
  position: relative;
  width: min(340px, 100%);
  padding: 22px 24px 18px;
  border-radius: 4px;
  background: var(--card);
}

.essay__meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-family: 'Inter Tight Variable', 'Helvetica Neue', Arial, sans-serif;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  font-weight: 460;
}

.essay__mag {
  color: var(--ink);
  font-weight: 640;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.essay__title {
  margin: 16px 0 14px;
  font-size: 29px;
  line-height: 1.04;
  letter-spacing: -0.012em;
  font-weight: 460;
  font-variation-settings: 'opsz' 48;
  text-wrap: balance;
}

/* the excerpt: the script sets its height and lays out every word around the moon */
.essay__body {
  position: relative;
  height: 198px;
  touch-action: pan-y;
}

.words {
  position: absolute;
  inset: 0;
}

.word {
  position: absolute;
  top: 0;
  left: 0;
  color: var(--text);
  font-size: 15.5px;
  line-height: 22px;
  font-weight: 400;
  font-variation-settings: 'opsz' 16;
  white-space: pre;
  will-change: transform;
}

/* the last word of a clamped excerpt */
.word.is-last::after {
  content: '\2026';
}

/* the moon: a button, so the keyboard can carry it too */
.moon {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: grab;
  touch-action: none;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
  clip-path: circle(48px at 50% 50%);
}

.moon:active {
  cursor: grabbing;
}

.moon svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.moon__dark {
  fill: var(--moon-dark);
}

.moon__lit {
  fill: var(--moon);
}

/* the room the words keep from the moon, drawn as a hairline while the moon is moving */
.moon__ring {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0;
  vector-effect: non-scaling-stroke;
}

.moon:focus-visible {
  outline: none;
}

.moon:focus-visible .moon__ring {
  stroke: var(--ink);
  stroke-dasharray: none;
  opacity: 1 !important;
}

.essay__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}

.essay__by {
  color: var(--muted);
  font-family: 'Inter Tight Variable', 'Helvetica Neue', Arial, sans-serif;
  font-size: 12px;
  font-weight: 460;
}

/* Read: the words take weight and the arrow goes ahead, no underline */
.read {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin-right: -6px;
  padding: 6px;
  border-radius: 3px;
  color: var(--ink);
  font-family: 'Inter Tight Variable', 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  font-weight: 560;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: font-weight 0.35s cubic-bezier(0.3, 1.5, 0.5, 1), color 0.25s ease;
}

.read svg {
  width: 18px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
}

@media (hover: hover) and (pointer: fine) {
  .read:hover {
    font-weight: 700;
    color: var(--moon);
  }

  .read:hover svg {
    transform: translateX(4px);
  }
}

.read:active svg {
  transform: translateX(7px);
}

.read:focus-visible {
  outline: 1.5px solid var(--ink);
  outline-offset: 1px;
}

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