/* Page rules on top of paranoia.css. Colours come from its variables. */

[hidden] { display: none !important; }

.site { flex: 1; display: flex; flex-direction: column; overflow-x: clip; }

/* buttons: roomier than the kit's 16px small, label centred and never wrapped */
.pm-btn { white-space: nowrap; }
.pm-btn.small { height: var(--button-h); padding: 0 12px; }
/* a panel head holding a button grows so the button has equal air above and below */
.pm-panel > .head:has(.pm-btn) { height: auto; min-height: calc(var(--head-h) + 8px); }

/* page: one column; centre + a rail of notes over posts; then notes left, centre, posts right */
.pm-page.home { max-width: 460px; }
.pm-page.home > .col { min-width: 0; }
.pm-page.home > .col > .pm-panel { min-width: 0; }
@media (max-width: 899px) {
  .pm-page.home { display: flex; flex-direction: column; gap: 8px; }
  .pm-page.home > .col { display: contents; }
  #profile { order: 1; }
  #presence { order: 2; }
  #posts { order: 3; }
  #notes { order: 4; }
  #notes + .pm-panel { order: 5; }
}
@media (min-width: 900px) {
  .pm-page.home {
    display: grid;
    align-items: start;
    gap: 8px;
    max-width: 780px;
    grid-template-columns: minmax(0, 460px) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "mid left" "mid right";
  }
  .pm-page.home > .mid { grid-area: mid; }
  .pm-page.home > .left { grid-area: left; }
  .pm-page.home > .right { grid-area: right; }
}
@media (min-width: 1080px) {
  .pm-page.home {
    max-width: 1100px;
    grid-template-columns: minmax(0, 1fr) 460px minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas: "left mid right";
  }
}

/* logo turning on its vertical axis */
.pm-logo { flex: none; display: block; width: 176px; height: 176px; animation: pm-spin 1.68s linear infinite; }
@keyframes pm-spin { to { transform: rotateY(360deg); } }
@media (prefers-reduced-motion: reduce) { .pm-logo { animation: none; } }

.pm-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; width: 100%; max-width: 288px; }

/* visitor counter: one fixed slot per digit, each a column of 0-9 that rolls to its digit */
.pm-counter {
  --digit-h: calc(var(--line) * 3);
  --digit-w: calc(var(--digit-h) * .45);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: var(--digit-h);
  transition: opacity .4s;
}
.pm-counter:empty { visibility: hidden; }
.pm-digit { display: block; flex: none; width: var(--digit-w); height: var(--digit-h); overflow: hidden; }
.pm-reel {
  display: flex;
  flex-direction: column;
  transform: translateY(calc(var(--d, 0) * var(--digit-h) * -1));
  transition: transform 1.4s var(--ease);
  transition-delay: calc(var(--k, 0) * 90ms);
}
.pm-reel img { display: block; flex: none; width: var(--digit-w); height: var(--digit-h); }

/* note form */
.pm-left { text-align: right; }
.pm-left.low { color: var(--text); font-weight: bold; }
.pm-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
#note-form { display: flex; flex-direction: column; gap: var(--gap); }
#note-form .pm-btn { margin-top: var(--gap); }

/* wall of notes */
.pm-wall { list-style: none; margin: 0; padding: 0; }
.pm-note-row { display: flex; flex-direction: column; gap: var(--gap); padding: var(--pad); border-top: 1px solid var(--border); }
.pm-note-row:first-child { border-top: 0; }
.pm-note-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--pad); min-height: var(--button-h); }
.pm-note-head .grow { flex: 1; }
.pm-act { display: inline-flex; align-items: center; gap: var(--gap); }
.pm-note-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.pm-empty { padding: var(--pad); }
#wall-more { width: calc(100% - var(--pad) * 2 - 2px); margin: var(--pad); }
#wall-more:first-child { margin-top: 0; }

/* moderation dialog */
.pm-dlg { width: min(calc(var(--width) / 2), calc(100% - var(--pad) * 2)); max-height: 80vh; overflow: auto; padding: 0; color: inherit; background: var(--box); border: 0; }
.pm-dlg::backdrop { background: color-mix(in srgb, var(--dark) 80%, transparent); }
.pm-dlg .pm-stack { gap: var(--pad); }
button.pm-tab { font: inherit; }

.pm-profile { align-items: center; gap: 8px; text-align: center; overflow-wrap: anywhere; }
/* full-bleed: cancel the body padding and its 1px margin so the line meets the panel borders */
.pm-panel > .body > .pm-sep { align-self: stretch; margin: 4px calc(var(--pad) * -1 - 1px); }
/* presence */
.pm-who, .pm-spotify { display: flex; align-items: center; gap: var(--pad); min-width: 0; }
.pm-who-text { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.pm-avatar, .pm-cover { flex: none; display: block; background: var(--field); border: 1px solid var(--border); }
.pm-track { display: flex; flex-direction: column; gap: var(--gap); }
.pm-avatar { width: 48px; height: 48px; }
.pm-cover { width: 64px; height: 64px; }
.pm-track-title { font-weight: bold; color: var(--text); }
a.pm-track-title { color: var(--accent-hi); }
.pm-recent { border-top: 1px solid var(--border); }
#recent-toggle { margin-top: var(--gap); }
.pm-play { color: inherit; text-decoration: none; }
.pm-play .pm-tile { width: 32px; height: 32px; }
.pm-play-title, .pm-play-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-play-when { flex: none; white-space: nowrap; }
a.pm-play:hover .pm-play-title, a.pm-play:focus-visible .pm-play-title { color: var(--accent-hi); }
a.pm-play:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; background: var(--hover); border-color: var(--accent-lo); }

/* lyrics: fixed height so the panel never jumps as lines change */
.pm-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); min-height: var(--button-h); }
.pm-lyrics { display: flex; flex-direction: column; height: calc(var(--line) * 5); padding: 0 var(--pad); background: var(--field); border: 1px solid var(--border); border-left: 2px solid var(--accent-lo); overflow: hidden; }
.pm-lyr { flex: none; height: var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-off); }
.pm-lyr.cur { color: var(--accent-hi); font-weight: bold; }
.pm-lyr.prev { color: var(--text-dim); }
.pm-lyrics:not(.plain) { justify-content: center; }
.pm-lyr-plain { flex: 1; min-height: 0; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-dim); }

/* sub pages: downloads and changelog */
.pm-page.doc { max-width: 760px; }
.pm-bar { flex-wrap: wrap; row-gap: 0; }
.pm-dl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 8px; align-items: start; }
.pm-dl-list > .pm-panel { min-width: 0; }
.pm-dl-name { overflow-wrap: anywhere; }
.pm-dl-tags { display: flex; flex-wrap: wrap; gap: var(--gap); }
.pm-hash { display: flex; align-items: center; gap: var(--gap); min-width: 0; }
.pm-hash code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-dl-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--gap); }
.pm-faq { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: var(--gap); }
.pm-faq li { overflow-wrap: anywhere; }

.pm-log { display: flex; flex-direction: column; gap: var(--gap); }
.pm-log-sec { display: flex; flex-direction: column; gap: var(--gap); }
.pm-log-sec ul { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 2px; }
.pm-log-sec li { overflow-wrap: anywhere; }
.pm-log-sec li::marker { color: var(--text-off); }
.pm-log-sec.added { border-left: 2px solid var(--good); }
.pm-log-sec.changed { border-left: 2px solid var(--accent); }
.pm-log-sec.fixed { border-left: 2px solid var(--warn); }
.pm-log-sec.removed { border-left: 2px solid var(--bad); }
.pm-log-sec { padding-left: var(--pad); }
.pm-tag.changed { color: var(--accent-hi); border-color: var(--accent-lo); }

/* posts feed */
.pm-feed-title { overflow-wrap: anywhere; }
.pm-feed-media { display: flex; flex-wrap: wrap; gap: var(--gap); }
.pm-feed-thumb { padding: 0; line-height: 0; max-width: 100%; background: var(--field); border: 1px solid var(--border); cursor: zoom-in; transition: border-color var(--t); }
.pm-feed-thumb:hover { border-color: var(--border-hi); }
.pm-feed-thumb img, .pm-feed-video { display: block; max-width: 100%; max-height: 60vh; width: auto; height: auto; }
.pm-feed-video { background: var(--field); border: 1px solid var(--border); }
.pm-feed-media.multi .pm-feed-thumb { max-width: calc(50% - var(--gap)); }

/* lightbox */
.pm-lb { padding: 0; color: inherit; max-width: calc(100vw - var(--pad) * 2); max-height: calc(100vh - var(--pad) * 2); min-width: min(16rem, 100%); overflow: auto; }
.pm-lb::backdrop { background: color-mix(in srgb, var(--dark) 85%, transparent); }
.pm-lb .title { gap: var(--pad); }
.pm-lb .title .grow { flex: 1; }
.pm-lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-lb .title button.x { margin-left: 0; padding: 0; border: 0; background: none; }
.pm-lb-body { display: flex; flex-direction: column; gap: var(--gap); padding: var(--pad); }
.pm-lb-body img { display: block; margin: 0 auto; max-width: 100%; max-height: 70vh; width: auto; height: auto; object-fit: contain; }

/* admin: posts composer */
.pm-dlg.wide { width: min(calc(var(--width) * .7), calc(100% - var(--pad) * 2)); }
.pm-drop { display: flex; align-items: center; justify-content: center; gap: var(--gap); padding: var(--pad); background: var(--field); border: 1px dashed var(--border); transition: border-color var(--t); }
.pm-drop.over { border-color: var(--accent); }
.pm-up-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: var(--gap); }
.pm-up-list:empty { display: none; }
.pm-up { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; padding: var(--gap); background: var(--field); border: 1px solid var(--border); }
.pm-up-thumb { display: flex; align-items: center; justify-content: center; height: 6rem; overflow: hidden; background: var(--box); }
.pm-up-thumb img, .pm-up-thumb video { max-width: 100%; max-height: 100%; object-fit: contain; }
.pm-up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pm-link-row .pm-field { flex: 1 1 8rem; min-width: 0; }

/* text wave: fx-text.js splits [data-wave] into letters. Letters inherit size, weight and colour; only translateY moves. */
.fx-ch { display: inline-block; white-space: pre; animation: fx-wave 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * -140ms); }
.pm-panel > .head[data-wave] { gap: 0; }
@keyframes fx-wave { 0%, 100% { transform: translateY(0); } 25% { transform: translateY(-1px); } 75% { transform: translateY(1px); } }
@media (prefers-reduced-motion: reduce) { .fx-ch { animation: none; } }

/* footer: a slim centred strip */
.pm-bar.foot { justify-content: center; flex-wrap: nowrap; height: 20px; padding: 0 4px; font-size: 11px; }
.pm-bar.foot .grow { display: none; }

/* webring and credits above the footer */
.pm-ring { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px var(--pad) 10px; text-align: center; font-size: 11px; color: var(--text-dim); }
.pm-ring a { color: var(--text-dim); text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
.pm-ring a:hover { color: var(--accent-hi); }
.pm-ring-heart { vertical-align: -1px; image-rendering: pixelated; }
.pm-ring-line { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 6px; }
.pm-ring-nav { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 100%; max-width: 220px; margin-bottom: 8px; }
.pm-ring .pm-btn { text-decoration: none; }
.pm-ring-rand { padding: 0 14px; }
.pm-ring-ico { font-size: 13px; line-height: 1; }
.pm-ring-row { display: flex; align-items: center; justify-content: center; gap: 5px; }
.pm-ring .pm-ring-arrow { flex: none; width: 24px; height: 31px; padding: 0; font-weight: bold; }
.pm-ring-arrow[aria-disabled] { opacity: .4; }
.pm-ring-strip.empty { color: var(--text-off); border: 1px dashed var(--border); }
.pm-ring-strip { flex: none; display: block; width: 88px; height: 31px; overflow: hidden; text-decoration: none; }
.pm-ring-strip img { display: block; width: 88px; height: 31px; }

/* sub pages: error, leaving, stats, sitemap */
.pm-page.narrow-doc { max-width: 520px; }
.pm-center { align-items: center; text-align: center; gap: 8px; padding: 18px var(--pad); }
.pm-center h1 { font-size: 14px; }
.pm-path { max-width: 100%; overflow-wrap: anywhere; word-break: break-all; text-align: left; }
.pm-path:empty { display: none; }
.pm-actions { display: flex; flex-wrap: wrap; gap: var(--gap); margin-top: var(--gap); }
.pm-lv-host { font-weight: bold; font-size: 14px; overflow-wrap: anywhere; }
.pm-num { text-align: right; font-variant-numeric: tabular-nums; width: 40%; }
.pm-map { list-style: none; margin: 0; padding: 0; }
.pm-map li + li { border-top: 1px solid var(--border); }
.pm-map-link { display: flex; align-items: center; gap: 10px; padding: var(--pad); color: var(--text); }
.pm-map-link:hover, .pm-map-link:focus-visible { background: var(--hover); color: var(--accent-hi); }
.pm-map-n { flex: none; color: var(--accent-hi); font: bold 11px var(--font-mono); }
.pm-map-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-weight: bold; }
.pm-map-t .dim { font-weight: normal; }
.pm-map-go { flex: none; color: var(--accent-hi); font: bold 11px var(--font-mono); }
.pm-keys-hint { text-align: center; }
.pm-kbd { padding: 0 5px; font: bold 11px var(--font-mono); color: var(--accent-hi); background: var(--field); border: 1px solid var(--field-border); }

/* message box (js/dialog.js) */
.sv-dlg { width: min(400px, calc(100% - var(--pad) * 2)); padding: 0; color: inherit; }
.sv-dlg::backdrop { background: color-mix(in srgb, var(--dark) 70%, transparent); }
.sv-dlg .title .x { margin-left: auto; padding: 0; border: 0; background: none; }
.sv-main { display: flex; align-items: flex-start; gap: 12px; padding: 14px var(--pad); background: var(--panel); }
.sv-ico { flex: none; }
.sv-msg { min-width: 0; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.sv-head { font-size: 14px; font-weight: bold; color: var(--accent-hi); }
.sv-detail { padding: 4px 6px; font-family: var(--font-mono); font-size: 11px; overflow-wrap: anywhere; word-break: break-all; background: var(--field); border: 1px solid var(--field-border); }
.sv-foot { display: flex; justify-content: flex-end; gap: 6px; padding: 8px var(--pad); border-top: 1px solid var(--border); }
.sv-foot .pm-btn { min-width: 76px; }
.sv-keys { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.sv-keys dt { display: flex; gap: 3px; }
.sv-keys dd { margin: 0; color: var(--text-dim); }
.sv-keys kbd { min-width: 18px; padding: 0 5px; text-align: center; font: bold 11px var(--font-mono); color: var(--accent-hi); background: var(--field); border: 1px solid; border-color: var(--border-hi) var(--field-border) var(--field-border) var(--border-hi); }

/* tooltip (js/tip.js) and right-click line (js/toast.js) */
.sv-tip { position: fixed; z-index: 120; max-width: 240px; padding: 3px 6px; font-size: 11px; line-height: 1.3; color: var(--text); background: var(--field); border: 1px solid var(--accent-lo); pointer-events: none; }
.sv-toast { position: fixed; z-index: 120; pointer-events: none; white-space: nowrap; padding: 2px 8px; font-size: 11px; color: var(--accent-hi); background: var(--box); border: 1px solid var(--accent-lo); opacity: 0; transition: opacity .25s, transform .6s; }
.sv-toast.up { opacity: 1; transform: translateY(-14px); }
.sv-toast.out { opacity: 0; }
.sv-toast.still, .sv-toast.still.up { transform: none; transition: opacity .15s; }

/* stats: day bars and language pie */
.pm-panel > .head.sub { border-top: 1px solid var(--dark); }
.pm-days { width: 100%; max-width: 420px; margin: 0 auto; }
.pm-chart { display: block; width: 100%; height: auto; overflow: visible; font-size: 11px; }
.pm-chart-base { stroke: var(--dark); stroke-width: 1; }
.pm-chart-bar { fill: var(--accent); stroke: var(--accent-lo); stroke-width: 1; }
.pm-chart-n { fill: var(--text); font-variant-numeric: tabular-nums; }
.pm-chart-d { fill: var(--text-dim); }
.pm-chart g:hover .pm-chart-bar { fill: var(--accent-hi); }
.pm-code { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pm-pie { flex: none; width: 96px; height: 96px; }
.pm-pie-svg { display: block; width: 96px; height: 96px; }
.pm-pie-svg > * { stroke: var(--dark); stroke-width: .02; }
.pm-s0 { fill: #FF0073; background: #FF0073; }
.pm-s1 { fill: #7ea64b; background: #7ea64b; }
.pm-s2 { fill: #57cbde; background: #57cbde; }
.pm-s3 { fill: #d9a441; background: #d9a441; }
.pm-legend { list-style: none; margin: 0; padding: 0; flex: 1 1 160px; display: flex; flex-direction: column; gap: 4px; }
.pm-legend li { display: flex; align-items: center; gap: 6px; }
.pm-legend i { flex: none; width: 10px; height: 10px; border: 1px solid var(--dark); }
.pm-legend .grow { flex: 1; }
