@media (hover: hover) {
  .single-post:not(:has(.article-head > figure)) .site-head .nav {
    opacity: 0;
    transition: opacity .3s var(--ease);
  }
  .single-post:not(:has(.article-head > figure)) .site-head:hover .nav,
  .single-post:not(:has(.article-head > figure)) .site-head:focus-within .nav {
    opacity: 1;
  }
}
@media (scripting: enabled) {
  :root:has(.article-head > figure) .site-head .bar > * {
    opacity: 0;
    pointer-events: none;
    transition: opacity .6s ease-in-out;
  }
  :root:has(.article-head > figure) .head-awake .site-head .bar > *,
  :root:has(.article-head > figure) .site-head:has(:focus-visible) .bar > * {
    opacity: 1;
    pointer-events: auto;
    transition-duration: .9s;
  }
}
@media (scripting: enabled) {
  :root:has(.article-head > figure) .head-floating .site-head .bar > * {
    opacity: 1;
    pointer-events: auto;
  }
  :root:has(.article-head > figure) .head-floating .site-head .nav a { color: var(--muted); }
  :root:has(.article-head > figure) .head-floating .site-head .nav a:hover,
  :root:has(.article-head > figure) .head-floating .site-head .nav a[aria-current="page"] {
    color: var(--ink);
  }
  :root:has(.article-head > figure) .head-floating .site-head .search-btn kbd {
    border-color: var(--rule-strong);
    background: var(--field);
    color: var(--ink);
  }
  :root:has(.article-head > figure) .head-floating .site-head :focus-visible {
    outline-color: var(--accent);
  }
}
:root:has(.article-head > figure) .site-head {
  position: absolute;
  inset: 0 0 auto;
  color: #fff;
}
:root:has(.article-head > figure) .site-head .nav a { color: rgb(255 255 255 / .9); }
:root:has(.article-head > figure) .site-head .nav a:hover,
:root:has(.article-head > figure) .site-head .nav a[aria-current="page"] {
  color: #fff;
}
:root:has(.article-head > figure) .site-head .brand:hover svg { color: #E9DCF3; }
:root:has(.article-head > figure) .site-head .search-btn kbd {
  border-color: rgb(255 255 255 / .45);
  background: transparent;
  color: #fff;
}
:root:has(.article-head > figure) .site-head :focus-visible { outline-color: #fff; }
/* Reading progress on articles, in the corner; it also takes you back up */
.read-meter {
  display: grid;
  position: fixed;
  z-index: 60;
  right: 24px;
  bottom: 24px;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 8px 28px rgb(0 0 0 / .22), inset 0 0 0 1px var(--rule-strong);
  color: var(--ink);
  cursor: pointer;
  place-items: center;
  transition: opacity .3s var(--ease), transform .3s var(--ease), visibility .3s;
}
.read-meter[hidden] {
  display: grid;
  visibility: hidden;
  opacity: 0;
  transform: translateY(12px);
}

/* Ring, number, tick and ripples share one centred cell */
.read-meter > * { grid-area: 1 / 1; }
.read-meter .ripples {
  position: absolute;
  inset: 0;
}
.read-meter .ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--soft);
  stroke-width: 3;
  transform: rotate(-90deg);
}
.read-meter .done {
  stroke: var(--accent);
  stroke-dasharray: 100;
  stroke-dashoffset: calc(100 - var(--progress, 0));
  stroke-linecap: round;
  transition: stroke-dashoffset .2s linear;
}
.read-meter .pct {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  transition: opacity .2s, transform .3s var(--ease);
}

/* Finished: the number gives way to a tick, ripples spread like rain on water */
.read-meter .check {
  position: absolute;
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--accent);
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.6;
}
.read-meter .ripples i {
  position: absolute;
  inset: 0;
  border: 2px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
}
.read-meter.is-done { animation: meter-pop .55s cubic-bezier(.34, 1.56, .64, 1); }
.read-meter.is-done .done { stroke-dashoffset: 0; }
.read-meter.is-done .pct {
  opacity: 0;
  transform: scale(.6);
}
.read-meter.is-done .check { animation: meter-check .45s .15s var(--ease) forwards; }
.read-meter.is-done .ripples i { animation: meter-ripple 1.5s var(--ease) forwards; }
.read-meter.is-done .ripples i:nth-child(2) { animation-delay: .25s; }
.read-meter.is-done .ripples i:nth-child(3) { animation-delay: .5s; }
.read-meter.is-gone { transition-duration: .8s; }
@keyframes meter-pop {
  45% { transform: scale(1.14); }
}
@keyframes meter-check {
  to { stroke-dashoffset: 0; }
}
@keyframes meter-ripple {
  from {
    opacity: .7;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(2.8);
  }
}
.read-meter:hover { background: var(--soft); }
@media (prefers-reduced-motion: reduce) {
  .read-meter, .read-meter .done { transition: none; }
  .read-meter.is-done, .read-meter.is-done .ripples i { animation: none; }
  .read-meter.is-done .check {
    animation: none;
    stroke-dashoffset: 0;
  }
}
@media (max-width: 860px) {
  .read-meter {
    right: 14px;
    bottom: 14px;
    width: 52px;
    height: 52px;
  }
}
.byline {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  align-items: center;
  margin-bottom: 44px;
  padding-block: 40px 28px;
  gap: 18px;
}
.byline img {
  width: 60px;
  height: 60px;
  object-fit: cover;

  /* A squircle in every browser, Safari has no corner-shape */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 0C88 0 100 12 100 50S88 100 50 100 0 88 0 50 12 0 50 0Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 0C88 0 100 12 100 50S88 100 50 100 0 88 0 50 12 0 50 0Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.byline p { margin: 0; }
.who-line { font-size: 17px; }
.byline .meta {
  display: flex;
  flex-wrap: wrap;
  margin-top: 4px;
  gap: 4px 18px;
  color: var(--muted);
  font-size: 15px;
}
.byline .meta > * {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Phones: the meta always takes two rows under the name, and the photo spans all three */
@media (max-width: 600px) {
  .byline { grid-template-columns: 84px minmax(0, 1fr); }
  .byline img {
    width: 84px;
    height: 84px;
  }
  .byline .meta {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    justify-content: start;
  }
}

/* Two columns of meta no longer fit beside the photo, a three-digit comment count needs 387px */
@media (max-width: 386px) {
  .byline .meta { grid-template-columns: max-content; }
}

/* Icons from CSS, so the editor shows them too */
.byline .meta > :is(.wp-block-post-date, .wp-block-post-time-to-read)::before {
  flex: none;
  width: 16px;
  height: 16px;
  background: currentColor;
  content: "";
  -webkit-mask: var(--meta-icon) center / contain no-repeat;
  mask: var(--meta-icon) center / contain no-repeat;
}
.byline .meta > .wp-block-post-date {
  --meta-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='15' rx='2'/%3E%3Cpath d='M3.5 9.5h17M8 3v4M16 3v4'/%3E%3C/svg%3E");
}
.byline .meta > .wp-block-post-time-to-read {
  --meta-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E");
}

/* Claps: "Hyvin kirjoitettu" after the last words. Click or hold to keep clapping */
.clap {
  display: flex;
  align-items: center;
  padding-block: 8px 16px;
  gap: 20px;
  font-family: var(--sans);
}
.clap-btn {
  display: grid;
  position: relative;
  flex: none;
  width: 72px;
  height: 72px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--tint);
  box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--accent) 30%, transparent);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color .2s, box-shadow .2s, scale .12s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.clap-btn:hover { box-shadow: inset 0 0 0 1.5px var(--accent); }
.clap-btn:active { scale: .94; }
.clap-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.clap-hands {
  width: 46px;
  height: 50px;
  overflow: visible;
  fill: currentColor;
}

/* Hands traced from the classic clap; they tip on hover and squeeze on each clap */
.clap-palms {
  transform-box: fill-box;
  transform-origin: 50% 85%;
  transition: scale .18s cubic-bezier(.3, 1.6, .5, 1), rotate .18s cubic-bezier(.3, 1.6, .5, 1), fill .3s;
}
.clap-spark {
  fill: var(--accent);
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: scale .25s;
}
.clap-btn:hover .clap-palms { rotate: -5deg; }
.clap.is-clapping .clap-palms {
  scale: .88;
  rotate: 4deg;
  transition: none;
}
.clap.is-clapping .clap-spark {
  scale: 1.4;
  transition: none;
}
.clap.has-clapped .clap-btn { background: color-mix(in oklab, var(--accent) 16%, var(--tint)); }
.clap.has-clapped .clap-palms { fill: var(--accent); }

/* The running count of one burst: +1, +2, +3 */
.clap-plus {
  position: absolute;
  top: -14px;
  left: 50%;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--deep);
  color: var(--on-deep);
  font: 700 13px / 1.2 var(--sans);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  pointer-events: none;
  translate: -50% 6px;
  transition: opacity .25s, translate .25s;
}
.clap.is-streaking .clap-plus {
  opacity: 1;
  translate: -50% -12px;
}
.clap-bit {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  pointer-events: none;
}
.clap-bit.is-ray {
  width: 3px;
  height: 10px;
  margin: -5px 0 0 -1.5px;
  border-radius: 2px;
}
.clap-title {
  margin: 0;
  color: var(--ink);
  font-family: var(--display);
  font-size: 30px;
  line-height: 1.1;
}
.clap-count {
  margin: 6px 0 0;
  color: var(--muted);
}
@media (prefers-reduced-motion: reduce) {
  .clap-palms, .clap-spark, .clap-plus { transition: none; }
}

/* The passage most readers highlighted */
::highlight(top-highlight) {
  background-color: color-mix(in oklab, var(--accent) 22%, transparent);
}
.prose mark.top-highlight {
  background: color-mix(in oklab, var(--accent) 22%, transparent);
  color: inherit;
}
.prose .hl-label {
  display: flex;
  align-items: center;
  margin: 0 0 6px;
  gap: 6px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13.5px;
}
.prose .hl-label::before {
  width: 14px;
  height: 14px;
  background: var(--accent);
  content: "";
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 11l-5 5v4h4l5-5M14 6l4 4M12.5 7.5l4-4 4 4-4 4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 11l-5 5v4h4l5-5M14 6l4 4M12.5 7.5l4-4 4 4-4 4'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Summary (rollemaa-site summary.php): open, a long one fades until asked for */
.ai-summary {
  margin: -24px 0 44px;
  border-radius: 12px;
  background: var(--tint);
  font-family: var(--sans);
}
.ai-summary > summary {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.ai-summary > summary::-webkit-details-marker { display: none; }
.ai-summary > summary::after {
  flex: none;
  width: 18px;
  height: 18px;
  content: "";
  background: var(--muted);
  transition: rotate .2s;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.ai-summary[open] > summary::after { rotate: 180deg; }
.gloss.summary-info {
  display: grid;
  flex: none;
  width: 28px;
  height: 28px;
  margin-left: auto;
  place-items: center;
  border-radius: 50%;
  text-decoration: none;
}
.gloss.summary-info::before {
  width: 18px;
  height: 18px;
  background: var(--muted);
  content: "";
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.gloss.summary-info:hover, .gloss.summary-info[aria-expanded="true"] { background: var(--soft); }
.ai-summary > p {
  margin: 0;
  padding: 0 18px 10px;
  color: var(--ink);
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.5;
}
.ai-summary > ul {
  display: grid;
  margin: 0;
  padding: 0 18px 18px;
  gap: 6px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.45;
  list-style: none;
}
.ai-summary > .is-clamped {
  max-height: 190px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent);
  mask-image: linear-gradient(to bottom, #000 45%, transparent);
}
.ai-summary > .expand {
  margin: 0;
  padding: 8px 0 10px;
}
.ai-summary > ul li {
  position: relative;
  padding-left: 16px;
}
.ai-summary > ul li::before {
  position: absolute;
  top: .62em;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

/* The editor wraps the hidden resume bar in a block of its own */
.byline > .wp-block-html { display: none; }
.resume {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  padding: 14px 18px;
  gap: 16px;
  border-radius: 8px;
  background: var(--tint);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.4;
}
.resume[hidden] { display: none; }
.resume-flag {
  flex: none;
  width: 14px;
  height: 30px;
  background: var(--deep);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
}
.resume-text {
  flex: 1;
  min-width: 0;
}
.resume-bar {
  display: block;
  height: 3px;
  margin-top: 8px;
  border-radius: 2px;
  background: var(--rule);
}
.resume-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 2px;
  background: var(--deep);
}
.resume a {
  font-weight: 700;
  white-space: nowrap;
}

/* Phone: the text gets the full width, the link goes under it */
@media (max-width: 600px) {
  .resume {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 10px 14px;
  }
  .resume-flag { margin-top: 2px; }
  .resume a {
    grid-column: 2;
    justify-self: start;
  }
}

/* Old article: when it was written and how old the writer was */
.archive-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  width: fit-content;
  max-width: 100%;

  /* As much room above (after the byline's own padding) as below, where the first line's leading adds to it */
  margin: -25px 0 40px;
  padding: 16px 24px 16px 20px;
  gap: 4px 20px;
  border-radius: 4px;
  background: var(--soft);
}
.archive-note .yr {
  color: var(--accent);
  font-family: var(--display);
  font-size: 40px;
  font-variant-numeric: lining-nums;
  line-height: 1;
}
.archive-note p {
  max-width: 46ch;
  margin: 0;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}
.archive-note b { color: var(--ink); }
.endmatter {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-top: 64px;
  gap: 48px;
}
.endmatter h2 {
  margin-bottom: 16px;
  font-size: 30px;
}
.keywords {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}
.keywords a { color: var(--ink); }
.keywords a:hover { color: var(--accent); }
.fedi-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
}
.share {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 16px;
}
.share .btn {
  min-height: 42px;
  padding: 0 16px;
  font-size: 15px;
}

/* Same shape as the front page's random picks: date and a large title */
.related {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  gap: 28px;
  list-style: none;
}
.related .meta-text { color: var(--muted); }
.related a {
  display: block;
  margin-top: 8px;
  color: inherit;
  font-family: var(--display);
  font-size: 30px;
  line-height: 1.1;
  text-decoration: none;
  text-wrap: pretty;
}
.related a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}
@media (max-width: 860px) {
  .archive-note {
    grid-template-columns: 1fr;
    margin-top: -25px;
    padding: 14px 16px;
  }
  .archive-note .yr { font-size: 32px; }
  .share {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .share .btn { justify-content: center; }
  .related { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .share { grid-template-columns: 1fr; }
}

/* Where most readers stop: a dim line and a dot that tells */
.reach {
  position: absolute;
  z-index: 1;
  top: calc(var(--reach) * 1%);
  right: 0;
  left: 0;
  height: 0;
  border-top: 1px dashed color-mix(in srgb, var(--accent) 35%, transparent);
  pointer-events: none;
}
.reach-dot {
  position: absolute;
  top: -16px;
  left: -16px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;
}
.reach-dot::before, .reach-dot::after {
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

/* Two classes, so the text's own paragraph rules stay off it */
.prose .reach-tip {
  position: absolute;
  bottom: 14px;
  left: 0;
  width: max-content;
  max-width: min(300px, 80vw);
  margin: 0;
  padding: 8px 12px;
  border-radius: 6px;
  background: #000;
  color: #fff;
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.4;
  pointer-events: auto;
}
.prose .reach-tip[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .reach-dot::after { animation: reach-pulse 2s ease-out infinite; }
}
@keyframes reach-pulse {
  to {
    opacity: 0;
    transform: scale(3);
  }
}
.byline figure {
  flex: none;
  margin: 0;
}
